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

Adding support for cert-manager certificates to manage webhook TLS. #1567

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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 charts/spark-operator-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: spark-operator
description: A Helm chart for Spark on Kubernetes operator
version: 1.1.25
version: 1.1.26
appVersion: v1beta2-1.3.7-3.1.1
keywords:
- spark
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- $webhookSvc := printf "%s-webhook.%s" (include "spark-operator.fullname" .) .Release.Namespace -}}
{{- if and .Values.webhook.enable .Values.webhook.certManager.enable }}
apiVersion: cert-manager.io/v1alpha3
kind: Certificate
metadata:
name: {{ include "spark-operator.fullname" . }}-webhook-cert
labels:
{{- include "spark-operator.labels" . | nindent 4 }}
spec:
dnsNames:
- {{ $webhookSvc }}.svc
- {{ $webhookSvc }}.svc.cluster.local
duration: 87600h0m0s
{{- if .Values.webhook.certManager.issuerRef }}
issuerRef: {{ toYaml .Values.webhook.certManager.issuerRef | nindent 4 }}
{{- else }}
{{ fail "webhook.certManager.issuerRef is required when certManager is enabled"}}
{{- end }}
renewBefore: {{ .Values.webhook.certManager.expiration }}
secretName: {{ include "spark-operator.fullname" . }}-webhook-certs
subject:
organizationalUnits:
- {{ include "spark-operator.fullname" . }}
usages:
# All Server TLS certs need to be created with "server auth" usage!
- server auth
- client auth
{{- end }}
5 changes: 5 additions & 0 deletions charts/spark-operator-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ spec:
- -webhook-svc-name={{ include "spark-operator.fullname" . }}-webhook
- -webhook-config-name={{ include "spark-operator.fullname" . }}-webhook-config
- -webhook-namespace-selector={{ .Values.webhook.namespaceSelector }}
{{- if .Values.webhook.certManager.enable }}
- -webhook-server-cert=/etc/webhook-certs/tls.crt
- -webhook-server-cert-key=/etc/webhook-certs/tls.key
- -webhook-ca-cert=/etc/webhook-certs/ca.crt
{{- end }}
{{- end }}
- -enable-resource-quota-enforcement={{ .Values.resourceQuotaEnforcement.enable }}
{{- if gt (int .Values.replicaCount) 1 }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ if .Values.webhook.enable }}
{{ if not .Values.webhook.certManager }}
apiVersion: batch/v1
kind: Job
metadata:
Expand Down Expand Up @@ -54,3 +55,4 @@ spec:
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions charts/spark-operator-chart/templates/webhook-init-job.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ if .Values.webhook.enable }}
{{ if not .Values.webhook.certManager }}
apiVersion: batch/v1
kind: Job
metadata:
Expand Down Expand Up @@ -44,3 +45,4 @@ spec:
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
8 changes: 8 additions & 0 deletions charts/spark-operator-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ webhook:
"helm.sh/hook-delete-policy": hook-succeeded
# -- Webhook Timeout in seconds
timeout: 30
# certManager, uses cert-manager to handle self-signed certificates
# `issuerRef` is required
certManager:
enable: false
expiration: 720h0m0s
issuerRef: {}
# name: selfsigned
# kind: ClusterIssuer

metrics:
# -- Enable prometheus metric scraping
Expand Down