Skip to content
Snippets Groups Projects
Commit 273758bb authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'OZG-3152: refactor helm chart for new dev cluster' (#125)...

Merge pull request 'OZG-3152: refactor helm chart for new dev cluster' (#125) from OZG-3152 into master

Reviewed-on: https://git.ozg-sh.de/mgm/goofy/pulls/125
parents 7807e172 7576b970
No related branches found
No related tags found
No related merge requests found
Showing
with 50 additions and 193 deletions
...@@ -195,7 +195,7 @@ pipeline { ...@@ -195,7 +195,7 @@ pipeline {
dir('src/main/helm') { dir('src/main/helm') {
sh "helm lint -f test-values.yaml" sh "helm lint -f test-values.yaml"
sh "helm unittest -f '../../test/helm/*.yaml' ." sh "helm unittest -f '../../test/helm/*.yaml' -v '../../test/unit-values.yaml' ."
sh "helm package --version=${HELM_CHART_VERSION} ." sh "helm package --version=${HELM_CHART_VERSION} ."
...@@ -467,7 +467,7 @@ Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa, String ...@@ -467,7 +467,7 @@ Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa, String
devVersions.values.pluto.put('env', ['overrideSpringProfiles': overrideSpringProfiles]) devVersions.values.pluto.put('env', ['overrideSpringProfiles': overrideSpringProfiles])
devVersions.versions.goofy.image.tag = imageTag devVersions.versions.goofy.image.tag = imageTag
devVersions.charts.goofy.version = chartVersion // devVersions.charts.goofy.version = chartVersion
writeYaml file: editFile, data: devVersions, overwrite: true writeYaml file: editFile, data: devVersions, overwrite: true
} }
...@@ -795,7 +795,7 @@ Void setNewGoofyProvisioningVersion(String environment) { ...@@ -795,7 +795,7 @@ Void setNewGoofyProvisioningVersion(String environment) {
def envVersions = readYaml file: envFile def envVersions = readYaml file: envFile
envVersions.versions.goofy.image.tag = IMAGE_TAG envVersions.versions.goofy.image.tag = IMAGE_TAG
envVersions.charts.goofy.version = HELM_CHART_VERSION // envVersions.charts.goofy.version = HELM_CHART_VERSION
writeYaml file: envFile, data: envVersions, overwrite: true writeYaml file: envFile, data: envVersions, overwrite: true
} }
......
...@@ -55,11 +55,7 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} ...@@ -55,11 +55,7 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
{{- end -}} {{- end -}}
{{- define "app.kop_user-manager_url" -}} {{- define "app.kop_user-manager_url" -}}
{{- if eq (include "app.kopEnvironment" . ) "prod" -}} {{ printf "https://%s-%s.%s" (include "app.kopBezeichner" .) .Values.usermanagerName .Values.baseUrl }}
{{ printf "https://%s-%s.ozg-sh.de" (include "app.kopBezeichner" .) .Values.usermanagerName }}
{{- else -}}
{{ printf "https://%s-%s.%s.ozg-sh.de" (include "app.kopBezeichner" .) .Values.usermanagerName (include "app.kopEnvironment" . ) }}
{{- end -}}
{{- end -}} {{- end -}}
{{- define "app.kop_user-manager_internalurl" -}} {{- define "app.kop_user-manager_internalurl" -}}
...@@ -72,11 +68,6 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} ...@@ -72,11 +68,6 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{/* --- region keycoak --- */}}
{{/* namespace sh-kiel-dev means <bundesland>-<name>-<level> */}}
{{/* depending on level the server url is sso.dev.ozg-sh.de or sso.ozg-sh.de */}}
{{/* values can be overwritten */}}
{{- define "app.kopBundesland" -}} {{- define "app.kopBundesland" -}}
{{- required "Bundesland muss angegeben sein" (.Values.kop).bundesland }} {{- required "Bundesland muss angegeben sein" (.Values.kop).bundesland }}
{{- end -}} {{- end -}}
...@@ -109,25 +100,11 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} ...@@ -109,25 +100,11 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
{{- end -}} {{- end -}}
{{- define "app.ssoServerUrl" -}} {{- define "app.ssoServerUrl" -}}
{{- if (.Values.sso).serverUrl -}}
{{- printf "%s" .Values.sso.serverUrl -}} {{- printf "%s" .Values.sso.serverUrl -}}
{{- else if eq (include "app.kopEnvironment" . ) "dev" -}}
{{ printf "https://sso.dev.ozg-sh.de" }}
{{- else if eq (include "app.kopEnvironment" . ) "test" -}}
{{ printf "https://sso.test.ozg-sh.de" }}
{{- else -}}
{{ printf "https://sso.ozg-sh.de" }}
{{- end -}}
{{- end -}} {{- end -}}
{{- define "app.baseUrl" -}} {{- define "app.baseUrl" -}}
{{- if .Values.host -}} {{ printf "https://%s.%s" (include "app.kopBezeichner" .) .Values.baseUrl }}
{{- printf "%s" .Values.host -}}
{{- else if eq (include "app.kopEnvironment" . ) "prod" -}}
{{ printf "https://%s.ozg-sh.de" (include "app.kopBezeichner" .) }}
{{- else -}}
{{ printf "https://%s.%s.ozg-sh.de" (include "app.kopBezeichner" .) (include "app.kopEnvironment" . ) }}
{{- end -}}
{{- end -}} {{- end -}}
{{- define "app.keycloakClientId" -}} {{- define "app.keycloakClientId" -}}
......
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
{{- with .Values.ingressAnnotations }} annotations:
annotations: {{- toYaml . | nindent 4 }} cert-manager.io/cluster-issuer: letsencrypt-prod
{{- end }}
name: {{ include "app.name" . }} name: {{ include "app.name" . }}
namespace: {{ include "app.namespace" . }} namespace: {{ include "app.namespace" . }}
spec: spec:
{{- if ne (.Values).cluster_env "dataport"}}
ingressClassName: nginx
{{- end }}
rules: rules:
- http: - http:
paths: paths:
...@@ -21,3 +23,6 @@ spec: ...@@ -21,3 +23,6 @@ spec:
tls: tls:
- hosts: - hosts:
- {{ trimPrefix "https://" ( include "app.baseUrl" . ) }} - {{ trimPrefix "https://" ( include "app.baseUrl" . ) }}
{{- if ne (.Values).cluster_env "dataport" }}
secretName: {{ .Values.kop.bezeichner }}-{{ include "app.name" . }}-tls
{{- end }}
\ No newline at end of file
...@@ -2,6 +2,3 @@ kop: ...@@ -2,6 +2,3 @@ kop:
bundesland: sh bundesland: sh
bezeichner: helm bezeichner: helm
environment: test environment: test
sso:
apiPassword: test1234
cluster_env: ""
baseUrl: test.sh.ozg-cloud.de
sso:
serverUrl: https://sso.sh.ozg-cloud.de
imageCredentials: imageCredentials:
registry: docker.ozg-sh.de registry: docker.ozg-sh.de
username: kop username: kop
...@@ -11,11 +18,6 @@ image: ...@@ -11,11 +18,6 @@ image:
replicaCount: 2 # [default: 2] replicaCount: 2 # [default: 2]
ingressAnnotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
usermanagerName: user-manager usermanagerName: user-manager
# env: # env:
......
...@@ -6,11 +6,6 @@ templates: ...@@ -6,11 +6,6 @@ templates:
- templates/deployment.yaml - templates/deployment.yaml
tests: tests:
- it: should work - it: should work
set:
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: test
sso.apiPassword: test1234
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
......
...@@ -5,20 +5,16 @@ release: ...@@ -5,20 +5,16 @@ release:
templates: templates:
- templates/ingress.yaml - templates/ingress.yaml
tests: tests:
- it: check ingress annotaions if traefik v2 - it: check ingress annotaions for nginx
set:
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: test
asserts: asserts:
- isKind: - isKind:
of: Ingress of: Ingress
- equal: - equal:
path: metadata.annotations.[kubernetes.io/ingress.class] path: metadata.annotations.[cert-manager.io/cluster-issuer]
value: traefik value: letsencrypt-prod
- equal: - equal:
path: metadata.annotations.[traefik.ingress.kubernetes.io/router.entrypoints] path: spec.ingressClassName
value: websecure value: nginx
- equal: - equal:
path: metadata.annotations.[traefik.ingress.kubernetes.io/router.tls] path: spec.tls[0].secretName
value: "true" value: helm-goofy-tls
\ No newline at end of file
suite: test deployment suite: test deployment
release: release:
name: goofy name: goofy
namespace: sh-helm-prod namespace: sh-helm-test
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
tests: tests:
- it: check default values - it: check default values
set:
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: prod
sso.apiPassword: test1234
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
...@@ -18,27 +13,27 @@ tests: ...@@ -18,27 +13,27 @@ tests:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: grpc_client_pluto_address name: grpc_client_pluto_address
value: pluto.sh-helm-prod:9090 value: pluto.sh-helm-test:9090
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: spring_profiles_active name: spring_profiles_active
value: oc, prod value: oc, test
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: keycloak_realm name: keycloak_realm
value: sh-helm-prod value: sh-helm-test
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: keycloak_resource name: keycloak_resource
value: sh-helm-prod-goofy value: sh-helm-test-goofy
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: keycloak_auth-server-url name: keycloak_auth-server-url
value: https://sso.ozg-sh.de value: https://sso.sh.ozg-cloud.de
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
......
...@@ -8,11 +8,6 @@ templates: ...@@ -8,11 +8,6 @@ templates:
- templates/service.yaml - templates/service.yaml
tests: tests:
- it: check default labels - it: check default labels
set:
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: test
sso.apiPassword: test1234
asserts: asserts:
- equal: - equal:
path: metadata.labels.[app.kubernetes.io/instance] path: metadata.labels.[app.kubernetes.io/instance]
......
...@@ -6,11 +6,6 @@ templates: ...@@ -6,11 +6,6 @@ templates:
- templates/deployment.yaml - templates/deployment.yaml
tests: tests:
- it: should work - it: should work
set:
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: test
sso.apiPassword: test1234
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
......
...@@ -6,11 +6,6 @@ templates: ...@@ -6,11 +6,6 @@ templates:
- templates/deployment.yaml - templates/deployment.yaml
tests: tests:
- it: should work - it: should work
set:
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: test
sso.apiPassword: test1234
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
......
...@@ -6,17 +6,12 @@ templates: ...@@ -6,17 +6,12 @@ templates:
- templates/deployment.yaml - templates/deployment.yaml
tests: tests:
- it: check for some standard values - it: check for some standard values
set:
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: test
sso.apiPassword: test1234
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
- equal: - equal:
path: spec.template.spec.containers[0].image path: spec.template.spec.containers[0].image
value: "docker.ozg-sh.de/goofy:latest" value: "docker.ozg-sh.de/goofy:snapshot-latest"
- equal: - equal:
path: spec.template.spec.containers[0].imagePullPolicy path: spec.template.spec.containers[0].imagePullPolicy
value: Always value: Always
...@@ -44,15 +39,6 @@ tests: ...@@ -44,15 +39,6 @@ tests:
- equal: - equal:
path: spec.template.spec.containers[0].tty path: spec.template.spec.containers[0].tty
value: true value: true
- it: should add the port for metrics when scrapeMetrics is enabled
set:
kop.bundesland: sh
kop.bezeichner: kiel
kop.environment: dev
sso.apiPassword: test1234
asserts:
- isKind:
of: Deployment
- equal: - equal:
path: spec.template.spec.containers[0].ports[1].containerPort path: spec.template.spec.containers[0].ports[1].containerPort
value: 8081 value: 8081
...@@ -62,16 +48,3 @@ tests: ...@@ -62,16 +48,3 @@ tests:
- equal: - equal:
path: spec.template.spec.containers[0].ports[1].protocol path: spec.template.spec.containers[0].ports[1].protocol
value: TCP value: TCP
- it: should not add the port for metrics when scrapeMetrics is disabled
set:
kop.bundesland: sh
kop.bezeichner: kiel
kop.environment: dev
sso.apiPassword: test1234
asserts:
- isKind:
of: Deployment
- notContains:
path: spec.template.spec.containers[0].ports
content:
name: metrics
\ No newline at end of file
...@@ -6,11 +6,6 @@ templates: ...@@ -6,11 +6,6 @@ templates:
- templates/deployment.yaml - templates/deployment.yaml
tests: tests:
- it: should work - it: should work
set:
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: test
sso.apiPassword: test1234
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
...@@ -19,7 +14,7 @@ tests: ...@@ -19,7 +14,7 @@ tests:
value: 600 value: 600
- equal: - equal:
path: spec.replicas path: spec.replicas
value: 2 value: 5
- equal: - equal:
path: spec.revisionHistoryLimit path: spec.revisionHistoryLimit
value: 10 value: 10
......
suite: test deployment suite: test deployment
release: release:
name: goofy name: goofy
namespace: sh-helm-prod namespace: sh-helm-test
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
tests: tests:
- it: check default values - it: check default values
set:
sso.apiPassword: SicherheitGehtVor!!1!
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: prod
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
...@@ -18,52 +13,26 @@ tests: ...@@ -18,52 +13,26 @@ tests:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: keycloak_realm name: keycloak_realm
value: sh-helm-prod value: sh-helm-test
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: keycloak_resource name: keycloak_resource
value: sh-helm-prod-goofy value: sh-helm-test-goofy
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: keycloak_auth-server-url name: keycloak_auth-server-url
value: https://sso.ozg-sh.de value: https://sso.sh.ozg-cloud.de
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: goofy_keycloak_api_password name: goofy_keycloak_api_password
value: SicherheitGehtVor!!1! value: test1234
- it: check sso serverUrl for dev environment
set:
kop.bundesland: sh
kop.bezeichner: name
kop.environment: dev
sso.apiPassword: test1234
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: keycloak_auth-server-url
value: https://sso.dev.ozg-sh.de
- it: check sso serverUrl for test environment
set:
kop.bundesland: sh
kop.bezeichner: name
kop.environment: test
sso.apiPassword: test1234
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: keycloak_auth-server-url
value: https://sso.test.ozg-sh.de
- it: check realm with long namespace - it: check realm with long namespace
set: set:
kop.bundesland: sh kop.bezeichner: eins-zwei-drei
kop.bezeichner: eins-zwei
kop.environment: prod
sso.apiPassword: test1234
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
...@@ -71,4 +40,4 @@ tests: ...@@ -71,4 +40,4 @@ tests:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: keycloak_realm name: keycloak_realm
value: sh-eins-zwei-prod value: sh-eins-zwei-drei-test
\ No newline at end of file \ No newline at end of file
...@@ -6,11 +6,6 @@ templates: ...@@ -6,11 +6,6 @@ templates:
- templates/deployment.yaml - templates/deployment.yaml
tests: tests:
- it: check default values - it: check default values
set:
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: test
sso.apiPassword: test1234
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
......
...@@ -5,10 +5,6 @@ tests: ...@@ -5,10 +5,6 @@ tests:
- it: check customList - it: check customList
template: deployment.yaml template: deployment.yaml
set: set:
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: test
sso.apiPassword: test1234
env.customList: env.customList:
- name: my_test_environment_name - name: my_test_environment_name
value: "A test value" value: "A test value"
...@@ -20,11 +16,6 @@ tests: ...@@ -20,11 +16,6 @@ tests:
value: "A test value" value: "A test value"
- it: check customList test value is not set by default - it: check customList test value is not set by default
template: deployment.yaml template: deployment.yaml
set:
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: test
sso.apiPassword: test1234
asserts: asserts:
- notContains: - notContains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
......
...@@ -5,16 +5,12 @@ release: ...@@ -5,16 +5,12 @@ release:
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
tests: tests:
- it: should set the snapshot latest imageTag - it: should set the latest imageTag
set: set:
image.tag: snapshot-latest image.tag: latest
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: test
sso.apiPassword: test1234
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
- equal: - equal:
path: spec.template.spec.containers[0].image path: spec.template.spec.containers[0].image
value: docker.ozg-sh.de/goofy:snapshot-latest value: docker.ozg-sh.de/goofy:latest
\ No newline at end of file \ No newline at end of file
...@@ -8,10 +8,6 @@ tests: ...@@ -8,10 +8,6 @@ tests:
- it: should set the pluto name - it: should set the pluto name
set: set:
plutoName: my-test-pluto-name plutoName: my-test-pluto-name
kop.bundesland: sh
kop.bezeichner: helm
kop.environment: test
sso.apiPassword: test1234
asserts: asserts:
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
......
...@@ -7,14 +7,10 @@ templates: ...@@ -7,14 +7,10 @@ templates:
tests: tests:
- it: should set the replica count - it: should set the replica count
set: set:
kop.bundesland: sh replicaCount: 10
kop.bezeichner: helm
kop.environment: test
sso.apiPassword: test1234
replicaCount: 5
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
- equal: - equal:
path: spec.replicas path: spec.replicas
value: 5 value: 10
\ No newline at end of file \ No newline at end of file
...@@ -6,10 +6,7 @@ templates: ...@@ -6,10 +6,7 @@ templates:
tests: tests:
- it: test resources for prod environment - it: test resources for prod environment
set: set:
kop.bundesland: sh
kop.bezeichner: name
kop.environment: prod kop.environment: prod
sso.apiPassword: test1234
asserts: asserts:
- equal: - equal:
path: spec.template.spec.containers[0].resources.limits.cpu path: spec.template.spec.containers[0].resources.limits.cpu
...@@ -25,10 +22,7 @@ tests: ...@@ -25,10 +22,7 @@ tests:
value: 250Mi value: 250Mi
- it: test default resources - it: test default resources
set: set:
kop.bundesland: sh
kop.bezeichner: name
kop.environment: dev kop.environment: dev
sso.apiPassword: test1234
asserts: asserts:
- equal: - equal:
path: spec.template.spec.containers[0].resources.limits.cpu path: spec.template.spec.containers[0].resources.limits.cpu
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment