diff --git a/charts/agent/Chart.yaml b/charts/agent/Chart.yaml index 48bf28e1..ce005500 100644 --- a/charts/agent/Chart.yaml +++ b/charts/agent/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.9 +version: 0.1.10 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/agent/templates/ingress.yaml b/charts/agent/templates/ingress.yaml index 5d4c8ae4..3bfc9304 100644 --- a/charts/agent/templates/ingress.yaml +++ b/charts/agent/templates/ingress.yaml @@ -1,7 +1,14 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "agent.fullname" . -}} {{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1beta1 {{- else -}} apiVersion: extensions/v1beta1 @@ -16,6 +23,9 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} {{- if .Values.ingress.tls }} tls: {{- range .Values.ingress.tls }} @@ -33,9 +43,20 @@ spec: paths: {{- range .paths }} - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} serviceName: {{ $fullName }} servicePort: {{ $svcPort }} + {{- end }} {{- end }} {{- end }} - {{- end }} +{{- end }} + diff --git a/charts/agent/templates/ingress_bridge.yaml b/charts/agent/templates/ingress_bridge.yaml index 4f9a1ec9..36f44746 100644 --- a/charts/agent/templates/ingress_bridge.yaml +++ b/charts/agent/templates/ingress_bridge.yaml @@ -1,15 +1,22 @@ {{- if .Values.container_bridge.enabled }} -{{- if .Values.container_bridge.ingress.enabled -}} +{{- if .Values.git_bridge.ingress.enabled -}} {{- $fullName := include "agent.fullname" . -}} {{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- if and .Values.container_bridge.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.container_bridge.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.container_bridge.ingress.annotations "kubernetes.io/ingress.class" .Values.container_bridge.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1beta1 {{- else -}} apiVersion: extensions/v1beta1 {{- end }} kind: Ingress metadata: - name: {{ $fullName }}-container + name: {{ $fullName }} labels: {{- include "agent.labels" . | nindent 4 }} {{- with .Values.container_bridge.ingress.annotations }} @@ -17,7 +24,10 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - {{- if .Values.container_bridge.ingress.tls }} + {{- if and .Values.container_bridge.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.container_bridge.ingress.className }} + {{- end }} + {{- if .Values.git_bridge.ingress.tls }} tls: {{- range .Values.container_bridge.ingress.tls }} - hosts: @@ -34,10 +44,20 @@ spec: paths: {{- range .paths }} - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }}-container + port: + number: {{ $svcPort }} + {{- else }} serviceName: {{ $fullName }}-container servicePort: {{ $svcPort }} + {{- end }} {{- end }} {{- end }} - {{- end }} +{{- end }} {{- end }} diff --git a/charts/agent/templates/ingress_git.yaml b/charts/agent/templates/ingress_git.yaml index 8ba85c8e..5c929b7f 100644 --- a/charts/agent/templates/ingress_git.yaml +++ b/charts/agent/templates/ingress_git.yaml @@ -1,8 +1,15 @@ {{- if .Values.git_bridge.enabled }} -{{- if .Values.container_bridge.ingress.enabled -}} +{{- if .Values.git_bridge.ingress.enabled -}} {{- $fullName := include "agent.fullname" . -}} {{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- if and .Values.git_bridge.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.git_bridge.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.git_bridge.ingress.annotations "kubernetes.io/ingress.class" .Values.git_bridge.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1beta1 {{- else -}} apiVersion: extensions/v1beta1 @@ -17,6 +24,9 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: + {{- if and .Values.git_bridge.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.git_bridge.ingress.className }} + {{- end }} {{- if .Values.git_bridge.ingress.tls }} tls: {{- range .Values.git_bridge.ingress.tls }} @@ -34,10 +44,20 @@ spec: paths: {{- range .paths }} - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }}-git + port: + number: {{ $svcPort }} + {{- else }} serviceName: {{ $fullName }}-git servicePort: {{ $svcPort }} + {{- end }} {{- end }} {{- end }} - {{- end }} - {{- end }} +{{- end }} +{{- end }}