Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(helm): Allow external TLS provider for webhook #420

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deploy/charts/trust-manager/templates/certificate.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if not .Values.app.webhook.tls.helmCert.enabled -}}
{{- if .Values.app.webhook.tls.certManager.enabled -}}
Copy link
Contributor

@erikgb erikgb Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears like a breaking change. Is it intentional? If possible, I think we should still support the app.webhook.tls.helmCert.enabled Helm value.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the app.webhook.tls.helmCert.enabled still works, but for for existing installation, the app.webhook.tls.certManager.enabled var would have to be set to false, which indeed is a breaking change.

Should we have instead a app.webhook.tls.externalProvider.enabled=false var that when enabled, disables the cert-manager certficates creation ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this will work, but could it be an option to add a new optional Helm value to set the name of the webhook certificate secret? And when user sets this value, all use of cert-manager or Helm to generate a webhook certificate is turned off?


apiVersion: cert-manager.io/v1
kind: Issuer
Expand Down
15 changes: 12 additions & 3 deletions deploy/charts/trust-manager/templates/webhook.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if and .Values.app.webhook.tls.helmCert.enabled .Values.app.webhook.tls.approverPolicy.enabled -}}
{{- fail "cannot set .app.webhook.tls.helmCert.enabled and .Values.app.webhook.tls.approverPolicy.enabled" }}
{{- if and .Values.app.webhook.tls.helmCert.enabled .Values.app.webhook.tls.certManager.enabled -}}
{{- fail "cannot set .app.webhook.tls.helmCert.enabled and .Values.app.webhook.tls.certManager.enabled" }}
{{- end -}}

{{- /*
Expand Down Expand Up @@ -55,6 +55,10 @@ metadata:
labels:
app: {{ include "trust-manager.name" . }}
{{- include "trust-manager.labels" . | nindent 4 }}
{{- if .Values.app.webhook.service.annotations }}
annotations:
{{- tpl (toYaml .Values.app.webhook.service.annotations) . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.app.webhook.service.type }}
{{- if .Values.app.webhook.service.ipFamilyPolicy }}
Expand Down Expand Up @@ -83,10 +87,15 @@ metadata:
labels:
app: {{ include "trust-manager.name" . }}
{{- include "trust-manager.labels" . | nindent 4 }}
{{ if not .Values.app.webhook.tls.helmCert.enabled }}
{{ if or .Values.app.webhook.tls.certManager.enabled .Values.app.webhook.annotations }}
annotations:
{{- if .Values.app.webhook.tls.certManager.enabled }}
cert-manager.io/inject-ca-from: "{{ include "trust-manager.namespace" . }}/{{ include "trust-manager.name" . }}"
{{ end }}
{{- if .Values.app.webhook.annotations }}
{{- tpl (toYaml .Values.app.webhook.annotations) . | nindent 4 }}
{{- end }}
{{- end }}

webhooks:
- name: trust.cert-manager.io
Expand Down
Loading