Skip to content

Commit

Permalink
feat: Add ability to mount server ssl cert from secret (#199)
Browse files Browse the repository at this point in the history
* feat: Add ability to mount server ssl cert from secret

* fix lint

* bump

---------

Co-authored-by: Elio Bischof <elio@zitadel.com>
  • Loading branch information
Exeteres and eliobischof committed May 6, 2024
1 parent 0d1e6f2 commit 8831017
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ jobs:
name: Install Helm (The Chart Testing CLI Depends On It)
uses: 'azure/setup-helm@v3.5'
with:
version: '${{ matrix.helm-version }}'
token: ${{ secrets.GITHUB_TOKEN }}
version: latest

- id: 'set-up-python'
name: Install Python (The Chart Testing CLI Depends On It)
Expand All @@ -47,16 +46,7 @@ jobs:
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Get Changed Test Relevant Files
id: 'list-changed-test'
uses: tj-actions/changed-files@v42
with:
files: |
go.mod
go.sum
charts/zitadel/acceptance/**
- id: 'lint'
name: Lint The Chart
run: 'ct lint --target-branch ${{ github.event.repository.default_branch }}'
if: steps.list-changed.outputs.changed == 'true' || steps.list-changed-test.outputs.any_changed == 'true'
if: steps.list-changed.outputs.changed == 'true'
2 changes: 1 addition & 1 deletion charts/zitadel/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: zitadel
description: A Helm chart for ZITADEL
type: application
appVersion: "v2.49.1"
version: 7.12.1
version: 7.13.0
kubeVersion: ">= 1.21.0-0"
icon: https://zitadel.com/zitadel-logo-dark.svg
maintainers:
Expand Down
16 changes: 16 additions & 0 deletions charts/zitadel/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ spec:
- name: ZITADEL_DATABASE_{{ $dbEnv }}_USER_SSL_KEY
value: /.secrets/db-ssl-user-crt/tls.key
{{- end }}
{{- if .Values.zitadel.serverSslCrtSecret }}
- name: ZITADEL_TLS_CERTPATH
value: /.secrets/server-ssl-crt/tls.crt
- name: ZITADEL_TLS_KEYPATH
value: /.secrets/server-ssl-crt/tls.key
{{- end }}
{{- if .Values.zitadel.selfSignedCert.enabled }}
- name: ZITADEL_TLS_CERTPATH
value: /etc/tls/tls.crt
Expand Down Expand Up @@ -163,6 +169,7 @@ spec:
(include "zitadel.makecpcommand" (dict "value" .Values.zitadel.configSecretName "path" "/zitadel-secret-config-yaml/" ))
(include "zitadel.makecpcommand" (dict "value" (or .Values.zitadel.dbSslCaCrt .Values.zitadel.dbSslCaCrtSecret) "path" "/db-ssl-ca-crt/" ))
(include "zitadel.makecpcommand" (dict "value" .Values.zitadel.dbSslUserCrtSecret "path" "/db-ssl-user-crt/" ))
(include "zitadel.makecpcommand" (dict "value" .Values.zitadel.serverSslCrtSecret "path" "/server-ssl-crt/" ))
)) }} chown -R 1000:1000 /chowned-secrets/ && find /chowned-secrets/ -type f -exec chmod 400 -- {} + "
command:
- sh
Expand All @@ -189,6 +196,10 @@ spec:
- name: db-ssl-user-crt
mountPath: /db-ssl-user-crt
{{- end }}
{{- if .Values.zitadel.serverSslCrtSecret }}
- name: server-ssl-crt
mountPath: /server-ssl-crt
{{- end }}
securityContext:
runAsNonRoot: false
runAsUser: 0
Expand Down Expand Up @@ -246,6 +257,11 @@ spec:
secret:
secretName: {{ .Values.zitadel.dbSslUserCrtSecret }}
{{- end }}
{{- if .Values.zitadel.serverSslCrtSecret }}
- name: server-ssl-crt
secret:
secretName: {{ .Values.zitadel.serverSslCrtSecret }}
{{- end }}
- name: chowned-secrets
emptyDir: {}
{{- if .Values.zitadel.selfSignedCert.enabled }}
Expand Down
3 changes: 3 additions & 0 deletions charts/zitadel/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ zitadel:
# The db users secret containing the client certificate and key at tls.crt and tls.key needed for establishing secure database connections
dbSslUserCrtSecret: ""

# The Secret containing the certificate at key tls.crt and tls.key for listening on HTTPS
serverSslCrtSecret: ""

# Generate a self-signed certificate using an init container
# This will also mount the generated files to /etc/tls/ so that you can reference them in the pod.
# E.G. KeyPath: /etc/tls/tls.key CertPath: /etc/tls/tls.crt
Expand Down

0 comments on commit 8831017

Please sign in to comment.