From ee29426a5d302b1ff13677ad628738c87826f9f6 Mon Sep 17 00:00:00 2001 From: sachinphogat <44605400+sachinphogat@users.noreply.github.com> Date: Fri, 17 Jan 2025 19:22:59 +0530 Subject: [PATCH] fix: crossnamespace remotecluster reference is not supported (#163) * Update kamajicontrolplane_controller_externalreference.go * Update kamajicontrolplane_controller_externalreference.go --- .../kamajicontrolplane_controller_externalreference.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/kamajicontrolplane_controller_externalreference.go b/controllers/kamajicontrolplane_controller_externalreference.go index 6eb46fd..d2a83ca 100644 --- a/controllers/kamajicontrolplane_controller_externalreference.go +++ b/controllers/kamajicontrolplane_controller_externalreference.go @@ -31,12 +31,12 @@ var ( //nolint:cyclop func (r *KamajiControlPlaneReconciler) extractRemoteClient(ctx context.Context, kcp v1alpha1.KamajiControlPlane) (client.Client, error) { //nolint:ireturn - if !r.FeatureGates.Enabled(features.ExternalClusterReference) && - !r.FeatureGates.Enabled(features.ExternalClusterReferenceCrossNamespace) { + if !r.FeatureGates.Enabled(features.ExternalClusterReference) { return nil, ErrExternalClusterReferenceNotEnabled } - if r.FeatureGates.Enabled(features.ExternalClusterReference) && + if r.FeatureGates.Enabled(features.ExternalClusterReference) && + !r.FeatureGates.Enabled(features.ExternalClusterReferenceCrossNamespace) && kcp.Spec.Deployment.ExternalClusterReference.KubeconfigSecretNamespace != "" && kcp.Spec.Deployment.ExternalClusterReference.KubeconfigSecretNamespace != kcp.Namespace { return nil, ErrExternalClusterReferenceCrossNamespaceReference