2
2
{{- $ca := genCA "psc-autoscaler-ca" 1825 -}}
3
3
{{- $cert := genSignedCert ( include "psc-autoscaler.fullname" . ) nil $altNames 1825 $ca -}}
4
4
---
5
+ {{- if not .Values.admission.certManager.enabled }}
5
6
apiVersion : v1
6
7
kind : Secret
7
8
type : kubernetes.io/tls
24
25
tls.crt : {{ $cert.Cert | b64enc }}
25
26
tls.key : {{ $cert.Key | b64enc }}
26
27
{{- end }}
27
-
28
+ {{- end }}
28
29
---
29
30
apiVersion : admissionregistration.k8s.io/v1
30
31
kind : MutatingWebhookConfiguration
@@ -35,10 +36,16 @@ metadata:
35
36
{{- if .Values.additionalLabels }}
36
37
{{- toYaml .Values.additionalLabels | nindent 4 }}
37
38
{{- end }}
38
- {{- with .Values.admission.annotations }}
39
+ {{- $hasAnnotations := .Values.admission.annotations }}
40
+ {{- if or $hasAnnotations .Values.admission.certManager.enabled }}
39
41
annotations :
42
+ {{- with $hasAnnotations }}
40
43
{{- toYaml . | nindent 4 }}
41
- {{- end }}
44
+ {{- end }}
45
+ {{- if .Values.admission.certManager.enabled }}
46
+ cert-manager.io/inject-ca-from : {{ .Release.Namespace }}/{{ include "psc-autoscaler.fullname" . }}-ca
47
+ {{- end }}
48
+ {{- end }}
42
49
webhooks :
43
50
- name : pods.perfectscale.io
44
51
{{- if and (.Values.settings.excludedNamespaces) (ne (.Values.settings.excludedNamespaces | toString) "[]") }}
@@ -55,11 +62,15 @@ webhooks:
55
62
resources : [ "pods" ]
56
63
scope : " Namespaced"
57
64
clientConfig :
58
- {{- if .Values.admission.staticCerts.enabled }}
65
+ {{- if not .Values.admission.certManager.enabled }}
66
+ {{- if .Values.admission.externalCertSecret.enabled }}
67
+ caBundle : {{ .Values.admission.externalCertSecret.caCert }}
68
+ {{- else if .Values.admission.staticCerts.enabled }}
59
69
caBundle : {{ .Values.admission.staticCerts.caCert }}
60
- {{- else }}
70
+ {{- else }}
61
71
caBundle : {{ $ca.Cert | b64enc }}
62
- {{- end }}
72
+ {{- end }}
73
+ {{- end }}
63
74
service :
64
75
namespace : {{ .Release.Namespace }}
65
76
name : {{ include "psc-autoscaler.fullname" . }}
@@ -79,10 +90,16 @@ metadata:
79
90
{{- if .Values.additionalLabels }}
80
91
{{- toYaml .Values.additionalLabels | nindent 4 }}
81
92
{{- end }}
82
- {{- with .Values.admission.annotations }}
93
+ {{- $hasAnnotations := .Values.admission.annotations }}
94
+ {{- if or $hasAnnotations .Values.admission.certManager.enabled }}
83
95
annotations :
96
+ {{- with $hasAnnotations }}
84
97
{{- toYaml . | nindent 4 }}
85
- {{- end }}
98
+ {{- end }}
99
+ {{- if .Values.admission.certManager.enabled }}
100
+ cert-manager.io/inject-ca-from : {{ .Release.Namespace }}/{{ include "psc-autoscaler.fullname" . }}-ca
101
+ {{- end }}
102
+ {{- end }}
86
103
webhooks :
87
104
- name : configs.perfectscale.io
88
105
rules :
@@ -97,11 +114,15 @@ webhooks:
97
114
resources : [ "namespaceautomationconfigs", "workloadautomationconfigs" ]
98
115
scope : " Namespaced"
99
116
clientConfig :
100
- {{- if .Values.admission.staticCerts.enabled }}
117
+ {{- if not .Values.admission.certManager.enabled }}
118
+ {{- if .Values.admission.externalCertSecret.enabled }}
119
+ caBundle : {{ .Values.admission.externalCertSecret.caCert }}
120
+ {{- else if .Values.admission.staticCerts.enabled }}
101
121
caBundle : {{ .Values.admission.staticCerts.caCert }}
102
- {{- else }}
122
+ {{- else }}
103
123
caBundle : {{ $ca.Cert | b64enc }}
104
- {{- end }}
124
+ {{- end }}
125
+ {{- end }}
105
126
service :
106
127
namespace : {{ .Release.Namespace }}
107
128
name : {{ include "psc-autoscaler.fullname" . }}
0 commit comments