diff --git a/.github/workflows/helm-chart-lint.yaml b/.github/workflows/helm-chart-lint.yaml index f7408d1ed..11267aa8f 100644 --- a/.github/workflows/helm-chart-lint.yaml +++ b/.github/workflows/helm-chart-lint.yaml @@ -56,5 +56,5 @@ jobs: # install the chart to the kind cluster and run helm test # define charts to test with the --charts parameter - name: Run chart-testing (install) - run: ct install --charts charts/pool,charts/gate --config charts/config/chart-testing-config.yaml + run: ct install --charts charts/bpdm,charts/bpdm/charts/bpdm-pool,charts/bpdm/charts/bpdm-gate --config charts/config/chart-testing-config.yaml if: ${{ env.CHART_CHANGED == 'true' }} diff --git a/.gitignore b/.gitignore index 2908c01f5..a423435f8 100644 --- a/.gitignore +++ b/.gitignore @@ -19,9 +19,9 @@ target #local database data /db #Helm dependencies -/charts/pool/charts -/charts/pool/Chart.lock -/charts/gate/charts -/charts/gate/Chart.lock +/charts/bpdm/Chart.lock +/charts/bpdm/charts/Chart.lock +/charts/bpdm/charts/bpdm-gate/Chart.lock +/charts/bpdm/charts/bpdm-pool/Chart.lock #Developer application properties application-developer.properties diff --git a/charts/bpdm/Chart.yaml b/charts/bpdm/Chart.yaml new file mode 100644 index 000000000..77abcb8db --- /dev/null +++ b/charts/bpdm/Chart.yaml @@ -0,0 +1,49 @@ +--- +################################################################################ +# 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 +################################################################################ + +apiVersion: v2 +name: bpdm umbrella-chart +type: application +description: A Helm chart for Kubernetes that deploys the gate and pool applications +version: 0.1.0 +appVersion: 1.0.0 +home: https://github.com/eclipse-tractusx/bpdm +sources: + - https://github.com/eclipse-tractusx/bpdm + +dependencies: + - name: bpdm-gate + version: 4.0.0-alpha.5 + alias: bpdm-gate + condition: bpdm-gate.enabled + - name: bpdm-pool + version: 5.0.0-alpha.4 + alias: bpdm-pool + condition: bpdm-pool.enabled + - name: opensearch + version: 2.*.* + repository: https://opensearch-project.github.io/helm-charts/ + alias: opensearch + condition: opensearch.enabled + - name: postgresql + version: 11.*.* + repository: https://charts.bitnami.com/bitnami + alias: postgres + condition: postgres.enabled diff --git a/charts/gate/.helmignore b/charts/bpdm/charts/bpdm-gate/.helmignore similarity index 100% rename from charts/gate/.helmignore rename to charts/bpdm/charts/bpdm-gate/.helmignore diff --git a/charts/gate/CHANGELOG.md b/charts/bpdm/charts/bpdm-gate/CHANGELOG.md similarity index 100% rename from charts/gate/CHANGELOG.md rename to charts/bpdm/charts/bpdm-gate/CHANGELOG.md diff --git a/charts/gate/Chart.yaml b/charts/bpdm/charts/bpdm-gate/Chart.yaml similarity index 100% rename from charts/gate/Chart.yaml rename to charts/bpdm/charts/bpdm-gate/Chart.yaml diff --git a/charts/gate/LICENSE b/charts/bpdm/charts/bpdm-gate/LICENSE similarity index 100% rename from charts/gate/LICENSE rename to charts/bpdm/charts/bpdm-gate/LICENSE diff --git a/charts/gate/README.md b/charts/bpdm/charts/bpdm-gate/README.md similarity index 100% rename from charts/gate/README.md rename to charts/bpdm/charts/bpdm-gate/README.md diff --git a/charts/gate/templates/NOTES.txt b/charts/bpdm/charts/bpdm-gate/templates/NOTES.txt similarity index 100% rename from charts/gate/templates/NOTES.txt rename to charts/bpdm/charts/bpdm-gate/templates/NOTES.txt diff --git a/charts/gate/templates/_helpers.tpl b/charts/bpdm/charts/bpdm-gate/templates/_helpers.tpl similarity index 81% rename from charts/gate/templates/_helpers.tpl rename to charts/bpdm/charts/bpdm-gate/templates/_helpers.tpl index d57b847a8..9b89831e8 100644 --- a/charts/gate/templates/_helpers.tpl +++ b/charts/bpdm/charts/bpdm-gate/templates/_helpers.tpl @@ -61,6 +61,31 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end }} +{{- define "bpdm-gate.poolServiceName" -}} +{{- $config := .Values.applicationConfig -}} +{{- if and $config (not (empty $config.bpdm)) -}} + {{- $bpdm := $config.bpdm -}} + {{- if and $bpdm (not (empty $bpdm.pool)) -}} + {{- $pool := $bpdm.pool -}} + {{- if and $pool (not (empty (index $pool "base-url"))) -}} + {{- index $pool "base-url" -}} + {{- else -}} + {{- printf "%s-bpdm-pool" .Release.Name -}} + {{- end -}} + {{- else -}} + {{- printf "%s-bpdm-pool" .Release.Name -}} + {{- end -}} +{{- else -}} + {{- printf "%s-bpdm-pool" .Release.Name -}} +{{- end -}} +{{- end }} + + + + + + + {{/* Selector labels */}} @@ -83,6 +108,7 @@ Determine postgres service/host name to connect to {{- include "includeWithPostgresContext" (list $ "postgresql.primary.fullname") }} {{- end }}} + {{/* Invoke include on given definition with postgresql dependency context Usage: include "includeWithPostgresContext" (list $ "your_include_function_here") diff --git a/charts/gate/templates/configMap.yaml b/charts/bpdm/charts/bpdm-gate/templates/configMap.yaml similarity index 96% rename from charts/gate/templates/configMap.yaml rename to charts/bpdm/charts/bpdm-gate/templates/configMap.yaml index d10f52fbb..f3a854978 100644 --- a/charts/gate/templates/configMap.yaml +++ b/charts/bpdm/charts/bpdm-gate/templates/configMap.yaml @@ -32,7 +32,7 @@ data: datasource: host: {{ include "bpdm.postgresDependency" . }} pool: - base-url: http://pool-bpdm:8080/api/catena + base-url: {{include "bpdm-gate.poolServiceName" .}} external.yml: |- # External properties for overwriting application config {{- if .Values.applicationConfig }} diff --git a/charts/gate/templates/deployment.yaml b/charts/bpdm/charts/bpdm-gate/templates/deployment.yaml similarity index 94% rename from charts/gate/templates/deployment.yaml rename to charts/bpdm/charts/bpdm-gate/templates/deployment.yaml index 00ab10002..08480b902 100644 --- a/charts/gate/templates/deployment.yaml +++ b/charts/bpdm/charts/bpdm-gate/templates/deployment.yaml @@ -58,6 +58,11 @@ spec: value: {{ .Values.springProfiles | join "," }} - name: SPRING_CONFIG_IMPORT value: "/etc/conf/deployment.yml,/etc/conf/external.yml,/etc/conf/secrets.yml" + - name: SPRING_DATASOURCE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "bpdm.postgresDependency" . }} + key: password ports: - name: http containerPort: 8081 diff --git a/charts/pool/templates/ingress.yaml b/charts/bpdm/charts/bpdm-gate/templates/ingress.yaml similarity index 67% rename from charts/pool/templates/ingress.yaml rename to charts/bpdm/charts/bpdm-gate/templates/ingress.yaml index 3eb492b61..6649544a0 100644 --- a/charts/pool/templates/ingress.yaml +++ b/charts/bpdm/charts/bpdm-gate/templates/ingress.yaml @@ -1,4 +1,24 @@ -{{- if .Values.ingress.enabled -}} +################################################################################ +# 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 +################################################################################ + +{{ if .Values.ingress.enabled }} + {{- $fullName := include "bpdm.fullname" . -}} {{- $svcPort := .Values.service.port -}} {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} @@ -15,24 +35,6 @@ apiVersion: extensions/v1beta1 {{- end }} kind: Ingress metadata: - ################################################################################ - # 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 - ################################################################################ name: {{ $fullName }} labels: {{- include "bpdm.labels" . | nindent 4 }} diff --git a/charts/gate/templates/secret.yaml b/charts/bpdm/charts/bpdm-gate/templates/secret.yaml similarity index 100% rename from charts/gate/templates/secret.yaml rename to charts/bpdm/charts/bpdm-gate/templates/secret.yaml diff --git a/charts/gate/templates/service.yaml b/charts/bpdm/charts/bpdm-gate/templates/service.yaml similarity index 100% rename from charts/gate/templates/service.yaml rename to charts/bpdm/charts/bpdm-gate/templates/service.yaml diff --git a/charts/gate/values.yaml b/charts/bpdm/charts/bpdm-gate/values.yaml similarity index 93% rename from charts/gate/values.yaml rename to charts/bpdm/charts/bpdm-gate/values.yaml index 729e88857..4aae2dde8 100644 --- a/charts/gate/values.yaml +++ b/charts/bpdm/charts/bpdm-gate/values.yaml @@ -121,17 +121,12 @@ applicationConfig: # Used to overwrite the secret property values of the application configuration applicationSecrets: - spring: - datasource: - # overwrite for security reasons - password: bpdm +# bpdm: +# saas: +# api-key: ... postgres: enabled: true auth: database: bpdm - # overwrite for security reasons - postgresPassword: bpdm username: bpdm - # overwrite for security reasons - password: bpdm diff --git a/charts/pool/.helmignore b/charts/bpdm/charts/bpdm-pool/.helmignore similarity index 100% rename from charts/pool/.helmignore rename to charts/bpdm/charts/bpdm-pool/.helmignore diff --git a/charts/pool/CHANGELOG.md b/charts/bpdm/charts/bpdm-pool/CHANGELOG.md similarity index 100% rename from charts/pool/CHANGELOG.md rename to charts/bpdm/charts/bpdm-pool/CHANGELOG.md diff --git a/charts/pool/Chart.yaml b/charts/bpdm/charts/bpdm-pool/Chart.yaml similarity index 100% rename from charts/pool/Chart.yaml rename to charts/bpdm/charts/bpdm-pool/Chart.yaml diff --git a/charts/pool/LICENSE b/charts/bpdm/charts/bpdm-pool/LICENSE similarity index 100% rename from charts/pool/LICENSE rename to charts/bpdm/charts/bpdm-pool/LICENSE diff --git a/charts/pool/README.md b/charts/bpdm/charts/bpdm-pool/README.md similarity index 100% rename from charts/pool/README.md rename to charts/bpdm/charts/bpdm-pool/README.md diff --git a/charts/pool/templates/NOTES.txt b/charts/bpdm/charts/bpdm-pool/templates/NOTES.txt similarity index 100% rename from charts/pool/templates/NOTES.txt rename to charts/bpdm/charts/bpdm-pool/templates/NOTES.txt diff --git a/charts/pool/templates/_helpers.tpl b/charts/bpdm/charts/bpdm-pool/templates/_helpers.tpl similarity index 100% rename from charts/pool/templates/_helpers.tpl rename to charts/bpdm/charts/bpdm-pool/templates/_helpers.tpl diff --git a/charts/pool/templates/configMap.yaml b/charts/bpdm/charts/bpdm-pool/templates/configMap.yaml similarity index 100% rename from charts/pool/templates/configMap.yaml rename to charts/bpdm/charts/bpdm-pool/templates/configMap.yaml diff --git a/charts/pool/templates/deployment.yaml b/charts/bpdm/charts/bpdm-pool/templates/deployment.yaml similarity index 94% rename from charts/pool/templates/deployment.yaml rename to charts/bpdm/charts/bpdm-pool/templates/deployment.yaml index 6b310ecba..4372c10bb 100644 --- a/charts/pool/templates/deployment.yaml +++ b/charts/bpdm/charts/bpdm-pool/templates/deployment.yaml @@ -58,6 +58,11 @@ spec: value: {{ .Values.springProfiles | join "," }} - name: SPRING_CONFIG_IMPORT value: "/etc/conf/deployment.yml,/etc/conf/external.yml,/etc/conf/secrets.yml" + - name: SPRING_DATASOURCE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "bpdm.postgresDependency" . }} + key: password ports: - name: http containerPort: 8080 diff --git a/charts/gate/templates/ingress.yaml b/charts/bpdm/charts/bpdm-pool/templates/ingress.yaml similarity index 67% rename from charts/gate/templates/ingress.yaml rename to charts/bpdm/charts/bpdm-pool/templates/ingress.yaml index 3eb492b61..aba12cd58 100644 --- a/charts/gate/templates/ingress.yaml +++ b/charts/bpdm/charts/bpdm-pool/templates/ingress.yaml @@ -1,4 +1,25 @@ -{{- if .Values.ingress.enabled -}} +################################################################################ +# 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 +################################################################################ + +{{ if .Values.ingress.enabled }} + + {{- $fullName := include "bpdm.fullname" . -}} {{- $svcPort := .Values.service.port -}} {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} @@ -15,24 +36,6 @@ apiVersion: extensions/v1beta1 {{- end }} kind: Ingress metadata: - ################################################################################ - # 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 - ################################################################################ name: {{ $fullName }} labels: {{- include "bpdm.labels" . | nindent 4 }} diff --git a/charts/pool/templates/secret.yaml b/charts/bpdm/charts/bpdm-pool/templates/secret.yaml similarity index 100% rename from charts/pool/templates/secret.yaml rename to charts/bpdm/charts/bpdm-pool/templates/secret.yaml diff --git a/charts/pool/templates/service.yaml b/charts/bpdm/charts/bpdm-pool/templates/service.yaml similarity index 100% rename from charts/pool/templates/service.yaml rename to charts/bpdm/charts/bpdm-pool/templates/service.yaml diff --git a/charts/pool/values.yaml b/charts/bpdm/charts/bpdm-pool/values.yaml similarity index 74% rename from charts/pool/values.yaml rename to charts/bpdm/charts/bpdm-pool/values.yaml index 9616f0f50..86a9c28fc 100644 --- a/charts/pool/values.yaml +++ b/charts/bpdm/charts/bpdm-pool/values.yaml @@ -87,9 +87,9 @@ livenessProbe: path: "/actuator/health/liveness" port: 8080 scheme: HTTP - failureThreshold: 3 - initialDelaySeconds: 5 - periodSeconds: 5 + failureThreshold: 5 + initialDelaySeconds: 120 + periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 @@ -177,8 +177,54 @@ postgres: enabled: true auth: database: bpdm - # overwrite for security reasons - postgresPassword: bpdm username: bpdm - # overwrite for security reasons - password: bpdm + +opensearch: + enabled: true + replicas: 1 + protocol: http + roles: + - master + - ingest + - data + resources: + limits: + cpu: 300m + memory: 2Gi + requests: + cpu: 100m + memory: 2Gi + config: + opensearch.yml: | + cluster.name: opensearch-cluster + # Bind to all interfaces because we don't know what + # IP address Docker will assign to us. + network.host: 0.0.0.0 + # Disable security + plugins.security.disabled: true + securityConfig: + enabled: false + extraInitContainers: + # Image that performs the sysctl operation to modify Kernel settings + # needed sometimes to avoid boot errors + - name: sysctl + image: docker.io/bitnami/bitnami-shell:10-debian-10-r199 + imagePullPolicy: "IfNotPresent" + command: + - /bin/bash + - -ec + - | + CURRENT=`sysctl -n vm.max_map_count`; + DESIRED="262144"; + if [ "$DESIRED" -gt "$CURRENT" ]; then + sysctl -w vm.max_map_count=262144; + fi; + CURRENT=`sysctl -n fs.file-max`; + DESIRED="65536"; + if [ "$DESIRED" -gt "$CURRENT" ]; then + sysctl -w fs.file-max=65536; + fi; + securityContext: + runAsUser: 0 + privileged: true + diff --git a/charts/bpdm/values.yaml b/charts/bpdm/values.yaml new file mode 100644 index 000000000..a4afcc766 --- /dev/null +++ b/charts/bpdm/values.yaml @@ -0,0 +1,86 @@ +bpdm-gate: + enabled: true + replicaCount: 1 + image: + registry: ghcr.io + repository: catenax-ng/tx-bpdm/gate + pullPolicy: Always + tag: "" + # ... more configuration for bpdm-gate if need... + applicationConfig: + bpdm: + pool: + base-url: "" + postgres: + enabled: false + +bpdm-pool: + enabled: true + replicaCount: 1 + image: + registry: ghcr.io + repository: catenax-ng/tx-bpdm/pool + pullPolicy: Always + tag: "" + opensearch: + enabled: false + masterService: "" + fullnameOverride: "bpdm-pool-opensearch" + postgres: + enabled: false + +opensearch: + masterService: "" + fullnameOverride: "bpdm-pool-opensearch" + enabled: true + replicas: 1 + protocol: http + roles: + - master + - ingest + - data + resources: + limits: + cpu: 300m + memory: 2Gi + requests: + cpu: 100m + memory: 2Gi + config: + opensearch.yml: | + # Bind to all interfaces because we don't know what + # IP address Docker will assign to us. + network.host: 0.0.0.0 + # Disable security + plugins.security.disabled: true + securityConfig: + enabled: false + extraInitContainers: + # Image that performs the sysctl operation to modify Kernel settings + # needed sometimes to avoid boot errors + - name: sysctl + image: docker.io/bitnami/bitnami-shell:10-debian-10-r199 + imagePullPolicy: "IfNotPresent" + command: + - /bin/bash + - -ec + - | + CURRENT=`sysctl -n vm.max_map_count`; + DESIRED="262144"; + if [ "$DESIRED" -gt "$CURRENT" ]; then + sysctl -w vm.max_map_count=262144; + fi; + CURRENT=`sysctl -n fs.file-max`; + DESIRED="65536"; + if [ "$DESIRED" -gt "$CURRENT" ]; then + sysctl -w fs.file-max=65536; + fi; + securityContext: + runAsUser: 0 + privileged: true + +postgres: + enabled: true + auth: + database: bpdm + username: bpdm diff --git a/charts/config/chart-testing-config.yaml b/charts/config/chart-testing-config.yaml index 0db69da58..d1b6d089b 100644 --- a/charts/config/chart-testing-config.yaml +++ b/charts/config/chart-testing-config.yaml @@ -1,4 +1,23 @@ --- +################################################################################ +# 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 +################################################################################ + validate-maintainers: false chart-repos: - bitnami=https://charts.bitnami.com/bitnami