Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions internal/controller/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -17,6 +15,7 @@ const (

// GitOps Subscription
const (
GitOpsDefaultSubscriptionNamespace = "openshift-gitops-operator"
GitOpsDefaultChannel = "gitops-1.18"
GitOpsDefaultPackageName = "openshift-gitops-operator"
GitOpsDefaultCatalogSource = "redhat-operators"
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/pattern_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -81,15 +81,15 @@ 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
}
return sub, nil
}

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
}

Expand Down Expand Up @@ -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
}

Expand Down
Loading