Skip to content

Commit

Permalink
feat(Traefik Proxy): 🎨 harmonize semverCompare calls
Browse files Browse the repository at this point in the history
  • Loading branch information
darkweaver87 authored Dec 9, 2024
1 parent 9ee6231 commit 2aad522
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion traefik/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ based on semverCompare
{{- if regexMatch "v[0-9]+.[0-9]+.[0-9]+" (default "" $.Values.image.tag) -}}
{{- if semverCompare "<v3.3.2-0" $.Values.image.tag -}}
{{ $hubVersion = "v3.0" }}
{{- else if semverCompare "<3.7.0-0" $.Values.image.tag -}}
{{- else if semverCompare "<v3.7.0-0" $.Values.image.tag -}}
{{ $hubVersion = "v3.1" }}
{{- end -}}
{{- end -}}
Expand Down
12 changes: 6 additions & 6 deletions traefik/templates/_podtemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@
- "--experimental.plugins.{{ $pluginName }}.moduleName={{ $plugin.moduleName }}"
- "--experimental.plugins.{{ $pluginName }}.version={{ $plugin.version }}"
{{- end }}
{{- if and (semverCompare ">=3.3.0-0" $version) (.Values.experimental.abortOnPluginFailure)}}
{{- if and (semverCompare ">=v3.3.0-0" $version) (.Values.experimental.abortOnPluginFailure)}}
- "--experimental.abortonpluginfailure={{ .Values.experimental.abortOnPluginFailure }}"
{{- end }}
{{- if .Values.providers.kubernetesCRD.enabled }}
Expand All @@ -470,7 +470,7 @@
- "--providers.kubernetescrd.allowEmptyServices={{ . }}"
{{- end }}
{{- end }}
{{- if and .Values.rbac.namespaced (semverCompare ">=3.1.2-0" $version) }}
{{- if and .Values.rbac.namespaced (semverCompare ">=v3.1.2-0" $version) }}
- "--providers.kubernetescrd.disableClusterScopeResources=true"
{{- end }}
{{- if .Values.providers.kubernetesCRD.nativeLBByDefault }}
Expand All @@ -497,9 +497,9 @@
- "--providers.kubernetesingress.ingressClass={{ .Values.providers.kubernetesIngress.ingressClass }}"
{{- end }}
{{- if .Values.rbac.namespaced }}
{{- if semverCompare "<3.1.5-0" $version }}
{{- if semverCompare "<v3.1.5-0" $version }}
- "--providers.kubernetesingress.disableIngressClassLookup=true"
{{- if semverCompare ">=3.1.2-0" $version }}
{{- if semverCompare ">=v3.1.2-0" $version }}
- "--providers.kubernetesingress.disableClusterScopeResources=true"
{{- end }}
{{- else }}
Expand Down Expand Up @@ -603,7 +603,7 @@
{{- end }}
{{- end }}
{{- if $config.allowACMEByPass }}
{{- if (semverCompare "<3.1.3-0" $version) }}
{{- if (semverCompare "<v3.1.3-0" $version) }}
{{- fail "ERROR: allowACMEByPass has been introduced with Traefik v3.1.3+" -}}
{{- end }}
- "--entryPoints.{{ $entrypoint }}.allowACMEByPass=true"
Expand Down Expand Up @@ -848,7 +848,7 @@
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.topologySpreadConstraints }}
{{- if (semverCompare "<1.19.0-0" .Capabilities.KubeVersion.Version) }}
{{- if (semverCompare "<v1.19.0-0" .Capabilities.KubeVersion.Version) }}
{{- fail "ERROR: topologySpreadConstraints are supported only on kubernetes >= v1.19" -}}
{{- end }}
topologySpreadConstraints:
Expand Down
2 changes: 1 addition & 1 deletion traefik/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{- fail "ERROR: maxReplicas is required on HPA" }}
{{- end }}

{{- if semverCompare ">=1.23.0-0" .Capabilities.KubeVersion.Version }}
{{- if semverCompare ">=v1.23.0-0" .Capabilities.KubeVersion.Version }}
apiVersion: autoscaling/v2
{{- else }}
apiVersion: autoscaling/v2beta2
Expand Down
2 changes: 1 addition & 1 deletion traefik/templates/rbac/podsecuritypolicy.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.podSecurityPolicy.enabled }}
{{- if semverCompare ">=1.25.0-0" .Capabilities.KubeVersion.Version }}
{{- if semverCompare ">=v1.25.0-0" .Capabilities.KubeVersion.Version }}
{{- fail "ERROR: PodSecurityPolicy has been removed in Kubernetes v1.25+" }}
{{- end }}
---
Expand Down
6 changes: 3 additions & 3 deletions traefik/templates/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- $version := include "imageVersion" $ }}
{{- if (ne $version "experimental-v3.0") }}
{{- if (semverCompare "<3.0.0-0" $version) }}
{{- if (semverCompare "<v3.0.0-0" $version) }}
{{- fail "ERROR: This version of the Chart only supports Traefik Proxy v3" -}}
{{- end }}
{{- end }}
Expand All @@ -13,7 +13,7 @@
{{- fail "ERROR: traefik-hub image is required when enabling Traefik Hub" -}}
{{- end }}

{{- if and (.Values.providers.kubernetesGateway).enabled (and (semverCompare "<3.1.0-rc3" $version) (not .Values.experimental.kubernetesGateway.enabled)) }}
{{- if and (.Values.providers.kubernetesGateway).enabled (and (semverCompare "<v3.1.0-rc3" $version) (not .Values.experimental.kubernetesGateway.enabled)) }}
{{- fail "ERROR: Before traefik v3.1.0-rc3, kubernetesGateway is experimental. Enable it by setting experimental.kubernetesGateway.enabled to true" -}}
{{- end }}

Expand All @@ -32,6 +32,6 @@
{{- end }}
{{- end }}

{{- if and (semverCompare "<3.3.0-0" $version) (.Values.experimental.abortOnPluginFailure)}}
{{- if and (semverCompare "<v3.3.0-0" $version) (.Values.experimental.abortOnPluginFailure)}}
{{- fail "ERROR: abortOnPluginFailure is an experimental feature only available for traefik >= v3.3.0." }}
{{- end }}

0 comments on commit 2aad522

Please sign in to comment.