From 1dd8c9c801dc241f7c05492925c84b3c0954f822 Mon Sep 17 00:00:00 2001 From: jjaruszewski Date: Thu, 2 Jul 2026 18:31:30 +0200 Subject: [PATCH] fix: missing olm.operatorNamespace annotation Signed-off-by: jjaruszewski --- .../render/registryv1/generators/generators.go | 8 ++++++-- .../render/registryv1/generators/generators_test.go | 12 +++++++----- ...eployment_argocd-operator-controller-manager.yaml | 1 + ...eployment_argocd-operator-controller-manager.yaml | 1 + ...eployment_argocd-operator-controller-manager.yaml | 1 + ...eployment_argocd-operator-controller-manager.yaml | 1 + ...eployment_argocd-operator-controller-manager.yaml | 1 + ...eployment_argocd-operator-controller-manager.yaml | 1 + ...ployment_webhook-operator-controller-manager.yaml | 1 + 9 files changed, 20 insertions(+), 7 deletions(-) diff --git a/internal/operator-controller/rukpak/render/registryv1/generators/generators.go b/internal/operator-controller/rukpak/render/registryv1/generators/generators.go index 95518793a4..454d4944fd 100644 --- a/internal/operator-controller/rukpak/render/registryv1/generators/generators.go +++ b/internal/operator-controller/rukpak/render/registryv1/generators/generators.go @@ -59,6 +59,7 @@ var certVolumeConfigs = []certVolumeConfig{ // BundleCSVDeploymentGenerator generates all deployments defined in rv1's cluster service version (CSV). The generated // resource aim to have parity with OLMv0 generated Deployment resources: // - olm.targetNamespaces annotation is set with the opts.TargetNamespace value +// - olm.operatorNamespace annotation is set with the opts.InstallNamespace value // - the deployment spec's revision history limit is set to 1 // - merges csv annotations to the deployment template's annotations func BundleCSVDeploymentGenerator(rv1 *bundle.RegistryV1, opts render.Options) ([]client.Object, error) { @@ -78,10 +79,13 @@ func BundleCSVDeploymentGenerator(rv1 *bundle.RegistryV1, opts render.Options) ( // See https://github.com/operator-framework/operator-lifecycle-manager/blob/dfd0b2bea85038d3c0d65348bc812d297f16b8d2/pkg/controller/install/deployment.go#L142 annotations := util.MergeMaps(rv1.CSV.Annotations, depSpec.Spec.Template.Annotations) - // In OLMv0 CSVs are annotated with the OperatorGroup's .spec.targetNamespaces + // In OLMv0, CSVs are annotated with OperatorGroup information: + // - olm.targetNamespaces: the OperatorGroup's .spec.targetNamespaces + // - olm.operatorNamespace: the namespace where the OperatorGroup is defined (operator's install namespace) // See https://github.com/operator-framework/operator-lifecycle-manager/blob/dfd0b2bea85038d3c0d65348bc812d297f16b8d2/pkg/controller/operators/olm/operatorgroup.go#L279 - // When the CSVs annotations are copied to the deployment template's annotations, they bring with it this annotation + // When the CSVs annotations are copied to the deployment template's annotations, they bring with it these annotations annotations["olm.targetNamespaces"] = strings.Join(opts.TargetNamespaces, ",") + annotations["olm.operatorNamespace"] = opts.InstallNamespace depSpec.Spec.Template.Annotations = annotations // Hardcode the deployment with RevisionHistoryLimit=1 to maintain parity with OLMv0 behaviour. diff --git a/internal/operator-controller/rukpak/render/registryv1/generators/generators_test.go b/internal/operator-controller/rukpak/render/registryv1/generators/generators_test.go index 26c3f4b70d..931e4429d3 100644 --- a/internal/operator-controller/rukpak/render/registryv1/generators/generators_test.go +++ b/internal/operator-controller/rukpak/render/registryv1/generators/generators_test.go @@ -123,9 +123,10 @@ func Test_BundleCSVDeploymentGenerator_Succeeds(t *testing.T) { Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ - "csv": "annotation", - "olm.targetNamespaces": "watch-namespace-one,watch-namespace-two", - "pod": "annotation", + "csv": "annotation", + "olm.targetNamespaces": "watch-namespace-one,watch-namespace-two", + "olm.operatorNamespace": "install-namespace", + "pod": "annotation", }, }, Spec: corev1.PodSpec{ @@ -148,8 +149,9 @@ func Test_BundleCSVDeploymentGenerator_Succeeds(t *testing.T) { Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ - "csv": "annotation", - "olm.targetNamespaces": "watch-namespace-one,watch-namespace-two", + "csv": "annotation", + "olm.targetNamespaces": "watch-namespace-one,watch-namespace-two", + "olm.operatorNamespace": "install-namespace", }, }, }, diff --git a/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/all-namespaces/11_deployment_argocd-operator-controller-manager.yaml b/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/all-namespaces/11_deployment_argocd-operator-controller-manager.yaml index e643a9b820..9709d7478e 100644 --- a/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/all-namespaces/11_deployment_argocd-operator-controller-manager.yaml +++ b/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/all-namespaces/11_deployment_argocd-operator-controller-manager.yaml @@ -144,6 +144,7 @@ spec: containerImage: quay.io/argoprojlabs/argocd-operator@sha256:99aeec24cc406d06d18822347d9ac3ed053a702d8419191e4e681075fed7b9bb description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. + olm.operatorNamespace: argocd-system olm.targetNamespaces: "" operators.operatorframework.io/builder: operator-sdk-v1.10.0+git operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 diff --git a/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/own-namespace/09_deployment_argocd-operator-controller-manager.yaml b/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/own-namespace/09_deployment_argocd-operator-controller-manager.yaml index f07080f3f3..d8a7a191f9 100644 --- a/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/own-namespace/09_deployment_argocd-operator-controller-manager.yaml +++ b/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/own-namespace/09_deployment_argocd-operator-controller-manager.yaml @@ -144,6 +144,7 @@ spec: containerImage: quay.io/argoprojlabs/argocd-operator@sha256:99aeec24cc406d06d18822347d9ac3ed053a702d8419191e4e681075fed7b9bb description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. + olm.operatorNamespace: argocd-system olm.targetNamespaces: argocd-system operators.operatorframework.io/builder: operator-sdk-v1.10.0+git operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 diff --git a/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/single-namespace/09_deployment_argocd-operator-controller-manager.yaml b/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/single-namespace/09_deployment_argocd-operator-controller-manager.yaml index 284bc54774..a54a53c17a 100644 --- a/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/single-namespace/09_deployment_argocd-operator-controller-manager.yaml +++ b/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/single-namespace/09_deployment_argocd-operator-controller-manager.yaml @@ -144,6 +144,7 @@ spec: containerImage: quay.io/argoprojlabs/argocd-operator@sha256:99aeec24cc406d06d18822347d9ac3ed053a702d8419191e4e681075fed7b9bb description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. + olm.operatorNamespace: argocd-system olm.targetNamespaces: argocd-watch operators.operatorframework.io/builder: operator-sdk-v1.10.0+git operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 diff --git a/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/with-deploymentconfig-options/11_deployment_argocd-operator-controller-manager.yaml b/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/with-deploymentconfig-options/11_deployment_argocd-operator-controller-manager.yaml index c0f01cc27d..2b386e4df4 100644 --- a/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/with-deploymentconfig-options/11_deployment_argocd-operator-controller-manager.yaml +++ b/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/with-deploymentconfig-options/11_deployment_argocd-operator-controller-manager.yaml @@ -148,6 +148,7 @@ spec: description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. foo: bar + olm.operatorNamespace: argocd-system olm.targetNamespaces: "" operators.operatorframework.io/builder: operator-sdk-v1.10.0+git operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 diff --git a/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/with-empty-affinity-subtype/11_deployment_argocd-operator-controller-manager.yaml b/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/with-empty-affinity-subtype/11_deployment_argocd-operator-controller-manager.yaml index e643a9b820..9709d7478e 100644 --- a/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/with-empty-affinity-subtype/11_deployment_argocd-operator-controller-manager.yaml +++ b/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/with-empty-affinity-subtype/11_deployment_argocd-operator-controller-manager.yaml @@ -144,6 +144,7 @@ spec: containerImage: quay.io/argoprojlabs/argocd-operator@sha256:99aeec24cc406d06d18822347d9ac3ed053a702d8419191e4e681075fed7b9bb description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. + olm.operatorNamespace: argocd-system olm.targetNamespaces: "" operators.operatorframework.io/builder: operator-sdk-v1.10.0+git operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 diff --git a/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/with-empty-affinity/11_deployment_argocd-operator-controller-manager.yaml b/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/with-empty-affinity/11_deployment_argocd-operator-controller-manager.yaml index e643a9b820..9709d7478e 100644 --- a/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/with-empty-affinity/11_deployment_argocd-operator-controller-manager.yaml +++ b/test/regression/convert/testdata/expected-manifests/argocd-operator.v0.6.0/with-empty-affinity/11_deployment_argocd-operator-controller-manager.yaml @@ -144,6 +144,7 @@ spec: containerImage: quay.io/argoprojlabs/argocd-operator@sha256:99aeec24cc406d06d18822347d9ac3ed053a702d8419191e4e681075fed7b9bb description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. + olm.operatorNamespace: argocd-system olm.targetNamespaces: "" operators.operatorframework.io/builder: operator-sdk-v1.10.0+git operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 diff --git a/test/regression/convert/testdata/expected-manifests/webhook-operator.v0.0.5/all-webhook-types/05_deployment_webhook-operator-controller-manager.yaml b/test/regression/convert/testdata/expected-manifests/webhook-operator.v0.0.5/all-webhook-types/05_deployment_webhook-operator-controller-manager.yaml index 57b5d7e17a..0a6537555e 100644 --- a/test/regression/convert/testdata/expected-manifests/webhook-operator.v0.0.5/all-webhook-types/05_deployment_webhook-operator-controller-manager.yaml +++ b/test/regression/convert/testdata/expected-manifests/webhook-operator.v0.0.5/all-webhook-types/05_deployment_webhook-operator-controller-manager.yaml @@ -47,6 +47,7 @@ spec: ] capabilities: Basic Install kubectl.kubernetes.io/default-container: manager + olm.operatorNamespace: webhook-system olm.targetNamespaces: "" operators.operatorframework.io/builder: operator-sdk-v1.41.1 operators.operatorframework.io/project_layout: go.kubebuilder.io/v4