feat: ingress.path now is an object intead string (#10)

This commit is contained in:
Wei-An Yen
2022-06-10 16:54:05 +08:00
committed by GitHub
parent 54b4a74b85
commit 2e064e65da
6 changed files with 28 additions and 14 deletions

View File

@ -10,9 +10,9 @@ spec:
{{- $cronJob := index . 1 }}
{{- $pod := index . 2 }}
{{- $serviceAccount := index . 3 }}
{{- if semverCompare ">=1.21.0" $top.Capabilities.KubeVersion.Version }}
{{- if semverCompare ">=1.21-0" $top.Capabilities.KubeVersion.GitVersion -}}
apiVersion: batch/v1
{{- else }}
{{- else -}}
apiVersion: batch/v1beta1
{{- end }}
kind: CronJob

View File

@ -3,9 +3,9 @@
{{- define "common.hpa.tpl" -}}
{{- $top := first . }}
{{- $autoscaling := index . 1 }}
{{- if semverCompare ">=1.23.0" $top.Capabilities.KubeVersion.Version }}
{{- if semverCompare ">=1.23-0" $top.Capabilities.KubeVersion.GitVersion -}}
apiVersion: autoscaling/v2
{{- else }}
{{- else -}}
apiVersion: autoscaling/v2beta2
{{- end }}
kind: HorizontalPodAutoscaler

View File

@ -14,11 +14,11 @@ annotations:
{{- $service := index . 2 }}
{{- $fullName := include "common.fullname" $top }}
{{- $svcPort := $service.port }}
{{- if semverCompare ">=1.19.0" $top.Capabilities.KubeVersion.Version }}
{{- if semverCompare ">=1.19-0" $top.Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14.0" $top.Capabilities.KubeVersion.Version }}
{{- else if semverCompare ">=1.14-0" $top.Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
@ -41,10 +41,20 @@ spec:
http:
paths:
{{- range .paths }}
- path: {{ . }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $top.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $top.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -3,9 +3,9 @@
{{- define "common.pdb.tpl" -}}
{{- $top := first . }}
{{- $pdb := index . 1 }}
{{- if semverCompare ">=1.21.0" $top.Capabilities.KubeVersion.Version }}
{{- if semverCompare ">=1.21-0" $top.Capabilities.KubeVersion.GitVersion -}}
apiVersion: policy/v1
{{- else }}
{{- else -}}
apiVersion: policy/v1beta1
{{- end }}
kind: PodDisruptionBudget