Merge pull request #68 from k8s-at-home/bug/media-common

[media-common] fix nested kube check and update for kube version 1.19 check
This commit is contained in:
Nicholas St. Germain 2020-09-27 12:58:59 -05:00 committed by GitHub
commit d90ddd9e2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 10 deletions

View File

@ -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

View File

@ -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,15 +35,27 @@ 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 -}}
apiVersion: extensions/v1beta1
@ -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 }}

View File

@ -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: