Skip to content

Commit

Permalink
Merge pull request #715 from linoleparquet/fix/acme
Browse files Browse the repository at this point in the history
fix(acme): fix templating and add unit tests (#655)
  • Loading branch information
dduportal authored Sep 20, 2023
2 parents 7a73f8e + 1b42a4c commit 6976ffc
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/acme/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: An acme settings chart for Jenkins infra project
name: acme
version: 0.1.2
version: 0.1.3
home: "https://github.com/jenkins-infra/charts"
maintainers:
- name: Olblak
Expand Down
2 changes: 2 additions & 0 deletions charts/acme/templates/clusterIssuer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ spec:
privateKeySecretRef:
# Secret resource used to store the account's private key.
name: {{ .Values.acme.id }}
{{- if .Values.acme.solvers }}
solvers:
{{- toYaml .Values.acme.solvers | nindent 4 }}
{{- end}}
20 changes: 20 additions & 0 deletions charts/acme/tests/custom_values_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
suite: Test with custom values
templates:
- clusterIssuer.yaml
- secret.yaml
tests:
- it: should create a Secret with the correct value
set:
acme:
clientSecrets:
- name: acme-test-secret
value: password
template: secret.yaml
asserts:
- hasDocuments:
count: 1
- isKind:
of: Secret
- equal:
path: data.CLIENT_SECRET
value: cGFzc3dvcmQ=
10 changes: 10 additions & 0 deletions charts/acme/tests/defaults_values_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
suite: Test with default values
templates:
- clusterIssuer.yaml
- secret.yaml
tests:
- it: should create a cluster issuer by default
template: clusterIssuer.yaml
asserts:
- hasDocuments:
count: 1
4 changes: 2 additions & 2 deletions charts/acme/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ acme:

# Secrets used for dns01 settings
clientSecrets:
- name: 'acme_test_secret'
value: 'password'
- name: acme-test-secret
value: ""

# Accepts any values as defined here https://cert-manager.io/docs/configuration/acme/dns01/
dns01: {}

0 comments on commit 6976ffc

Please sign in to comment.