Skip to content
Open
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
7 changes: 7 additions & 0 deletions pkg/operator/controller/gatewayclass/okd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build okd

package gatewayclass

func init() {
OKD = true
}
15 changes: 13 additions & 2 deletions pkg/operator/controller/gatewayclass/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import (
"k8s.io/apimachinery/pkg/types"
)

var (
OKD = false
)

// ensureServiceMeshOperatorSubscription attempts to ensure that a subscription
// for servicemeshoperator is present and returns a Boolean indicating whether
// it exists, the subscription if it exists, and an error value.
Expand Down Expand Up @@ -49,6 +53,13 @@ func (r *reconciler) ensureServiceMeshOperatorSubscription(ctx context.Context)

// desiredSubscription returns the desired subscription.
func desiredSubscription(name types.NamespacedName) (*operatorsv1alpha1.Subscription, error) {
packageName := "servicemeshoperator"
catalogSource := "redhat-operators"

if OKD {
packageName = "servicemeshoperator3"
catalogSource = "okderators"
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this require OKDerators catalog to be installed? what happens if you trigger this feature without installing OKDerators?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are also interested in the answer to this question.

subscription := operatorsv1alpha1.Subscription{
ObjectMeta: metav1.ObjectMeta{
Namespace: name.Namespace,
Expand All @@ -57,8 +68,8 @@ func desiredSubscription(name types.NamespacedName) (*operatorsv1alpha1.Subscrip
Spec: &operatorsv1alpha1.SubscriptionSpec{
Channel: "stable",
InstallPlanApproval: operatorsv1alpha1.ApprovalAutomatic,
Package: "servicemeshoperator",
CatalogSource: "redhat-operators",
Package: packageName,
CatalogSource: catalogSource,
CatalogSourceNamespace: "openshift-marketplace",
},
}
Expand Down