diff --git a/README.md b/README.md index 8c0d34b..e6abd65 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ combination with [Buildbarn Remote Execution](https://github.com/buildbarn/bb-re to automatically adjust the size of Amazon EC2 [Auto Scaling Groups (ASGs)](https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroup.html), EKS [Managed Node Groups](https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html), -or [Kubernetes deployments](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) +or Kubernetes [deployments](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/)/ +[stateful sets](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/) of Buildbarn workers based on load. Load metrics are obtained by querying Prometheus, which in its turn extracts metrics from `bb_scheduler`. It relies on Prometheus to normalize the load metrics diff --git a/cmd/bb_autoscaler/main.go b/cmd/bb_autoscaler/main.go index d46cf46..08b9c80 100644 --- a/cmd/bb_autoscaler/main.go +++ b/cmd/bb_autoscaler/main.go @@ -104,7 +104,7 @@ func main() { autoScalingClient = autoscaling.NewFromConfig(cfg) eksClient = eks.NewFromConfig(cfg) } - case *bb_autoscaler.NodeGroupConfiguration_KubernetesDeployment: + case *bb_autoscaler.NodeGroupConfiguration_KubernetesDeployment, *bb_autoscaler.NodeGroupConfiguration_KubernetesStatefulSet: if kubernetesClientset == nil { config, err := rest.InClusterConfig() if err != nil { @@ -116,7 +116,7 @@ func main() { } } default: - return status.Error(codes.InvalidArgument, "No ASG, EKS managed node group, or Kubernetes deployment name specified") + return status.Error(codes.InvalidArgument, "No ASG, EKS managed node group, Kubernetes deployment, or Kubernetes stateful set specified") } } @@ -174,6 +174,9 @@ func main() { case *bb_autoscaler.NodeGroupConfiguration_KubernetesDeployment: minSize = kind.KubernetesDeployment.MinimumReplicas maxSize = kind.KubernetesDeployment.MaximumReplicas + case *bb_autoscaler.NodeGroupConfiguration_KubernetesStatefulSet: + minSize = kind.KubernetesStatefulSet.MinimumReplicas + maxSize = kind.KubernetesStatefulSet.MaximumReplicas default: panic("Incomplete switch on node group kind") } @@ -250,6 +253,38 @@ func main() { }); err != nil { return util.StatusWrapf(err, "Failed to change number of replicas of Kubernetes deployment %#v in namespace %#v", name, namespace) } + case *bb_autoscaler.NodeGroupConfiguration_KubernetesStatefulSet: + namespace := kind.KubernetesStatefulSet.Namespace + name := kind.KubernetesStatefulSet.Name + metaKind := "StatefulSet" + metaAPIVersion := "apps/v1" + if _, err := kubernetesClientset. + AppsV1(). + StatefulSets(namespace). + Apply( + ctx, + &appsv1_apply.StatefulSetApplyConfiguration{ + TypeMetaApplyConfiguration: metav1_apply.TypeMetaApplyConfiguration{ + Kind: &metaKind, + APIVersion: &metaAPIVersion, + }, + ObjectMetaApplyConfiguration: &metav1_apply.ObjectMetaApplyConfiguration{ + Name: &name, + Namespace: &namespace, + Annotations: map[string]string{ + "kubernetes.io/change-cause": "replicas updated by bb_autoscaler", + }, + }, + Spec: &appsv1_apply.StatefulSetSpecApplyConfiguration{ + Replicas: &newDesiredCapacity, + }, + }, + metav1.ApplyOptions{ + FieldManager: "bb_autoscaler", + Force: true, + }); err != nil { + return util.StatusWrapf(err, "Failed to change number of replicas of Kubernetes stateful set %#v in namespace %#v", name, namespace) + } default: panic("Incomplete switch on node group kind") } @@ -261,3 +296,16 @@ func main() { return nil }) } + +func createKubernetesClient() (*kubernetes.Clientset, error) { + config, err := rest.InClusterConfig() + if err != nil { + return nil, util.StatusWrap(err, "Failed to create Kubernetes client configuration") + } + kubernetesClientset, err := kubernetes.NewForConfig(config) + if err != nil { + return nil, util.StatusWrap(err, "Failed to create Kubernetes client") + } + + return kubernetesClientset, nil +} diff --git a/pkg/proto/configuration/bb_autoscaler/bb_autoscaler.pb.go b/pkg/proto/configuration/bb_autoscaler/bb_autoscaler.pb.go index ebacf3f..06fd8b6 100644 --- a/pkg/proto/configuration/bb_autoscaler/bb_autoscaler.pb.go +++ b/pkg/proto/configuration/bb_autoscaler/bb_autoscaler.pb.go @@ -157,7 +157,7 @@ func (x *EKSManagedNodeGroupConfiguration) GetNodeGroupName() string { return "" } -type KubernetesDeploymentConfiguration struct { +type KubernetesReplicaSetConfiguration struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -168,8 +168,8 @@ type KubernetesDeploymentConfiguration struct { MaximumReplicas int32 `protobuf:"varint,4,opt,name=maximum_replicas,json=maximumReplicas,proto3" json:"maximum_replicas,omitempty"` } -func (x *KubernetesDeploymentConfiguration) Reset() { - *x = KubernetesDeploymentConfiguration{} +func (x *KubernetesReplicaSetConfiguration) Reset() { + *x = KubernetesReplicaSetConfiguration{} if protoimpl.UnsafeEnabled { mi := &file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -177,13 +177,13 @@ func (x *KubernetesDeploymentConfiguration) Reset() { } } -func (x *KubernetesDeploymentConfiguration) String() string { +func (x *KubernetesReplicaSetConfiguration) String() string { return protoimpl.X.MessageStringOf(x) } -func (*KubernetesDeploymentConfiguration) ProtoMessage() {} +func (*KubernetesReplicaSetConfiguration) ProtoMessage() {} -func (x *KubernetesDeploymentConfiguration) ProtoReflect() protoreflect.Message { +func (x *KubernetesReplicaSetConfiguration) ProtoReflect() protoreflect.Message { mi := &file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -195,33 +195,33 @@ func (x *KubernetesDeploymentConfiguration) ProtoReflect() protoreflect.Message return mi.MessageOf(x) } -// Deprecated: Use KubernetesDeploymentConfiguration.ProtoReflect.Descriptor instead. -func (*KubernetesDeploymentConfiguration) Descriptor() ([]byte, []int) { +// Deprecated: Use KubernetesReplicaSetConfiguration.ProtoReflect.Descriptor instead. +func (*KubernetesReplicaSetConfiguration) Descriptor() ([]byte, []int) { return file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_rawDescGZIP(), []int{2} } -func (x *KubernetesDeploymentConfiguration) GetNamespace() string { +func (x *KubernetesReplicaSetConfiguration) GetNamespace() string { if x != nil { return x.Namespace } return "" } -func (x *KubernetesDeploymentConfiguration) GetName() string { +func (x *KubernetesReplicaSetConfiguration) GetName() string { if x != nil { return x.Name } return "" } -func (x *KubernetesDeploymentConfiguration) GetMinimumReplicas() int32 { +func (x *KubernetesReplicaSetConfiguration) GetMinimumReplicas() int32 { if x != nil { return x.MinimumReplicas } return 0 } -func (x *KubernetesDeploymentConfiguration) GetMaximumReplicas() int32 { +func (x *KubernetesReplicaSetConfiguration) GetMaximumReplicas() int32 { if x != nil { return x.MaximumReplicas } @@ -241,6 +241,7 @@ type NodeGroupConfiguration struct { // *NodeGroupConfiguration_AutoScalingGroupName // *NodeGroupConfiguration_EksManagedNodeGroup // *NodeGroupConfiguration_KubernetesDeployment + // *NodeGroupConfiguration_KubernetesStatefulSet Kind isNodeGroupConfiguration_Kind `protobuf_oneof:"kind"` WorkersPerCapacityUnit int32 `protobuf:"varint,4,opt,name=workers_per_capacity_unit,json=workersPerCapacityUnit,proto3" json:"workers_per_capacity_unit,omitempty"` } @@ -319,13 +320,20 @@ func (x *NodeGroupConfiguration) GetEksManagedNodeGroup() *EKSManagedNodeGroupCo return nil } -func (x *NodeGroupConfiguration) GetKubernetesDeployment() *KubernetesDeploymentConfiguration { +func (x *NodeGroupConfiguration) GetKubernetesDeployment() *KubernetesReplicaSetConfiguration { if x, ok := x.GetKind().(*NodeGroupConfiguration_KubernetesDeployment); ok { return x.KubernetesDeployment } return nil } +func (x *NodeGroupConfiguration) GetKubernetesStatefulSet() *KubernetesReplicaSetConfiguration { + if x, ok := x.GetKind().(*NodeGroupConfiguration_KubernetesStatefulSet); ok { + return x.KubernetesStatefulSet + } + return nil +} + func (x *NodeGroupConfiguration) GetWorkersPerCapacityUnit() int32 { if x != nil { return x.WorkersPerCapacityUnit @@ -346,7 +354,11 @@ type NodeGroupConfiguration_EksManagedNodeGroup struct { } type NodeGroupConfiguration_KubernetesDeployment struct { - KubernetesDeployment *KubernetesDeploymentConfiguration `protobuf:"bytes,7,opt,name=kubernetes_deployment,json=kubernetesDeployment,proto3,oneof"` + KubernetesDeployment *KubernetesReplicaSetConfiguration `protobuf:"bytes,7,opt,name=kubernetes_deployment,json=kubernetesDeployment,proto3,oneof"` +} + +type NodeGroupConfiguration_KubernetesStatefulSet struct { + KubernetesStatefulSet *KubernetesReplicaSetConfiguration `protobuf:"bytes,9,opt,name=kubernetes_stateful_set,json=kubernetesStatefulSet,proto3,oneof"` } func (*NodeGroupConfiguration_AutoScalingGroupName) isNodeGroupConfiguration_Kind() {} @@ -355,6 +367,8 @@ func (*NodeGroupConfiguration_EksManagedNodeGroup) isNodeGroupConfiguration_Kind func (*NodeGroupConfiguration_KubernetesDeployment) isNodeGroupConfiguration_Kind() {} +func (*NodeGroupConfiguration_KubernetesStatefulSet) isNodeGroupConfiguration_Kind() {} + var File_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto protoreflect.FileDescriptor var file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_rawDesc = []byte{ @@ -406,8 +420,8 @@ var file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_rawDesc = []b 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xab, 0x01, 0x0a, 0x21, - 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, @@ -416,7 +430,7 @@ var file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_rawDesc = []b 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, - 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x22, 0xad, 0x04, 0x0a, 0x16, 0x4e, 0x6f, + 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x22, 0xb2, 0x05, 0x0a, 0x16, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x14, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, @@ -444,19 +458,28 @@ var file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_rawDesc = []b 0x20, 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x62, 0x61, 0x72, 0x6e, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x62, 0x62, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x72, 0x2e, 0x4b, 0x75, 0x62, - 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, + 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x14, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x44, 0x65, 0x70, 0x6c, - 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x39, 0x0a, 0x19, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, - 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x5f, 0x75, - 0x6e, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x16, 0x77, 0x6f, 0x72, 0x6b, 0x65, - 0x72, 0x73, 0x50, 0x65, 0x72, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x55, 0x6e, 0x69, - 0x74, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x42, 0x4a, 0x5a, 0x48, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x62, 0x61, 0x72, - 0x6e, 0x2f, 0x62, 0x62, 0x2d, 0x61, 0x75, 0x74, 0x6f, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x72, 0x2f, - 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x62, 0x62, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x73, - 0x63, 0x61, 0x6c, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x82, 0x01, 0x0a, 0x17, 0x6b, 0x75, 0x62, 0x65, 0x72, + 0x6e, 0x65, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x66, 0x75, 0x6c, 0x5f, 0x73, + 0x65, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x62, 0x61, 0x72, 0x6e, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x62, 0x62, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x72, + 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x15, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x66, 0x75, 0x6c, 0x53, 0x65, 0x74, 0x12, 0x39, 0x0a, 0x19, 0x77, + 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x63, 0x61, 0x70, 0x61, 0x63, + 0x69, 0x74, 0x79, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x16, + 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x73, 0x50, 0x65, 0x72, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, + 0x74, 0x79, 0x55, 0x6e, 0x69, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x42, 0x4a, + 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x62, 0x61, 0x72, 0x6e, 0x2f, 0x62, 0x62, 0x2d, 0x61, 0x75, 0x74, 0x6f, 0x73, 0x63, + 0x61, 0x6c, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x62, 0x62, 0x5f, + 0x61, 0x75, 0x74, 0x6f, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -475,7 +498,7 @@ var file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_msgTypes = ma var file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_goTypes = []interface{}{ (*ApplicationConfiguration)(nil), // 0: buildbarn.configuration.bb_autoscaler.ApplicationConfiguration (*EKSManagedNodeGroupConfiguration)(nil), // 1: buildbarn.configuration.bb_autoscaler.EKSManagedNodeGroupConfiguration - (*KubernetesDeploymentConfiguration)(nil), // 2: buildbarn.configuration.bb_autoscaler.KubernetesDeploymentConfiguration + (*KubernetesReplicaSetConfiguration)(nil), // 2: buildbarn.configuration.bb_autoscaler.KubernetesReplicaSetConfiguration (*NodeGroupConfiguration)(nil), // 3: buildbarn.configuration.bb_autoscaler.NodeGroupConfiguration (*http.ClientConfiguration)(nil), // 4: buildbarn.configuration.http.ClientConfiguration (*aws.SessionConfiguration)(nil), // 5: buildbarn.configuration.cloud.aws.SessionConfiguration @@ -487,12 +510,13 @@ var file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_depIdxs = []i 5, // 2: buildbarn.configuration.bb_autoscaler.ApplicationConfiguration.aws_session:type_name -> buildbarn.configuration.cloud.aws.SessionConfiguration 6, // 3: buildbarn.configuration.bb_autoscaler.NodeGroupConfiguration.platform:type_name -> build.bazel.remote.execution.v2.Platform 1, // 4: buildbarn.configuration.bb_autoscaler.NodeGroupConfiguration.eks_managed_node_group:type_name -> buildbarn.configuration.bb_autoscaler.EKSManagedNodeGroupConfiguration - 2, // 5: buildbarn.configuration.bb_autoscaler.NodeGroupConfiguration.kubernetes_deployment:type_name -> buildbarn.configuration.bb_autoscaler.KubernetesDeploymentConfiguration - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 2, // 5: buildbarn.configuration.bb_autoscaler.NodeGroupConfiguration.kubernetes_deployment:type_name -> buildbarn.configuration.bb_autoscaler.KubernetesReplicaSetConfiguration + 2, // 6: buildbarn.configuration.bb_autoscaler.NodeGroupConfiguration.kubernetes_stateful_set:type_name -> buildbarn.configuration.bb_autoscaler.KubernetesReplicaSetConfiguration + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_init() } @@ -526,7 +550,7 @@ func file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_init() { } } file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KubernetesDeploymentConfiguration); i { + switch v := v.(*KubernetesReplicaSetConfiguration); i { case 0: return &v.state case 1: @@ -554,6 +578,7 @@ func file_pkg_proto_configuration_bb_autoscaler_bb_autoscaler_proto_init() { (*NodeGroupConfiguration_AutoScalingGroupName)(nil), (*NodeGroupConfiguration_EksManagedNodeGroup)(nil), (*NodeGroupConfiguration_KubernetesDeployment)(nil), + (*NodeGroupConfiguration_KubernetesStatefulSet)(nil), } type x struct{} out := protoimpl.TypeBuilder{ diff --git a/pkg/proto/configuration/bb_autoscaler/bb_autoscaler.proto b/pkg/proto/configuration/bb_autoscaler/bb_autoscaler.proto index 9f28376..8e22df8 100644 --- a/pkg/proto/configuration/bb_autoscaler/bb_autoscaler.proto +++ b/pkg/proto/configuration/bb_autoscaler/bb_autoscaler.proto @@ -59,7 +59,7 @@ message EKSManagedNodeGroupConfiguration { string node_group_name = 2; } -message KubernetesDeploymentConfiguration { +message KubernetesReplicaSetConfiguration { // Namespace containing the deployment whose replicas count should be // adjusted. string namespace = 1; @@ -101,7 +101,10 @@ message NodeGroupConfiguration { EKSManagedNodeGroupConfiguration eks_managed_node_group = 5; // Kubernetes deployment whose replicas count should be adjusted. - KubernetesDeploymentConfiguration kubernetes_deployment = 7; + KubernetesReplicaSetConfiguration kubernetes_deployment = 7; + + // Kubernetes stateful set whose replicas count should be adjusted. + KubernetesReplicaSetConfiguration kubernetes_stateful_set = 9; } // The number of workers that constitute to a single unit of capacity.