From e30ad68ab25f62422ff2d34d57a9f06055cccd8a Mon Sep 17 00:00:00 2001 From: Adam Talbot Date: Tue, 25 Jun 2024 11:14:30 +0100 Subject: [PATCH] feat: default ControllerConfiguration apiVersion and kind in helm Signed-off-by: Adam Talbot --- deploy/charts/cert-manager/README.template.md | 15 +++++++++------ .../templates/cainjector-config.yaml | 7 ++++--- .../templates/controller-config.yaml | 7 ++++--- .../cert-manager/templates/webhook-config.yaml | 7 ++++--- deploy/charts/cert-manager/values.schema.json | 6 +++--- deploy/charts/cert-manager/values.yaml | 18 ++++++++++++------ 6 files changed, 36 insertions(+), 24 deletions(-) diff --git a/deploy/charts/cert-manager/README.template.md b/deploy/charts/cert-manager/README.template.md index 5a0af82d2..3cfd64b45 100644 --- a/deploy/charts/cert-manager/README.template.md +++ b/deploy/charts/cert-manager/README.template.md @@ -344,8 +344,9 @@ When this flag is enabled, secrets will be automatically removed when the certif > {} > ``` -This property is used to configure options for the controller pod. This allows setting options that would usually be provided using flags. An APIVersion and Kind must be specified in your values.yaml file. -Flags will override options that are set here. +This property is used to configure options for the controller pod. This allows setting options that would usually be provided using flags. + +If `apiVersion` and `kind` are unspecified they default to the current latest version (currently `controller.config.cert-manager.io/v1alpha1`). You can pin the version by specifying the `apiVersion` yourself. For example: @@ -860,8 +861,9 @@ The default is set to the maximum value of 30 seconds as users sometimes report > {} > ``` -This is used to configure options for the webhook pod. This allows setting options that would usually be provided using flags. An APIVersion and Kind must be specified in your values.yaml file. -Flags override options that are set here. +This is used to configure options for the webhook pod. This allows setting options that would usually be provided using flags. + +If `apiVersion` and `kind` are unspecified they default to the current latest version (currently `webhook.config.cert-manager.io/v1alpha1`). You can pin the version by specifying the `apiVersion` yourself. For example: @@ -1310,8 +1312,9 @@ Note that cert-manager uses leader election to ensure that there can only be a s > {} > ``` -This is used to configure options for the cainjector pod. It allows setting options that are usually provided via flags. An APIVersion and Kind must be specified in your values.yaml file. -Flags override options that are set here. +This is used to configure options for the cainjector pod. It allows setting options that are usually provided via flags. + +If `apiVersion` and `kind` are unspecified they default to the current latest version (currently `cainjector.config.cert-manager.io/v1alpha1`). You can pin the version by specifying the `apiVersion` yourself. For example: diff --git a/deploy/charts/cert-manager/templates/cainjector-config.yaml b/deploy/charts/cert-manager/templates/cainjector-config.yaml index 82399cc1a..994cfa347 100644 --- a/deploy/charts/cert-manager/templates/cainjector-config.yaml +++ b/deploy/charts/cert-manager/templates/cainjector-config.yaml @@ -1,6 +1,7 @@ {{- if .Values.cainjector.config -}} -{{- $_ := .Values.cainjector.config.apiVersion | required ".Values.cainjector.config.apiVersion must be set !" -}} -{{- $_ := .Values.cainjector.config.kind | required ".Values.cainjector.config.kind must be set !" -}} +{{- $config := .Values.cainjector.config -}} +{{- $_ := set $config "apiVersion" (default "cainjector.config.cert-manager.io/v1alpha1" $config.apiVersion) -}} +{{- $_ := set $config "kind" (default "CAInjectorConfiguration" $config.kind) -}} apiVersion: v1 kind: ConfigMap metadata: @@ -14,5 +15,5 @@ metadata: {{- include "labels" . | nindent 4 }} data: config.yaml: | - {{- .Values.cainjector.config | toYaml | nindent 4 }} + {{- $config | toYaml | nindent 4 }} {{- end -}} \ No newline at end of file diff --git a/deploy/charts/cert-manager/templates/controller-config.yaml b/deploy/charts/cert-manager/templates/controller-config.yaml index 25f62ef1d..46d2cc247 100644 --- a/deploy/charts/cert-manager/templates/controller-config.yaml +++ b/deploy/charts/cert-manager/templates/controller-config.yaml @@ -1,6 +1,7 @@ {{- if .Values.config -}} -{{- $_ := .Values.config.apiVersion | required ".Values.config.apiVersion must be set !" -}} -{{- $_ := .Values.config.kind | required ".Values.config.kind must be set !" -}} +{{- $config := .Values.config -}} +{{- $_ := set $config "apiVersion" (default "controller.config.cert-manager.io/v1alpha1" $config.apiVersion) -}} +{{- $_ := set $config "kind" (default "ControllerConfiguration" $config.kind) -}} apiVersion: v1 kind: ConfigMap metadata: @@ -14,5 +15,5 @@ metadata: {{- include "labels" . | nindent 4 }} data: config.yaml: | - {{- .Values.config | toYaml | nindent 4 }} + {{- $config | toYaml | nindent 4 }} {{- end -}} \ No newline at end of file diff --git a/deploy/charts/cert-manager/templates/webhook-config.yaml b/deploy/charts/cert-manager/templates/webhook-config.yaml index 8f3ce20c3..cd8b67f55 100644 --- a/deploy/charts/cert-manager/templates/webhook-config.yaml +++ b/deploy/charts/cert-manager/templates/webhook-config.yaml @@ -1,6 +1,7 @@ {{- if .Values.webhook.config -}} -{{- $_ := .Values.webhook.config.apiVersion | required ".Values.webhook.config.apiVersion must be set !" -}} -{{- $_ := .Values.webhook.config.kind | required ".Values.webhook.config.kind must be set !" -}} +{{- $config := .Values.webhook.config -}} +{{- $_ := set $config "apiVersion" (default "webhook.config.cert-manager.io/v1alpha1" $config.apiVersion) -}} +{{- $_ := set $config "kind" (default "WebhookConfiguration" $config.kind) -}} apiVersion: v1 kind: ConfigMap metadata: @@ -14,5 +15,5 @@ metadata: {{- include "labels" . | nindent 4 }} data: config.yaml: | - {{- .Values.webhook.config | toYaml | nindent 4 }} + {{- $config | toYaml | nindent 4 }} {{- end -}} \ No newline at end of file diff --git a/deploy/charts/cert-manager/values.schema.json b/deploy/charts/cert-manager/values.schema.json index bcb501efe..9eb0499a7 100644 --- a/deploy/charts/cert-manager/values.schema.json +++ b/deploy/charts/cert-manager/values.schema.json @@ -327,7 +327,7 @@ }, "helm-values.cainjector.config": { "default": {}, - "description": "This is used to configure options for the cainjector pod. It allows setting options that are usually provided via flags. An APIVersion and Kind must be specified in your values.yaml file.\nFlags override options that are set here.\n\nFor example:\napiVersion: cainjector.config.cert-manager.io/v1alpha1\nkind: CAInjectorConfiguration\nlogging:\n verbosity: 2\n format: text\nleaderElectionConfig:\n namespace: kube-system", + "description": "This is used to configure options for the cainjector pod. It allows setting options that are usually provided via flags.\n\nIf `apiVersion` and `kind` are unspecified they default to the current latest version (currently `cainjector.config.cert-manager.io/v1alpha1`). You can pin the version by specifying the `apiVersion` yourself.\n\nFor example:\napiVersion: cainjector.config.cert-manager.io/v1alpha1\nkind: CAInjectorConfiguration\nlogging:\n verbosity: 2\n format: text\nleaderElectionConfig:\n namespace: kube-system", "type": "object" }, "helm-values.cainjector.containerSecurityContext": { @@ -554,7 +554,7 @@ }, "helm-values.config": { "default": {}, - "description": "This property is used to configure options for the controller pod. This allows setting options that would usually be provided using flags. An APIVersion and Kind must be specified in your values.yaml file.\nFlags will override options that are set here.\n\nFor example:\nconfig:\n apiVersion: controller.config.cert-manager.io/v1alpha1\n kind: ControllerConfiguration\n logging:\n verbosity: 2\n format: text\n leaderElectionConfig:\n namespace: kube-system\n kubernetesAPIQPS: 9000\n kubernetesAPIBurst: 9000\n numberOfConcurrentWorkers: 200\n featureGates:\n AdditionalCertificateOutputFormats: true\n DisallowInsecureCSRUsageDefinition: true\n ExperimentalCertificateSigningRequestControllers: true\n ExperimentalGatewayAPISupport: true\n LiteralCertificateSubject: true\n SecretsFilteredCaching: true\n ServerSideApply: true\n StableCertificateRequestName: true\n UseCertificateRequestBasicConstraints: true\n ValidateCAA: true\n metricsTLSConfig:\n dynamic:\n secretNamespace: \"cert-manager\"\n secretName: \"cert-manager-metrics-ca\"\n dnsNames:\n - cert-manager-metrics\n - cert-manager-metrics.cert-manager\n - cert-manager-metrics.cert-manager.svc", + "description": "This property is used to configure options for the controller pod. This allows setting options that would usually be provided using flags.\n\nIf `apiVersion` and `kind` are unspecified they default to the current latest version (currently `controller.config.cert-manager.io/v1alpha1`). You can pin the version by specifying the `apiVersion` yourself.\n\nFor example:\nconfig:\n apiVersion: controller.config.cert-manager.io/v1alpha1\n kind: ControllerConfiguration\n logging:\n verbosity: 2\n format: text\n leaderElectionConfig:\n namespace: kube-system\n kubernetesAPIQPS: 9000\n kubernetesAPIBurst: 9000\n numberOfConcurrentWorkers: 200\n featureGates:\n AdditionalCertificateOutputFormats: true\n DisallowInsecureCSRUsageDefinition: true\n ExperimentalCertificateSigningRequestControllers: true\n ExperimentalGatewayAPISupport: true\n LiteralCertificateSubject: true\n SecretsFilteredCaching: true\n ServerSideApply: true\n StableCertificateRequestName: true\n UseCertificateRequestBasicConstraints: true\n ValidateCAA: true\n metricsTLSConfig:\n dynamic:\n secretNamespace: \"cert-manager\"\n secretName: \"cert-manager-metrics-ca\"\n dnsNames:\n - cert-manager-metrics\n - cert-manager-metrics.cert-manager\n - cert-manager-metrics.cert-manager.svc", "type": "object" }, "helm-values.containerSecurityContext": { @@ -1683,7 +1683,7 @@ }, "helm-values.webhook.config": { "default": {}, - "description": "This is used to configure options for the webhook pod. This allows setting options that would usually be provided using flags. An APIVersion and Kind must be specified in your values.yaml file.\nFlags override options that are set here.\n\nFor example:\napiVersion: webhook.config.cert-manager.io/v1alpha1\nkind: WebhookConfiguration\n# The port that the webhook listens on for requests.\n# In GKE private clusters, by default Kubernetes apiservers are allowed to\n# talk to the cluster nodes only on 443 and 10250. Configuring\n# securePort: 10250 therefore will work out-of-the-box without needing to add firewall\n# rules or requiring NET_BIND_SERVICE capabilities to bind port numbers < 1000.\n# This should be uncommented and set as a default by the chart once\n# the apiVersion of WebhookConfiguration graduates beyond v1alpha1.\nsecurePort: 10250", + "description": "This is used to configure options for the webhook pod. This allows setting options that would usually be provided using flags.\n\nIf `apiVersion` and `kind` are unspecified they default to the current latest version (currently `webhook.config.cert-manager.io/v1alpha1`). You can pin the version by specifying the `apiVersion` yourself.\n\nFor example:\napiVersion: webhook.config.cert-manager.io/v1alpha1\nkind: WebhookConfiguration\n# The port that the webhook listens on for requests.\n# In GKE private clusters, by default Kubernetes apiservers are allowed to\n# talk to the cluster nodes only on 443 and 10250. Configuring\n# securePort: 10250 therefore will work out-of-the-box without needing to add firewall\n# rules or requiring NET_BIND_SERVICE capabilities to bind port numbers < 1000.\n# This should be uncommented and set as a default by the chart once\n# the apiVersion of WebhookConfiguration graduates beyond v1alpha1.\nsecurePort: 10250", "type": "object" }, "helm-values.webhook.containerSecurityContext": { diff --git a/deploy/charts/cert-manager/values.yaml b/deploy/charts/cert-manager/values.yaml index 1c4033e6e..7b23b4449 100644 --- a/deploy/charts/cert-manager/values.yaml +++ b/deploy/charts/cert-manager/values.yaml @@ -208,8 +208,10 @@ enableCertificateOwnerRef: false # This property is used to configure options for the controller pod. # This allows setting options that would usually be provided using flags. -# An APIVersion and Kind must be specified in your values.yaml file. -# Flags will override options that are set here. +# +# If `apiVersion` and `kind` are unspecified they default to the current latest +# version (currently `controller.config.cert-manager.io/v1alpha1`). You can pin +# the version by specifying the `apiVersion` yourself. # # For example: # config: @@ -614,8 +616,10 @@ webhook: # This is used to configure options for the webhook pod. # This allows setting options that would usually be provided using flags. - # An APIVersion and Kind must be specified in your values.yaml file. - # Flags override options that are set here. + # + # If `apiVersion` and `kind` are unspecified they default to the current latest + # version (currently `webhook.config.cert-manager.io/v1alpha1`). You can pin + # the version by specifying the `apiVersion` yourself. # # For example: # apiVersion: webhook.config.cert-manager.io/v1alpha1 @@ -965,8 +969,10 @@ cainjector: # This is used to configure options for the cainjector pod. # It allows setting options that are usually provided via flags. - # An APIVersion and Kind must be specified in your values.yaml file. - # Flags override options that are set here. + # + # If `apiVersion` and `kind` are unspecified they default to the current latest + # version (currently `cainjector.config.cert-manager.io/v1alpha1`). You can pin + # the version by specifying the `apiVersion` yourself. # # For example: # apiVersion: cainjector.config.cert-manager.io/v1alpha1