diff --git a/charts/registry/Chart.yaml b/charts/registry/Chart.yaml index 56c3952e..b3228bff 100644 --- a/charts/registry/Chart.yaml +++ b/charts/registry/Chart.yaml @@ -26,7 +26,7 @@ sources: - https://github.com/eclipse-tractusx/sldt-digital-twin-registry type: application -version: 0.3.31 +version: 0.3.32 appVersion: 0.3.23 dependencies: diff --git a/charts/registry/README.md b/charts/registry/README.md index 005a4d42..c5b9de0b 100644 --- a/charts/registry/README.md +++ b/charts/registry/README.md @@ -30,57 +30,63 @@ helm install registry -n semantics charts/registry ## Values -| Key | Type | Default | Description | -|-----|------|---------|-------------| -| enableKeycloak | bool | `true` | | -| enablePostgres | bool | `true` | | -| keycloak.args[0] | string | `"kc.sh import --file /opt/keycloak/data/import/default-realm-import.json; kc.sh start-dev --hostname=registry-keycloak --hostname-strict=false --proxy=edge"` | | -| keycloak.auth.adminPassword | string | `"admin"` | | -| keycloak.auth.adminUser | string | `"admin"` | | -| keycloak.command[0] | string | `"/bin/sh"` | | -| keycloak.command[1] | string | `"-c"` | | -| keycloak.externalDatabase.existingSecret | string | `"keycloak-database-credentials"` | | -| keycloak.extraVolumeMounts[0].mountPath | string | `"/opt/keycloak/data/import/default-realm-import.json"` | | -| keycloak.extraVolumeMounts[0].name | string | `"init-script-vol"` | | -| keycloak.extraVolumeMounts[0].subPath | string | `"default-realm-import.json"` | | -| keycloak.extraVolumes[0].configMap.name | string | `"init-script-vol"` | | -| keycloak.extraVolumes[0].name | string | `"init-script-vol"` | | -| keycloak.fullnameOverride | string | `"registry-keycloak"` | | -| keycloak.postgresql.enabled | bool | `false` | | -| keycloak.service.type | string | `"ClusterIP"` | | -| postgresql.auth.database | string | `"default-database"` | | -| postgresql.auth.password | string | `"password"` | | -| postgresql.auth.username | string | `"default-user"` | | -| postgresql.primary.persistence.enabled | bool | `true` | | -| postgresql.primary.persistence.size | string | `"50Gi"` | | -| postgresql.service.ports.postgresql | int | `5432` | | -| registry.authentication | bool | `true` | | -| registry.containerPort | int | `4243` | | -| registry.dataSource.driverClassName | string | `"org.postgresql.Driver"` | | -| registry.dataSource.password | string | `""` | | -| registry.dataSource.sqlInitPlatform | string | `"pg"` | | -| registry.dataSource.url | string | `"jdbc:postgresql://database:5432"` | | -| registry.dataSource.user | string | `"default-user"` | | -| registry.host | string | `"minikube"` | | -| registry.idpClientId | string | `"default-client"` | | -| registry.idpIssuerUri | string | `""` | | -| registry.image.registry | string | `"docker.io"` | | -| registry.image.repository | string | `"tractusx/sldt-digital-twin-registry"` | | -| registry.image.version | string | `""` | | -| registry.imagePullPolicy | string | `"IfNotPresent"` | | -| registry.ingress.annotations | object | `{}` | | -| registry.ingress.className | string | `"nginx"` | | -| registry.ingress.enabled | bool | `false` | | -| registry.ingress.tls | bool | `false` | | -| registry.ingress.urlPrefix | string | `"/semantics/registry"` | | -| registry.replicaCount | int | `1` | | -| registry.resources.limits.memory | string | `"1024Mi"` | | -| registry.resources.requests.memory | string | `"512Mi"` | | -| registry.service.port | int | `8080` | | -| registry.service.type | string | `"ClusterIP"` | | -| registry.tenantId | string | `"default-tenant"` | | -| registry.externalSubjectIdWildcardPrefix | string | `PUBLIC_READABLE` | | -| registry.externalSubjectIdWildcardAllowedTypes | string | `manufacturerPartId,assetLifecyclePhase` | | +| Key | Type | Default | Description | +|------------------------------------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------| +| enableKeycloak | bool | `true` | | +| enablePostgres | bool | `true` | | +| keycloak.args[0] | string | `"kc.sh import --file /opt/keycloak/data/import/default-realm-import.json; kc.sh start-dev --hostname=registry-keycloak --hostname-strict=false --proxy=edge"` | | +| keycloak.auth.adminPassword | string | `"admin"` | | +| keycloak.auth.adminUser | string | `"admin"` | | +| keycloak.command[0] | string | `"/bin/sh"` | | +| keycloak.command[1] | string | `"-c"` | | +| keycloak.externalDatabase.existingSecret | string | `"keycloak-database-credentials"` | | +| keycloak.extraVolumeMounts[0].mountPath | string | `"/opt/keycloak/data/import/default-realm-import.json"` | | +| keycloak.extraVolumeMounts[0].name | string | `"init-script-vol"` | | +| keycloak.extraVolumeMounts[0].subPath | string | `"default-realm-import.json"` | | +| keycloak.extraVolumes[0].configMap.name | string | `"init-script-vol"` | | +| keycloak.extraVolumes[0].name | string | `"init-script-vol"` | | +| keycloak.fullnameOverride | string | `"registry-keycloak"` | | +| keycloak.postgresql.enabled | bool | `false` | | +| keycloak.service.type | string | `"ClusterIP"` | | +| postgresql.auth.database | string | `"default-database"` | | +| postgresql.auth.password | string | `"password"` | | +| postgresql.auth.username | string | `"default-user"` | | +| postgresql.primary.persistence.enabled | bool | `true` | | +| postgresql.primary.persistence.size | string | `"50Gi"` | | +| postgresql.service.ports.postgresql | int | `5432` | | +| registry.authentication | bool | `true` | | +| registry.containerPort | int | `4243` | | +| registry.dataSource.driverClassName | string | `"org.postgresql.Driver"` | | +| registry.dataSource.password | string | `""` | | +| registry.dataSource.sqlInitPlatform | string | `"pg"` | | +| registry.dataSource.url | string | `"jdbc:postgresql://database:5432"` | | +| registry.dataSource.user | string | `"default-user"` | | +| registry.host | string | `"minikube"` | | +| registry.idpClientId | string | `"default-client"` | | +| registry.idpIssuerUri | string | `""` | | +| registry.image.registry | string | `"docker.io"` | | +| registry.image.repository | string | `"tractusx/sldt-digital-twin-registry"` | | +| registry.image.version | string | `""` | | +| registry.imagePullPolicy | string | `"IfNotPresent"` | | +| registry.ingress.annotations | object | `{}` | | +| registry.ingress.className | string | `"nginx"` | | +| registry.ingress.enabled | bool | `false` | | +| registry.ingress.tls | bool | `false` | | +| registry.ingress.urlPrefix | string | `"/semantics/registry"` | | +| registry.replicaCount | int | `1` | | +| registry.resources.limits.memory | string | `"1024Mi"` | | +| registry.resources.requests.memory | string | `"512Mi"` | | +| registry.service.port | int | `8080` | | +| registry.service.type | string | `"ClusterIP"` | | +| registry.tenantId | string | `"default-tenant"` | | +| registry.externalSubjectIdWildcardPrefix | string | `PUBLIC_READABLE` | | +| registry.externalSubjectIdWildcardAllowedTypes | string | `manufacturerPartId,assetLifecyclePhase` | | +| registry.livenessProbe.initialDelaySeconds | int | `100` | | +| registry.livenessProbe.failureThreshold | int | `3` | | +| registry.livenessProbe.periodSeconds | int | `3` | | +| registry.readinessProbe.initialDelaySeconds | int | `100` | | +| registry.readinessProbe.failureThreshold | int | `3` | | +| registry.readinessProbe.periodSeconds | int | `3` | | ---------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0) diff --git a/charts/registry/templates/_helpers.tpl b/charts/registry/templates/_helpers.tpl index e69de29b..b6cf6732 100644 --- a/charts/registry/templates/_helpers.tpl +++ b/charts/registry/templates/_helpers.tpl @@ -0,0 +1,48 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "dtr.name" -}} +{{- default .Chart.Name .Values.nameOverride | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end }} + +{{/* +Create a default fully qualified app name. +If release name contains chart name it will be used as a full name. +*/}} +{{- define "dtr.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "dtr.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "dtr.labels" -}} +helm.sh/chart: {{ include "dtr.chart" . }} +{{ include "dtr.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + + +{{- define "dtr.selectorLabels" -}} +app.kubernetes.io/name: {{ include "dtr.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/charts/registry/templates/keycloak/database-credentials.yaml b/charts/registry/templates/keycloak/database-credentials.yaml index 194260c6..4f780ab8 100644 --- a/charts/registry/templates/keycloak/database-credentials.yaml +++ b/charts/registry/templates/keycloak/database-credentials.yaml @@ -22,7 +22,7 @@ apiVersion: v1 kind: Secret metadata: - name: keycloak-database-credentials + name: {{ .Values.keycloak.externalDatabase.existingSecret }} type: Opaque data: db-host: {{ printf "%s-postgresql" .Release.Name | b64enc }} diff --git a/charts/registry/templates/keycloak/init-script-configmap.yaml b/charts/registry/templates/keycloak/init-script-configmap.yaml index 6aea75d8..58e5fdee 100644 --- a/charts/registry/templates/keycloak/init-script-configmap.yaml +++ b/charts/registry/templates/keycloak/init-script-configmap.yaml @@ -20,7 +20,7 @@ kind: ConfigMap apiVersion: v1 metadata: - name: init-script-vol + name: {{ include "dtr.fullname" . }}-keycloak-configmap data: default-realm-import.json: |- {{ .Files.Get "config/default-realm-import.json" | indent 4 }} diff --git a/charts/registry/templates/registry/registry-deployment.yaml b/charts/registry/templates/registry/registry-deployment.yaml index a3d51946..4f201526 100644 --- a/charts/registry/templates/registry/registry-deployment.yaml +++ b/charts/registry/templates/registry/registry-deployment.yaml @@ -18,27 +18,26 @@ # SPDX-License-Identifier: Apache-2.0 ############################################################### -{{- $deployment_name := printf "cx-%s-registry" .Release.Name }} -{{- $sec_name := printf "%s-sec" $deployment_name }} -{{- $svc_name := printf "%s-svc" $deployment_name }} apiVersion: apps/v1 kind: Deployment metadata: - name: {{ $deployment_name }} + name: {{ include "dtr.fullname" . }} + labels: + {{- include "dtr.labels" . | nindent 4 }} spec: replicas: {{ .Values.registry.replicaCount }} selector: matchLabels: - app: {{ $deployment_name }} + {{- include "dtr.selectorLabels" . | nindent 6 }} template: metadata: labels: - app: {{ $deployment_name }} + {{- include "dtr.selectorLabels" . | nindent 8 }} spec: securityContext: runAsUser: 100 containers: - - name: {{ $deployment_name }} + - name: {{ .Chart.Name }} image: {{ .Values.registry.image.registry }}/{{ .Values.registry.image.repository }}:{{ .Values.registry.image.version | default .Chart.AppVersion }} imagePullPolicy: {{ .Values.registry.imagePullPolicy }} securityContext: @@ -58,19 +57,19 @@ spec: httpGet: path: /actuator/health/liveness port: {{ .Values.registry.containerPort }} - initialDelaySeconds: 100 - periodSeconds: 3 - failureThreshold: 3 + initialDelaySeconds: {{ .Values.registry.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.registry.livenessProbe.periodSeconds }} + failureThreshold: {{ .Values.registry.livenessProbe.failureThreshold }} readinessProbe: httpGet: path: /actuator/health/readiness port: {{ .Values.registry.containerPort }} - initialDelaySeconds: 60 - periodSeconds: 3 - failureThreshold: 3 + initialDelaySeconds: {{ .Values.registry.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.registry.readinessProbe.periodSeconds }} + failureThreshold: {{ .Values.registry.readinessProbe.failureThreshold }} envFrom: - secretRef: - name: {{ $sec_name }} + name: {{ include "dtr.fullname" . }} resources: {{ .Values.registry.resources | toYaml | indent 12 }} imagePullSecrets: diff --git a/charts/registry/templates/registry/registry-ingress.yaml b/charts/registry/templates/registry/registry-ingress.yaml index ff7f5c06..76769bbe 100644 --- a/charts/registry/templates/registry/registry-ingress.yaml +++ b/charts/registry/templates/registry/registry-ingress.yaml @@ -19,17 +19,14 @@ # SPDX-License-Identifier: Apache-2.0 ############################################################### -{{- $deployment_name := printf "cx-%s-registry" .Release.Name }} -{{- $svc_name := printf "%s-svc" $deployment_name }} -{{- $ingr_name := printf "%s-ingr" $deployment_name }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: {{ $ingr_name }} + name: {{ include "dtr.fullname" . }} annotations: {{ .Values.registry.ingress.annotations | toYaml | indent 4 }} labels: - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + {{- include "dtr.labels" . | nindent 4 }} spec: ingressClassName: {{ .Values.registry.ingress.className }} {{- if .Values.registry.ingress.tls }} @@ -46,7 +43,7 @@ spec: pathType: Prefix backend: service: - name: {{ $svc_name }} + name: {{ include "dtr.fullname" . }} port: number: {{ .Values.registry.service.port }} {{- end}} diff --git a/charts/registry/templates/registry/registry-secret.yaml b/charts/registry/templates/registry/registry-secret.yaml index 029e5625..13131b3d 100644 --- a/charts/registry/templates/registry/registry-secret.yaml +++ b/charts/registry/templates/registry/registry-secret.yaml @@ -18,12 +18,10 @@ # SPDX-License-Identifier: Apache-2.0 ############################################################### -{{- $deployment_name := printf "cx-%s-registry" .Release.Name }} -{{- $sec_name := printf "%s-sec" $deployment_name }} apiVersion: v1 kind: Secret metadata: - name: {{ $sec_name }} + name: {{ include "dtr.fullname" . }} type: Opaque data: {{- if .Values.enablePostgres }} diff --git a/charts/registry/templates/registry/registry-service.yaml b/charts/registry/templates/registry/registry-service.yaml index aa671ea6..efa66052 100644 --- a/charts/registry/templates/registry/registry-service.yaml +++ b/charts/registry/templates/registry/registry-service.yaml @@ -18,18 +18,16 @@ # SPDX-License-Identifier: Apache-2.0 ############################################################### -{{- $deployment_name := printf "cx-%s-registry" .Release.Name }} -{{- $svc_name := printf "%s-svc" $deployment_name }} apiVersion: v1 kind: Service metadata: - name: {{ $svc_name }} + name: {{ include "dtr.fullname" . }} labels: - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + {{- include "dtr.labels" . | nindent 4 }} spec: type: {{ .Values.registry.service.type }} ports: - port: {{ .Values.registry.service.port }} targetPort: {{ .Values.registry.containerPort }} selector: - app: {{ $deployment_name }} + {{- include "dtr.selectorLabels" . | nindent 4 }} diff --git a/charts/registry/templates/tests/test-connection.yaml b/charts/registry/templates/tests/test-connection.yaml index e946228e..2f650292 100644 --- a/charts/registry/templates/tests/test-connection.yaml +++ b/charts/registry/templates/tests/test-connection.yaml @@ -17,10 +17,15 @@ # # SPDX-License-Identifier: Apache-2.0 ############################################################### + +{{- $fullName := include "dtr.fullname" . }} +{{- $testconnection_name := printf "%s-test-script-pod" $fullName }} +{{- $testsec_name := printf "%s-test-credentials" $fullName }} +{{- $testconfig_name := printf "%s-test-script" $fullName }} apiVersion: v1 kind: Pod metadata: - name: "test-script-pod" + name: {{ $testconnection_name }} annotations: "helm.sh/hook": test spec: @@ -40,12 +45,12 @@ spec: - name: AAS_REGISTRY_API_URL valueFrom: secretKeyRef: - name: test-credentials + name: {{ $testsec_name }} key: aasRegistryUrl volumes: - name: test-script configMap: - name: test-script + name: {{ $testconfig_name }} defaultMode: 0777 - name: test-output hostPath: diff --git a/charts/registry/templates/tests/test-credentials.yaml b/charts/registry/templates/tests/test-credentials.yaml index cf9664a8..05a49984 100644 --- a/charts/registry/templates/tests/test-credentials.yaml +++ b/charts/registry/templates/tests/test-credentials.yaml @@ -17,10 +17,12 @@ # # SPDX-License-Identifier: Apache-2.0 ############################################################### +{{- $fullName := include "dtr.fullname" . }} +{{- $testsec_name := printf "%s-test-credentials" $fullName }} apiVersion: v1 kind: Secret metadata: - name: test-credentials + name: {{ $testsec_name }} type: Opaque data: - aasRegistryUrl: {{ printf "http://cx-%s-registry-svc:8080" .Release.Name | b64enc }} + aasRegistryUrl: {{ printf "http://%s:8080" $fullName | b64enc }} diff --git a/charts/registry/templates/tests/test-script-configmap.yaml b/charts/registry/templates/tests/test-script-configmap.yaml index 186599be..69a43102 100644 --- a/charts/registry/templates/tests/test-script-configmap.yaml +++ b/charts/registry/templates/tests/test-script-configmap.yaml @@ -17,10 +17,11 @@ # # SPDX-License-Identifier: Apache-2.0 ############################################################### + kind: ConfigMap apiVersion: v1 metadata: - name: test-script + name: {{ include "dtr.fullname" . }}-test-script data: test-script.sh: | #!/bin/sh diff --git a/charts/registry/values.yaml b/charts/registry/values.yaml index 6172e434..fbfe9f8b 100644 --- a/charts/registry/values.yaml +++ b/charts/registry/values.yaml @@ -18,7 +18,8 @@ # SPDX-License-Identifier: Apache-2.0 ############################################################### - +nameOverride: +fullnameOverride: # enables the default postgres database enablePostgres: true # enables the default keycloak identity provider @@ -51,6 +52,14 @@ registry: service: port: 8080 type: ClusterIP + livenessProbe: + failureThreshold: 3 + periodSeconds: 3 + initialDelaySeconds: 100 + readinessProbe: + failureThreshold: 3 + periodSeconds: 3 + initialDelaySeconds: 100 dataSource: driverClassName: org.postgresql.Driver sqlInitPlatform: pg