Skip to content

Commit ff40ddc

Browse files
committed
Force rolebindings as early as possible
This is important because in some situations (we've observed this on the clusterwide argo instance on spokes) the permissions are not there yet when argo tries to create service accounts for the imperative SAs. This means that the very first sync works up to the service account creation which then fails due to lacking RBACs. This triggers a gitops issue where selfheal never retries because the previous run failed and so the app is in a stuck loop forever Co-Authored-By: Jonny Rickard <jrickard@redhat.com> Closes: GITOPS-4677
1 parent e3d6704 commit ff40ddc

6 files changed

Lines changed: 48 additions & 0 deletions

clustergroup/templates/plumbing/argocd-super-role.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ apiVersion: rbac.authorization.k8s.io/v1
44
kind: ClusterRoleBinding
55
metadata:
66
name: openshift-gitops-cluster-admin-rolebinding
7+
# We need to have this before anything else or the sync might get stuck forever
8+
# due to permission issues
9+
annotations:
10+
argocd.argoproj.io/sync-wave: "-100"
711
roleRef:
812
apiGroup: rbac.authorization.k8s.io
913
kind: ClusterRole
@@ -22,6 +26,10 @@ apiVersion: rbac.authorization.k8s.io/v1
2226
kind: ClusterRoleBinding
2327
metadata:
2428
name: {{ $.Values.global.pattern }}-{{ .Values.clusterGroup.name }}-cluster-admin-rolebinding
29+
# We need to have this before anything else or the sync might get stuck forever
30+
# due to permission issues
31+
annotations:
32+
argocd.argoproj.io/sync-wave: "-100"
2533
roleRef:
2634
apiGroup: rbac.authorization.k8s.io
2735
kind: ClusterRole

tests/clustergroup-industrial-edge-factory.expected.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ apiVersion: rbac.authorization.k8s.io/v1
321321
kind: ClusterRoleBinding
322322
metadata:
323323
name: openshift-gitops-cluster-admin-rolebinding
324+
# We need to have this before anything else or the sync might get stuck forever
325+
# due to permission issues
326+
annotations:
327+
argocd.argoproj.io/sync-wave: "-100"
324328
roleRef:
325329
apiGroup: rbac.authorization.k8s.io
326330
kind: ClusterRole
@@ -340,6 +344,10 @@ apiVersion: rbac.authorization.k8s.io/v1
340344
kind: ClusterRoleBinding
341345
metadata:
342346
name: mypattern-factory-cluster-admin-rolebinding
347+
# We need to have this before anything else or the sync might get stuck forever
348+
# due to permission issues
349+
annotations:
350+
argocd.argoproj.io/sync-wave: "-100"
343351
roleRef:
344352
apiGroup: rbac.authorization.k8s.io
345353
kind: ClusterRole

tests/clustergroup-industrial-edge-hub.expected.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,10 @@ apiVersion: rbac.authorization.k8s.io/v1
482482
kind: ClusterRoleBinding
483483
metadata:
484484
name: openshift-gitops-cluster-admin-rolebinding
485+
# We need to have this before anything else or the sync might get stuck forever
486+
# due to permission issues
487+
annotations:
488+
argocd.argoproj.io/sync-wave: "-100"
485489
roleRef:
486490
apiGroup: rbac.authorization.k8s.io
487491
kind: ClusterRole
@@ -501,6 +505,10 @@ apiVersion: rbac.authorization.k8s.io/v1
501505
kind: ClusterRoleBinding
502506
metadata:
503507
name: mypattern-datacenter-cluster-admin-rolebinding
508+
# We need to have this before anything else or the sync might get stuck forever
509+
# due to permission issues
510+
annotations:
511+
argocd.argoproj.io/sync-wave: "-100"
504512
roleRef:
505513
apiGroup: rbac.authorization.k8s.io
506514
kind: ClusterRole

tests/clustergroup-medical-diagnosis-hub.expected.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ apiVersion: rbac.authorization.k8s.io/v1
409409
kind: ClusterRoleBinding
410410
metadata:
411411
name: openshift-gitops-cluster-admin-rolebinding
412+
# We need to have this before anything else or the sync might get stuck forever
413+
# due to permission issues
414+
annotations:
415+
argocd.argoproj.io/sync-wave: "-100"
412416
roleRef:
413417
apiGroup: rbac.authorization.k8s.io
414418
kind: ClusterRole
@@ -428,6 +432,10 @@ apiVersion: rbac.authorization.k8s.io/v1
428432
kind: ClusterRoleBinding
429433
metadata:
430434
name: mypattern-hub-cluster-admin-rolebinding
435+
# We need to have this before anything else or the sync might get stuck forever
436+
# due to permission issues
437+
annotations:
438+
argocd.argoproj.io/sync-wave: "-100"
431439
roleRef:
432440
apiGroup: rbac.authorization.k8s.io
433441
kind: ClusterRole

tests/clustergroup-naked.expected.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ apiVersion: rbac.authorization.k8s.io/v1
174174
kind: ClusterRoleBinding
175175
metadata:
176176
name: openshift-gitops-cluster-admin-rolebinding
177+
# We need to have this before anything else or the sync might get stuck forever
178+
# due to permission issues
179+
annotations:
180+
argocd.argoproj.io/sync-wave: "-100"
177181
roleRef:
178182
apiGroup: rbac.authorization.k8s.io
179183
kind: ClusterRole
@@ -193,6 +197,10 @@ apiVersion: rbac.authorization.k8s.io/v1
193197
kind: ClusterRoleBinding
194198
metadata:
195199
name: common-example-cluster-admin-rolebinding
200+
# We need to have this before anything else or the sync might get stuck forever
201+
# due to permission issues
202+
annotations:
203+
argocd.argoproj.io/sync-wave: "-100"
196204
roleRef:
197205
apiGroup: rbac.authorization.k8s.io
198206
kind: ClusterRole

tests/clustergroup-normal.expected.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@ apiVersion: rbac.authorization.k8s.io/v1
371371
kind: ClusterRoleBinding
372372
metadata:
373373
name: openshift-gitops-cluster-admin-rolebinding
374+
# We need to have this before anything else or the sync might get stuck forever
375+
# due to permission issues
376+
annotations:
377+
argocd.argoproj.io/sync-wave: "-100"
374378
roleRef:
375379
apiGroup: rbac.authorization.k8s.io
376380
kind: ClusterRole
@@ -390,6 +394,10 @@ apiVersion: rbac.authorization.k8s.io/v1
390394
kind: ClusterRoleBinding
391395
metadata:
392396
name: mypattern-example-cluster-admin-rolebinding
397+
# We need to have this before anything else or the sync might get stuck forever
398+
# due to permission issues
399+
annotations:
400+
argocd.argoproj.io/sync-wave: "-100"
393401
roleRef:
394402
apiGroup: rbac.authorization.k8s.io
395403
kind: ClusterRole

0 commit comments

Comments
 (0)