diff --git a/charts/semantic-hub/Chart.yaml b/charts/semantic-hub/Chart.yaml index 43bf61c0..3dc68a18 100644 --- a/charts/semantic-hub/Chart.yaml +++ b/charts/semantic-hub/Chart.yaml @@ -26,7 +26,7 @@ sources: - https://github.com/eclipse-tractusx/sldt-semantic-hub type: application -version: 0.2.1-RC1 +version: 0.2.1-RC2 appVersion: 0.3.1-RC1 dependencies: - repository: https://charts.bitnami.com/bitnami diff --git a/charts/semantic-hub/templates/_helpers.tpl b/charts/semantic-hub/templates/_helpers.tpl index e69de29b..faa60313 100644 --- a/charts/semantic-hub/templates/_helpers.tpl +++ b/charts/semantic-hub/templates/_helpers.tpl @@ -0,0 +1,48 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "hub.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 "hub.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 "hub.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "hub.labels" -}} +helm.sh/chart: {{ include "hub.chart" . }} +{{ include "hub.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + + +{{- define "hub.selectorLabels" -}} +app.kubernetes.io/name: {{ include "hub.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/charts/semantic-hub/templates/graphdb/graphdb-deployment.yaml b/charts/semantic-hub/templates/graphdb/graphdb-deployment.yaml index a8792e50..5ec908aa 100644 --- a/charts/semantic-hub/templates/graphdb/graphdb-deployment.yaml +++ b/charts/semantic-hub/templates/graphdb/graphdb-deployment.yaml @@ -1,45 +1,44 @@ ############################################################### -# Copyright (c) 2021, 2023 Robert Bosch Manufacturing Solutions GmbH - # Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation - # - # See the NOTICE file(s) distributed with this work for additional - # information regarding copyright ownership. - # - # This program and the accompanying materials are made available under the - # terms of the Apache License, Version 2.0 which is available at - # https://www.apache.org/licenses/LICENSE-2.0. - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - # License for the specific language governing permissions and limitations - # under the License. - # - # SPDX-License-Identifier: Apache-2.0 - ############################################################### +# Copyright (c) 2021 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2021 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +############################################################### {{- if and (.Values.graphdb.enabled) (not .Values.hub.embeddedTripleStore) }} -{{- $deployment_name := printf "cx-%s-graphdb" .Release.Name }} -{{- $sec_name := printf "%s-sec" $deployment_name }} -{{- $pvc_name := printf "%s-pvc" $deployment_name }} apiVersion: apps/v1 kind: Deployment metadata: - name: {{ $deployment_name }} + name: {{ include "hub.fullname" .}}-graphdb + labels: + {{- include "hub.labels" . | nindent 4 }}-graphdb spec: replicas: {{ .Values.graphdb.replicaCount }} selector: matchLabels: - app: {{ $deployment_name }} + {{- include "hub.selectorLabels" . | nindent 6 }}-graphdb template: metadata: labels: - app: {{ $deployment_name }} + {{- include "hub.selectorLabels" . | nindent 8 }}-graphdb spec: securityContext: runAsUser: 1000 containers: - - name: {{ $deployment_name }} + - name: {{ include "hub.fullname" .}}-graphdb image: {{ .Values.graphdb.image }} imagePullPolicy: {{ .Values.graphdb.imagePullPolicy }} securityContext: @@ -64,5 +63,5 @@ spec: volumes: - name: graphdbdata persistentVolumeClaim: - claimName: {{ $pvc_name }} + claimName: {{ include "hub.fullname" .}}-graphdb {{- end -}} diff --git a/charts/semantic-hub/templates/graphdb/graphdb-pvc.yaml b/charts/semantic-hub/templates/graphdb/graphdb-pvc.yaml index bc9e3b15..364bd233 100644 --- a/charts/semantic-hub/templates/graphdb/graphdb-pvc.yaml +++ b/charts/semantic-hub/templates/graphdb/graphdb-pvc.yaml @@ -1,30 +1,28 @@ ############################################################### - # Copyright (c) 2021, 2023 Robert Bosch Manufacturing Solutions GmbH - # Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation - # - # See the NOTICE file(s) distributed with this work for additional - # information regarding copyright ownership. - # - # This program and the accompanying materials are made available under the - # terms of the Apache License, Version 2.0 which is available at - # https://www.apache.org/licenses/LICENSE-2.0. - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - # License for the specific language governing permissions and limitations - # under the License. - # - # SPDX-License-Identifier: Apache-2.0 - ############################################################### +# Copyright (c) 2021 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2021 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +############################################################### {{- if and (.Values.graphdb.enabled) (not .Values.hub.embeddedTripleStore) }} -{{- $deployment_name := printf "cx-%s-graphdb" .Release.Name }} -{{- $pvc_name := printf "%s-pvc" $deployment_name }} apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: {{ $pvc_name }} + name: {{ include "hub.fullname" .}}-graphdb spec: storageClassName: {{ .Values.graphdb.storageClassName }} accessModes: diff --git a/charts/semantic-hub/templates/graphdb/graphdb-service.yaml b/charts/semantic-hub/templates/graphdb/graphdb-service.yaml index 71e297b0..ecb9734c 100644 --- a/charts/semantic-hub/templates/graphdb/graphdb-service.yaml +++ b/charts/semantic-hub/templates/graphdb/graphdb-service.yaml @@ -1,35 +1,33 @@ ############################################################### -# Copyright (c) 2021, 2023 Robert Bosch Manufacturing Solutions GmbH - # Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation - # - # See the NOTICE file(s) distributed with this work for additional - # information regarding copyright ownership. - # - # This program and the accompanying materials are made available under the - # terms of the Apache License, Version 2.0 which is available at - # https://www.apache.org/licenses/LICENSE-2.0. - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - # License for the specific language governing permissions and limitations - # under the License. - # - # SPDX-License-Identifier: Apache-2.0 - ############################################################### +# Copyright (c) 2021 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2021 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +############################################################### {{- if and (.Values.graphdb.enabled) (not .Values.hub.embeddedTripleStore) }} -{{- $deployment_name := printf "cx-%s-graphdb" .Release.Name }} -{{- $service_name := printf "cx-%s-graphdb-svc" .Release.Name }} apiVersion: v1 kind: Service metadata: - name: {{ $service_name }} + name: {{ include "hub.fullname" .}}-graphdb spec: type: ClusterIP ports: - port: {{ .Values.graphdb.service.port }} targetPort: {{ .Values.graphdb.containerPort }} selector: - app: {{ $deployment_name }} + {{- include "hub.selectorLabels" . | nindent 4}}-graphdb {{- end -}} diff --git a/charts/semantic-hub/templates/hub/hub-deployment.yaml b/charts/semantic-hub/templates/hub/hub-deployment.yaml index 935f357b..c3982070 100644 --- a/charts/semantic-hub/templates/hub/hub-deployment.yaml +++ b/charts/semantic-hub/templates/hub/hub-deployment.yaml @@ -1,6 +1,6 @@ ############################################################### -# Copyright (c) 2021, 2023 Robert Bosch Manufacturing Solutions GmbH -# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation +# Copyright (c) 2021 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2021 2023 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -25,23 +25,23 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ $deployment_name }} + name: {{ include "hub.fullname" . }} labels: - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + {{- include "hub.labels" . | nindent 4 }} spec: + replicas: {{ default 1 .Values.hub.replicaCount | int }} selector: matchLabels: - app: {{ $deployment_name }} - replicas: {{ default 1 .Values.hub.replicaCount | int }} + {{- include "hub.selectorLabels" . | nindent 6 }} template: metadata: labels: - app: {{ $deployment_name }} + {{- include "hub.selectorLabels" . | nindent 8 }} spec: securityContext: runAsUser: 100 containers: - - name: {{ $deployment_name }} + - name: {{ .Chart.Name }} image: {{ .Values.hub.image.registry }}/{{ .Values.hub.image.repository }}:{{ .Values.hub.image.version | default .Chart.AppVersion }} imagePullPolicy: {{ .Values.hub.imagePullPolicy }} securityContext: @@ -57,7 +57,7 @@ spec: value: "{{ .Values.hub.embeddedTripleStore }}" - name: HUB_TRIPLE_STORE_BASE_URL {{- if .Values.graphdb.enabled }} - value: {{ printf "http://%s:%v" $graphdb_svc_name .Values.graphdb.service.port }}/ds + value: {{ printf "http://%s-graphdb:%v" (include "hub.fullname" .) .Values.graphdb.service.port }}/ds {{- else }} value: {{ .Values.hub.graphdbBaseUrl }} {{- end }} @@ -67,7 +67,7 @@ spec: value: {{ .Values.graphdb.updateEndpoint }} envFrom: - secretRef: - name: {{ $sec_name }} + name: {{ include "hub.fullname" . }} livenessProbe: httpGet: path: /actuator/health/liveness diff --git a/charts/semantic-hub/templates/hub/hub-ingress.yaml b/charts/semantic-hub/templates/hub/hub-ingress.yaml index 639b9bc0..29de8b4e 100644 --- a/charts/semantic-hub/templates/hub/hub-ingress.yaml +++ b/charts/semantic-hub/templates/hub/hub-ingress.yaml @@ -1,35 +1,32 @@ ############################################################### -# Copyright (c) 2021, 2023 Robert Bosch Manufacturing Solutions GmbH - # Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation - # - # See the NOTICE file(s) distributed with this work for additional - # information regarding copyright ownership. - # - # This program and the accompanying materials are made available under the - # terms of the Apache License, Version 2.0 which is available at - # https://www.apache.org/licenses/LICENSE-2.0. - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - # License for the specific language governing permissions and limitations - # under the License. - # - # SPDX-License-Identifier: Apache-2.0 - ############################################################### +# Copyright (c) 2021 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2021 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +############################################################### {{- if .Values.hub.ingress.enabled }} -{{- $deployment_name := printf "cx-%s-hub" .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 "hub.fullname" . }} annotations: {{ .Values.hub.ingress.annotations | toYaml | indent 4 }} labels: - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + {{- include "hub.labels" . | nindent 4 }} spec: ingressClassName: {{ .Values.hub.ingress.className }} {{- if .Values.hub.ingress.tls }} @@ -46,7 +43,7 @@ spec: pathType: Prefix backend: service: - name: {{ $svc_name }} + name: {{ include "hub.fullname" . }} port: number: {{ .Values.hub.service.port }} {{- end}} diff --git a/charts/semantic-hub/templates/hub/hub-secret.yaml b/charts/semantic-hub/templates/hub/hub-secret.yaml index a6c902f0..979690ae 100644 --- a/charts/semantic-hub/templates/hub/hub-secret.yaml +++ b/charts/semantic-hub/templates/hub/hub-secret.yaml @@ -1,6 +1,6 @@ ############################################################### -# Copyright (c) 2021, 2024 Robert Bosch Manufacturing Solutions GmbH -# Copyright (c) 2021, 2024 Contributors to the Eclipse Foundation +# Copyright (c) 2021 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2021 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -18,14 +18,12 @@ # SPDX-License-Identifier: Apache-2.0 ############################################################### -{{- $deployment_name := printf "cx-%s-hub" .Release.Name }} -{{- $sec_name := printf "%s-sec" $deployment_name }} apiVersion: v1 kind: Secret metadata: - name: {{ $sec_name }} + name: {{ include "hub.fullname" . }} labels: - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + {{- include "hub.labels" . | nindent 4 }} type: Opaque data: {{- if .Values.hub.idpIssuerUri }} @@ -40,7 +38,7 @@ data: {{ if .Values.graphdb.password -}} HUB_TRIPLE_STORE_PASSWORD: {{ ( .Values.graphdb.password | b64enc) }} {{ else }} - {{- $secret := (lookup "v1" "Secret" .Release.Namespace $sec_name) }} + {{- $secret := (lookup "v1" "Secret" .Release.Namespace (include "hub.fullname" .)) }} {{ if $secret -}} HUB_TRIPLE_STORE_PASSWORD: {{ index $secret.data "HUB_TRIPLE_STORE_PASSWORD" | quote }} {{- else -}} diff --git a/charts/semantic-hub/templates/hub/hub-service.yaml b/charts/semantic-hub/templates/hub/hub-service.yaml index eff94a5b..98a7c06c 100644 --- a/charts/semantic-hub/templates/hub/hub-service.yaml +++ b/charts/semantic-hub/templates/hub/hub-service.yaml @@ -1,6 +1,6 @@ ############################################################### -# Copyright (c) 2021, 2023 Robert Bosch Manufacturing Solutions GmbH -# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation +# Copyright (c) 2021 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2021 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -18,18 +18,16 @@ # SPDX-License-Identifier: Apache-2.0 ############################################################### -{{- $deployment_name := printf "cx-%s-hub" .Release.Name }} -{{- $svc_name := printf "%s-svc" $deployment_name }} apiVersion: v1 kind: Service metadata: - name: {{ $svc_name }} + name: {{ include "hub.fullname" . }} labels: - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + {{- include "hub.labels" . | nindent 4 }} spec: type: {{ .Values.hub.service.type }} ports: - port: {{ .Values.hub.service.port }} targetPort: {{ .Values.hub.containerPort }} selector: - app: {{ $deployment_name }} + {{- include "hub.selectorLabels" . | nindent 4 }} diff --git a/charts/semantic-hub/templates/keycloak/init-script-configmap.yaml b/charts/semantic-hub/templates/keycloak/init-script-configmap.yaml index 6aea75d8..27a3a725 100644 --- a/charts/semantic-hub/templates/keycloak/init-script-configmap.yaml +++ b/charts/semantic-hub/templates/keycloak/init-script-configmap.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH # Copyright (c) 2023 Contributors to the Eclipse Foundation # See the NOTICE file(s) distributed with this work for additional @@ -20,7 +20,7 @@ kind: ConfigMap apiVersion: v1 metadata: - name: init-script-vol + name: {{ include "hub.fullname" . }}-keycloak-init-script-configmap data: default-realm-import.json: |- {{ .Files.Get "config/default-realm-import.json" | indent 4 }} diff --git a/charts/semantic-hub/values.yaml b/charts/semantic-hub/values.yaml index cf7b81e9..6b61d218 100644 --- a/charts/semantic-hub/values.yaml +++ b/charts/semantic-hub/values.yaml @@ -1,6 +1,6 @@ ############################################################### -# Copyright (c) 2021, 2024 Robert Bosch Manufacturing Solutions GmbH -# Copyright (c) 2021, 2024 Contributors to the Eclipse Foundation +# Copyright (c) 2021 Robert Bosch Manufacturing Solutions GmbH +# Copyright (c) 2021 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -18,7 +18,8 @@ # SPDX-License-Identifier: Apache-2.0 ############################################################### - +nameOverride: +fullnameOverride: # enables the default keycloak identity provider enableKeycloak: false