Skip to content
Snippets Groups Projects
Commit 61478c97 authored by OZGCloud's avatar OZGCloud
Browse files

generate ingress with kop environment

parent 7402506c
Branches
Tags
No related merge requests found
......@@ -42,10 +42,9 @@ questions:
group: "Ingress"
show_subquestion_if: true
subquestions:
- variable: ingress.host
- variable: ingress.overrideHost
type: string
label: URL des deposit Webservice
default: afm.ozg-sh.de
label: Override generated deposit Webservice URL
group: "Ingress"
- variable: routing.fallbackStrategy
......
......@@ -63,6 +63,11 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
{{- end -}}
{{- define "app.kopBezeichner" -}}
{{- required "Bezeichner muss angegeben sein" (.Values.kop).bezeichner -}}
{{- end -}}
{{- define "app.resources" }}
{{- if eq (include "app.kopEnvironment" . ) "prod" }}
limits:
......@@ -81,20 +86,32 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
{{- end }}
{{- end -}}
{{- define "app.ssoName" -}}
{{ coalesce (.Values.sso).name ((split "-" (include "app.namespace" .) )._1) }}
{{- end -}}
{{- define "app.ingress.host" }}
{{- if .Values.ingress.host }}
{{- printf "%s" .Values.ingress.host }}
{{- if .Values.ingress.overrideHost }}
{{- printf "%s" .Values.ingress.overrideHost }}
{{- else }}
{{- if eq (include "app.kopEnvironment" . ) "prod" }}
{{- if eq (.Values.image).name "formsolutions-adapter" }}
{{- printf "https://%s-fs.ozg-sh.de" (include "app.kopBezeichner" .) }}
{{- else }}
{{- if eq (include "app.ssoLevel" . ) "prod" }}
{{- printf "https://%s.afm.ozg-sh.de" (include "app.ssoName" .) }}
{{- else if eq (include "app.ssoLevel" . ) "stage" }}
{{- printf "https://%s.%s.afm.ozg-sh.de" (include "app.ssoName" .) (include "app.ssoLevel" . ) }}
{{- printf "https://%s.afm.ozg-sh.de" (include "app.kopBezeichner" .) }}
{{- end }}
{{- else if eq (include "app.kopEnvironment" . ) "stage" }}
{{- if eq (.Values.image).name "formsolutions-adapter" }}
{{- printf "https://%s-fs.stage.ozg-sh.de" (include "app.kopBezeichner" .) }}
{{- else }}
{{- printf "https://%s-afm.%s.ozg-sh.de" (include "app.ssoName" .) (include "app.ssoLevel" . ) }}
{{- printf "https://%s.stage.afm.ozg-sh.de" (include "app.kopBezeichner" .) }}
{{- end }}
{{- else }}
{{- if eq (.Values.image).name "formsolutions-adapter" }}
{{- printf "https://%s-fs.%s.ozg-sh.de" (include "app.kopBezeichner" .) (include "app.kopEnvironment" . ) }}
{{- else }}
{{- printf "https://%s-afm.%s.ozg-sh.de" (include "app.kopBezeichner" .) (include "app.kopEnvironment" . ) }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
kop:
environment: test
bezeichner: helm
\ No newline at end of file
......@@ -5,6 +5,8 @@ tests:
- it: create ingress by config
set:
ingress.enabled: true
kop.environment: dev
kop.bezeichner: unit
asserts:
- isKind:
of: Ingress
......@@ -15,6 +17,9 @@ tests:
- hasDocuments:
count: 0
- it: ingress should be created by default
set:
kop.environment: dev
kop.bezeichner: unit
asserts:
- isKind:
of: Ingress
suite: test ingress creation
release:
name: intelliform-adapter
namespace: helm-test
namespace: sh-helm-test
templates:
- templates/ingress.yaml
set:
image.name: intelliform-adapter
tests:
- it: should match basic data
set:
kop.environment: dev
kop.bezeichner: unit
asserts:
- containsDocument:
kind: Ingress
......@@ -17,29 +18,42 @@ tests:
value: intelliform-adapter
- equal:
path: metadata.namespace
value: helm-test
value: sh-helm-test
- it: should match service port number
set:
kop.environment: dev
kop.bezeichner: unit
asserts:
- equal:
path: spec.rules[0].http.paths[0].backend.service.port.number
value: 8080
- it: should match service name
set:
kop.environment: dev
kop.bezeichner: unit
asserts:
- equal:
path: spec.rules[0].http.paths[0].backend.service.name
value: intelliform-adapter
- it: should match service path
set:
kop.environment: dev
kop.bezeichner: unit
asserts:
- isEmpty:
path: spec.rules[0].http.paths[0].path
- it: should match service pathType
set:
kop.environment: dev
kop.bezeichner: unit
asserts:
- equal:
path: spec.rules[0].http.paths[0].pathType
value: ImplementationSpecific
- it: should create dev host
release:
namespace: sh-unit-dev
- it: should create afm dev host
set:
kop.environment: dev
kop.bezeichner: unit
asserts:
- equal:
path: spec.rules[0].host
......@@ -47,9 +61,10 @@ tests:
- equal:
path: spec.tls[0].hosts[0]
value: https://unit-afm.dev.ozg-sh.de
- it: should create test host
release:
namespace: sh-unit-test
- it: should create afm test host
set:
kop.environment: test
kop.bezeichner: unit
asserts:
- equal:
path: spec.rules[0].host
......@@ -57,9 +72,10 @@ tests:
- equal:
path: spec.tls[0].hosts[0]
value: https://unit-afm.test.ozg-sh.de
- it: should create prod host
release:
namespace: sh-unit-prod
- it: should create afm prod host
set:
kop.environment: prod
kop.bezeichner: unit
asserts:
- equal:
path: spec.rules[0].host
......@@ -67,9 +83,10 @@ tests:
- equal:
path: spec.tls[0].hosts[0]
value: https://unit.afm.ozg-sh.de
- it: should create stage host
release:
namespace: sh-unit-stage
- it: should create afm stage host
set:
kop.environment: stage
kop.bezeichner: unit
asserts:
- equal:
path: spec.rules[0].host
......@@ -81,7 +98,9 @@ tests:
release:
namespace: sh-unit-stage
set:
ingress.host: https://host.dev.ozg-sh.de
ingress.overrideHost: https://host.dev.ozg-sh.de
kop.environment: dev
kop.bezeichner: unit
asserts:
- equal:
path: spec.rules[0].host
......@@ -89,3 +108,52 @@ tests:
- equal:
path: spec.tls[0].hosts[0]
value: https://host.dev.ozg-sh.de
- it: should create fs dev host
set:
image.name: formsolutions-adapter
kop.environment: dev
kop.bezeichner: unit
asserts:
- equal:
path: spec.rules[0].host
value: https://unit-fs.dev.ozg-sh.de
- equal:
path: spec.tls[0].hosts[0]
value: https://unit-fs.dev.ozg-sh.de
- it: should create fs test host
set:
image.name: formsolutions-adapter
kop.environment: test
kop.bezeichner: unit
asserts:
- equal:
path: spec.rules[0].host
value: https://unit-fs.test.ozg-sh.de
- equal:
path: spec.tls[0].hosts[0]
value: https://unit-fs.test.ozg-sh.de
- it: should create fs prod host
set:
image.name: formsolutions-adapter
kop.environment: prod
kop.bezeichner: unit
asserts:
- equal:
path: spec.rules[0].host
value: https://unit-fs.ozg-sh.de
- equal:
path: spec.tls[0].hosts[0]
value: https://unit-fs.ozg-sh.de
- it: should create fs stage host
set:
image.name: formsolutions-adapter
kop.environment: stage
kop.bezeichner: unit
asserts:
- equal:
path: spec.rules[0].host
value: https://unit-fs.stage.ozg-sh.de
- equal:
path: spec.tls[0].hosts[0]
value: https://unit-fs.stage.ozg-sh.de
\ No newline at end of file
......@@ -25,6 +25,7 @@ imageCredentials:
ingress:
enabled: true
# overrideHost: afm.ozg-sh.de
#routing:
# fallbackStrategy: DENY
......@@ -32,3 +33,4 @@ ingress:
# kop:
# environment: dev
# bezeichner: helm
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment