Chart: Implement controller.admissionWebhooks.service.servicePort
. (#11931)
This commit is contained in:
parent
e9259af906
commit
a647bc1b7a
4 changed files with 66 additions and 1 deletions
|
@ -40,6 +40,7 @@ webhooks:
|
||||||
service:
|
service:
|
||||||
name: {{ include "ingress-nginx.controller.fullname" . }}-admission
|
name: {{ include "ingress-nginx.controller.fullname" . }}-admission
|
||||||
namespace: {{ include "ingress-nginx.namespace" . }}
|
namespace: {{ include "ingress-nginx.namespace" . }}
|
||||||
|
port: {{ .Values.controller.admissionWebhooks.service.servicePort }}
|
||||||
path: /networking/v1/ingresses
|
path: /networking/v1/ingresses
|
||||||
{{- if .Values.controller.admissionWebhooks.timeoutSeconds }}
|
{{- if .Values.controller.admissionWebhooks.timeoutSeconds }}
|
||||||
timeoutSeconds: {{ .Values.controller.admissionWebhooks.timeoutSeconds }}
|
timeoutSeconds: {{ .Values.controller.admissionWebhooks.timeoutSeconds }}
|
||||||
|
|
|
@ -29,7 +29,7 @@ spec:
|
||||||
{{- end }}
|
{{- end }}
|
||||||
ports:
|
ports:
|
||||||
- name: https-webhook
|
- name: https-webhook
|
||||||
port: 443
|
port: {{ .Values.controller.admissionWebhooks.service.servicePort }}
|
||||||
targetPort: webhook
|
targetPort: webhook
|
||||||
{{- if semverCompare ">=1.20.0-0" .Capabilities.KubeVersion.Version }}
|
{{- if semverCompare ">=1.20.0-0" .Capabilities.KubeVersion.Version }}
|
||||||
appProtocol: https
|
appProtocol: https
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
suite: Admission Webhooks > ValidatingWebhookConfiguration
|
||||||
|
templates:
|
||||||
|
- admission-webhooks/validating-webhook.yaml
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- it: should not create a ValidatingWebhookConfiguration if `controller.admissionWebhooks.enabled` is false
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.enabled: false
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
|
||||||
|
- it: should create a ValidatingWebhookConfiguration if `controller.admissionWebhooks.enabled` is true
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.enabled: true
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 1
|
||||||
|
- isKind:
|
||||||
|
of: ValidatingWebhookConfiguration
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: RELEASE-NAME-admission
|
||||||
|
|
||||||
|
- it: should create a ValidatingWebhookConfiguration with a custom port if `controller.admissionWebhooks.service.servicePort` is set
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.enabled: true
|
||||||
|
controller.admissionWebhooks.service.servicePort: 9443
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: webhooks[0].clientConfig.service.port
|
||||||
|
value: 9443
|
|
@ -0,0 +1,32 @@
|
||||||
|
suite: Controller > Service > Webhook
|
||||||
|
templates:
|
||||||
|
- controller-service-webhook.yaml
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- it: should not create a webhook Service if `controller.admissionWebhooks.enabled` is false
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.enabled: false
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
|
||||||
|
- it: should create a webhook Service if `controller.admissionWebhooks.enabled` is true
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.enabled: true
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 1
|
||||||
|
- isKind:
|
||||||
|
of: Service
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: RELEASE-NAME-ingress-nginx-controller-admission
|
||||||
|
|
||||||
|
- it: should create a webhook Service with a custom port if `controller.admissionWebhooks.service.servicePort` is set
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.enabled: true
|
||||||
|
controller.admissionWebhooks.service.servicePort: 9443
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.ports[0].port
|
||||||
|
value: 9443
|
Loading…
Reference in a new issue