@@ -82,6 +82,11 @@ func (r *naisNamespaceReconciler) Reconcile(ctx context.Context, client *apiclie
8282 for it .Next () {
8383 env := it .Value ()
8484
85+ if strings .HasSuffix (env .EnvironmentName , "-fss" ) {
86+ log .Infof ("Skipping namespace reconciliation for FSS environment %q" , env .EnvironmentName )
87+ continue
88+ }
89+
8590 c , exists := r .k8sClients [env .EnvironmentName ]
8691 if ! exists {
8792 log .Errorf ("No Kubernetes client for environment %q" , env .EnvironmentName )
@@ -90,16 +95,7 @@ func (r *naisNamespaceReconciler) Reconcile(ctx context.Context, client *apiclie
9095
9196 log = log .WithField ("environment" , env .EnvironmentName )
9297
93- var gcpProjectIdOverride * string
94- if env .EnvironmentName == "ci-fss" {
95- gcpProjectIdOverride = gcpProjectIdCache ["ci-gcp" ]
96- } else if env .EnvironmentName == "dev-fss" {
97- gcpProjectIdOverride = gcpProjectIdCache ["dev-gcp" ]
98- } else if env .EnvironmentName == "prod-fss" {
99- gcpProjectIdOverride = gcpProjectIdCache ["prod-gcp" ]
100- }
101-
102- if err := r .ensureNamespace (ctx , naisTeam , env , gcpProjectIdOverride , c .Clientset .CoreV1 ().Namespaces (), log ); err != nil {
98+ if err := r .ensureNamespace (ctx , naisTeam , env , c .Clientset .CoreV1 ().Namespaces (), log ); err != nil {
10399 return fmt .Errorf ("ensure namespace for project %q in environment %q: %w" , ptr .Deref (env .GcpProjectId , "" ), env .EnvironmentName , err )
104100 }
105101
@@ -127,12 +123,8 @@ func (r *naisNamespaceReconciler) Reconcile(ctx context.Context, client *apiclie
127123 return fmt .Errorf ("ensure team rolebinding in namespace %q in environment %q: %w" , naisTeam .Slug , env .EnvironmentName , err )
128124 }
129125
130- if ! strings .HasSuffix (env .EnvironmentName , "-fss" ) {
131- if err := r .ensureCNRMConfig (ctx , env , c .DynamicClient .Resource (cnrmbeta1 .GroupVersion .WithResource ("configconnectorcontexts" )).Namespace (naisTeam .Slug ), log ); err != nil {
132- return fmt .Errorf ("ensure CNRM config in namespace %q in environment %q: %w" , naisTeam .Slug , env .EnvironmentName , err )
133- }
134- } else {
135- log .Debug ("Skipping CNRM config for FSS" )
126+ if err := r .ensureCNRMConfig (ctx , env , c .DynamicClient .Resource (cnrmbeta1 .GroupVersion .WithResource ("configconnectorcontexts" )).Namespace (naisTeam .Slug ), log ); err != nil {
127+ return fmt .Errorf ("ensure CNRM config in namespace %q in environment %q: %w" , naisTeam .Slug , env .EnvironmentName , err )
136128 }
137129
138130 if err := r .ensureResourceQuota (ctx , naisTeam , c .Clientset .CoreV1 ().ResourceQuotas (naisTeam .Slug ), log ); err != nil {
@@ -143,13 +135,12 @@ func (r *naisNamespaceReconciler) Reconcile(ctx context.Context, client *apiclie
143135 return it .Err ()
144136}
145137
146- func (r * naisNamespaceReconciler ) ensureNamespace (ctx context.Context , naisTeam * protoapi.Team , env * protoapi.TeamEnvironment , gcpProjectIdOverride * string , c corev1Typed.NamespaceInterface , log logrus.FieldLogger ) error {
138+ func (r * naisNamespaceReconciler ) ensureNamespace (ctx context.Context , naisTeam * protoapi.Team , env * protoapi.TeamEnvironment , c corev1Typed.NamespaceInterface , log logrus.FieldLogger ) error {
147139 var ns * corev1.Namespace
148140
149141 log = log .WithField ("slug" , env .Slug ).
150142 WithField ("environment" , env .EnvironmentName ).
151- WithField ("gcpProjectId" , env .GcpProjectId ).
152- WithField ("gcpProjectIdOverride" , gcpProjectIdOverride )
143+ WithField ("gcpProjectId" , env .GcpProjectId )
153144
154145 ns , err := c .Get (ctx , naisTeam .Slug , metav1.GetOptions {})
155146 if errors .IsNotFound (err ) {
@@ -171,11 +162,6 @@ func (r *naisNamespaceReconciler) ensureNamespace(ctx context.Context, naisTeam
171162 metav1 .SetMetaDataLabel (& ns .ObjectMeta , "nais.io/type" , "workload" )
172163 metav1 .SetMetaDataLabel (& ns .ObjectMeta , "google-cloud-project" , ptr .Deref (env .GcpProjectId , "" ))
173164
174- if gcpProjectIdOverride != nil {
175- metav1 .SetMetaDataAnnotation (& ns .ObjectMeta , "cnrm.cloud.google.com/project-id" , ptr .Deref (gcpProjectIdOverride , "" ))
176- metav1 .SetMetaDataLabel (& ns .ObjectMeta , "google-cloud-project" , ptr .Deref (gcpProjectIdOverride , "" ))
177- }
178-
179165 _ , err = c .Update (ctx , ns , metav1.UpdateOptions {})
180166 if err != nil {
181167 return fmt .Errorf ("updating namespace: %w" , err )
0 commit comments