Skip to content

Commit 64a6000

Browse files
gitops operator custom tls injection (#250)
1 parent 424c5ee commit 64a6000

File tree

4 files changed

+135
-1
lines changed

4 files changed

+135
-1
lines changed

charts/gitops-runtime/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependencies:
3838
condition: tunnel-client.enabled
3939
- name: codefresh-gitops-operator
4040
repository: oci://quay.io/codefresh/charts
41-
version: 0.1.5
41+
version: 0.2.0
4242
alias: gitops-operator
4343
condition: gitops-operator.enabled
4444
- name: garage
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
global:
2+
codefresh:
3+
accountId: 628a80b693a15c0f9c13ab75 # Codefresh Account id for ilia-codefresh for now, needs to be some test account
4+
userToken:
5+
secretKeyRef:
6+
name: mysecret
7+
key: myvalue
8+
optional: true
9+
tls:
10+
# -- Custom CA certificates bundle for platform access with ssl
11+
caCerts:
12+
# -- Reference to existing secret
13+
secretKeyRef: {}
14+
# -- Chart managed secret for custom platform CA certificates
15+
secret:
16+
# -- Whether to create the secret.
17+
create: true
18+
# -- The secret key that holds the ca bundle
19+
key: 'ca-bundle.crt'
20+
# Annotations
21+
annotations: {}
22+
# Certificate content
23+
content: |
24+
-----BEGIN CERTIFICATE-----
25+
MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB
26+
gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk
27+
MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY
28+
UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx
29+
NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3
30+
dy54cmFtcH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XHGPurt+HBvbaoAPIbzp26a3QPSy
46+
i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ
47+
O+7ETPTsJ3xCwnR8gooJybQDJbw=
48+
-----END CERTIFICATE-----
49+
50+
runtime:
51+
name: default
52+
53+
ingress:
54+
className: "nginx"
55+
hosts:
56+
- runtime.codefresh.local
57+
58+
repoCredentialsTemplate:
59+
url: 'https://github.com'
60+
username: 'username'
61+
password: 'dummy'
62+
63+
64+
argo-rollouts:
65+
enabled: true

charts/gitops-runtime/templates/gitops-operator.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
{{- end }}
2626
{{- end}}
2727

28+
{{/* Set certificates */}}
29+
{{- if or .Values.global.codefresh.tls.caCerts.secret.create .Values.global.codefresh.tls.caCerts.secretKeyRef}}
30+
{{- $_ := set $gitopsOperatorContext.Values.global.codefresh.tls.caCerts.secretKeyRef "name" (.Values.global.codefresh.tls.caCerts.secret.create | ternary "codefresh-tls-certs" .Values.global.codefresh.tls.caCerts.secretKeyRef.name) }}
31+
{{- $_ := set $gitopsOperatorContext.Values.global.codefresh.tls.caCerts.secretKeyRef "key" (.Values.global.codefresh.tls.caCerts.secret.create | ternary (default "ca-bundle.crt" .Values.global.codefresh.tls.caCerts.secret.key) .Values.global.codefresh.tls.caCerts.secretKeyRef.key) }}
32+
{{- end }}
33+
2834
{{- include "gitops-operator.resources" $gitopsOperatorContext}}
2935

3036
{{- end }}

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

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ templates:
88
- event-reporters/events-reporter/sensor.yaml
99
- event-reporters/rollout-reporter/sensor.yaml
1010
- hooks/pre-uninstall/delete-runtime-from-platform.yaml
11+
- "gitops-operator.yaml"
12+
- charts/gitops-operator/*
1113
tests:
1214

1315
- it: test chart created secret contents - default secret key
@@ -441,3 +443,64 @@ tests:
441443
-----BEGIN CERTIFICATE-----
442444
override
443445
-----END CERTIFICATE-----
446+
447+
- it: gitops operator chart created secret
448+
template: gitops-operator.yaml
449+
documentSelector:
450+
path: kind
451+
value: Deployment
452+
values:
453+
- ./values/mandatory-values.yaml
454+
set:
455+
global.codefresh.tls.caCerts.secret.annotations.test: 'test'
456+
global.codefresh.tls.caCerts.secret.create: true
457+
global.codefresh.tls.caCerts.secret.key: my-key
458+
global.codefresh.tls.caCerts.secret.content: |
459+
-----BEGIN CERTIFICATE-----
460+
... encoded certificate data here ...
461+
-----END CERTIFICATE-----
462+
asserts:
463+
- contains:
464+
path: spec.template.spec.containers[1].env
465+
content:
466+
name: CF_CA_CERT
467+
value: /app/config/codefresh-tls/my-key
468+
- contains:
469+
path: spec.template.spec.containers[1].volumeMounts
470+
content:
471+
name: codefresh-tls
472+
mountPath: /app/config/codefresh-tls
473+
- contains:
474+
path: spec.template.spec.volumes
475+
content:
476+
name: codefresh-tls
477+
secret:
478+
secretName: codefresh-tls-certs
479+
480+
- it: gitops operator existing secret
481+
template: gitops-operator.yaml
482+
documentSelector:
483+
path: kind
484+
value: Deployment
485+
values:
486+
- ./values/mandatory-values.yaml
487+
set:
488+
global.codefresh.tls.caCerts.secretKeyRef.name: my-tls
489+
global.codefresh.tls.caCerts.secretKeyRef.key: my-key
490+
asserts:
491+
- contains:
492+
path: spec.template.spec.containers[1].env
493+
content:
494+
name: CF_CA_CERT
495+
value: /app/config/codefresh-tls/my-key
496+
- contains:
497+
path: spec.template.spec.containers[1].volumeMounts
498+
content:
499+
name: codefresh-tls
500+
mountPath: /app/config/codefresh-tls
501+
- contains:
502+
path: spec.template.spec.volumes
503+
content:
504+
name: codefresh-tls
505+
secret:
506+
secretName: my-tls

0 commit comments

Comments
 (0)