From faca3060d3fd980b1e8726cc326ea8d069017299 Mon Sep 17 00:00:00 2001 From: Kartikey Mamgain Date: Thu, 12 Oct 2023 16:29:27 +0530 Subject: [PATCH 1/8] modify NSTemplateTierSpec Signed-off-by: Kartikey Mamgain --- api/v1alpha1/nstemplatetier_types.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/v1alpha1/nstemplatetier_types.go b/api/v1alpha1/nstemplatetier_types.go index 1ea048f3..c41c318a 100644 --- a/api/v1alpha1/nstemplatetier_types.go +++ b/api/v1alpha1/nstemplatetier_types.go @@ -22,6 +22,10 @@ type NSTemplateTierSpec struct { // +optional // +mapType=atomic SpaceRoles map[string]NSTemplateTierSpaceRole `json:"spaceRoles,omitempty"` + + // flag to signigy whether to copy SA token or not + // +optional + CopySaToken bool `json:"copySaToken,omitempty"` } // NSTemplateTierNamespace the namespace definition in an NSTemplateTier resource From 9b5f6e65334fa28a9d98fc5f03a4b162c7c2062a Mon Sep 17 00:00:00 2001 From: Kartikey Mamgain Date: Thu, 12 Oct 2023 16:50:24 +0530 Subject: [PATCH 2/8] update nstemplatetier CRD Signed-off-by: Kartikey Mamgain --- api/v1alpha1/nstemplatetier_types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/v1alpha1/nstemplatetier_types.go b/api/v1alpha1/nstemplatetier_types.go index c41c318a..e0e40313 100644 --- a/api/v1alpha1/nstemplatetier_types.go +++ b/api/v1alpha1/nstemplatetier_types.go @@ -23,7 +23,7 @@ type NSTemplateTierSpec struct { // +mapType=atomic SpaceRoles map[string]NSTemplateTierSpaceRole `json:"spaceRoles,omitempty"` - // flag to signigy whether to copy SA token or not + // flag to signify whether to copy SA token or not // +optional CopySaToken bool `json:"copySaToken,omitempty"` } From 642eff5593a03314144b50e4a45bea0ac3537256 Mon Sep 17 00:00:00 2001 From: Kartikey Mamgain Date: Fri, 13 Oct 2023 12:23:39 +0530 Subject: [PATCH 3/8] update NSTemplateTierSpec Signed-off-by: Kartikey Mamgain --- .DS_Store | Bin 6148 -> 6148 bytes api/v1alpha1/nstemplatetier_types.go | 9 +++++++-- api/v1alpha1/zz_generated.deepcopy.go | 16 ++++++++++++++++ api/v1alpha1/zz_generated.openapi.go | 9 ++++++++- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/.DS_Store b/.DS_Store index f21c584a3de86108a7f6392ef1f9d53e1e6ac776..3233df9e705bb54ff46c8e61a2783a360df3a655 100644 GIT binary patch delta 31 ncmZoMXfc@J&&aniU^g=(-(((^vzu92nV2Uw=xk=^_{$Ffm~jbW delta 56 zcmZoMXfc@J&&am7Y2I$w@i+Nem1O0t^gH>6=fm M2s3YH=lIJH0Ksk#K>z>% diff --git a/api/v1alpha1/nstemplatetier_types.go b/api/v1alpha1/nstemplatetier_types.go index e0e40313..347efbc9 100644 --- a/api/v1alpha1/nstemplatetier_types.go +++ b/api/v1alpha1/nstemplatetier_types.go @@ -23,9 +23,14 @@ type NSTemplateTierSpec struct { // +mapType=atomic SpaceRoles map[string]NSTemplateTierSpaceRole `json:"spaceRoles,omitempty"` - // flag to signify whether to copy SA token or not + // Provides the name of the Service Account whose token is to be copied // +optional - CopySaToken bool `json:"copySaToken,omitempty"` + SpaceRequestConfigName SpaceRequestConfig `json:"spaceRequestConfig,omitempty"` +} + +type SpaceRequestConfig struct { + // +optional + SaTokenToCopy string `json:"saTokenToCopy,omitempty"` } // NSTemplateTierNamespace the namespace definition in an NSTemplateTier resource diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 1d560537..128a34b6 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1504,6 +1504,7 @@ func (in *NSTemplateTierSpec) DeepCopyInto(out *NSTemplateTierSpec) { (*out)[key] = val } } + out.SpaceRequestConfigName = in.SpaceRequestConfigName } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NSTemplateTierSpec. @@ -2669,6 +2670,21 @@ func (in *SpaceRequest) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpaceRequestConfig) DeepCopyInto(out *SpaceRequestConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpaceRequestConfig. +func (in *SpaceRequestConfig) DeepCopy() *SpaceRequestConfig { + if in == nil { + return nil + } + out := new(SpaceRequestConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SpaceRequestList) DeepCopyInto(out *SpaceRequestList) { *out = *in diff --git a/api/v1alpha1/zz_generated.openapi.go b/api/v1alpha1/zz_generated.openapi.go index 93dadfc7..0e2b9185 100644 --- a/api/v1alpha1/zz_generated.openapi.go +++ b/api/v1alpha1/zz_generated.openapi.go @@ -1988,12 +1988,19 @@ func schema_codeready_toolchain_api_api_v1alpha1_NSTemplateTierSpec(ref common.R }, }, }, + "spaceRequestConfig": { + SchemaProps: spec.SchemaProps{ + Description: "Provides the name of the Service Account whose token is to be copied", + Default: map[string]interface{}{}, + Ref: ref("github.com/codeready-toolchain/api/api/v1alpha1.SpaceRequestConfig"), + }, + }, }, Required: []string{"namespaces"}, }, }, Dependencies: []string{ - "github.com/codeready-toolchain/api/api/v1alpha1.NSTemplateTierClusterResources", "github.com/codeready-toolchain/api/api/v1alpha1.NSTemplateTierNamespace", "github.com/codeready-toolchain/api/api/v1alpha1.NSTemplateTierSpaceRole"}, + "github.com/codeready-toolchain/api/api/v1alpha1.NSTemplateTierClusterResources", "github.com/codeready-toolchain/api/api/v1alpha1.NSTemplateTierNamespace", "github.com/codeready-toolchain/api/api/v1alpha1.NSTemplateTierSpaceRole", "github.com/codeready-toolchain/api/api/v1alpha1.SpaceRequestConfig"}, } } From 6dd3df698a0ad62d4e4fa1d8d57f219ed0e519e3 Mon Sep 17 00:00:00 2001 From: Kartikey Mamgain Date: Fri, 13 Oct 2023 16:04:19 +0530 Subject: [PATCH 4/8] modify test to use docker config Signed-off-by: Kartikey Mamgain --- api/v1alpha1/nstemplatetier_types.go | 2 ++ api/v1alpha1/zz_generated.openapi.go | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/api/v1alpha1/nstemplatetier_types.go b/api/v1alpha1/nstemplatetier_types.go index 347efbc9..5f8bc5de 100644 --- a/api/v1alpha1/nstemplatetier_types.go +++ b/api/v1alpha1/nstemplatetier_types.go @@ -28,6 +28,8 @@ type NSTemplateTierSpec struct { SpaceRequestConfigName SpaceRequestConfig `json:"spaceRequestConfig,omitempty"` } +// SpaceRequestConfig provides the name of the Service Account whose token is to be copied +// +k8s:openapi-gen=true type SpaceRequestConfig struct { // +optional SaTokenToCopy string `json:"saTokenToCopy,omitempty"` diff --git a/api/v1alpha1/zz_generated.openapi.go b/api/v1alpha1/zz_generated.openapi.go index 4fce60fe..68bf4bb7 100644 --- a/api/v1alpha1/zz_generated.openapi.go +++ b/api/v1alpha1/zz_generated.openapi.go @@ -106,6 +106,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/codeready-toolchain/api/api/v1alpha1.SpaceBindingStatus": schema_codeready_toolchain_api_api_v1alpha1_SpaceBindingStatus(ref), "github.com/codeready-toolchain/api/api/v1alpha1.SpaceConfig": schema_codeready_toolchain_api_api_v1alpha1_SpaceConfig(ref), "github.com/codeready-toolchain/api/api/v1alpha1.SpaceRequest": schema_codeready_toolchain_api_api_v1alpha1_SpaceRequest(ref), + "github.com/codeready-toolchain/api/api/v1alpha1.SpaceRequestConfig": schema_codeready_toolchain_api_api_v1alpha1_SpaceRequestConfig(ref), "github.com/codeready-toolchain/api/api/v1alpha1.SpaceRequestSpec": schema_codeready_toolchain_api_api_v1alpha1_SpaceRequestSpec(ref), "github.com/codeready-toolchain/api/api/v1alpha1.SpaceRequestStatus": schema_codeready_toolchain_api_api_v1alpha1_SpaceRequestStatus(ref), "github.com/codeready-toolchain/api/api/v1alpha1.SpaceSpec": schema_codeready_toolchain_api_api_v1alpha1_SpaceSpec(ref), @@ -3706,6 +3707,25 @@ func schema_codeready_toolchain_api_api_v1alpha1_SpaceRequest(ref common.Referen } } +func schema_codeready_toolchain_api_api_v1alpha1_SpaceRequestConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SpaceRequestConfig provides the name of the Service Account whose token is to be copied", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "saTokenToCopy": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_codeready_toolchain_api_api_v1alpha1_SpaceRequestSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ From 77419a5cd6894f57b54d22c5ac329566d6883f96 Mon Sep 17 00:00:00 2001 From: Kartikey Mamgain Date: Mon, 16 Oct 2023 13:11:51 +0530 Subject: [PATCH 5/8] update nstemplatetier spec Signed-off-by: Kartikey Mamgain --- api/v1alpha1/nstemplatetier_types.go | 2 +- api/v1alpha1/zz_generated.deepcopy.go | 6 +++++- api/v1alpha1/zz_generated.openapi.go | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/api/v1alpha1/nstemplatetier_types.go b/api/v1alpha1/nstemplatetier_types.go index 5f8bc5de..0f8309e8 100644 --- a/api/v1alpha1/nstemplatetier_types.go +++ b/api/v1alpha1/nstemplatetier_types.go @@ -25,7 +25,7 @@ type NSTemplateTierSpec struct { // Provides the name of the Service Account whose token is to be copied // +optional - SpaceRequestConfigName SpaceRequestConfig `json:"spaceRequestConfig,omitempty"` + SpaceRequestConfigName *SpaceRequestConfig `json:"spaceRequestConfig,omitempty"` } // SpaceRequestConfig provides the name of the Service Account whose token is to be copied diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index f4aa75d5..07677b31 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1508,7 +1508,11 @@ func (in *NSTemplateTierSpec) DeepCopyInto(out *NSTemplateTierSpec) { (*out)[key] = val } } - out.SpaceRequestConfigName = in.SpaceRequestConfigName + if in.SpaceRequestConfigName != nil { + in, out := &in.SpaceRequestConfigName, &out.SpaceRequestConfigName + *out = new(SpaceRequestConfig) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NSTemplateTierSpec. diff --git a/api/v1alpha1/zz_generated.openapi.go b/api/v1alpha1/zz_generated.openapi.go index 9dad496e..16c18e20 100644 --- a/api/v1alpha1/zz_generated.openapi.go +++ b/api/v1alpha1/zz_generated.openapi.go @@ -2079,7 +2079,6 @@ func schema_codeready_toolchain_api_api_v1alpha1_NSTemplateTierSpec(ref common.R "spaceRequestConfig": { SchemaProps: spec.SchemaProps{ Description: "Provides the name of the Service Account whose token is to be copied", - Default: map[string]interface{}{}, Ref: ref("github.com/codeready-toolchain/api/api/v1alpha1.SpaceRequestConfig"), }, }, From b057edc190513a94798b9a2576d73e9113bbd0ea Mon Sep 17 00:00:00 2001 From: Kartikey Mamgain Date: Mon, 16 Oct 2023 16:11:55 +0530 Subject: [PATCH 6/8] Modify NSTemplateTierSpec to support SA token copy Signed-off-by: Kartikey Mamgain --- api/v1alpha1/nstemplatetier_types.go | 5 +++-- api/v1alpha1/zz_generated.openapi.go | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/api/v1alpha1/nstemplatetier_types.go b/api/v1alpha1/nstemplatetier_types.go index 0f8309e8..8d972846 100644 --- a/api/v1alpha1/nstemplatetier_types.go +++ b/api/v1alpha1/nstemplatetier_types.go @@ -23,14 +23,15 @@ type NSTemplateTierSpec struct { // +mapType=atomic SpaceRoles map[string]NSTemplateTierSpaceRole `json:"spaceRoles,omitempty"` - // Provides the name of the Service Account whose token is to be copied + // SpaceRequestConfigName stores all the configuration related to the Space Request feature // +optional SpaceRequestConfigName *SpaceRequestConfig `json:"spaceRequestConfig,omitempty"` } -// SpaceRequestConfig provides the name of the Service Account whose token is to be copied +// SpaceRequestConfig contains all the configuration related to the Space Request feature // +k8s:openapi-gen=true type SpaceRequestConfig struct { + // Provides the name of the Service Account whose token is to be copied // +optional SaTokenToCopy string `json:"saTokenToCopy,omitempty"` } diff --git a/api/v1alpha1/zz_generated.openapi.go b/api/v1alpha1/zz_generated.openapi.go index 16c18e20..a83bbd86 100644 --- a/api/v1alpha1/zz_generated.openapi.go +++ b/api/v1alpha1/zz_generated.openapi.go @@ -2078,7 +2078,7 @@ func schema_codeready_toolchain_api_api_v1alpha1_NSTemplateTierSpec(ref common.R }, "spaceRequestConfig": { SchemaProps: spec.SchemaProps{ - Description: "Provides the name of the Service Account whose token is to be copied", + Description: "SpaceRequestConfigName stores all the configuration related to the Space Request feature", Ref: ref("github.com/codeready-toolchain/api/api/v1alpha1.SpaceRequestConfig"), }, }, @@ -3709,13 +3709,14 @@ func schema_codeready_toolchain_api_api_v1alpha1_SpaceRequestConfig(ref common.R return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "SpaceRequestConfig provides the name of the Service Account whose token is to be copied", + Description: "SpaceRequestConfig contains all the configuration related to the Space Request feature", Type: []string{"object"}, Properties: map[string]spec.Schema{ "saTokenToCopy": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "Provides the name of the Service Account whose token is to be copied", + Type: []string{"string"}, + Format: "", }, }, }, From bb80446d6b218d254645a5a3dc6312c878cc3c4e Mon Sep 17 00:00:00 2001 From: Kartikey Mamgain Date: Tue, 17 Oct 2023 11:56:06 +0530 Subject: [PATCH 7/8] update NSTemplateTier CRD Signed-off-by: Kartikey Mamgain --- api/v1alpha1/nstemplatetier_types.go | 2 +- api/v1alpha1/zz_generated.openapi.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/v1alpha1/nstemplatetier_types.go b/api/v1alpha1/nstemplatetier_types.go index 8d972846..2e119888 100644 --- a/api/v1alpha1/nstemplatetier_types.go +++ b/api/v1alpha1/nstemplatetier_types.go @@ -33,7 +33,7 @@ type NSTemplateTierSpec struct { type SpaceRequestConfig struct { // Provides the name of the Service Account whose token is to be copied // +optional - SaTokenToCopy string `json:"saTokenToCopy,omitempty"` + ServiceAccountName string `json:"serviceAccountName,omitempty"` } // NSTemplateTierNamespace the namespace definition in an NSTemplateTier resource diff --git a/api/v1alpha1/zz_generated.openapi.go b/api/v1alpha1/zz_generated.openapi.go index a83bbd86..760ae01e 100644 --- a/api/v1alpha1/zz_generated.openapi.go +++ b/api/v1alpha1/zz_generated.openapi.go @@ -3712,7 +3712,7 @@ func schema_codeready_toolchain_api_api_v1alpha1_SpaceRequestConfig(ref common.R Description: "SpaceRequestConfig contains all the configuration related to the Space Request feature", Type: []string{"object"}, Properties: map[string]spec.Schema{ - "saTokenToCopy": { + "serviceAccountName": { SchemaProps: spec.SchemaProps{ Description: "Provides the name of the Service Account whose token is to be copied", Type: []string{"string"}, From 6a2b75be77a13ac74472419fa76f7152c488d120 Mon Sep 17 00:00:00 2001 From: Kartikey Mamgain Date: Tue, 17 Oct 2023 12:07:47 +0530 Subject: [PATCH 8/8] update NSTemplateTier CRD Signed-off-by: Kartikey Mamgain --- .DS_Store | Bin 6148 -> 0 bytes api/v1alpha1/nstemplatetier_types.go | 4 ++-- api/v1alpha1/zz_generated.deepcopy.go | 4 ++-- api/v1alpha1/zz_generated.openapi.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 3233df9e705bb54ff46c8e61a2783a360df3a655..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKOHRWu5Pfa}L?9}bY>;w-O57lYc2Nmf&;vmKst5!LDzVI-J8%Wg#|qxq7K$C% zq6*DK_Vee>*z=^sF#vP6nV$kj05TTAbf47^Ci7BS*6|}rolJzkSa1KCRg#5=^niL&SQISUY5G$SW}qndT&7CYa&A#d?icyJS^( zz>+anQN)iHcSUZGQL8vEB%8NJHoI`#C+_w>j0?%B$vw2(CF4Hh1`E7!PbK~4ScIN7 z$EN2VE-=D5hPc8Q!-y@pHrXjxnBcAzRq|}|GF&>IRi%viomIq7sK*A+;p(D@={6KO zz%}>T$AHm?RB^)mD$F7;Y7=;6)TH85;)y=gG~|mS0iRn_+Y$wMW{YJ94z*SVQ~_1s zTLJk#