Skip to content

Commit 8a15029

Browse files
authored
fix: exclude argocd namespace from podAffinity mutation (#1547)
1 parent 7c9c3ce commit 8a15029

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

charts/gatekeeper-artifacts/templates/_helpers.tpl

+1-5
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,12 @@ Create the name of the service account to use
6060

6161
{{- define "gatekeeper-artifacts.namespaces" -}}
6262
{{- if gt (len .teamIds) 0 }}
63-
{{- if .excludedNamespaces }}
6463
excludedNamespaces:
65-
{{- else }}
66-
namespaces:
67-
{{- end }}
6864
{{- range $teamId := (.teamIds | sortAlpha) }}
6965
- team-{{ $teamId }}
7066
{{- end }}
71-
- argocd
7267
{{- end -}}
68+
- argocd
7369
{{- end -}}
7470

7571
{{- define "gatekeeper-artifacts.nodeselector-terms" -}}

charts/gatekeeper-artifacts/templates/mutations.yaml

+16-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ spec:
2828
kinds:
2929
- apiGroups: [batch]
3030
kinds: [CronJob]
31-
{{- include "gatekeeper-artifacts.namespaces" (dict "teamIds" $v.teamIds "excludedNamespaces" true) | nindent 4 }}
31+
excludedNamespaces:
32+
{{- range $teamId := ($v.teamIds | sortAlpha) }}
33+
- team-{{ $teamId }}
34+
{{- end }}
35+
- argocd
3236
location: spec.jobTemplate.spec.affinity.nodeAffinity
3337
parameters:
3438
assign:
@@ -64,7 +68,11 @@ spec:
6468
kinds: [Job]
6569
- apiGroups: [serving.knative.dev]
6670
kinds: [Service]
67-
{{- include "gatekeeper-artifacts.namespaces" (dict "teamIds" $v.teamIds "excludedNamespaces" true) | nindent 4 }}
71+
excludedNamespaces:
72+
{{- range $teamId := ($v.teamIds | sortAlpha) }}
73+
- team-{{ $teamId }}
74+
{{- end }}
75+
- argocd
6876
location: spec.template.spec.affinity.nodeAffinity
6977
parameters:
7078
assign:
@@ -86,7 +94,12 @@ spec:
8694
kinds:
8795
- apiGroups: ["*"]
8896
kinds: [Pod]
89-
{{- include "gatekeeper-artifacts.namespaces" (dict "teamIds" $v.teamIds) | nindent 4 }}
97+
{{- if gt (len $v.teamIds) 0 }}
98+
namespaces:
99+
{{- range $teamId := ($v.teamIds | sortAlpha) }}
100+
- team-{{ $teamId }}
101+
{{- end }}
102+
{{- end }}
90103
location: spec.affinity.nodeAffinity
91104
parameters:
92105
assign:

0 commit comments

Comments
 (0)