Skip to content

Commit

Permalink
fix(Traefik Proxy): allowEmptyServices not disabled when set to false
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximilianMeister authored Nov 22, 2024
1 parent 8e991f3 commit 4c2a65e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 5 deletions.
12 changes: 8 additions & 4 deletions traefik/templates/_podtemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,10 @@
{{- if .Values.providers.kubernetesCRD.allowExternalNameServices }}
- "--providers.kubernetescrd.allowExternalNameServices=true"
{{- end }}
{{- if .Values.providers.kubernetesCRD.allowEmptyServices }}
- "--providers.kubernetescrd.allowEmptyServices=true"
{{- if ne .Values.providers.kubernetesCRD.allowEmptyServices nil }}
{{- with .Values.providers.kubernetesCRD.allowEmptyServices | toString }}
- "--providers.kubernetescrd.allowEmptyServices={{ . }}"
{{- end }}
{{- end }}
{{- if and .Values.rbac.namespaced (semverCompare ">=3.1.2-0" $version) }}
- "--providers.kubernetescrd.disableClusterScopeResources=true"
Expand All @@ -477,8 +479,10 @@
{{- if .Values.providers.kubernetesIngress.allowExternalNameServices }}
- "--providers.kubernetesingress.allowExternalNameServices=true"
{{- end }}
{{- if .Values.providers.kubernetesIngress.allowEmptyServices }}
- "--providers.kubernetesingress.allowEmptyServices=true"
{{- if ne .Values.providers.kubernetesIngress.allowEmptyServices nil }}
{{- with .Values.providers.kubernetesIngress.allowEmptyServices | toString }}
- "--providers.kubernetesingress.allowEmptyServices={{ . }}"
{{- end }}
{{- end }}
{{- if and .Values.service.enabled .Values.providers.kubernetesIngress.publishedService.enabled }}
- "--providers.kubernetesingress.ingressendpoint.publishedservice={{ template "providers.kubernetesIngress.publishedServicePath" . }}"
Expand Down
38 changes: 37 additions & 1 deletion traefik/tests/pod-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ tests:
asserts:
- isNull:
path: spec.template.spec.containers[0].runtimeClassName
- it: should set runtimeClassName when configured
- it: should set defaultRuleSyntax when configured
set:
core:
defaultRuleSyntax: v2
Expand Down Expand Up @@ -709,3 +709,39 @@ tests:
asserts:
- failedTemplate:
errorPattern: "level"
- it: should set allowEmptyServices for kubernetesCRD
set:
providers:
kubernetesCRD:
allowEmptyServices: true
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--providers.kubernetescrd.allowEmptyServices=true"
- it: should unset allowEmptyServices for kubernetesCRD
set:
providers:
kubernetesCRD:
allowEmptyServices: false
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--providers.kubernetescrd.allowEmptyServices=false"
- it: should set allowEmptyServices for kubernetesIngress
set:
providers:
kubernetesIngress:
allowEmptyServices: true
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--providers.kubernetesingress.allowEmptyServices=true"
- it: should unset allowEmptyServices for kubernetesIngress
set:
providers:
kubernetesIngress:
allowEmptyServices: false
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--providers.kubernetesingress.allowEmptyServices=false"

0 comments on commit 4c2a65e

Please sign in to comment.