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