From 88d200232ad1d4da2a507984f0692120acb60119 Mon Sep 17 00:00:00 2001 From: katexochen <49727155+katexochen@users.noreply.github.com> Date: Thu, 15 Sep 2022 16:51:07 +0200 Subject: [PATCH] Remove autoscaling from CLI and bootstrapper --- bootstrapper/cmd/bootstrapper/test.go | 2 +- bootstrapper/initproto/init.pb.go | 121 ++++++++---------- bootstrapper/initproto/init.proto | 2 +- .../internal/initserver/initserver.go | 2 - .../internal/initserver/initserver_test.go | 2 +- .../k8sapi/resources/cluster_autoscaler.go | 19 +-- .../resources/cluster_autoscaler_test.go | 1 - .../internal/kubernetes/kubernetes.go | 10 +- .../internal/kubernetes/kubernetes_test.go | 3 +- cli/internal/cmd/init.go | 51 +------- cli/internal/cmd/init_test.go | 24 ---- internal/config/config.go | 14 +- internal/config/config_doc.go | 64 ++++----- internal/config/config_test.go | 9 +- 14 files changed, 99 insertions(+), 225 deletions(-) diff --git a/bootstrapper/cmd/bootstrapper/test.go b/bootstrapper/cmd/bootstrapper/test.go index 32aa8e571..cfb397e94 100644 --- a/bootstrapper/cmd/bootstrapper/test.go +++ b/bootstrapper/cmd/bootstrapper/test.go @@ -21,7 +21,7 @@ type clusterFake struct{} // InitCluster fakes bootstrapping a new cluster with the current node being the master, returning the arguments required to join the cluster. func (c *clusterFake) InitCluster( - context.Context, []string, string, string, []byte, []uint32, bool, []byte, bool, + context.Context, string, string, []byte, []uint32, bool, []byte, bool, resources.KMSConfig, map[string]string, []byte, bool, *logger.Logger, ) ([]byte, error) { return []byte{}, nil diff --git a/bootstrapper/initproto/init.pb.go b/bootstrapper/initproto/init.pb.go index 355b6f078..3432e90bd 100644 --- a/bootstrapper/initproto/init.pb.go +++ b/bootstrapper/initproto/init.pb.go @@ -25,7 +25,7 @@ type InitRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - AutoscalingNodeGroups []string `protobuf:"bytes,1,rep,name=autoscaling_node_groups,json=autoscalingNodeGroups,proto3" json:"autoscaling_node_groups,omitempty"` + // repeated string autoscaling_node_groups = 1; removed MasterSecret []byte `protobuf:"bytes,2,opt,name=master_secret,json=masterSecret,proto3" json:"master_secret,omitempty"` KmsUri string `protobuf:"bytes,3,opt,name=kms_uri,json=kmsUri,proto3" json:"kms_uri,omitempty"` StorageUri string `protobuf:"bytes,4,opt,name=storage_uri,json=storageUri,proto3" json:"storage_uri,omitempty"` @@ -73,13 +73,6 @@ func (*InitRequest) Descriptor() ([]byte, []int) { return file_init_proto_rawDescGZIP(), []int{0} } -func (x *InitRequest) GetAutoscalingNodeGroups() []string { - if x != nil { - return x.AutoscalingNodeGroups - } - return nil -} - func (x *InitRequest) GetMasterSecret() []byte { if x != nil { return x.MasterSecret @@ -293,64 +286,60 @@ var File_init_proto protoreflect.FileDescriptor var file_init_proto_rawDesc = []byte{ 0x0a, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x69, 0x6e, - 0x69, 0x74, 0x22, 0xe1, 0x04, 0x0a, 0x0b, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x36, 0x0a, 0x17, 0x61, 0x75, 0x74, 0x6f, 0x73, 0x63, 0x61, 0x6c, 0x69, 0x6e, - 0x67, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x15, 0x61, 0x75, 0x74, 0x6f, 0x73, 0x63, 0x61, 0x6c, 0x69, 0x6e, 0x67, - 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x61, - 0x73, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x0c, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, - 0x17, 0x0a, 0x07, 0x6b, 0x6d, 0x73, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x6b, 0x6d, 0x73, 0x55, 0x72, 0x69, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x55, 0x72, 0x69, 0x12, 0x31, 0x0a, 0x15, 0x6b, 0x65, 0x79, - 0x5f, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x5f, - 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6b, 0x65, 0x79, 0x45, 0x6e, 0x63, - 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x10, - 0x75, 0x73, 0x65, 0x5f, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x6b, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x75, 0x73, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, - 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x6b, 0x12, 0x39, 0x0a, 0x19, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, - 0x75, 0x72, 0x69, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x6c, 0x6f, 0x75, 0x64, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x72, - 0x69, 0x12, 0x2d, 0x0a, 0x12, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x5f, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6b, - 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x34, 0x0a, 0x0d, 0x73, 0x73, 0x68, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6b, 0x65, 0x79, - 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x53, - 0x53, 0x48, 0x55, 0x73, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x52, 0x0b, 0x73, 0x73, 0x68, 0x55, 0x73, - 0x65, 0x72, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x68, 0x65, - 0x6c, 0x6d, 0x5f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x68, 0x65, 0x6c, 0x6d, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, - 0x64, 0x5f, 0x70, 0x63, 0x72, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, 0x65, 0x6e, - 0x66, 0x6f, 0x72, 0x63, 0x65, 0x64, 0x50, 0x63, 0x72, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x65, 0x6e, - 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x6b, 0x65, 0x79, 0x64, 0x69, 0x67, 0x65, 0x73, - 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, - 0x49, 0x64, 0x6b, 0x65, 0x79, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x63, - 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, - 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, - 0x63, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x22, 0x68, 0x0a, 0x0c, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x6b, 0x75, 0x62, 0x65, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x6b, 0x75, 0x62, 0x65, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, - 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, - 0x22, 0x47, 0x0a, 0x0a, 0x53, 0x53, 0x48, 0x55, 0x73, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x1a, - 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x32, 0x34, 0x0a, 0x03, 0x41, 0x50, 0x49, - 0x12, 0x2d, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x11, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x2e, - 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x69, 0x6e, - 0x69, 0x74, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, - 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x64, - 0x67, 0x65, 0x6c, 0x65, 0x73, 0x73, 0x73, 0x79, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x65, - 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, - 0x70, 0x70, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x69, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x74, 0x22, 0xa9, 0x04, 0x0a, 0x0b, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x63, + 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x6d, 0x61, 0x73, 0x74, 0x65, + 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x6d, 0x73, 0x5f, 0x75, + 0x72, 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6b, 0x6d, 0x73, 0x55, 0x72, 0x69, + 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x75, 0x72, 0x69, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x55, 0x72, + 0x69, 0x12, 0x31, 0x0a, 0x15, 0x6b, 0x65, 0x79, 0x5f, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x12, 0x6b, 0x65, 0x79, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, + 0x65, 0x79, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x5f, 0x65, 0x78, 0x69, 0x73, + 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, + 0x75, 0x73, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x6b, 0x12, 0x39, + 0x0a, 0x19, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x16, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x72, 0x69, 0x12, 0x2d, 0x0a, 0x12, 0x6b, 0x75, 0x62, + 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, + 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x0d, 0x73, 0x73, 0x68, 0x5f, + 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x53, 0x53, 0x48, 0x55, 0x73, 0x65, 0x72, 0x4b, 0x65, + 0x79, 0x52, 0x0b, 0x73, 0x73, 0x68, 0x55, 0x73, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x12, + 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, + 0x6c, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x68, 0x65, 0x6c, 0x6d, 0x5f, 0x64, 0x65, 0x70, 0x6c, 0x6f, + 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x68, 0x65, + 0x6c, 0x6d, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x23, 0x0a, + 0x0d, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x64, 0x5f, 0x70, 0x63, 0x72, 0x73, 0x18, 0x0c, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x64, 0x50, 0x63, + 0x72, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x6b, 0x65, 0x79, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x12, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x49, 0x64, 0x6b, 0x65, 0x79, 0x64, 0x69, 0x67, + 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, + 0x63, 0x65, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x63, + 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x22, 0x68, + 0x0a, 0x0c, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, + 0x0a, 0x0a, 0x6b, 0x75, 0x62, 0x65, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x0a, 0x6b, 0x75, 0x62, 0x65, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x19, + 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x47, 0x0a, 0x0a, 0x53, 0x53, 0x48, 0x55, + 0x73, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, + 0x79, 0x32, 0x34, 0x0a, 0x03, 0x41, 0x50, 0x49, 0x12, 0x2d, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, + 0x12, 0x11, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x64, 0x67, 0x65, 0x6c, 0x65, 0x73, 0x73, 0x73, 0x79, + 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, + 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x69, + 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/bootstrapper/initproto/init.proto b/bootstrapper/initproto/init.proto index d52627952..8106143fa 100644 --- a/bootstrapper/initproto/init.proto +++ b/bootstrapper/initproto/init.proto @@ -9,7 +9,7 @@ service API { } message InitRequest { - repeated string autoscaling_node_groups = 1; + // repeated string autoscaling_node_groups = 1; removed bytes master_secret = 2; string kms_uri = 3; string storage_uri = 4; diff --git a/bootstrapper/internal/initserver/initserver.go b/bootstrapper/internal/initserver/initserver.go index 590d8c602..5c5cf4fd6 100644 --- a/bootstrapper/internal/initserver/initserver.go +++ b/bootstrapper/internal/initserver/initserver.go @@ -125,7 +125,6 @@ func (s *Server) Init(ctx context.Context, req *initproto.InitRequest) (*initpro } kubeconfig, err := s.initializer.InitCluster(ctx, - req.AutoscalingNodeGroups, req.CloudServiceAccountUri, req.KubernetesVersion, measurementSalt, @@ -234,7 +233,6 @@ type ClusterInitializer interface { // InitCluster initializes a new Kubernetes cluster. InitCluster( ctx context.Context, - autoscalingNodeGroups []string, cloudServiceAccountURI string, k8sVersion string, measurementSalt []byte, diff --git a/bootstrapper/internal/initserver/initserver_test.go b/bootstrapper/internal/initserver/initserver_test.go index 4cb1fc879..0c34c760b 100644 --- a/bootstrapper/internal/initserver/initserver_test.go +++ b/bootstrapper/internal/initserver/initserver_test.go @@ -289,7 +289,7 @@ type stubClusterInitializer struct { } func (i *stubClusterInitializer) InitCluster( - context.Context, []string, string, string, []byte, []uint32, bool, []byte, bool, + context.Context, string, string, []byte, []uint32, bool, []byte, bool, resources.KMSConfig, map[string]string, []byte, bool, *logger.Logger, ) ([]byte, error) { return i.initClusterKubeconfig, i.initClusterErr diff --git a/bootstrapper/internal/kubernetes/k8sapi/resources/cluster_autoscaler.go b/bootstrapper/internal/kubernetes/k8sapi/resources/cluster_autoscaler.go index 253c0df13..3bd484868 100644 --- a/bootstrapper/internal/kubernetes/k8sapi/resources/cluster_autoscaler.go +++ b/bootstrapper/internal/kubernetes/k8sapi/resources/cluster_autoscaler.go @@ -422,7 +422,7 @@ func NewDefaultAutoscalerDeployment(extraVolumes []k8s.Volume, extraVolumeMounts Namespace: "kube-system", }, Spec: apps.DeploymentSpec{ - Replicas: proto.Int32(1), + Replicas: proto.Int32(0), Selector: &v1.LabelSelector{ MatchLabels: map[string]string{ "app.kubernetes.io/instance": "constellation", @@ -494,20 +494,3 @@ func NewDefaultAutoscalerDeployment(extraVolumes []k8s.Volume, extraVolumeMounts func (a *autoscalerDeployment) Marshal() ([]byte, error) { return kubernetes.MarshalK8SResources(a) } - -func (a *autoscalerDeployment) SetAutoscalerCommand(cloudprovider string, autoscalingNodeGroups []string) { - command := []string{ - "./cluster-autoscaler", - "--cloud-provider", - cloudprovider, - "--logtostderr=true", - "--stderrthreshold=info", - "--v=2", - "--namespace=kube-system", - } - for _, autoscalingNodeGroup := range autoscalingNodeGroups { - command = append(command, "--nodes", autoscalingNodeGroup) - } - - a.Deployment.Spec.Template.Spec.Containers[0].Command = command -} diff --git a/bootstrapper/internal/kubernetes/k8sapi/resources/cluster_autoscaler_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/cluster_autoscaler_test.go index 009ad1fdd..611604981 100644 --- a/bootstrapper/internal/kubernetes/k8sapi/resources/cluster_autoscaler_test.go +++ b/bootstrapper/internal/kubernetes/k8sapi/resources/cluster_autoscaler_test.go @@ -35,7 +35,6 @@ func TestAutoscalerDeploymentWithCommandMarshalUnmarshal(t *testing.T) { assert := assert.New(t) autoscalerDepl := NewDefaultAutoscalerDeployment(nil, nil, nil, "") - autoscalerDepl.SetAutoscalerCommand("someProvider", []string{"group1", "group2"}) data, err := autoscalerDepl.Marshal() require.NoError(err) diff --git a/bootstrapper/internal/kubernetes/kubernetes.go b/bootstrapper/internal/kubernetes/kubernetes.go index bd09a8ac2..eebab8da3 100644 --- a/bootstrapper/internal/kubernetes/kubernetes.go +++ b/bootstrapper/internal/kubernetes/kubernetes.go @@ -76,8 +76,9 @@ func New(cloudProvider string, clusterUtil clusterUtil, configProvider configura // InitCluster initializes a new Kubernetes cluster and applies pod network provider. func (k *KubeWrapper) InitCluster( - ctx context.Context, autoscalingNodeGroups []string, cloudServiceAccountURI, versionString string, measurementSalt []byte, - enforcedPCRs []uint32, enforceIdKeyDigest bool, idKeyDigest []byte, azureCVM bool, kmsConfig resources.KMSConfig, sshUsers map[string]string, helmDeployments []byte, conformanceMode bool, log *logger.Logger, + ctx context.Context, cloudServiceAccountURI, versionString string, measurementSalt []byte, enforcedPCRs []uint32, + enforceIdKeyDigest bool, idKeyDigest []byte, azureCVM bool, kmsConfig resources.KMSConfig, sshUsers map[string]string, + helmDeployments []byte, conformanceMode bool, log *logger.Logger, ) ([]byte, error) { k8sVersion, err := versions.NewValidK8sVersion(versionString) if err != nil { @@ -210,7 +211,7 @@ func (k *KubeWrapper) InitCluster( return nil, fmt.Errorf("setting up cloud node manager: %w", err) } - if err := k.setupClusterAutoscaler(instance, cloudServiceAccountURI, autoscalingNodeGroups, k8sVersion); err != nil { + if err := k.setupClusterAutoscaler(instance, cloudServiceAccountURI, k8sVersion); err != nil { return nil, fmt.Errorf("setting up cluster autoscaler: %w", err) } @@ -381,7 +382,7 @@ func (k *KubeWrapper) setupCloudNodeManager(k8sVersion versions.ValidK8sVersion) return nil } -func (k *KubeWrapper) setupClusterAutoscaler(instance metadata.InstanceMetadata, cloudServiceAccountURI string, autoscalingNodeGroups []string, k8sVersion versions.ValidK8sVersion) error { +func (k *KubeWrapper) setupClusterAutoscaler(instance metadata.InstanceMetadata, cloudServiceAccountURI string, k8sVersion versions.ValidK8sVersion) error { if !k.clusterAutoscaler.Supported() { return nil } @@ -391,7 +392,6 @@ func (k *KubeWrapper) setupClusterAutoscaler(instance metadata.InstanceMetadata, } clusterAutoscalerConfiguration := resources.NewDefaultAutoscalerDeployment(k.clusterAutoscaler.Volumes(), k.clusterAutoscaler.VolumeMounts(), k.clusterAutoscaler.Env(), k8sVersion) - clusterAutoscalerConfiguration.SetAutoscalerCommand(k.clusterAutoscaler.Name(), autoscalingNodeGroups) if err := k.clusterUtil.SetupAutoscaling(k.client, clusterAutoscalerConfiguration, caSecrets); err != nil { return fmt.Errorf("setting up cluster-autoscaler: %w", err) } diff --git a/bootstrapper/internal/kubernetes/kubernetes_test.go b/bootstrapper/internal/kubernetes/kubernetes_test.go index 4851cdbd0..eefadd35c 100644 --- a/bootstrapper/internal/kubernetes/kubernetes_test.go +++ b/bootstrapper/internal/kubernetes/kubernetes_test.go @@ -37,7 +37,6 @@ func TestInitCluster(t *testing.T) { someErr := errors.New("failed") serviceAccountURI := "some-service-account-uri" masterSecret := []byte("some-master-secret") - autoscalingNodeGroups := []string{"0,10,autoscaling_group_0"} nodeName := "node-name" providerID := "provider-id" @@ -319,7 +318,7 @@ func TestInitCluster(t *testing.T) { } _, err := kube.InitCluster( - context.Background(), autoscalingNodeGroups, serviceAccountURI, string(tc.k8sVersion), + context.Background(), serviceAccountURI, string(tc.k8sVersion), nil, nil, false, nil, true, resources.KMSConfig{MasterSecret: masterSecret}, nil, nil, false, logger.NewTest(t), ) diff --git a/cli/internal/cmd/init.go b/cli/internal/cmd/init.go index 7b82ce44f..f7c5bb04d 100644 --- a/cli/internal/cmd/init.go +++ b/cli/internal/cmd/init.go @@ -9,23 +9,18 @@ package cmd import ( "context" "encoding/base64" - "errors" "fmt" "io" - "io/fs" "net" "strconv" "text/tabwriter" "time" "github.com/edgelesssys/constellation/bootstrapper/initproto" - "github.com/edgelesssys/constellation/cli/internal/azure" "github.com/edgelesssys/constellation/cli/internal/cloudcmd" - "github.com/edgelesssys/constellation/cli/internal/gcp" "github.com/edgelesssys/constellation/cli/internal/helm" "github.com/edgelesssys/constellation/internal/azureshared" "github.com/edgelesssys/constellation/internal/cloud/cloudprovider" - "github.com/edgelesssys/constellation/internal/cloud/cloudtypes" "github.com/edgelesssys/constellation/internal/config" "github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/crypto" @@ -36,7 +31,6 @@ import ( grpcRetry "github.com/edgelesssys/constellation/internal/grpc/retry" "github.com/edgelesssys/constellation/internal/license" "github.com/edgelesssys/constellation/internal/retry" - "github.com/edgelesssys/constellation/internal/state" "github.com/edgelesssys/constellation/internal/versions" kms "github.com/edgelesssys/constellation/kms/setup" "github.com/spf13/afero" @@ -55,7 +49,6 @@ func NewInitCmd() *cobra.Command { } cmd.Flags().String("master-secret", "", "path to base64-encoded master secret") cmd.Flags().String("endpoint", "", "endpoint of the bootstrapper, passed as HOST[:PORT]") - cmd.Flags().Bool("autoscale", false, "enable Kubernetes cluster-autoscaler") cmd.Flags().Bool("conformance", false, "enable conformance mode") return cmd } @@ -84,14 +77,6 @@ func initialize(cmd *cobra.Command, newDialer func(validator *cloudcmd.Validator return err } - var stat state.ConstellationState - err = fileHandler.ReadJSON(constants.StateFilename, &stat) - if errors.Is(err, fs.ErrNotExist) { - return fmt.Errorf("missing Constellation state file: %w. Please do 'constellation create ...' before 'constellation init'", err) - } else if err != nil { - return fmt.Errorf("loading Constellation state file: %w", err) - } - config, err := readConfig(cmd.OutOrStdout(), fileHandler, flags.configPath) if err != nil { return fmt.Errorf("reading and validating config: %w", err) @@ -129,17 +114,7 @@ func initialize(cmd *cobra.Command, newDialer func(validator *cloudcmd.Validator return err } - workers, err := getScalingGroupsFromState(stat, config) - if err != nil { - return err - } - - var autoscalingNodeGroups []string - if flags.autoscale { - autoscalingNodeGroups = append(autoscalingNodeGroups, workers.GroupID) - } - - helmDeployments, err := helmLoader.Load(stat.CloudProvider, flags.conformance) + helmDeployments, err := helmLoader.Load(provider.String(), flags.conformance) if err != nil { return fmt.Errorf("loading Helm charts: %w", err) } @@ -151,7 +126,6 @@ func initialize(cmd *cobra.Command, newDialer func(validator *cloudcmd.Validator cmd.Println("Initializing cluster ...") req := &initproto.InitRequest{ - AutoscalingNodeGroups: autoscalingNodeGroups, MasterSecret: masterSecret.Key, Salt: masterSecret.Salt, KmsUri: kms.ClusterKMSURI, @@ -287,10 +261,6 @@ func evalFlagArgs(cmd *cobra.Command, fileHandler file.Handler) (initFlags, erro return initFlags{}, fmt.Errorf("getting bootstrapper endpoint: %w", err) } } - autoscale, err := cmd.Flags().GetBool("autoscale") - if err != nil { - return initFlags{}, fmt.Errorf("parsing autoscale flag: %w", err) - } conformance, err := cmd.Flags().GetBool("conformance") if err != nil { return initFlags{}, fmt.Errorf("parsing autoscale flag: %w", err) @@ -303,7 +273,6 @@ func evalFlagArgs(cmd *cobra.Command, fileHandler file.Handler) (initFlags, erro return initFlags{ configPath: configPath, endpoint: endpoint, - autoscale: autoscale, conformance: conformance, masterSecretPath: masterSecretPath, }, nil @@ -314,7 +283,6 @@ type initFlags struct { configPath string masterSecretPath string endpoint string - autoscale bool conformance bool } @@ -402,23 +370,6 @@ func getMarshaledServiceAccountURI(provider cloudprovider.Provider, config *conf } } -func getScalingGroupsFromState(stat state.ConstellationState, config *config.Config) (workers cloudtypes.ScalingGroup, err error) { - switch cloudprovider.FromString(stat.CloudProvider) { - case cloudprovider.GCP: - return cloudtypes.ScalingGroup{ - GroupID: gcp.AutoscalingNodeGroup(stat.GCPProject, stat.GCPZone, stat.GCPWorkerInstanceGroup, config.AutoscalingNodeGroupMin, config.AutoscalingNodeGroupMax), - }, nil - case cloudprovider.Azure: - return cloudtypes.ScalingGroup{ - GroupID: azure.AutoscalingNodeGroup(stat.AzureWorkerScaleSet, config.AutoscalingNodeGroupMin, config.AutoscalingNodeGroupMax), - }, nil - case cloudprovider.QEMU: - return cloudtypes.ScalingGroup{GroupID: ""}, nil - default: - return cloudtypes.ScalingGroup{}, errors.New("unknown cloud provider") - } -} - type grpcDialer interface { Dial(ctx context.Context, target string) (*grpc.ClientConn, error) } diff --git a/cli/internal/cmd/init_test.go b/cli/internal/cmd/init_test.go index c2fdc9523..ce4fa633e 100644 --- a/cli/internal/cmd/init_test.go +++ b/cli/internal/cmd/init_test.go @@ -81,7 +81,6 @@ func TestInitialize(t *testing.T) { initServerAPI *stubInitServer endpointFlag string masterSecretShouldExist bool - setAutoscaleFlag bool wantErr bool }{ "initialize some gcp instances": { @@ -101,20 +100,6 @@ func TestInitialize(t *testing.T) { idFile: &clusterIDsFile{IP: "192.0.2.1"}, initServerAPI: &stubInitServer{initResp: testInitResp}, }, - "initialize gcp with autoscaling": { - state: testGcpState, - idFile: &clusterIDsFile{IP: "192.0.2.1"}, - configMutator: func(c *config.Config) { c.Provider.GCP.ServiceAccountKeyPath = serviceAccPath }, - serviceAccKey: gcpServiceAccKey, - initServerAPI: &stubInitServer{initResp: testInitResp}, - setAutoscaleFlag: true, - }, - "initialize azure with autoscaling": { - state: testAzureState, - idFile: &clusterIDsFile{IP: "192.0.2.1"}, - initServerAPI: &stubInitServer{initResp: testInitResp}, - setAutoscaleFlag: true, - }, "initialize with endpoint flag": { state: testGcpState, configMutator: func(c *config.Config) { c.Provider.GCP.ServiceAccountKeyPath = serviceAccPath }, @@ -177,7 +162,6 @@ func TestInitialize(t *testing.T) { // Flags cmd.Flags().String("config", constants.ConfigFilename, "") // register persistent flag manually - require.NoError(cmd.Flags().Set("autoscale", strconv.FormatBool(tc.setAutoscaleFlag))) if tc.endpointFlag != "" { require.NoError(cmd.Flags().Set("endpoint", tc.endpointFlag)) } @@ -218,11 +202,6 @@ func TestInitialize(t *testing.T) { require.NoError(err) // assert.Contains(out.String(), base64.StdEncoding.EncodeToString([]byte("ownerID"))) assert.Contains(out.String(), base64.StdEncoding.EncodeToString([]byte("clusterID"))) - if tc.setAutoscaleFlag { - assert.Len(tc.initServerAPI.activateAutoscalingNodeGroups, 1) - } else { - assert.Len(tc.initServerAPI.activateAutoscalingNodeGroups, 0) - } var secret masterSecret assert.NoError(fileHandler.ReadJSON(constants.MasterSecretFilename, &secret)) assert.NotEmpty(secret.Key) @@ -494,13 +473,10 @@ type stubInitServer struct { initResp *initproto.InitResponse initErr error - activateAutoscalingNodeGroups []string - initproto.UnimplementedAPIServer } func (s *stubInitServer) Init(ctx context.Context, req *initproto.InitRequest) (*initproto.InitResponse, error) { - s.activateAutoscalingNodeGroups = req.AutoscalingNodeGroups return s.initResp, s.initErr } diff --git a/internal/config/config.go b/internal/config/config.go index bd6d5cf4b..08e86d105 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -37,12 +37,6 @@ type Config struct { // Schema version of this configuration file. Version string `yaml:"version" validate:"eq=v1"` // description: | - // Minimum number of worker nodes in autoscaling group. - AutoscalingNodeGroupMin int `yaml:"autoscalingNodeGroupMin" validate:"min=0"` - // description: | - // Maximum number of worker nodes in autoscaling group. - AutoscalingNodeGroupMax int `yaml:"autoscalingNodeGroupMax" validate:"gtefield=AutoscalingNodeGroupMin"` - // description: | // Size (in GB) of a node's disk to store the non-volatile state. StateDiskSizeGB int `yaml:"stateDiskSizeGB" validate:"min=0"` // description: | @@ -193,11 +187,9 @@ type QEMUConfig struct { // Default returns a struct with the default config. func Default() *Config { return &Config{ - Version: Version1, - AutoscalingNodeGroupMin: 1, - AutoscalingNodeGroupMax: 10, - StateDiskSizeGB: 30, - DebugCluster: func() *bool { b := false; return &b }(), + Version: Version1, + StateDiskSizeGB: 30, + DebugCluster: func() *bool { b := false; return &b }(), Provider: ProviderConfig{ Azure: &AzureConfig{ SubscriptionID: "", diff --git a/internal/config/config_doc.go b/internal/config/config_doc.go index ef8b4cdbe..fcc7801c9 100644 --- a/internal/config/config_doc.go +++ b/internal/config/config_doc.go @@ -24,56 +24,46 @@ func init() { ConfigDoc.Type = "Config" ConfigDoc.Comments[encoder.LineComment] = "Config defines configuration used by CLI." ConfigDoc.Description = "Config defines configuration used by CLI." - ConfigDoc.Fields = make([]encoder.Doc, 9) + ConfigDoc.Fields = make([]encoder.Doc, 7) ConfigDoc.Fields[0].Name = "version" ConfigDoc.Fields[0].Type = "string" ConfigDoc.Fields[0].Note = "" ConfigDoc.Fields[0].Description = "Schema version of this configuration file." ConfigDoc.Fields[0].Comments[encoder.LineComment] = "Schema version of this configuration file." - ConfigDoc.Fields[1].Name = "autoscalingNodeGroupMin" + ConfigDoc.Fields[1].Name = "stateDiskSizeGB" ConfigDoc.Fields[1].Type = "int" ConfigDoc.Fields[1].Note = "" - ConfigDoc.Fields[1].Description = "Minimum number of worker nodes in autoscaling group." - ConfigDoc.Fields[1].Comments[encoder.LineComment] = "Minimum number of worker nodes in autoscaling group." - ConfigDoc.Fields[2].Name = "autoscalingNodeGroupMax" - ConfigDoc.Fields[2].Type = "int" + ConfigDoc.Fields[1].Description = "Size (in GB) of a node's disk to store the non-volatile state." + ConfigDoc.Fields[1].Comments[encoder.LineComment] = "Size (in GB) of a node's disk to store the non-volatile state." + ConfigDoc.Fields[2].Name = "kubernetesVersion" + ConfigDoc.Fields[2].Type = "string" ConfigDoc.Fields[2].Note = "" - ConfigDoc.Fields[2].Description = "Maximum number of worker nodes in autoscaling group." - ConfigDoc.Fields[2].Comments[encoder.LineComment] = "Maximum number of worker nodes in autoscaling group." - ConfigDoc.Fields[3].Name = "stateDiskSizeGB" - ConfigDoc.Fields[3].Type = "int" + ConfigDoc.Fields[2].Description = "Kubernetes version to be installed in the cluster." + ConfigDoc.Fields[2].Comments[encoder.LineComment] = "Kubernetes version to be installed in the cluster." + ConfigDoc.Fields[3].Name = "debugCluster" + ConfigDoc.Fields[3].Type = "bool" ConfigDoc.Fields[3].Note = "" - ConfigDoc.Fields[3].Description = "Size (in GB) of a node's disk to store the non-volatile state." - ConfigDoc.Fields[3].Comments[encoder.LineComment] = "Size (in GB) of a node's disk to store the non-volatile state." - ConfigDoc.Fields[4].Name = "kubernetesVersion" - ConfigDoc.Fields[4].Type = "string" + ConfigDoc.Fields[3].Description = "DON'T USE IN PRODUCTION: enable debug mode and use debug images. For usage, see: https://github.com/edgelesssys/constellation/blob/main/debugd/README.md" + ConfigDoc.Fields[3].Comments[encoder.LineComment] = "DON'T USE IN PRODUCTION: enable debug mode and use debug images. For usage, see: https://github.com/edgelesssys/constellation/blob/main/debugd/README.md" + ConfigDoc.Fields[4].Name = "provider" + ConfigDoc.Fields[4].Type = "ProviderConfig" ConfigDoc.Fields[4].Note = "" - ConfigDoc.Fields[4].Description = "Kubernetes version to be installed in the cluster." - ConfigDoc.Fields[4].Comments[encoder.LineComment] = "Kubernetes version to be installed in the cluster." - ConfigDoc.Fields[5].Name = "debugCluster" - ConfigDoc.Fields[5].Type = "bool" + ConfigDoc.Fields[4].Description = "Supported cloud providers and their specific configurations." + ConfigDoc.Fields[4].Comments[encoder.LineComment] = "Supported cloud providers and their specific configurations." + ConfigDoc.Fields[5].Name = "sshUsers" + ConfigDoc.Fields[5].Type = "[]UserKey" ConfigDoc.Fields[5].Note = "" - ConfigDoc.Fields[5].Description = "DON'T USE IN PRODUCTION: enable debug mode and use debug images. For usage, see: https://github.com/edgelesssys/constellation/blob/main/debugd/README.md" - ConfigDoc.Fields[5].Comments[encoder.LineComment] = "DON'T USE IN PRODUCTION: enable debug mode and use debug images. For usage, see: https://github.com/edgelesssys/constellation/blob/main/debugd/README.md" - ConfigDoc.Fields[6].Name = "provider" - ConfigDoc.Fields[6].Type = "ProviderConfig" + ConfigDoc.Fields[5].Description = "Create SSH users on Constellation nodes." + ConfigDoc.Fields[5].Comments[encoder.LineComment] = "Create SSH users on Constellation nodes." + + ConfigDoc.Fields[5].AddExample("", []UserKey{{Username: "Alice", PublicKey: "ssh-rsa AAAAB3NzaC...5QXHKW1rufgtJeSeJ8= alice@domain.com"}}) + ConfigDoc.Fields[6].Name = "upgrade" + ConfigDoc.Fields[6].Type = "UpgradeConfig" ConfigDoc.Fields[6].Note = "" - ConfigDoc.Fields[6].Description = "Supported cloud providers and their specific configurations." - ConfigDoc.Fields[6].Comments[encoder.LineComment] = "Supported cloud providers and their specific configurations." - ConfigDoc.Fields[7].Name = "sshUsers" - ConfigDoc.Fields[7].Type = "[]UserKey" - ConfigDoc.Fields[7].Note = "" - ConfigDoc.Fields[7].Description = "Create SSH users on Constellation nodes." - ConfigDoc.Fields[7].Comments[encoder.LineComment] = "Create SSH users on Constellation nodes." + ConfigDoc.Fields[6].Description = "Configuration to apply during constellation upgrade." + ConfigDoc.Fields[6].Comments[encoder.LineComment] = "Configuration to apply during constellation upgrade." - ConfigDoc.Fields[7].AddExample("", []UserKey{{Username: "Alice", PublicKey: "ssh-rsa AAAAB3NzaC...5QXHKW1rufgtJeSeJ8= alice@domain.com"}}) - ConfigDoc.Fields[8].Name = "upgrade" - ConfigDoc.Fields[8].Type = "UpgradeConfig" - ConfigDoc.Fields[8].Note = "" - ConfigDoc.Fields[8].Description = "Configuration to apply during constellation upgrade." - ConfigDoc.Fields[8].Comments[encoder.LineComment] = "Configuration to apply during constellation upgrade." - - ConfigDoc.Fields[8].AddExample("", UpgradeConfig{Image: "", Measurements: Measurements{}}) + ConfigDoc.Fields[6].AddExample("", UpgradeConfig{Image: "", Measurements: Measurements{}}) UpgradeConfigDoc.Type = "UpgradeConfig" UpgradeConfigDoc.Comments[encoder.LineComment] = "UpgradeConfig defines configuration used during constellation upgrade." diff --git a/internal/config/config_test.go b/internal/config/config_test.go index dc8542697..063b8757a 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -62,15 +62,11 @@ func TestFromFile(t *testing.T) { }, "custom config from default file": { config: &Config{ - Version: Version1, - AutoscalingNodeGroupMin: 42, - AutoscalingNodeGroupMax: 1337, + Version: Version1, }, configName: constants.ConfigFilename, wantResult: &Config{ - Version: Version1, - AutoscalingNodeGroupMin: 42, - AutoscalingNodeGroupMax: 1337, + Version: Version1, }, }, "modify default config": { @@ -151,6 +147,7 @@ func TestFromFileStrictErrors(t *testing.T) { err := fileHandler.Write(constants.ConfigFilename, []byte(tc.yamlConfig), file.OptNone) assert.NoError(err) + // TODO: Test should fail because of unknown field "autoscalingNodeGroupMin" but it doesn't. _, err = FromFile(fileHandler, constants.ConfigFilename) assert.Error(err) })