Skip to content

Commit

Permalink
Merge pull request #140 from projectsyn/fix/presync
Browse files Browse the repository at this point in the history
Fix bootstrapping issue in PreSync hook
  • Loading branch information
HappyTetrahedron authored Sep 16, 2024
2 parents 3881c4f + 849cbba commit bd2a6a4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
21 changes: 18 additions & 3 deletions component/cleanup.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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' ],
Expand All @@ -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,
};
Expand Down
9 changes: 6 additions & 3 deletions tests/golden/olm-opensource/cilium/cilium/olm/99_cleanup.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit bd2a6a4

Please sign in to comment.