Skip to content

Commit

Permalink
Merge pull request #27 from Contezza/api-ingress-capabilities
Browse files Browse the repository at this point in the history
Api ingress capabilities
  • Loading branch information
shazada authored Jun 1, 2023
2 parents 485243d + 024fee3 commit 844966d
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 17 deletions.
48 changes: 44 additions & 4 deletions charts/open-notificaties/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
{{- $flowerFullName := include "open-notificaties.flowerFullname" . -}}
{{- $flowerSvcPort := .Values.flower.service.port -}}
{{- $flowerUrlPrefix := .Values.settings.flower.urlPrefix -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" }}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
Expand All @@ -21,6 +23,9 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
Expand All @@ -38,13 +43,33 @@ spec:
paths:
- path: /
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
pathType: ImplementationSpecific
{{- end }}
{{- if and ($flowerEnabled) (not $flowerIngressEnabled) }}
- path: /{{ $flowerUrlPrefix }}
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: {{ $flowerFullName }}
port:
number: {{ $flowerSvcPort }}
{{- else }}
serviceName: {{ $flowerFullName }}
servicePort: {{ $flowerSvcPort }}
{{- end }}
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
pathType: ImplementationSpecific
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Expand All @@ -54,9 +79,11 @@ spec:
{{- $fullName := include "open-notificaties.flowerFullname" . -}}
{{- $svcPort := .Values.flower.service.port -}}
{{- $flowerUrlPrefix := .Values.settings.flower.urlPrefix -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" }}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
Expand All @@ -69,6 +96,9 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.flower.ingress.tls }}
tls:
{{- range .Values.flower.ingress.tls }}
Expand All @@ -86,7 +116,17 @@ spec:
paths:
- path: /{{ $flowerUrlPrefix }}
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
pathType: ImplementationSpecific
{{- end }}
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions charts/open-notificaties/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ ingress:
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
className: ""
hosts:
- open-notificaties.gemeente.nl
tls: []
Expand Down
22 changes: 11 additions & 11 deletions charts/open-zaak/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ type: application
version: 0.8.1
appVersion: "1.7.1"

dependencies:
- name: postgresql
version: ~10.12.0
repository: https://charts.bitnami.com/bitnami
tags:
- postgresql
- name: redis
version: ~13.0.0
repository: https://charts.bitnami.com/bitnami
tags:
- redis
# dependencies:
# - name: postgresql
# version: ~10.12.0
# repository: https://charts.bitnami.com/bitnami
# tags:
# - postgresql
# - name: redis
# version: ~13.0.0
# repository: https://charts.bitnami.com/bitnami
# tags:
# - redis
19 changes: 17 additions & 2 deletions charts/open-zaak/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "open-zaak.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" }}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
Expand All @@ -16,6 +18,9 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
Expand All @@ -33,7 +38,17 @@ spec:
paths:
- path: /
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: {{ $fullName }}
port:
name: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end}}
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
pathType: ImplementationSpecific
{{- end }}
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions charts/open-zaak/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ ingress:
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
className: ""
hosts:
- open-zaak.gemeente.nl
tls: []
Expand Down

0 comments on commit 844966d

Please sign in to comment.