Skip to content

Chart: Add controller.admissionWebhooks.certManager.*.revisionHistoryLimit. #12906

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

Merged
merged 18 commits into from
Mar 3, 2025
Merged
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: 2 additions & 0 deletions charts/ingress-nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,10 @@ metadata:
| controller.addHeaders | object | `{}` | Will add custom headers before sending response traffic to the client according to: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#add-headers |
| controller.admissionWebhooks.annotations | object | `{}` | |
| controller.admissionWebhooks.certManager.admissionCert.duration | string | `""` | |
| controller.admissionWebhooks.certManager.admissionCert.revisionHistoryLimit | int | `0` | Revision history limit of the webhook certificate. Ref.: https://cert-manager.io/docs/reference/api-docs/#cert-manager.io/v1.CertificateSpec |
| controller.admissionWebhooks.certManager.enabled | bool | `false` | |
| controller.admissionWebhooks.certManager.rootCert.duration | string | `""` | |
| controller.admissionWebhooks.certManager.rootCert.revisionHistoryLimit | int | `0` | Revision history limit of the root certificate. Ref.: https://cert-manager.io/docs/reference/api-docs/#cert-manager.io/v1.CertificateSpec |
| controller.admissionWebhooks.certificate | string | `"/usr/local/certificates/cert"` | |
| controller.admissionWebhooks.createSecretJob.name | string | `"create"` | |
| controller.admissionWebhooks.createSecretJob.resources | object | `{}` | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ metadata:
spec:
secretName: {{ include "ingress-nginx.fullname" . }}-root-cert
duration: {{ .Values.controller.admissionWebhooks.certManager.rootCert.duration | default "43800h0m0s" | quote }}
{{- if gt (.Values.controller.admissionWebhooks.certManager.rootCert.revisionHistoryLimit | int) 0 }}
revisionHistoryLimit: {{ .Values.controller.admissionWebhooks.certManager.rootCert.revisionHistoryLimit }}
{{- end }}
issuerRef:
name: {{ include "ingress-nginx.fullname" . }}-self-signed-issuer
commonName: "ca.webhook.ingress-nginx"
Expand Down Expand Up @@ -47,6 +50,9 @@ metadata:
spec:
secretName: {{ include "ingress-nginx.admissionWebhooks.fullname" . }}
duration: {{ .Values.controller.admissionWebhooks.certManager.admissionCert.duration | default "8760h0m0s" | quote }}
{{- if gt (.Values.controller.admissionWebhooks.certManager.admissionCert.revisionHistoryLimit | int) 0 }}
revisionHistoryLimit: {{ .Values.controller.admissionWebhooks.certManager.admissionCert.revisionHistoryLimit }}
{{- end }}
issuerRef:
{{- if .Values.controller.admissionWebhooks.certManager.issuerRef }}
{{- toYaml .Values.controller.admissionWebhooks.certManager.issuerRef | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
suite: Admission Webhooks > CertManager
templates:
- admission-webhooks/cert-manager.yaml

tests:
- it: should not create a Certificate if `controller.admissionWebhooks.certManager.enabled` is false
set:
controller.admissionWebhooks.certManager.enabled: false
asserts:
- hasDocuments:
count: 0

- it: should create a Certificate if `controller.admissionWebhooks.certManager.enabled` is true
set:
controller.admissionWebhooks.certManager.enabled: true
controller.admissionWebhooks.certManager.issuerRef: ingress-nginx-issuer
asserts:
- hasDocuments:
count: 1
- isKind:
of: Certificate
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-admission

- it: should create a Certificate with `revisionHistoryLimit` if `controller.admissionWebhooks.certManager.admissionCert.revisionHistoryLimit` is set
set:
controller.admissionWebhooks.certManager.enabled: true
controller.admissionWebhooks.certManager.issuerRef: ingress-nginx-issuer
controller.admissionWebhooks.certManager.admissionCert.revisionHistoryLimit: 3
asserts:
- equal:
path: spec.revisionHistoryLimit
value: 3
6 changes: 6 additions & 0 deletions charts/ingress-nginx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -853,9 +853,15 @@ controller:
rootCert:
# default to be 5y
duration: ""
# -- Revision history limit of the root certificate.
# Ref.: https://cert-manager.io/docs/reference/api-docs/#cert-manager.io/v1.CertificateSpec
revisionHistoryLimit: 0
admissionCert:
# default to be 1y
duration: ""
# -- Revision history limit of the webhook certificate.
# Ref.: https://cert-manager.io/docs/reference/api-docs/#cert-manager.io/v1.CertificateSpec
revisionHistoryLimit: 0
# issuerRef:
# name: "issuer"
# kind: "ClusterIssuer"
Expand Down
Loading