Skip to content

Commit

Permalink
Add operator Namespace to the Subscription manifest work
Browse files Browse the repository at this point in the history
...so the namespace is deleted on clean up. The namesapce used to get
deleted via the agent add-on manifest work but that was removed b/c it
interfered with submariner cleanup on the managed clusters. It was
thought that deleting the Subscription would cause the installed
operator components to be deleted but that's not the case - deleting
a Subscription only unsubscribes from future updates and leaves the
installation intact.

Related to https://issues.redhat.com/browse/ACM-16491

Signed-off-by: Tom Pantelis <[email protected]>
  • Loading branch information
tpantelis authored and openshift-merge-bot[bot] committed Jan 13, 2025
1 parent 0707560 commit 9f1c83d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/hub/submarineragent/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const (
SubmarinerCRManifestWorkName = "submariner-resource"
agentRBACFile = "manifests/rbac/operatorgroup-aggregate-clusterrole.yaml"
submarinerCRFile = "manifests/operator/submariner.io-submariners-cr.yaml"
operatorNamespaceFile = "manifests/operator/submariner-operator-namespace.yaml"
BrokerCfgApplied = "SubmarinerBrokerConfigApplied"
BrokerObjectName = "submariner-broker"
BackupLabelKey = "cluster.open-cluster-management.io/backup"
Expand Down Expand Up @@ -620,7 +621,7 @@ func newSubmarinerManifestWork(managedCluster *clusterv1.ManagedCluster, config

func newOperatorManifestWork(managedCluster *clusterv1.ManagedCluster, config interface{}, skipOperatorGroup bool,
) (*workv1.ManifestWork, error) {
files := []string{agentRBACFile}
files := []string{operatorNamespaceFile, agentRBACFile}
clusterProduct := getClusterProduct(managedCluster)
if clusterProduct == constants.ProductOCP || clusterProduct == constants.ProductROSA ||
clusterProduct == constants.ProductARO || clusterProduct == constants.ProductROKS {
Expand Down
2 changes: 2 additions & 0 deletions pkg/hub/submarineragent/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,8 @@ func (t *testDriver) assertOperatorManifestWork(work *workv1.ManifestWork) []*un

assertNoManifestObj(manifestObjs, "Submariner", "")

assertManifestObj(manifestObjs, "Namespace", installNamespace)

subscription := assertManifestObj(manifestObjs, "Subscription", "")
assertNestedString(subscription, installNamespace, "metadata", "namespace")
assertNestedString(subscription, "submariner", "spec", "name")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{ .InstallationNamespace }}

0 comments on commit 9f1c83d

Please sign in to comment.