Skip to content

Commit 72fb3b7

Browse files
feat: support acr controller in our chart
1 parent fbc6b88 commit 72fb3b7

File tree

8 files changed

+469
-0
lines changed

8 files changed

+469
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{- if .Values.acrController.enabled }}
2+
{{- $config := .Values.acrController.clusterAdminAccess | default dict -}}
3+
{{- if hasKey $config "enabled" | ternary $config.enabled .Values.createClusterRoles }}
4+
apiVersion: rbac.authorization.k8s.io/v1
5+
kind: ClusterRole
6+
metadata:
7+
name: {{ include "argo-cd.acr-controller.fullname" . }}
8+
labels:
9+
{{- include "argo-cd.labels" (dict "context" . "component" .Values.acrController.name "name" .Values.acrController.name) | nindent 4 }}
10+
rules:
11+
{{- if .Values.acrController.clusterRoleRules.enabled }}
12+
{{- toYaml .Values.acrController.clusterRoleRules.rules | nindent 2 }}
13+
{{- else }}
14+
- apiGroups:
15+
- '*'
16+
resources:
17+
- '*'
18+
verbs:
19+
- '*'
20+
- nonResourceURLs:
21+
- '*'
22+
verbs:
23+
- '*'
24+
{{- end }}
25+
{{- end }}
26+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- if .Values.acrController.enabled }}
2+
{{- $config := .Values.acrController.clusterAdminAccess | default dict -}}
3+
{{- if hasKey $config "enabled" | ternary $config.enabled .Values.createClusterRoles }}
4+
apiVersion: rbac.authorization.k8s.io/v1
5+
kind: ClusterRoleBinding
6+
metadata:
7+
name: {{ include "argo-cd.acr-controller.fullname" . }}
8+
labels:
9+
{{- include "argo-cd.labels" (dict "context" . "component" .Values.acrController.name "name" .Values.acrController.name) | nindent 4 }}
10+
roleRef:
11+
apiGroup: rbac.authorization.k8s.io
12+
kind: ClusterRole
13+
name: {{ include "argo-cd.acr-controller.fullname" . }}
14+
subjects:
15+
- kind: ServiceAccount
16+
name: {{ include "argo-cd.acrControllerServiceAccountName" . }}
17+
namespace: {{ .Release.Namespace }}
18+
{{- end }}
19+
{{- end }}
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
{{- if .Values.acrController.enabled }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
{{- with (mergeOverwrite (deepCopy .Values.global.statefulsetAnnotations) .Values.acrController.statefulsetAnnotations) }}
6+
annotations:
7+
{{- range $key, $value := . }}
8+
{{ $key }}: {{ $value | quote }}
9+
{{- end }}
10+
{{- end }}
11+
name: {{ template "argo-cd.acr-controller.fullname" . }}
12+
namespace: {{ .Release.Namespace | quote }}
13+
labels:
14+
{{- include "argo-cd.labels" (dict "context" . "component" .Values.acrController.name "name" .Values.acrController.name) | nindent 4 }}
15+
spec:
16+
replicas: {{ .Values.acrController.replicas }}
17+
# TODO: Remove for breaking release as history limit cannot be patched
18+
revisionHistoryLimit: 5
19+
selector:
20+
matchLabels:
21+
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.acrController.name) | nindent 6 }}
22+
template:
23+
metadata:
24+
labels:
25+
{{- include "argo-cd.labels" (dict "context" . "component" .Values.acrController.name "name" .Values.acrController.name) | nindent 8 }}
26+
{{- with (mergeOverwrite (deepCopy .Values.global.podLabels) .Values.acrController.podLabels) }}
27+
{{- toYaml . | nindent 8 }}
28+
{{- end }}
29+
spec:
30+
{{- with .Values.acrController.imagePullSecrets | default .Values.global.imagePullSecrets }}
31+
imagePullSecrets:
32+
{{- toYaml . | nindent 8 }}
33+
{{- end }}
34+
{{- with .Values.global.hostAliases }}
35+
hostAliases:
36+
{{- toYaml . | nindent 8 }}
37+
{{- end }}
38+
{{- with .Values.global.securityContext }}
39+
securityContext:
40+
{{- toYaml . | nindent 8 }}
41+
{{- end }}
42+
{{- with .Values.acrController.priorityClassName | default .Values.global.priorityClassName }}
43+
priorityClassName: {{ . }}
44+
{{- end }}
45+
{{- if .Values.acrController.terminationGracePeriodSeconds }}
46+
terminationGracePeriodSeconds: {{ .Values.acrController.terminationGracePeriodSeconds }}
47+
{{- end }}
48+
serviceAccountName: {{ include "argo-cd.acrControllerServiceAccountName" . }}
49+
containers:
50+
- args:
51+
- /usr/local/bin/argocd-application-change-revision-controller
52+
{{- with .Values.acrController.extraArgs }}
53+
{{- toYaml . | nindent 8 }}
54+
{{- end }}
55+
image: {{ default .Values.global.image.repository .Values.acrController.image.repository }}:{{ default (include "argo-cd.defaultTag" .) .Values.acrController.image.tag }}
56+
imagePullPolicy: {{ default .Values.global.image.imagePullPolicy .Values.acrController.image.imagePullPolicy }}
57+
name: {{ .Values.acrController.name }}
58+
env:
59+
{{- with (concat .Values.global.env .Values.acrController.env) }}
60+
{{- toYaml . | nindent 10 }}
61+
{{- end }}
62+
- name: ARGOCD_SERVER
63+
value: "http://argocd-server:80"
64+
- name: ARGOCD_TOKEN
65+
valueFrom:
66+
secretKeyRef:
67+
key: token
68+
name: argocd-token
69+
- name: ARGOCD_APPLICATION_NAMESPACES
70+
valueFrom:
71+
configMapKeyRef:
72+
name: argocd-cmd-params-cm
73+
key: application.namespaces
74+
optional: true
75+
- name: ACR_CONTROLLER_LOGFORMAT
76+
valueFrom:
77+
configMapKeyRef:
78+
name: argocd-cmd-params-cm
79+
key: acr.log.format
80+
optional: true
81+
- name: ACR_CONTROLLER_LOG_LEVEL
82+
valueFrom:
83+
configMapKeyRef:
84+
name: argocd-cmd-params-cm
85+
key: acr.log.level
86+
optional: true
87+
- name: ACR_CONTROLLER_LISTEN_ADDRESS
88+
valueFrom:
89+
configMapKeyRef:
90+
name: argocd-cmd-params-cm
91+
key: acr.listen.address
92+
optional: true
93+
{{- with .Values.acrController.envFrom }}
94+
envFrom:
95+
{{- toYaml . | nindent 10 }}
96+
{{- end }}
97+
ports:
98+
- name: health
99+
containerPort: {{ .Values.acrController.containerPorts.health }}
100+
protocol: TCP
101+
livenessProbe:
102+
httpGet:
103+
path: /healthz?full=true
104+
port: health
105+
initialDelaySeconds: 3
106+
periodSeconds: 30
107+
timeoutSeconds: 5
108+
readinessProbe:
109+
httpGet:
110+
path: /healthz
111+
port: health
112+
initialDelaySeconds: {{ .Values.acrController.readinessProbe.initialDelaySeconds }}
113+
periodSeconds: {{ .Values.acrController.readinessProbe.periodSeconds }}
114+
timeoutSeconds: {{ .Values.acrController.readinessProbe.timeoutSeconds }}
115+
successThreshold: {{ .Values.acrController.readinessProbe.successThreshold }}
116+
failureThreshold: {{ .Values.acrController.readinessProbe.failureThreshold }}
117+
resources:
118+
{{- toYaml .Values.acrController.resources | nindent 12 }}
119+
{{- with .Values.acrController.containerSecurityContext }}
120+
securityContext:
121+
{{- toYaml . | nindent 10 }}
122+
{{- end }}
123+
{{- with .Values.acrController.extraContainers }}
124+
{{- tpl (toYaml .) $ | nindent 6 }}
125+
{{- end }}
126+
{{- with .Values.acrController.initContainers }}
127+
initContainers:
128+
{{- tpl (toYaml .) $ | nindent 6 }}
129+
{{- end }}
130+
{{- with include "argo-cd.affinity" (dict "context" . "component" .Values.acrController) }}
131+
affinity:
132+
{{- trim . | nindent 8 }}
133+
{{- end }}
134+
{{- with .Values.acrController.nodeSelector | default .Values.global.nodeSelector }}
135+
nodeSelector:
136+
{{- toYaml . | nindent 8 }}
137+
{{- end }}
138+
{{- with .Values.acrController.tolerations | default .Values.global.tolerations }}
139+
tolerations:
140+
{{- toYaml . | nindent 8 }}
141+
{{- end }}
142+
{{- with .Values.acrController.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
143+
topologySpreadConstraints:
144+
{{- range $constraint := . }}
145+
- {{ toYaml $constraint | nindent 8 | trim }}
146+
{{- if not $constraint.labelSelector }}
147+
labelSelector:
148+
matchLabels:
149+
{{- include "argo-cd.selectorLabels" (dict "context" $ "name" $.Values.acrController.name) | nindent 12 }}
150+
{{- end }}
151+
{{- end }}
152+
{{- end }}
153+
{{- if .Values.acrController.hostNetwork }}
154+
hostNetwork: {{ .Values.acrController.hostNetwork }}
155+
{{- end }}
156+
{{- with .Values.acrController.dnsConfig }}
157+
dnsConfig:
158+
{{- toYaml . | nindent 8 }}
159+
{{- end }}
160+
dnsPolicy: {{ .Values.acrController.dnsPolicy }}
161+
{{- end }}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{{- if .Values.acrController.enabled }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: Role
4+
metadata:
5+
name: {{ template "argo-cd.acr-controller.fullname" . }}
6+
namespace: {{ .Release.Namespace | quote }}
7+
labels:
8+
{{- include "argo-cd.labels" (dict "context" . "component" .Values.acrController.name "name" .Values.acrController.name) | nindent 4 }}
9+
rules:
10+
- apiGroups:
11+
- ""
12+
resources:
13+
- secrets
14+
- configmaps
15+
verbs:
16+
- create
17+
- get
18+
- list
19+
- watch
20+
- update
21+
- patch
22+
- delete
23+
- apiGroups:
24+
- argoproj.io
25+
resources:
26+
- applications
27+
- appprojects
28+
- applicationsets
29+
verbs:
30+
- create
31+
- get
32+
- list
33+
- watch
34+
- update
35+
- delete
36+
- patch
37+
- apiGroups:
38+
- ""
39+
resources:
40+
- events
41+
verbs:
42+
- create
43+
- list
44+
{{- end }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{- if .Values.acrController.enabled }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: RoleBinding
4+
metadata:
5+
name: {{ template "argo-cd.acr-controller.fullname" . }}
6+
namespace: {{ .Release.Namespace | quote }}
7+
labels:
8+
{{- include "argo-cd.labels" (dict "context" . "component" .Values.acrController.name "name" .Values.acrController.name) | nindent 4 }}
9+
roleRef:
10+
apiGroup: rbac.authorization.k8s.io
11+
kind: Role
12+
name: {{ template "argo-cd.acr-controller.fullname" . }}
13+
subjects:
14+
- kind: ServiceAccount
15+
name: {{ template "argo-cd.acrControllerServiceAccountName" . }}
16+
namespace: {{ .Release.Namespace }}
17+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- if and .Values.acrController.enabled .Values.acrController.serviceAccount.create }}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
automountServiceAccountToken: {{ .Values.acrController.serviceAccount.automountServiceAccountToken }}
5+
metadata:
6+
name: {{ template "argo-cd.acrControllerServiceAccountName" . }}
7+
namespace: {{ .Release.Namespace | quote }}
8+
{{- if .Values.acrController.serviceAccount.annotations }}
9+
annotations:
10+
{{- range $key, $value := .Values.acrController.serviceAccount.annotations }}
11+
{{ $key }}: {{ $value | quote }}
12+
{{- end }}
13+
{{- end }}
14+
labels:
15+
{{- include "argo-cd.labels" (dict "context" . "component" .Values.acrController.name "name" .Values.acrController.name) | nindent 4 }}
16+
{{- range $key, $value := .Values.acrController.serviceAccount.labels }}
17+
{{ $key }}: {{ $value | quote }}
18+
{{- end }}
19+
{{- end }}

charts/argo-cd/templates/crds/crd-application.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ spec:
116116
sync:
117117
description: Sync contains parameters for the operation
118118
properties:
119+
changeRevision:
120+
type: string
121+
changeRevisions:
122+
items:
123+
type: string
124+
type: array
119125
dryRun:
120126
description: DryRun specifies to perform a `kubectl apply --dry-run`
121127
without actually performing the sync
@@ -2544,6 +2550,12 @@ spec:
25442550
sync:
25452551
description: Sync contains parameters for the operation
25462552
properties:
2553+
changeRevision:
2554+
type: string
2555+
changeRevisions:
2556+
items:
2557+
type: string
2558+
type: array
25472559
dryRun:
25482560
description: DryRun specifies to perform a `kubectl apply
25492561
--dry-run` without actually performing the sync

0 commit comments

Comments
 (0)