From 5621ccb6c0c41fbc1260b86278284ecb015b6455 Mon Sep 17 00:00:00 2001 From: Akos Eros Date: Thu, 5 Mar 2026 13:53:35 +0100 Subject: [PATCH] feat: Change default gitops sub namespace The new recommended namespace for the subscription is openshift-gitops-operator. --- internal/controller/defaults.go | 3 +-- internal/controller/pattern_controller.go | 2 +- internal/controller/subscription.go | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/internal/controller/defaults.go b/internal/controller/defaults.go index 21d6a3227..1d9c6ff40 100644 --- a/internal/controller/defaults.go +++ b/internal/controller/defaults.go @@ -7,8 +7,6 @@ const ( OperatorNamespace = "openshift-operators" // Default Operator Config Map Name OperatorConfigMap = "patterns-operator-config" - // Default Subscription Namespace - SubscriptionNamespace = "openshift-operators" // Default Application Namespace ApplicationNamespace = "openshift-gitops" // ClusterWide Argo Name @@ -17,6 +15,7 @@ const ( // GitOps Subscription const ( + GitOpsDefaultSubscriptionNamespace = "openshift-gitops-operator" GitOpsDefaultChannel = "gitops-1.18" GitOpsDefaultPackageName = "openshift-gitops-operator" GitOpsDefaultCatalogSource = "redhat-operators" diff --git a/internal/controller/pattern_controller.go b/internal/controller/pattern_controller.go index 7a7d32fd7..2172d5716 100644 --- a/internal/controller/pattern_controller.go +++ b/internal/controller/pattern_controller.go @@ -201,7 +201,7 @@ func (r *PatternReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct return r.actionPerformed(qualifiedInstance, "error setting patterns operator owner reference of gitops subscription", err) } // Persist the updated ownerReferences on the Subscription - if _, err := r.olmClient.OperatorsV1alpha1().Subscriptions(SubscriptionNamespace).Update(context.Background(), sub, metav1.UpdateOptions{}); err != nil { + if _, err := r.olmClient.OperatorsV1alpha1().Subscriptions(GitOpsDefaultSubscriptionNamespace).Update(context.Background(), sub, metav1.UpdateOptions{}); err != nil { return r.actionPerformed(qualifiedInstance, "error updating gitops subscription owner references", err) } return r.actionPerformed(qualifiedInstance, "updated patterns operator owner reference of gitops subscription", nil) diff --git a/internal/controller/subscription.go b/internal/controller/subscription.go index c099d48c9..86f08aa0e 100644 --- a/internal/controller/subscription.go +++ b/internal/controller/subscription.go @@ -72,7 +72,7 @@ func newSubscriptionFromConfigMap(r kubernetes.Interface) (*operatorv1alpha1.Sub newSubscription = &operatorv1alpha1.Subscription{ ObjectMeta: metav1.ObjectMeta{ Name: GitOpsDefaultPackageName, - Namespace: SubscriptionNamespace, + Namespace: GitOpsDefaultSubscriptionNamespace, }, Spec: spec, } @@ -81,7 +81,7 @@ func newSubscriptionFromConfigMap(r kubernetes.Interface) (*operatorv1alpha1.Sub } func getSubscription(client olmclient.Interface, name string) (*operatorv1alpha1.Subscription, error) { - sub, err := client.OperatorsV1alpha1().Subscriptions(SubscriptionNamespace).Get(context.Background(), name, metav1.GetOptions{}) + sub, err := client.OperatorsV1alpha1().Subscriptions(GitOpsDefaultSubscriptionNamespace).Get(context.Background(), name, metav1.GetOptions{}) if err != nil { return nil, err } @@ -89,7 +89,7 @@ func getSubscription(client olmclient.Interface, name string) (*operatorv1alpha1 } func createSubscription(client olmclient.Interface, sub *operatorv1alpha1.Subscription) error { - _, err := client.OperatorsV1alpha1().Subscriptions(SubscriptionNamespace).Create(context.Background(), sub, metav1.CreateOptions{}) + _, err := client.OperatorsV1alpha1().Subscriptions(GitOpsDefaultSubscriptionNamespace).Create(context.Background(), sub, metav1.CreateOptions{}) return err } @@ -133,7 +133,7 @@ func updateSubscription(client olmclient.Interface, target, current *operatorv1a if changed { target.Spec.DeepCopyInto(current.Spec) - _, err := client.OperatorsV1alpha1().Subscriptions(SubscriptionNamespace).Update(context.Background(), current, metav1.UpdateOptions{}) + _, err := client.OperatorsV1alpha1().Subscriptions(GitOpsDefaultSubscriptionNamespace).Update(context.Background(), current, metav1.UpdateOptions{}) return changed, err }