Skip to content

Commit 15137e9

Browse files
Switch gitops operator to library mode and set ArgoCD image and workflows url from runtime chart values (#219)
1 parent 48ac23e commit 15137e9

13 files changed

+231
-68
lines changed

charts/gitops-runtime/Chart.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@ annotations:
1515
artifacthub.io/alternativeName: "codefresh-gitops-runtime"
1616
artifacthub.io/changes: |
1717
- kind: changed
18-
description: "update codefresh-gitops-operator chart to 1.0.19"
18+
description: "removed promotion-related notifications from argocd-notifications-controller"
19+
- kind: changed
20+
description: "update gitops operator and switch gitops operator to library mode - set ArgoCD image for notifications controller to match other ArgoCD components and set correct workflows url from chart values"
1921
- kind: changed
2022
description: "updated cap-app-proxy to 1.2875.0, including skipping PAT scopes permissions validations for git providers: BitBucket, BitBucket Server and GitLab; new query promotablePropertiesPreview"
21-
- kind: added
22-
description: garage as optional dependency for Argo workflows artifact and log storage
23-
- kind: fixed
24-
description: multiarch image for installer image used in hooks
25-
- kind: fixed
26-
description: multiarch frpc (codefresh-tunnel-client) image
2723
dependencies:
2824
- name: argo-cd
2925
repository: https://codefresh-io.github.io/argo-helm
@@ -49,7 +45,7 @@ dependencies:
4945
condition: tunnel-client.enabled
5046
- name: codefresh-gitops-operator
5147
repository: oci://quay.io/codefresh/charts
52-
version: 1.0.19
48+
version: 1.0.21
5349
alias: gitops-operator
5450
condition: gitops-operator.enabled
5551
- name: garage

charts/gitops-runtime/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ sealed-secrets:
231231
| garage-workflows-artifact-storage.persistence.meta.storageClass | string | `""` | When empty value empty the default storage class for the cluster will be used |
232232
| garage-workflows-artifact-storage.resources | object | `{}` | Resources for garage pods. For smaller deployments at least 100m CPU and 1024Mi memory is reccommended. For larger deployments double this size. |
233233
| gitops-operator.affinity | object | `{}` | |
234+
| gitops-operator.argoCdNotifications | object | `{"image":{},"imageOverride":false,"resources":{}}` | Builtin notifications controller used by gitops-operator for promotion related notifications |
235+
| gitops-operator.argoCdNotifications.image | object | `{}` | Set image.repository and image.tag notifications image used by the gitops operator. Ignored unless imageOverride is set to true. |
236+
| gitops-operator.argoCdNotifications.imageOverride | bool | `false` | If set to true allows to override notifications image used by the gitops operator. When set to false the version of ArgoCD will be set to the version used for all other ArgoCD components. |
237+
| gitops-operator.argoCdNotifications.resources | object | `{}` | Resources for notifications controller used by gitops-operator. |
234238
| gitops-operator.crds | object | `{"additionalLabels":{},"annotations":{},"install":true,"keep":false}` | Codefresh gitops operator crds |
235239
| gitops-operator.crds.additionalLabels | object | `{}` | Additional labels for gitops operator CRDs |
236240
| gitops-operator.crds.annotations | object | `{}` | Annotations on gitops operator CRDs |
@@ -248,6 +252,7 @@ sealed-secrets:
248252
| gitops-operator.kube-rbac-proxy.resources.requests.memory | string | `"64Mi"` | |
249253
| gitops-operator.kube-rbac-proxy.securityContext.allowPrivilegeEscalation | bool | `false` | |
250254
| gitops-operator.kube-rbac-proxy.securityContext.capabilities.drop[0] | string | `"ALL"` | |
255+
| gitops-operator.libraryMode | bool | `true` | Do not change unless instructed otherwise by Codefresh support |
251256
| gitops-operator.nameOverride | string | `""` | |
252257
| gitops-operator.nodeSelector | object | `{}` | |
253258
| gitops-operator.podAnnotations | object | `{}` | |

charts/gitops-runtime/templates/_helpers.tpl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,22 @@ Determine argocd server service name. Must be called with chart root context
8080
{{- template "argo-cd.server.fullname" (dict "Values" (get .Values "argo-cd")) }}
8181
{{- end }}
8282

83+
{{/*
84+
Determine argocd repo server service name. Must be called with chart root context
85+
*/}}
86+
{{- define "codefresh-gitops-runtime.argocd.reposerver.servicename" -}}
87+
{{/* For now use template from ArgoCD chart until better approach */}}
88+
{{- template "argo-cd.repoServer.fullname" (dict "Values" (get .Values "argo-cd")) }}
89+
{{- end }}
90+
91+
{{/*
92+
Determine argocd argocd repo server port
93+
*/}}
94+
{{- define "codefresh-gitops-runtime.argocd.reposerver.serviceport" -}}
95+
{{/* For now use template from ArgoCD chart until better approach */}}
96+
{{- index .Values "argo-cd" "repoServer" "service" "port" }}
97+
{{- end }}
98+
8399
{{/*
84100
Determine argocd servicename. Must be called with chart root context
85101
*/}}
@@ -283,4 +299,4 @@ valueFrom:
283299
key: {{ include "codefresh-gitops-runtime.runtime-gitcreds.password.secretkey" . }}
284300
optional: true
285301
{{- end }}
286-
# ------------------------------------------------------------------------------------------------------------
302+
# ------------------------------------------------------------------------------------------------------------
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{- if index (get .Values "gitops-operator") "libraryMode" }}
2+
{{- $gitopsOperatorContext := (index .Subcharts "gitops-operator")}}
3+
{{- $argoCDImageDict := index .Subcharts "argo-cd" "Values" "global" "image" }}
4+
{{- if not $argoCDImageDict.tag }}
5+
{{- $_ := set $argoCDImageDict "tag" (get .Subcharts "argo-cd").Chart.AppVersion }}
6+
{{- end }}
7+
8+
9+
{{/* Set ArgoCD image */}}
10+
{{- if not (index .Values "gitops-operator" "argoCdNotifications.imageOverride") }}
11+
{{- $_ := set $gitopsOperatorContext.Values.argoCdNotifications.image "repository" $argoCDImageDict.repository }}
12+
{{- $_ := set $gitopsOperatorContext.Values.argoCdNotifications.image "tag" $argoCDImageDict.tag }}
13+
{{- end }}
14+
15+
{{/* Set repo server service and port */}}
16+
{{- $_ := set $gitopsOperatorContext.Values.argoCdNotifications.argocd.repoServer "fullname" (include "codefresh-gitops-runtime.argocd.reposerver.servicename" . ) }}
17+
{{- $_ := set $gitopsOperatorContext.Values.argoCdNotifications.argocd.repoServer "port" (include "codefresh-gitops-runtime.argocd.reposerver.serviceport" . ) }}
18+
19+
20+
{{/* Set workflows url */}}
21+
{{- if index .Values "argo-workflows" "enabled" }}
22+
{{- if not $gitopsOperatorContext.Values.env.ARGO_WF_URL }}
23+
{{- $argoWorkflowsUrl := include "codefresh-gitops-runtime.argo-workflows.server.url" . }}
24+
{{- $_ := set $gitopsOperatorContext.Values.env "ARGO_WF_URL" $argoWorkflowsUrl }}
25+
{{- end }}
26+
{{- end}}
27+
28+
{{- include "gitops-operator.resources" $gitopsOperatorContext}}
29+
30+
{{- end }}

charts/gitops-runtime/tests/app-proxy-image-enrichemnt_test.yaml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ tests:
1515
app-proxy.image-enrichment.enabled: true
1616
asserts:
1717
- failedTemplate:
18-
errorMessage: 'app-proxy.image-enrichment is enabled but argo-workflows is disabled. This is not suppurted. Either disable erichment or enable workflows'
18+
errorMessage: 'ERROR: app-proxy.image-enrichment is enabled but argo-workflows is disabled. This is not suppurted. Either disable erichment or enable workflows'
1919

2020
- it: Set correct values in app-proxy configmap
2121
template: 'app-proxy/config.yaml'
@@ -31,7 +31,7 @@ tests:
3131
app-proxy.image-enrichment.config.clientHeartbeatIntervalInSeconds: 1
3232
app-proxy.image-enrichment.serviceAccount.name: test
3333
app-proxy.image-enrichment.config.images:
34-
reportImage:
34+
reportImage:
3535
registry: registry.example
3636
repository: codefresh/report-image
3737
tag: 1-test-report
@@ -61,19 +61,19 @@ tests:
6161
- equal:
6262
path: data.enrichmentTtlActiveInSeconds
6363
value: "1"
64-
- equal:
64+
- equal:
6565
path: data.enrichmentClientHeartbeatIntervalInSeconds
6666
value: "1"
67-
- equal:
67+
- equal:
6868
path: data.enrichmentServiceAccountName
6969
value: test
70-
- equal:
70+
- equal:
7171
path: data.enrichmentImageReportingImage
7272
value: registry.example/codefresh/report-image:1-test-report
73-
- equal:
73+
- equal:
7474
path: data.enrichmentGitEnrichmentImage
7575
value: reg.ex/codefresh/git-enrich:1-test-git
76-
- equal:
76+
- equal:
7777
path: data.enrichmentJiraEnrichmentImage
7878
value: my.reg/codefresh/jira-enrich:1-test-jira
7979

@@ -147,7 +147,7 @@ tests:
147147
name: cap-app-proxy-cm
148148
key: enrichmentServiceAccountName
149149
optional: true
150-
- contains:
150+
- contains:
151151
path: spec.template.spec.containers[0].env
152152
content:
153153
name: IRW_REPORT_IMAGE_TASK_IMAGE
@@ -156,7 +156,7 @@ tests:
156156
name: cap-app-proxy-cm
157157
key: enrichmentImageReportingImage
158158
optional: true
159-
- contains:
159+
- contains:
160160
path: spec.template.spec.containers[0].env
161161
content:
162162
name: IRW_GIT_ENRICHMENT_TASK_IMAGE
@@ -165,7 +165,7 @@ tests:
165165
name: cap-app-proxy-cm
166166
key: enrichmentGitEnrichmentImage
167167
optional: true
168-
- contains:
168+
- contains:
169169
path: spec.template.spec.containers[0].env
170170
content:
171171
name: IRW_JIRA_ENRICHMENT_TASK_IMAGE
@@ -202,8 +202,3 @@ tests:
202202
- equal:
203203
path: roleRef.name
204204
value: cap-app-proxy-enrichment
205-
206-
207-
208-
209-

charts/gitops-runtime/tests/argo-projects-templates-integration_test.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Test components that depend on templates from Argo projects.
1+
# Test components that depend on templates from Argo projects.
22
# This is extremely important since currently templates are used that may change between versions of Argo charts.
33
suite: Test integration of outputs from Argo Project templates with components that use them in the runtime chart
44
templates:
@@ -8,9 +8,9 @@ templates:
88
- internal-router/config.yaml
99
- event-reporters/events-reporter/eventsource.yaml
1010
- event-reporters/rollout-reporter/clusterrolebinding.yaml
11-
tests:
11+
tests:
1212
# ------------------------------------------------------------------------
13-
# ArgoCD
13+
# ArgoCD
1414
# Affected templates: app-proxy configmap and events-reporter eventsource
1515
# ------------------------------------------------------------------------
1616
- it: test app proxy argocd url - http
@@ -61,7 +61,7 @@ tests:
6161
path: spec.generic.events.url
6262
value: argo-cd-test-server:443
6363
# ------------------------------------------------------------------------------------------
64-
# Argo Workflows
64+
# Argo Workflows
6565
# Affected templates: app-proxy ClusterRoleBinding to argo-server role, intenal-url config
6666
# ------------------------------------------------------------------------------------------
6767
- it: test app proxy ClusterRoleBinding to argo workflows role
@@ -87,7 +87,7 @@ tests:
8787
argo-workflows.server.secure: true
8888
asserts:
8989
- matchRegex:
90-
path: data.default\.conf\.template
90+
path: data["default.conf.template"]
9191
pattern: .proxy_pass https://argo-test-server:2746+
9292

9393
- it: check worklfow route users argo-workflows server name and protocol http
@@ -101,7 +101,7 @@ tests:
101101
argo-workflows.server.secure: false
102102
asserts:
103103
- matchRegex:
104-
path: data.default\.conf\.template
104+
path: data["default.conf.template"]
105105
pattern: .proxy_pass http://argo-test-server:2746+
106106

107107
- it: test app proxy argocd workflows url - http
@@ -130,7 +130,7 @@ tests:
130130
path: data.argoWorkflowsUrl
131131
value: https://argo-test-server:2746
132132
# ------------------------------------------------------------------------------------------
133-
# Argo rollouts
133+
# Argo rollouts
134134
# Affected templates - rollouts reporter clusterrolebinding
135135
# ------------------------------------------------------------------------------------------
136136
- it: test rollout reporter ClusterRoleBinding to argo rollouts role
@@ -143,4 +143,4 @@ tests:
143143
asserts:
144144
- equal:
145145
path: roleRef.name
146-
value: rollouts-test
146+
value: rollouts-test

charts/gitops-runtime/tests/custom-ca_test.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,25 +379,24 @@ tests:
379379
values:
380380
- ./values/mandatory-values.yaml
381381
asserts:
382-
- isEmpty:
382+
- notExists:
383383
path: spec.triggers[0].template.http.tls
384384

385385
- it: rollout reporter sensor - no tls
386386
template: event-reporters/rollout-reporter/sensor.yaml
387387
values:
388388
- ./values/mandatory-values.yaml
389389
asserts:
390-
- isEmpty:
390+
- notExists:
391391
path: spec.triggers[0].template.http.tls
392392

393393
- it: workflow reporter sensor - no tls
394394
template: event-reporters/workflow-reporter/sensor.yaml
395395
values:
396396
- ./values/mandatory-values.yaml
397397
asserts:
398-
- isEmpty:
398+
- notExists:
399399
path: spec.triggers[0].template.http.tls
400-
401400
# --------------------------------------------------------
402401
# workflowPipelinesGitWebhooks
403402
# --------------------------------------------------------

0 commit comments

Comments
 (0)