Skip to content

Commit

Permalink
Add support for custom tls issuer
Browse files Browse the repository at this point in the history
Signed-off-by: Erwan Vallienne <[email protected]>
  • Loading branch information
erwanval committed Apr 18, 2024
1 parent d295964 commit 9f75ac6
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 3 deletions.
5 changes: 5 additions & 0 deletions charts/crowdsec/templates/tls/agent-certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ spec:
reflector.v1.k8s.emberstack.com/reflection-auto-enabled: "true"
{{ end }}
issuerRef:
{{ if .Values.tls.certManager.issuerRef }}
name: {{ .Values.tls.certManager.issuerRef.name }}
kind: {{ default "Issuer" .Values.tls.certManager.issuerRef.kind }}
{{ else }}
name: {{ .Release.Name }}-ca-issuer
{{ end }}
subject:
organizationalUnits:
- agent-ou
Expand Down
5 changes: 5 additions & 0 deletions charts/crowdsec/templates/tls/bouncer-certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ spec:
reflector.v1.k8s.emberstack.com/reflection-auto-enabled: "true"
{{ end }}
issuerRef:
{{ if .Values.tls.certManager.issuerRef }}
name: {{ .Values.tls.certManager.issuerRef.name }}
kind: {{ default "Issuer" .Values.tls.certManager.issuerRef.kind }}
{{ else }}
name: {{ .Release.Name }}-ca-issuer
{{ end }}
subject:
organizationalUnits:
- bouncer-ou
Expand Down
2 changes: 1 addition & 1 deletion charts/crowdsec/templates/tls/ca-certificate.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# vim: set ft=gotmpl:
---
{{ if and (.Values.tls.enabled) (.Values.tls.certManager.enabled) }}
{{ if and (.Values.tls.enabled) (.Values.tls.certManager.enabled) (not .Values.tls.certManager.issuerRef) }}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
Expand Down
2 changes: 1 addition & 1 deletion charts/crowdsec/templates/tls/ca-issuer.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# vim: set ft=gotmpl:
---
{{ if and (.Values.tls.enabled) (.Values.tls.certManager.enabled) }}
{{ if and (.Values.tls.enabled) (.Values.tls.certManager.enabled) (not .Values.tls.certManager.issuerRef) }}
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
Expand Down
2 changes: 1 addition & 1 deletion charts/crowdsec/templates/tls/crowdsec-clusterIssuer.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# vim: set ft=gotmpl:
---
{{ if and (.Values.tls.enabled) (.Values.tls.certManager.enabled) }}
{{ if and (.Values.tls.enabled) (.Values.tls.certManager.enabled) (not .Values.tls.certManager.issuerRef) }}
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
Expand Down
5 changes: 5 additions & 0 deletions charts/crowdsec/templates/tls/lapi-certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ spec:
- localhost
secretName: {{ .Release.Name }}-lapi-tls
issuerRef:
{{ if .Values.tls.certManager.issuerRef }}
name: {{ .Values.tls.certManager.issuerRef.name }}
kind: {{ default "Issuer" .Values.tls.certManager.issuerRef.kind }}
{{ else }}
name: {{ .Release.Name }}-ca-issuer
{{ end }}
{{ end }}
4 changes: 4 additions & 0 deletions charts/crowdsec/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ tls:
insecureSkipVerify: false
certManager:
enabled: true
# -- Use existing issuer to sign certificates. Leave empty to generate a self-signed issuer
issuerRef: {}
# name: ""
# kind: "ClusterIssuer"
bouncer:
secret: "{{ .Release.Name }}-bouncer-tls"
reflector:
Expand Down

0 comments on commit 9f75ac6

Please sign in to comment.