diff --git a/charts/media-common/Chart.yaml b/charts/media-common/Chart.yaml index 6e8e8ce6..5f1b799f 100644 --- a/charts/media-common/Chart.yaml +++ b/charts/media-common/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: media-common description: Common dependancy chart for media ecosystem containers type: application -version: 1.2.0 +version: 1.3.0 keywords: - media-common home: https://github.com/k8s-at-home/charts/tree/master/charts/media-common diff --git a/charts/media-common/templates/ingress.yaml b/charts/media-common/templates/ingress.yaml index d3753c42..054788a1 100644 --- a/charts/media-common/templates/ingress.yaml +++ b/charts/media-common/templates/ingress.yaml @@ -1,7 +1,10 @@ {{- if .Values.ingress.enabled -}} + {{- $kubeVersion := .Capabilities.KubeVersion.GitVersion -}} {{- $fullName := include "media-common.fullname" . -}} {{- $svcPort := .Values.service.port -}} - {{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} + {{- if semverCompare ">= 1.19-0" $kubeVersion -}} +apiVersion: networking.k8s.io/v1 + {{- else if semverCompare ">= 1.14-0 < 1.19-0" $kubeVersion -}} apiVersion: networking.k8s.io/v1beta1 {{- else -}} apiVersion: extensions/v1beta1 @@ -32,17 +35,29 @@ spec: http: paths: {{- range .paths }} - - path: {{ . }} + - path: {{ .path }} + {{- if semverCompare ">= 1.14-0" $kubeVersion}} + pathType: {{ .pathType }} + {{- end }} backend: + {{- if semverCompare ">= 1.19-0" $kubeVersion}} + service: + name: {{ $fullName }} + port: + name: http + {{- else }} serviceName: {{ $fullName }} servicePort: {{ $svcPort }} + {{- end }} {{- end }} {{- end }} {{- range $index, $ingress := .Values.ingress.extraIngresses }} --- - {{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} + {{- if semverCompare ">= 1.19-0" $kubeVersion -}} +apiVersion: networking.k8s.io/v1 + {{- else if semverCompare ">= 1.14-0 < 1.19-0" $kubeVersion -}} apiVersion: networking.k8s.io/v1beta1 - {{- else -}} + {{- else -}} apiVersion: extensions/v1beta1 {{- end }} kind: Ingress @@ -71,11 +86,21 @@ spec: http: paths: {{- range .paths }} - - path: {{ . }} + - path: {{ .path }} + {{- if semverCompare ">= 1.14-0" $kubeVersion}} + pathType: {{ .pathType }} + {{- end }} backend: + {{- if semverCompare ">= 1.19-0" $kubeVersion}} + service: + name: {{ $fullName }} + port: + name: http + {{- else }} serviceName: {{ $fullName }} servicePort: {{ $svcPort }} - {{- end }} - {{- end }} + {{- end }} + {{- end }} + {{- end }} {{- end }} {{- end }} diff --git a/charts/media-common/values.yaml b/charts/media-common/values.yaml index e6141dd9..f32efde8 100644 --- a/charts/media-common/values.yaml +++ b/charts/media-common/values.yaml @@ -50,7 +50,9 @@ ingress: hosts: - host: chart-example.local paths: - - / + - path: / + # Ignored if not kubeVersion >= 1.14-0 + pathType: Prefix tls: [] # - secretName: chart-example-tls # hosts: @@ -65,7 +67,9 @@ ingress: # hosts: # - host: chart-example.local # paths: - # - /api + # - path: /api + # # Ignored if not kubeVersion >= 1.14-0 + # pathType: Prefix # tls: [] # # - secretName: chart-example-tls # # hosts: