Skip to content

Commit 06f5f7a

Browse files
Merge pull request #97 from codefresh-io/feat/acr-controller
feat: support acr controller as part of argocd deployment
2 parents 821746a + 7bd41e8 commit 06f5f7a

File tree

11 files changed

+505
-2
lines changed

11 files changed

+505
-2
lines changed

charts/argo-cd/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v2
2-
appVersion: v2.12-2024.9.9-ba613c5bd
2+
appVersion: v2.12-2024.9.23-0dc32342c
33
kubeVersion: ">=1.23.0-0"
44
description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes.
55
name: argo-cd
@@ -27,4 +27,4 @@ annotations:
2727
url: https://argoproj.github.io/argo-helm/pgp_keys.asc
2828
artifacthub.io/changes: |
2929
- kind: changed
30-
description: Upgrade argo-cd to v2.12-2024.9.9-ba613c5bd with reporting of resources health errors on level with application event
30+
description: Upgrade argo-cd to v2.12-2024.9.23-0dc32342c with and add acr controller support

charts/argo-cd/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,47 @@ NAME: my-release
669669

670670
| Key | Type | Default | Description |
671671
|-----|------|---------|-------------|
672+
| acrController.affinity | object | `{}` (defaults to global.affinity preset) | Assign custom [affinity] rules to the deployment |
673+
| acrController.clusterRoleRules.enabled | bool | `false` | Enable custom rules for the acr controller's ClusterRole resource |
674+
| acrController.clusterRoleRules.rules | list | `[]` | List of custom rules for the acr controller's ClusterRole resource |
675+
| acrController.containerPorts.health | int | `8090` | |
676+
| acrController.containerSecurityContext | object | See [values.yaml] | acr controller container-level security context |
677+
| acrController.dnsConfig | object | `{}` | [DNS configuration] |
678+
| acrController.dnsPolicy | string | `"ClusterFirst"` | Alternative DNS policy for acr controller pods |
679+
| acrController.enabled | bool | `false` | |
680+
| acrController.env | list | `[]` | Environment variables to pass to acr controller |
681+
| acrController.envFrom | list | `[]` (See [values.yaml]) | envFrom to pass to acr controller |
682+
| acrController.extraArgs | list | `[]` | Additional command line arguments to pass to acr controller |
683+
| acrController.extraContainers | list | `[]` | Additional containers to be added to the acr controller pod |
684+
| acrController.hostNetwork | bool | `false` | Host Network for acr controller pods |
685+
| acrController.image.imagePullPolicy | string | `""` (defaults to global.image.imagePullPolicy) | Image pull policy for the acr controller |
686+
| acrController.image.repository | string | `""` (defaults to global.image.repository) | Repository to use for the acr controller |
687+
| acrController.image.tag | string | `""` (defaults to global.image.tag) | Tag to use for the acr controller |
688+
| acrController.imagePullSecrets | list | `[]` (defaults to global.imagePullSecrets) | Secrets with credentials to pull images from a private registry |
689+
| acrController.initContainers | list | `[]` | Init containers to add to the acr controller pod |
690+
| acrController.name | string | `"acr-controller"` | |
691+
| acrController.nodeSelector | object | `{}` (defaults to global.nodeSelector) | [Node selector] |
692+
| acrController.podAnnotations | object | `{}` | Annotations to be added to acr controller pods |
693+
| acrController.podLabels | object | `{}` | Labels to be added to acr controller pods |
694+
| acrController.priorityClassName | string | `""` (defaults to global.priorityClassName) | Priority class for the acr controller pods |
695+
| acrController.readinessProbe.failureThreshold | int | `3` | Minimum consecutive failures for the [probe] to be considered failed after having succeeded |
696+
| acrController.readinessProbe.initialDelaySeconds | int | `10` | Number of seconds after the container has started before [probe] is initiated |
697+
| acrController.readinessProbe.periodSeconds | int | `10` | How often (in seconds) to perform the [probe] |
698+
| acrController.readinessProbe.successThreshold | int | `1` | Minimum consecutive successes for the [probe] to be considered successful after having failed |
699+
| acrController.readinessProbe.timeoutSeconds | int | `1` | Number of seconds after which the [probe] times out |
700+
| acrController.replicas | int | `1` | |
701+
| acrController.resources | object | `{}` | Resource limits and requests for the acr controller pods |
702+
| acrController.serviceAccount.annotations | object | `{}` | Annotations applied to created service account |
703+
| acrController.serviceAccount.automountServiceAccountToken | bool | `true` | Automount API credentials for the Service Account |
704+
| acrController.serviceAccount.create | bool | `true` | Create a service account for the acr controller |
705+
| acrController.serviceAccount.labels | object | `{}` | Labels applied to created service account |
706+
| acrController.serviceAccount.name | string | `"acr-controller"` | Service account name |
707+
| acrController.statefulsetAnnotations | object | `{}` | Annotations for the acr controller StatefulSet |
708+
| acrController.terminationGracePeriodSeconds | int | `30` | terminationGracePeriodSeconds for container lifecycle hook |
709+
| acrController.tolerations | list | `[]` (defaults to global.tolerations) | [Tolerations] for use with node taints |
710+
| acrController.topologySpreadConstraints | list | `[]` (defaults to global.topologySpreadConstraints) | Assign custom [TopologySpreadConstraints] rules to the acr controller |
711+
| acrController.volumeMounts | list | `[]` | Additional volumeMounts to the acr controller main container |
712+
| acrController.volumes | list | `[]` | Additional volumes to the acr controller pod |
672713
| apiVersionOverrides | object | `{}` | |
673714
| applicationVersioning.enabled | bool | `true` | enables the Codefresh application versioning feature |
674715
| applicationVersioning.useApplicationConfiguration | bool | `true` | use ApplicationConfiguration CRD to manage application versioning |

charts/argo-cd/templates/_helpers.tpl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,20 @@ Helper template to set argocd server url in event reporter
285285
{{- end }}
286286
{{- printf "%s:%v" (include "argo-cd.server.fullname" .) $port }}
287287
{{- end -}}
288+
289+
{{/*
290+
Create acr controller name and version as used by the chart label.
291+
*/}}
292+
{{- define "argo-cd.acr-controller.fullname" -}}
293+
{{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.acrController.name | trunc 63 | trimSuffix "-" -}}
294+
{{- end -}}
295+
{{/*
296+
Create the name of the acr controller service account to use
297+
*/}}
298+
{{- define "argo-cd.acrControllerServiceAccountName" -}}
299+
{{- if .Values.acrController.serviceAccount.create -}}
300+
{{ default (include "argo-cd.acr-controller.fullname" .) .Values.acrController.serviceAccount.name }}
301+
{{- else -}}
302+
{{ default "default" .Values.acrController.serviceAccount.name }}
303+
{{- end -}}
304+
{{- end -}}
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+
- argoproj.io
16+
resources:
17+
- applications
18+
verbs:
19+
- get
20+
- list
21+
- watch
22+
- patch
23+
- update
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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
- argoproj.io
12+
resources:
13+
- applications
14+
verbs:
15+
- get
16+
- list
17+
- watch
18+
- patch
19+
- update
20+
{{- 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
@@ -125,6 +125,12 @@ spec:
125125
sync:
126126
description: Sync contains parameters for the operation
127127
properties:
128+
changeRevision:
129+
type: string
130+
changeRevisions:
131+
items:
132+
type: string
133+
type: array
128134
dryRun:
129135
description: DryRun specifies to perform a `kubectl apply --dry-run`
130136
without actually performing the sync
@@ -2547,6 +2553,12 @@ spec:
25472553
sync:
25482554
description: Sync contains parameters for the operation
25492555
properties:
2556+
changeRevision:
2557+
type: string
2558+
changeRevisions:
2559+
items:
2560+
type: string
2561+
type: array
25502562
dryRun:
25512563
description: DryRun specifies to perform a `kubectl apply
25522564
--dry-run` without actually performing the sync

0 commit comments

Comments
 (0)