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

OZG-4923-keycloak operator imagePullSecret aus Namespace nutzen

parent 76e62ca2
No related branches found
No related tags found
No related merge requests found
Showing
with 20 additions and 101 deletions
...@@ -4,4 +4,4 @@ set -e ...@@ -4,4 +4,4 @@ set -e
helm template ./src/main/helm/ -f src/test/helm/linter_values.yaml helm template ./src/main/helm/ -f src/test/helm/linter_values.yaml
helm lint -f src/test/helm/linter_values.yaml ./src/main/helm/ helm lint -f src/test/helm/linter_values.yaml ./src/main/helm/
cd src/main/helm && helm unittest -f '../../test/helm/*/*.yaml' . cd src/main/helm && helm unittest -f '../../test/helm/**/*test.yaml' .
{{- define "app.imagePullSecret" }}
{{- with .Values.imageCredentials }}
{{- printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}}" .registry .username .password .email (printf "%s:%s" .username .password | b64enc) | b64enc }}
{{- end }}
{{- end }}
{{- define "app.matchLabels" }} {{- define "app.matchLabels" }}
app.kubernetes.io/name: {{ .Release.Name }} app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/namespace: {{ .Release.Namespace }} app.kubernetes.io/namespace: {{ .Release.Namespace }}
......
...@@ -88,6 +88,6 @@ spec: ...@@ -88,6 +88,6 @@ spec:
dnsConfig: {} dnsConfig: {}
dnsPolicy: ClusterFirst dnsPolicy: ClusterFirst
imagePullSecrets: imagePullSecrets:
- name: {{ .Release.Name }}-image-pull-secret - name: {{ required "imagePullSecret must be set" .Values.imagePullSecret }}
restartPolicy: Always restartPolicy: Always
#
# Copyright (C) 2022 Das Land Schleswig-Holstein vertreten durch den
# Ministerpräsidenten des Landes Schleswig-Holstein
# Staatskanzlei
# Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
#
# Lizenziert unter der EUPL, Version 1.2 oder - sobald
# diese von der Europäischen Kommission genehmigt wurden -
# Folgeversionen der EUPL ("Lizenz");
# Sie dürfen dieses Werk ausschließlich gemäß
# dieser Lizenz nutzen.
# Eine Kopie der Lizenz finden Sie hier:
#
# https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
#
# Sofern nicht durch anwendbare Rechtsvorschriften
# gefordert oder in schriftlicher Form vereinbart, wird
# die unter der Lizenz verbreitete Software "so wie sie
# ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
# ausdrücklich oder stillschweigend - verbreitet.
# Die sprachspezifischen Genehmigungen und Beschränkungen
# unter der Lizenz sind dem Lizenztext zu entnehmen.
#
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-image-pull-secret
namespace: {{ .Release.Namespace }}
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: {{ include "app.imagePullSecret" . }}
\ No newline at end of file
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
suite: test environments suite: test environments
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
set:
imagePullSecret: "docker-secret"
tests: tests:
- it: check customList - it: check customList
template: deployment.yaml template: deployment.yaml
......
...@@ -28,6 +28,8 @@ release: ...@@ -28,6 +28,8 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
set:
imagePullSecret: "docker-secret"
tests: tests:
- it: check matchlabels - it: check matchlabels
set: set:
...@@ -36,15 +38,8 @@ tests: ...@@ -36,15 +38,8 @@ tests:
tag: latest tag: latest
asserts: asserts:
- equal: - equal:
path: spec.selector.matchLabels.[app.kubernetes.io/name] path: spec.selector.matchLabels["app.kubernetes.io/name"]
value: ozgcloud-keycloak-operator
- equal:
path: spec.selector.matchLabels.[app.kubernetes.io/namespace]
value: sh-helm-test
- equal:
path: spec.template.metadata.labels.[app.kubernetes.io/name]
value: ozgcloud-keycloak-operator value: ozgcloud-keycloak-operator
- equal: - equal:
path: spec.template.metadata.labels.[app.kubernetes.io/namespace] path: spec.selector.matchLabels["app.kubernetes.io/namespace"]
value: sh-helm-test value: sh-helm-test
\ No newline at end of file
...@@ -28,6 +28,8 @@ release: ...@@ -28,6 +28,8 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
set:
imagePullSecret: "docker-secret"
tests: tests:
- it: check default labels - it: check default labels
set: set:
...@@ -36,14 +38,8 @@ tests: ...@@ -36,14 +38,8 @@ tests:
tag: latest tag: latest
asserts: asserts:
- equal: - equal:
path: metadata.labels.[app.kubernetes.io/instance] path: metadata.labels["app.kubernetes.io/name"]
value: ozgcloud-keycloak-operator
- equal:
path: metadata.labels.[app.kubernetes.io/name]
value: ozgcloud-keycloak-operator value: ozgcloud-keycloak-operator
- equal: - equal:
path: metadata.labels.[app.kubernetes.io/part-of] path: metadata.labels["app.kubernetes.io/namespace"]
value: ozg
- equal:
path: metadata.labels.[app.kubernetes.io/namespace]
value: sh-helm-test value: sh-helm-test
\ No newline at end of file
...@@ -34,7 +34,8 @@ tests: ...@@ -34,7 +34,8 @@ tests:
image: image:
name: hase name: hase
tag: latest tag: latest
imagePullSecret: imagePullSecret
asserts: asserts:
- equal: - equal:
path: spec.template.spec.imagePullSecrets[0].name path: spec.template.spec.imagePullSecrets[0].name
value: ozgcloud-keycloak-operator-image-pull-secret value: imagePullSecret
...@@ -27,6 +27,8 @@ release: ...@@ -27,6 +27,8 @@ release:
name: afm-adapter name: afm-adapter
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
set:
imagePullSecret: "docker-secret"
tests: tests:
- it: test resources - it: test resources
set: set:
......
...@@ -28,6 +28,8 @@ release: ...@@ -28,6 +28,8 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- deployment.yaml - deployment.yaml
set:
imagePullSecret: "docker-secret"
tests: tests:
- it: validate image type and container image - it: validate image type and container image
set: set:
......
#
# Copyright (C) 2022 Das Land Schleswig-Holstein vertreten durch den
# Ministerpräsidenten des Landes Schleswig-Holstein
# Staatskanzlei
# Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
#
# Lizenziert unter der EUPL, Version 1.2 oder - sobald
# diese von der Europäischen Kommission genehmigt wurden -
# Folgeversionen der EUPL ("Lizenz");
# Sie dürfen dieses Werk ausschließlich gemäß
# dieser Lizenz nutzen.
# Eine Kopie der Lizenz finden Sie hier:
#
# https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
#
# Sofern nicht durch anwendbare Rechtsvorschriften
# gefordert oder in schriftlicher Form vereinbart, wird
# die unter der Lizenz verbreitete Software "so wie sie
# ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
# ausdrücklich oder stillschweigend - verbreitet.
# Die sprachspezifischen Genehmigungen und Beschränkungen
# unter der Lizenz sind dem Lizenztext zu entnehmen.
#
suite: test image pull secret
templates:
- templates/image_pull_secret.yaml
release:
name: intelliform-adaptero
namespace: helm-test
tests:
- it: should match basic data
asserts:
- containsDocument:
kind: Secret
apiVersion: v1
- equal:
path: metadata.name
value: intelliform-adaptero-image-pull-secret
- equal:
path: metadata.namespace
value: helm-test
...@@ -2,3 +2,4 @@ ...@@ -2,3 +2,4 @@
image: image:
name: test name: test
tag: latest tag: latest
imagePullSecret: "docker-secret"
\ 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