Skip to content

Commit

Permalink
Simplify ingress removing support for k8s less than 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusfcr committed Mar 15, 2024
1 parent 9ee577f commit 2e55d02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 31 deletions.
35 changes: 5 additions & 30 deletions stable/vulcan/templates/_ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
{{/*
Override names
Standard ingress definition
*/}}
{{- define "common-ingress" -}}
{{- if and .Values.comp.enabled .Values.comp.ingress.enabled -}}
{{- $fullName := printf "%s-%s" (include "vulcan.fullname" . ) .Values.comp.name -}}
{{- $svcPort := .Values.comp.service.port -}}
{{- if and .Values.comp.ingress.className (not (semverCompare ">=1.18-0" (include "common.capabilities.kubeVersion" .))) }}
{{- if not (hasKey .Values.comp.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.comp.ingress.annotations "kubernetes.io/ingress.class" .Values.comp.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" (include "common.capabilities.kubeVersion" .) -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" (include "common.capabilities.kubeVersion" .) -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
Expand All @@ -27,8 +16,8 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.comp.ingress.className (semverCompare ">=1.18-0" (include "common.capabilities.kubeVersion" .)) }}
ingressClassName: {{ .Values.comp.ingress.className }}
{{- if .Values.comp.ingress.className }}
ingressClassName: {{ .Values.comp.ingress.className | quote }}
{{- end }}
{{- if .Values.comp.ingress.tls }}
tls:
Expand All @@ -48,34 +37,20 @@ spec:
{{- range .paths }}
{{- if kindIs "string" . }}
- path: {{ . }}
{{- if semverCompare ">=1.18-0" (include "common.capabilities.kubeVersion" $) }}
pathType: ImplementationSpecific
{{- end }}
pathType: "ImplementationSpecific"
backend:
{{- if semverCompare ">=1.19-0" (include "common.capabilities.kubeVersion" $) }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- else }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" (include "common.capabilities.kubeVersion" $)) }}
pathType: {{ .pathType }}
{{- end }}
pathType: {{ default "ImplementationSpecific" .pathType }}
backend:
{{- if semverCompare ">=1.19-0" (include "common.capabilities.kubeVersion" $) }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion stable/vulcan/templates/_service.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{/*
Override names
Standard service definition
*/}}
{{- define "common-service" -}}
{{- if and .Values.comp.enabled -}}
Expand Down

0 comments on commit 2e55d02

Please sign in to comment.