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

generate ingress with kop environment

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