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

Merge branch 'master' into release

parents 61c9fa0d 18b8927a
No related branches found
No related tags found
No related merge requests found
......@@ -159,7 +159,7 @@ pipeline {
dir('src/main/helm') {
sh "helm lint -f ../../test/unit-values.yaml"
sh "helm unittest -f '../../test/helm/*.yaml' -v '../../test/unit-values.yaml' ."
sh "helm unittest --helm3 -f '../../test/helm/*.yaml' -v '../../test/unit-values.yaml' ."
sh "helm package --version=${HELM_CHART_VERSION} ."
......
#!/bin/sh
set -e
helm template ./src/main/helm/ -f src/test/unit-values.yaml
helm lint -f src/test/unit-values.yaml ./src/main/helm/
cd src/main/helm && helm unittest --helm3 -f '../../test/helm/*.yaml' -v '../../test/unit-values.yaml' .
\ No newline at end of file
#
# 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.
#
{{- if not (.Values.networkPolicy).disabled }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: network-policy-user-manager
namespace: {{ .Release.Namespace }}
spec:
podSelector:
matchLabels:
component: user-manager
policyTypes:
- Ingress
- Egress
ingress:
- ports:
- port: 8080
{{- with (.Values.networkPolicy).additionalIngressConfig }}
- from:
{{ toYaml . | indent 8 }}
{{- end }}
egress:
- to:
- podSelector:
matchLabels:
component: ozg-mongodb
ports:
- port: 27017
protocol: TCP
# public keycloak ip
- to:
- ipBlock:
cidr: {{ required "Keycloak public IP must be set" (.Values.networkPolicy).ssoPublicIp }}
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
{{- end }}
......@@ -39,5 +39,4 @@ tests:
more_set_headers "Access-Control-Allow-Methods: GET,PATCH,OPTIONS";
more_set_headers "Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-XSRF-TOKEN";
more_set_headers "Access-Control-Expose-Headers: Content-Length,Content-Range";
more_set_headers "Access-Control-Allow-Origin: https://helm.test.sh.ozg-cloud.de";
#
# 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: network policy test
release:
namespace: by-helm-test
templates:
- templates/network_policy.yaml
tests:
- it: should match apiVersion
asserts:
- isAPIVersion:
of: networking.k8s.io/v1
- it: should match kind
asserts:
- isKind:
of: NetworkPolicy
- it: validate metadata
asserts:
- equal:
path: metadata
value:
name: network-policy-user-manager
namespace: by-helm-test
- it: validate spec
asserts:
- equal:
path: spec
value:
podSelector:
matchLabels:
component: user-manager
policyTypes:
- Ingress
- Egress
ingress:
- ports:
- port: 8080
egress:
- to:
- podSelector:
matchLabels:
component: ozg-mongodb
ports:
- port: 27017
protocol: TCP
# public keycloak ip
- to:
- ipBlock:
cidr: 51.89.117.53/32
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
- it: add ingress rule by values
set:
networkPolicy:
additionalIngressConfig:
- podSelector:
matchLabels:
component: client2
asserts:
- equal:
path: spec.ingress
value:
- ports:
- port: 8080
- from:
- podSelector:
matchLabels:
component: client2
- it: test network policy disabled
set:
networkPolicy:
disabled: true
asserts:
- hasDocuments:
count: 0
- it: test network policy unset should be disabled
set:
networkPolicy:
disabled: false
asserts:
- hasDocuments:
count: 1
\ No newline at end of file
......@@ -34,3 +34,6 @@ kop:
sso:
serverUrl: sso.test.sh.ozg-cloud.de
networkPolicy:
ssoPublicIp: 51.89.117.53/32
\ 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