Merge pull request #32 from gimlet-io/v1-ingress-support

Using networking.k8s.io/v1 Ingress; requires cluster versions >= 1.19
This commit is contained in:
Laszlo Fogas
2021-09-29 14:15:50 +02:00
committed by GitHub
4 changed files with 39 additions and 30 deletions
+11 -4
View File
@@ -6,7 +6,7 @@
{{- $resourceName = printf "%s-%s" $robustName (include "robustName" .ingress.host) -}}
{{- end }}
---
apiVersion: networking.k8s.io/v1beta1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $resourceName }}
@@ -26,6 +26,9 @@ metadata:
{{- end }}
{{- end }}
spec:
{{- if .ingress.ingressClassName }}
ingressClassName: {{ .ingress.ingressClassName }}
{{- end }}
{{- if default false .ingress.tlsEnabled }}
tls:
- hosts:
@@ -36,9 +39,13 @@ spec:
- host: {{ .ingress.host | quote }}
http:
paths:
- backend:
serviceName: {{ $robustName }}
servicePort: {{ if .root.Values.svcPort }}{{ .root.Values.svcPort }}{{ else }}{{ .root.Values.containerPort }}{{ end }}
- path: "/"
pathType: "Prefix"
backend:
service:
name: {{ $robustName }}
port:
number: {{ if .root.Values.svcPort }}{{ .root.Values.svcPort }}{{ else }}{{ .root.Values.containerPort }}{{ end }}
{{- end }}
{{- with .Values.ingress }}
+25 -8
View File
@@ -20,9 +20,13 @@ tests:
- host: chart-example.local
http:
paths:
- backend:
serviceName: release-name
servicePort: 80
- path: "/"
pathType: "Prefix"
backend:
service:
name: release-name
port:
number: 80
- it: Should pass ingress host name as is, user must sanitize it
set:
ingress:
@@ -41,20 +45,33 @@ tests:
- host: feature/my_branch.local
http:
paths:
- backend:
serviceName: release-name
servicePort: 80
- path: "/"
pathType: "Prefix"
backend:
service:
name: release-name
port:
number: 80
- it: Should set Ingress annotation
set:
ingress:
host: chart-example.local
annotations:
kubernetes.io/ingress.class: nginx
just/a-random: annotation
asserts:
- equal:
path: metadata.annotations
value:
kubernetes.io/ingress.class: nginx
just/a-random: annotation
- it: Should set ingress class
set:
ingress:
host: chart-example.local
ingressClassName: nginx
asserts:
- equal:
path: spec.ingressClassName
value: nginx
- it: Should generate multiple ingresses
set:
ingresses:
+2 -2
View File
@@ -9,7 +9,7 @@ tests:
containerPort: 1234
asserts:
- equal:
path: spec.rules[0].http.paths[0].backend.servicePort
path: spec.rules[0].http.paths[0].backend.service.port.number
value: 1234
- it: Should use service port
set:
@@ -19,5 +19,5 @@ tests:
containerPort: 5678
asserts:
- equal:
path: spec.rules[0].http.paths[0].backend.servicePort
path: spec.rules[0].http.paths[0].backend.service.port.number
value: 1234
+1 -16
View File
@@ -1,24 +1,9 @@
ingress:
host: chart-example.local
annotations:
kubernetes.io/ingress.class: nginx
ingresses:
- host: chart-example.local
tlsEnabled: true
annotations:
kubernetes.io/ingress.class: nginx
- host: another.local
tlsEnabled: true
annotations:
kubernetes.io/ingress.class: nginx
ingressClassName: nginx
gitRepository: github.com/laszlocph/demo-app
gitSha: xyz
vars:
MY_VAR: "value"
volumes:
- name: data
path: /data
existingClaim: myclaim