feat: Add option to keep CRDs when helm chart is uninstalled

Signed-off-by: Jason Witkowski <jwitko1@gmail.com>
This commit is contained in:
Jason Witkowski 2023-02-20 10:08:20 -05:00 committed by Tim Ramlot
parent 57de0fc4d2
commit a6f665353f
No known key found for this signature in database
GPG Key ID: 47428728E0C2878D
9 changed files with 45 additions and 3 deletions

View File

@ -170,7 +170,17 @@ The duration the clients should wait between attempting acquisition and renewal
> false
> ```
Install the cert-manager CRDs, it is recommended to not use Helm to manage the CRDs.
This method of CRDs installation will be deprecated in future releases. It is mutually exclusive with crds.install and crds.keep=true
#### **crds.install** ~ `bool`
> Default value:
> ```yaml
> false
> ```
#### **crds.keep** ~ `bool`
> Default value:
> ```yaml
> false
> ```
### Controller
#### **replicaCount** ~ `number`

View File

@ -0,0 +1,9 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "cert-manager.preflight" -}}
{{- if and (.Values.installCRDs) (or (.Values.crds.install) (.Values.crds.keep)) }}
{{- fail "ERROR: Cannot set both .Values.installCRDs and .Values.crds.install" }}
{{- end }}
{{- end -}}

View File

@ -67,10 +67,14 @@ global:
# +docs:property
# retryPeriod: 15s
# Install the cert-manager CRDs, it is recommended to not use Helm to manage
# the CRDs.
# This method of CRDs installation will be deprecated in future releases
# It is mutually exclusive with crds.install and crds.keep=true
installCRDs: false
crds:
install: false
keep: false
# +docs:section=Controller
# The number of replicas of the cert-manager controller to run.

View File

@ -3,6 +3,9 @@ kind: CustomResourceDefinition
metadata:
name: certificaterequests.cert-manager.io
labels:
{{- if .Values.crds.keep }}
"helm.sh/resource-policy": keep
{{- end }}
app: '{{ template "cert-manager.name" . }}'
app.kubernetes.io/name: '{{ template "cert-manager.name" . }}'
app.kubernetes.io/instance: '{{ .Release.Name }}'

View File

@ -3,6 +3,9 @@ kind: CustomResourceDefinition
metadata:
name: certificates.cert-manager.io
labels:
{{- if .Values.crds.keep }}
"helm.sh/resource-policy": keep
{{- end }}
app: '{{ template "cert-manager.name" . }}'
app.kubernetes.io/name: '{{ template "cert-manager.name" . }}'
app.kubernetes.io/instance: '{{ .Release.Name }}'

View File

@ -3,6 +3,9 @@ kind: CustomResourceDefinition
metadata:
name: challenges.acme.cert-manager.io
labels:
{{- if .Values.crds.keep }}
"helm.sh/resource-policy": keep
{{- end }}
app: '{{ template "cert-manager.name" . }}'
app.kubernetes.io/name: '{{ template "cert-manager.name" . }}'
app.kubernetes.io/instance: '{{ .Release.Name }}'

View File

@ -1,8 +1,12 @@
{{- include "cert-manager.preflight" . }}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clusterissuers.cert-manager.io
labels:
{{- if .Values.crds.keep }}
"helm.sh/resource-policy": keep
{{- end }}
app: '{{ template "cert-manager.name" . }}'
app.kubernetes.io/name: '{{ template "cert-manager.name" . }}'
app.kubernetes.io/instance: "{{ .Release.Name }}"

View File

@ -3,6 +3,9 @@ kind: CustomResourceDefinition
metadata:
name: issuers.cert-manager.io
labels:
{{- if .Values.crds.keep }}
"helm.sh/resource-policy": keep
{{- end }}
app: '{{ template "cert-manager.name" . }}'
app.kubernetes.io/name: '{{ template "cert-manager.name" . }}'
app.kubernetes.io/instance: "{{ .Release.Name }}"

View File

@ -3,6 +3,9 @@ kind: CustomResourceDefinition
metadata:
name: orders.acme.cert-manager.io
labels:
{{- if .Values.crds.keep }}
"helm.sh/resource-policy": keep
{{- end }}
app: '{{ template "cert-manager.name" . }}'
app.kubernetes.io/name: '{{ template "cert-manager.name" . }}'
app.kubernetes.io/instance: '{{ .Release.Name }}'