Skip to content

Commit

Permalink
chart: Upgrade appVersion and Ingress to network.k8s.io/v1
Browse files Browse the repository at this point in the history
  • Loading branch information
devplayer0 committed Jul 9, 2021
1 parent 9bd5caf commit e5b260e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
4 changes: 2 additions & 2 deletions charts/iamd/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: iamd
description: Netsoc's IAM microservice
type: application
version: 0.5.0
appVersion: 1.1.0
version: 0.6.0
appVersion: 1.1.1
dependencies:
- name: postgresql
version: 10.5.x
Expand Down
27 changes: 23 additions & 4 deletions charts/iamd/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "iamd.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
Expand All @@ -16,6 +22,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 }}
Expand All @@ -32,10 +41,20 @@ spec:
http:
paths:
{{- range .paths }}
- path: {{ . }}
- path: {{ .path }}
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
name: http
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
servicePort: http
{{- end }}
{{- end }}
{{- end }}
{{- end }}
5 changes: 4 additions & 1 deletion charts/iamd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ service:

ingress:
enabled: false
className: ''
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: 'true'
hosts:
- host: chart-example.local
paths: []
paths:
- path: /
pathType: Prefix
tls: []
# - secretName: chart-example-tls
# hosts:
Expand Down

0 comments on commit e5b260e

Please sign in to comment.