diff --git a/component/cleanup.libsonnet b/component/cleanup.libsonnet index 3502ed79..9723d451 100644 --- a/component/cleanup.libsonnet +++ b/component/cleanup.libsonnet @@ -7,7 +7,12 @@ local name = 'cleanup-old-clusterserviceversions'; local namespace = params._namespace; local role = kube.Role(name) { - metadata+: { namespace: namespace }, + metadata+: { + namespace: namespace, + annotations+: { + 'argocd.argoproj.io/hook': 'PreSync', + }, + }, rules: [ { apiGroups: [ 'operators.coreos.com' ], @@ -18,11 +23,21 @@ local role = kube.Role(name) { }; local serviceAccount = kube.ServiceAccount(name) { - metadata+: { namespace: namespace }, + metadata+: { + namespace: namespace, + annotations+: { + 'argocd.argoproj.io/hook': 'PreSync', + }, + }, }; local roleBinding = kube.RoleBinding(name) { - metadata+: { namespace: namespace }, + metadata+: { + namespace: namespace, + annotations+: { + 'argocd.argoproj.io/hook': 'PreSync', + }, + }, subjects_: [ serviceAccount ], roleRef_: role, }; diff --git a/tests/golden/olm-opensource/cilium/cilium/olm/99_cleanup.yaml b/tests/golden/olm-opensource/cilium/cilium/olm/99_cleanup.yaml index b64a4bf4..9bdc8339 100644 --- a/tests/golden/olm-opensource/cilium/cilium/olm/99_cleanup.yaml +++ b/tests/golden/olm-opensource/cilium/cilium/olm/99_cleanup.yaml @@ -1,7 +1,8 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: - annotations: {} + annotations: + argocd.argoproj.io/hook: PreSync labels: name: cleanup-old-clusterserviceversions name: cleanup-old-clusterserviceversions @@ -19,7 +20,8 @@ rules: apiVersion: v1 kind: ServiceAccount metadata: - annotations: {} + annotations: + argocd.argoproj.io/hook: PreSync labels: name: cleanup-old-clusterserviceversions name: cleanup-old-clusterserviceversions @@ -28,7 +30,8 @@ metadata: apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: - annotations: {} + annotations: + argocd.argoproj.io/hook: PreSync labels: name: cleanup-old-clusterserviceversions name: cleanup-old-clusterserviceversions