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

Merge branch 'master' into knecht-root-recht-stage

parents b79f0d4e 7a3ade1f
No related branches found
No related tags found
No related merge requests found
Showing
with 129 additions and 26 deletions
...@@ -30,6 +30,7 @@ templates: ...@@ -30,6 +30,7 @@ templates:
- deployment.yaml - deployment.yaml
set: set:
image.tag: latest image.tag: latest
ozgcloud.environment: test
tests: tests:
- it: validate default routing values without questions.yaml - it: validate default routing values without questions.yaml
asserts: asserts:
......
...@@ -28,6 +28,9 @@ release: ...@@ -28,6 +28,9 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
set:
ozgcloud.environment: test
tests: tests:
- it: should use afm-adapter service account name - it: should use afm-adapter service account name
set: set:
......
...@@ -27,6 +27,7 @@ release: ...@@ -27,6 +27,7 @@ release:
name: if-adapter name: if-adapter
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
tests: tests:
- it: should override spring profiles - it: should override spring profiles
set: set:
...@@ -40,6 +41,8 @@ tests: ...@@ -40,6 +41,8 @@ tests:
name: spring_profiles_active name: spring_profiles_active
value: oc,stage,ea value: oc,stage,ea
- it: should generate spring profiles - it: should generate spring profiles
set:
ozgcloud.environment: test
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
......
...@@ -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:
ozgcloud.environment: test
tests: tests:
- it: validate image type and container image - it: validate image type and container image
asserts: asserts:
......
...@@ -25,6 +25,11 @@ ...@@ -25,6 +25,11 @@
suite: test ingress creation dependent from values suite: test ingress creation dependent from values
templates: templates:
- templates/ingress.yaml - templates/ingress.yaml
set:
ozgcloud:
bezeichner: helm
tests: tests:
- it: create ingress by config - it: create ingress by config
set: set:
......
...@@ -25,6 +25,11 @@ ...@@ -25,6 +25,11 @@
suite: test ingress options suite: test ingress options
templates: templates:
- templates/ingress.yaml - templates/ingress.yaml
set:
ozgcloud:
bezeichner: helm
tests: tests:
- it: should create afm ingress tls - it: should create afm ingress tls
release: release:
......
...@@ -28,6 +28,9 @@ release: ...@@ -28,6 +28,9 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- templates/ingress.yaml - templates/ingress.yaml
set:
ozgcloud:
bezeichner: helm
tests: tests:
- it: should match basic data - it: should match basic data
asserts: asserts:
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
set -e set -e
helm template ./src/main/helm/ -f src/main/helm/test-values.yaml helm template ./src/main/helm/ -f src/test/helm-linter-values.yaml
helm lint -f src/test/helm/values/unit-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' -v '../../test/helm/values/unit-values.yaml' . cd src/main/helm && helm unittest -f '../../test/helm/*.yaml' .
\ No newline at end of file
{{/* vim: set filetype=mustache: */}} {{/* vim: set filetype=mustache: */}}
{{/* Truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec) */}} {{/* error check 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec) */}}
{{/* Name */}}
{{- define "app.name" -}}
{{- default .Release.Name | toString | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/* Namespace */}} {{/* Namespace */}}
{{- define "app.namespace" -}} {{- define "app.namespace" -}}
{{- default .Release.Namespace | toString | trunc 63 | trimSuffix "-" -}} {{- if gt (len (.Release.Namespace)) 63 -}}
{{- fail (printf ".Release.Namespace %s ist zu lang (max. 63 Zeichen)" .Release.Namespace) -}}
{{- end -}} {{- end -}}
{{ printf "%s" .Release.Namespace }}
{{/* Version */}}
{{- define "app.version" -}}
{{- default .Chart.Version | toString | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{/* Chart: Name + Version */}} {{/* Chart: Name + Version */}}
{{- define "app.chart" -}} {{- define "app.chart" -}}
{{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- if gt (len (printf "%s-%s" .Chart.Name .Chart.Version)) 63 -}}
{{- fail (printf ".Chart.Name-.Chart.Version %s-%s ist zu lang (max. 63 Zeichen)" .Chart.Name .Chart.Version) -}}
{{- end -}}
{{ printf "%s-%s" .Chart.Name .Chart.Version }}
{{- end -}} {{- end -}}
{{/* Managed-by -> On Helm, this value is always Helm */}} {{/* Managed-by -> On Helm, this value is always Helm */}}
{{- define "app.managedBy" -}} {{- define "app.managedBy" -}}
{{- default .Release.Service | toString | trunc 63 | trimSuffix "-" -}} {{- if gt (len (.Release.Service)) 63 -}}
{{- fail (printf ".Release.Service %s ist zu lang (max. 63 Zeichen)" .Release.Service) -}}
{{- end -}}
{{ printf "%s" .Release.Service }}
{{- end -}} {{- end -}}
{{/* Default Labels: Helm recommended best-practice labels https://helm.sh/docs/chart_best_practices/labels/ */}} {{/* Default Labels: Helm recommended best-practice labels https://helm.sh/docs/chart_best_practices/labels/ */}}
{{- define "app.defaultLabels" }} {{- define "app.defaultLabels" }}
app.kubernetes.io/instance: {{ include "app.name" . }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ include "app.managedBy" . }} app.kubernetes.io/managed-by: {{ include "app.managedBy" . }}
app.kubernetes.io/name: {{ include "app.name" . }} app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/part-of: ozgcloud app.kubernetes.io/part-of: ozgcloud
app.kubernetes.io/version: {{ include "app.version" . }} app.kubernetes.io/version: {{ .Chart.Version }}
app.kubernetes.io/namespace: {{ include "app.namespace" . }} app.kubernetes.io/namespace: {{ include "app.namespace" . }}
helm.sh/chart: {{ include "app.chart" . }} helm.sh/chart: {{ include "app.chart" . }}
{{- end -}} {{- end -}}
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: {{ include "app.name" . }}-image-pull-secret name: {{ .Release.Name }}-image-pull-secret
namespace: {{ include "app.namespace" . }} namespace: {{ include "app.namespace" . }}
type: kubernetes.io/dockerconfigjson type: kubernetes.io/dockerconfigjson
data: data:
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
apiVersion: batch/v1 apiVersion: batch/v1
kind: CronJob kind: CronJob
metadata: metadata:
name: {{ include "app.name" . }} name: {{ .Release.Name }}
namespace: {{ include "app.namespace" . }} namespace: {{ include "app.namespace" . }}
labels: labels:
{{- include "app.defaultLabels" . | indent 4 }} {{- include "app.defaultLabels" . | indent 4 }}
...@@ -166,7 +166,7 @@ spec: ...@@ -166,7 +166,7 @@ spec:
{{- if .Values.imagePullSecret }} {{- if .Values.imagePullSecret }}
- name: {{ .Values.imagePullSecret }} - name: {{ .Values.imagePullSecret }}
{{ else }} {{ else }}
- name: {{ include "app.name" . }}-image-pull-secret - name: {{ .Release.Name }}-image-pull-secret
{{- end }} {{- end }}
{{- if (.Values.securityContext).fsGroup }} {{- if (.Values.securityContext).fsGroup }}
securityContext: securityContext:
......
...@@ -9,6 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,6 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import de.ozgcloud.eingang.common.formdata.FormData; import de.ozgcloud.eingang.common.formdata.FormData;
import de.ozgcloud.eingang.common.formdata.FormHeader;
import de.ozgcloud.eingang.common.vorgang.VorgangNummerSupplier;
import lombok.NonNull; import lombok.NonNull;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
...@@ -17,11 +19,14 @@ import lombok.extern.log4j.Log4j2; ...@@ -17,11 +19,14 @@ import lombok.extern.log4j.Log4j2;
class XtaService { class XtaService {
static final String DFOERDERMITTELANTRAG_MESSAGE_TYPE = "Geschaeftsgang.Geschaeftsgang.0201"; static final String DFOERDERMITTELANTRAG_MESSAGE_TYPE = "Geschaeftsgang.Geschaeftsgang.0201";
static final int VORGANG_NUMMER_SUFFIX_LENGTH = 4;
@Autowired @Autowired
private XtaRemoteService remoteService; private XtaRemoteService remoteService;
@Autowired @Autowired
private XtaMessageMapper mapper; private XtaMessageMapper mapper;
@Autowired
private VorgangNummerSupplier vorgangNummerSupplier;
public Stream<FormData> getMessages() { public Stream<FormData> getMessages() {
return createXtaMessageStream().filter(this::filterByMessageType).map(this::getFormData); return createXtaMessageStream().filter(this::filterByMessageType).map(this::getFormData);
...@@ -45,7 +50,16 @@ class XtaService { ...@@ -45,7 +50,16 @@ class XtaService {
public FormData getFormData(@NonNull XtaMessageMetaData metaData) { public FormData getFormData(@NonNull XtaMessageMetaData metaData) {
var msg = remoteService.getMessage(metaData.getMessageId()); var msg = remoteService.getMessage(metaData.getMessageId());
return mapper.toFormData(msg.toBuilder().metaData(metaData).build()); var formData = mapper.toFormData(msg.toBuilder().metaData(metaData).build());
return updateHeader(formData);
}
FormData updateHeader(FormData formData) {
return formData.toBuilder().header(setVorgangNummer(formData.getHeader())).build();
}
FormHeader setVorgangNummer(FormHeader formHeader) {
return formHeader.toBuilder().vorgangNummer(vorgangNummerSupplier.get(VORGANG_NUMMER_SUFFIX_LENGTH)).build();
} }
public void acknowledgeReceive(@NonNull XtaMessageId messageId) { public void acknowledgeReceive(@NonNull XtaMessageId messageId) {
......
...@@ -28,6 +28,8 @@ templates: ...@@ -28,6 +28,8 @@ templates:
release: release:
name: xta-adapter name: xta-adapter
namespace: helm-test namespace: helm-test
set:
ozgcloud.environment: test
tests: tests:
- it: should use service account with default name - it: should use service account with default name
set: set:
......
...@@ -22,17 +22,34 @@ ...@@ -22,17 +22,34 @@
# unter der Lizenz sind dem Lizenztext zu entnehmen. # unter der Lizenz sind dem Lizenztext zu entnehmen.
# #
baseUrl: test.sh.ozg-cloud.de suite: test less than 63 chars
release:
name: xta-adapter
namespace: sh-helm-test
set:
ozgcloud.environment: test
chart:
name: xta-adapter
ozgcloud: templates:
bundesland: sh - templates/xta_adapter_cronjob.yaml
environment: test
bezeichner: helm
routing: tests:
targetVorgangManagerName: vorgang-manager - it: should fail on .Release.Namespace length longer than 63 characters
release:
image: namespace: test1234567890123123456789012345678901234567890123456789012345678901234567890123456789012345678904567890
repo: docker.ozg-sh.de asserts:
name: intelliform-adapter - failedTemplate:
tag: latest errorMessage: .Release.Namespace test1234567890123123456789012345678901234567890123456789012345678901234567890123456789012345678904567890 ist zu lang (max. 63 Zeichen)
- it: should not fail on .Release.Namespace length less than 63 characters
asserts:
- notFailedTemplate: {}
- it: should fail on .Chart.Name-.Chart.Version length longer than 63 characters
chart:
version: 1.0-test1234567890123123456789012345678901234567890123456789012345678901234567890123456789012345678904567890
asserts:
- failedTemplate:
errorMessage: .Chart.Name-.Chart.Version xta-adapter-1.0-test1234567890123123456789012345678901234567890123456789012345678901234567890123456789012345678904567890 ist zu lang (max. 63 Zeichen)
- it: should not fail on .Chart.Name-.Chart.Version length less than 63 characters
asserts:
- notFailedTemplate: {}
\ No newline at end of file
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
suite: xta-adapter bindings suite: xta-adapter bindings
templates: templates:
- templates/xta_adapter_cronjob.yaml - templates/xta_adapter_cronjob.yaml
set:
ozgcloud.environment: test
tests: tests:
- it: should have temp-dir volume - it: should have temp-dir volume
asserts: asserts:
......
...@@ -28,6 +28,9 @@ templates: ...@@ -28,6 +28,9 @@ templates:
release: release:
name: xta-adapter name: xta-adapter
namespace: helm-test namespace: helm-test
set:
ozgcloud.environment: dev
tests: tests:
- it: validate basic data - it: validate basic data
template: xta_adapter_cronjob.yaml template: xta_adapter_cronjob.yaml
...@@ -70,7 +73,6 @@ tests: ...@@ -70,7 +73,6 @@ tests:
template: xta_adapter_cronjob.yaml template: xta_adapter_cronjob.yaml
set: set:
image.name: xta-adapter image.name: xta-adapter
ozgcloud.environment: dev
asserts: asserts:
- equal: - equal:
path: spec.schedule path: spec.schedule
...@@ -79,7 +81,6 @@ tests: ...@@ -79,7 +81,6 @@ tests:
template: xta_adapter_cronjob.yaml template: xta_adapter_cronjob.yaml
set: set:
image.name: xta-adapter image.name: xta-adapter
ozgcloud.environment: dev
asserts: asserts:
- equal: - equal:
path: spec.jobTemplate.spec.template.spec.containers[0].image path: spec.jobTemplate.spec.template.spec.containers[0].image
......
...@@ -28,6 +28,8 @@ templates: ...@@ -28,6 +28,8 @@ templates:
release: release:
name: xta-adapter name: xta-adapter
namespace: helm-test namespace: helm-test
set:
ozgcloud.environment: test
tests: tests:
- it: check dummy livenessProbe default disabled - it: check dummy livenessProbe default disabled
template: xta_adapter_cronjob.yaml template: xta_adapter_cronjob.yaml
......
...@@ -28,6 +28,8 @@ templates: ...@@ -28,6 +28,8 @@ templates:
release: release:
name: xta-adapter name: xta-adapter
namespace: helm-test namespace: helm-test
set:
ozgcloud.environment: test
tests: tests:
- it: check default env - it: check default env
template: xta_adapter_cronjob.yaml template: xta_adapter_cronjob.yaml
......
...@@ -28,8 +28,12 @@ release: ...@@ -28,8 +28,12 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- templates/xta_adapter_cronjob.yaml - templates/xta_adapter_cronjob.yaml
set:
ozgcloud.environment: dev
tests: tests:
- it: should use default imagePull secret - it: should use default imagePull secret
set:
asserts: asserts:
- equal: - equal:
path: spec.jobTemplate.spec.template.spec.imagePullSecrets[0].name path: spec.jobTemplate.spec.template.spec.imagePullSecrets[0].name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment