| Giorgi Lekveishvili | ae1a4a4 | 2023-12-07 13:23:17 +0400 | [diff] [blame^] | 1 | --- |
| 2 | # Create a selfsigned Issuer, in order to create a root CA certificate for |
| 3 | # signing webhook serving certificates |
| 4 | apiVersion: cert-manager.io/v1 |
| 5 | kind: Issuer |
| 6 | metadata: |
| 7 | name: {{ include "cert-manager-webhook-pcloud.selfSignedIssuer" . }} |
| 8 | namespace: {{ .Values.certManager.namespace | quote }} |
| 9 | labels: |
| 10 | app: {{ include "cert-manager-webhook-pcloud.name" . }} |
| 11 | chart: {{ include "cert-manager-webhook-pcloud.chart" . }} |
| 12 | release: {{ .Release.Name }} |
| 13 | heritage: {{ .Release.Service }} |
| 14 | spec: |
| 15 | selfSigned: {} |
| 16 | --- |
| 17 | # Generate a CA Certificate used to sign certificates for the webhook |
| 18 | apiVersion: cert-manager.io/v1 |
| 19 | kind: Certificate |
| 20 | metadata: |
| 21 | name: {{ include "cert-manager-webhook-pcloud.rootCACertificate" . }} |
| 22 | namespace: {{ .Values.certManager.namespace | quote }} |
| 23 | labels: |
| 24 | app: {{ include "cert-manager-webhook-pcloud.name" . }} |
| 25 | chart: {{ include "cert-manager-webhook-pcloud.chart" . }} |
| 26 | release: {{ .Release.Name }} |
| 27 | heritage: {{ .Release.Service }} |
| 28 | spec: |
| 29 | secretName: {{ include "cert-manager-webhook-pcloud.rootCACertificate" . }} |
| 30 | duration: 43800h # 5y |
| 31 | issuerRef: |
| 32 | name: {{ include "cert-manager-webhook-pcloud.selfSignedIssuer" . }} |
| 33 | commonName: "ca.cert-manager-webhook-pcloud.cert-manager" |
| 34 | isCA: true |
| 35 | --- |
| 36 | # Create an Issuer that uses the above generated CA certificate to issue certs |
| 37 | apiVersion: cert-manager.io/v1 |
| 38 | kind: Issuer |
| 39 | metadata: |
| 40 | name: {{ include "cert-manager-webhook-pcloud.rootCAIssuer" . }} |
| 41 | namespace: {{ .Values.certManager.namespace | quote }} |
| 42 | labels: |
| 43 | app: {{ include "cert-manager-webhook-pcloud.name" . }} |
| 44 | chart: {{ include "cert-manager-webhook-pcloud.chart" . }} |
| 45 | release: {{ .Release.Name }} |
| 46 | heritage: {{ .Release.Service }} |
| 47 | spec: |
| 48 | ca: |
| 49 | secretName: {{ include "cert-manager-webhook-pcloud.rootCACertificate" . }} |
| 50 | --- |
| 51 | # Finally, generate a serving certificate for the webhook to use |
| 52 | apiVersion: cert-manager.io/v1 |
| 53 | kind: Certificate |
| 54 | metadata: |
| 55 | name: {{ include "cert-manager-webhook-pcloud.servingCertificate" . }} |
| 56 | namespace: {{ .Values.certManager.namespace | quote }} |
| 57 | labels: |
| 58 | app: {{ include "cert-manager-webhook-pcloud.name" . }} |
| 59 | chart: {{ include "cert-manager-webhook-pcloud.chart" . }} |
| 60 | release: {{ .Release.Name }} |
| 61 | heritage: {{ .Release.Service }} |
| 62 | spec: |
| 63 | secretName: {{ include "cert-manager-webhook-pcloud.servingCertificate" . }} |
| 64 | duration: 8760h # 1y |
| 65 | issuerRef: |
| 66 | name: {{ include "cert-manager-webhook-pcloud.rootCAIssuer" . }} |
| 67 | dnsNames: |
| 68 | - {{ include "cert-manager-webhook-pcloud.fullname" . }} |
| 69 | - {{ include "cert-manager-webhook-pcloud.fullname" . }}.{{ .Values.certManager.namespace }} |
| 70 | - {{ include "cert-manager-webhook-pcloud.fullname" . }}.{{ .Values.certManager.namespace }}.svc |