From 35d37c4ec08142757fdb13e350ba9bb7f7133dd0 Mon Sep 17 00:00:00 2001 From: Vinicius Vieira Date: Thu, 24 Aug 2023 21:49:00 +0100 Subject: [PATCH 01/28] fix: ajusted charts --- charts/charts/Chart.yaml | 25 --- .../values.yaml | 2 +- charts/tx-dcm/values.yaml | 201 ------------------ 3 files changed, 1 insertion(+), 227 deletions(-) delete mode 100644 charts/charts/Chart.yaml delete mode 100644 charts/tx-dcm/values.yaml diff --git a/charts/charts/Chart.yaml b/charts/charts/Chart.yaml deleted file mode 100644 index 66306209..00000000 --- a/charts/charts/Chart.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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: my-chart -version: 0.1.0 -description: An empty Helm chart diff --git a/charts/charts/demand-capacity-management-frontend/values.yaml b/charts/charts/demand-capacity-management-frontend/values.yaml index 2331e6f1..4a273078 100644 --- a/charts/charts/demand-capacity-management-frontend/values.yaml +++ b/charts/charts/demand-capacity-management-frontend/values.yaml @@ -25,7 +25,7 @@ replicaCount: 1 image: registry: "ghcr.io" - name: "catenax-ng/tx-demand-capacity-mgmt-frontend" + name: "catenax-ng/demand-capacity-mgmt-frontend" pullPolicy: Always # Overrides the image tag whose default is the chart appVersion. tag: "" diff --git a/charts/tx-dcm/values.yaml b/charts/tx-dcm/values.yaml deleted file mode 100644 index 466cd513..00000000 --- a/charts/tx-dcm/values.yaml +++ /dev/null @@ -1,201 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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 -# ******************************************************************************** - - - -tx-dcm-backend: - - replicaCount: 1 - image: - registry: "ghcr.io" - # -- Name of the docker image - name: "catenax-ng/tx-demand-capacity-mgmt-backend" - pullPolicy: Always - # -- Overrides the image tag whose default is the chart appVersion. - tag: "" - - certificate: - # -- Hostname for the certificate - host: "backend.tx-demand-capacity-mgmt-backend.example.net" - - # -- Name of the backend service - appName: tx-demand-capacity-mgmt-backend - - # -- List of secrets to be used - imagePullSecrets: [] - # -- Annotations to be added to the running pod - podAnnotations: {} - - # -- Configuration for security-related options of the running pod - podSecurityContext: - # -- Set the file system group ID for all containers in the pod - fsGroup: 2000 - - # Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm - # @url: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod - securityContext: - # -- Specifies if processes running inside the container can gain more privileges than its initial user - allowPrivilegeEscalation: false - # -- Specifies whether the process inside the container should run as a non-root user - runAsNonRoot: true - # -- Specifies the user ID that the process inside the container should run - runAsUser: 10001 - # -- Specifies the group ID that the process inside the container should run - runAsGroup: 3000 - # -- Capabilities that the process inside the container should have - capabilities: - drop: - - ALL - - # -- Service that should be created for the pod - service: - # -- Type of service to be used - type: ClusterIP - # -- Service port - port: 8080 - - # -- Specifies whether autoscaling should be enabled for the pod - autoscaling: - enabled: false - - ingress: - # -- Ingress enabled or not - enabled: false - className: "" - annotations: {} - - # -- Class name (Example) - # className: nginx - # annotations: - # -- HTTP traffic should be redirected to HTTPS - # nginx.ingress.kubernetes.io/force-ssl-redirect: "true" - # -- Ingress controller should pass SSL traffic directly to the backend pods - # nginx.ingress.kubernetes.io/ssl-passthrough: "true" - - # Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm - # @url: https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-resource-requests-and-limits - resources: - # -- Maximum amount of resources that the deployment should be able to consume - limits: - cpu: 800m - memory: 2Gi - # -- Minimum amount of resources that the deployment should be guaranteed to receive - requests: - cpu: 300m - memory: 1Gi - - # -- Node placement constraints - nodeSelector: {} - - # -- Pod toleration constraints - tolerations: [] - - # Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm - # @url: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - # -- Match Pod rules - - key: app.kubernetes.io/name - operator: DoesNotExist - # -- Key that is used to determine the topology of the cluster - topologyKey: kubernetes.io/hostname - - # Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm - # @url: https://github.com/helm/charts/blob/master/stable/nginx-ingress/values.yaml#L210 - # -- Determines if a pod is still alive or not - livenessProbe: - failureThreshold: 5 - # -- Number of seconds to wait before performing the first liveness probe - initialDelaySeconds: 120 - # -- Number of seconds to wait between consecutive probes - periodSeconds: 10 - # -- Number of consecutive successful probes before a pod is considered healthy - successThreshold: 1 - # -- Number of seconds after which a liveness probe times out - timeoutSeconds: 1 - # -- HTTP endpoint - path: /management/health/liveness - # -- Port used - port: 8080 - # -- Determine when a pod is ready to start accepting requests - readinessProbe: - failureThreshold: 3 - initialDelaySeconds: 60 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 1 - path: /management/health/readiness - port: 8080 - - # -- Defines the client secret and client ID - applicationSecret: - # -- Value that specifies whether the application secret should be used - enabled: true - # -- String value that represents the client secret - clientSecret: "" # - # -- String value that represents the client ID - clientId: "" # - - configmap: - # Specifies whether a configmap should be created - create: false - data: - # -- Which profile should be activated for the application - spring_profiles_active: 'dev' - # -- Security configurations for the application - security_enabled: 'false' - - elastic: - # -- Should elastic be enabled or not - enabled: false - security: - # -- Information about the transport layer security (TLS) - tls: - # -- Encryption for the REST requests made to the Elastic cluster - restEncryption: false - -######################### -# Postgres configuration # -######################### - -postgres: - enabled: true - env: - service_name: "postgres" - auth: - database: dcm - username: dcm - password: "dcm" - -######################### -# PG Admin configuration # -######################### -pgadmin4: - # -- Should pgadmin4 be enabled or not - enabled: false - env: - # -- Email used on the Env environment approiate email needs to be setter on the envs - email: "" - password: "" From 8660b9a918a37d570383cba4152a2f15014b1b7c Mon Sep 17 00:00:00 2001 From: Vinicius Vieira Date: Thu, 24 Aug 2023 21:50:06 +0100 Subject: [PATCH 02/28] fix: ajusted chart --- charts/Chart.lock | 6 ------ charts/Chart.yaml | 8 -------- charts/values.yaml | 22 +++++++++++----------- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/charts/Chart.lock b/charts/Chart.lock index b69a43ed..46a72682 100644 --- a/charts/Chart.lock +++ b/charts/Chart.lock @@ -1,10 +1,4 @@ dependencies: -- name: postgresql - repository: https://charts.bitnami.com/bitnami - version: 11.9.13 -- name: demand-capacity-management-backend - repository: "" - version: 0.1.0 - name: demand-capacity-management-frontend repository: "" version: 0.1.0 diff --git a/charts/Chart.yaml b/charts/Chart.yaml index 9b5c5662..fdebfee7 100644 --- a/charts/Chart.yaml +++ b/charts/Chart.yaml @@ -45,14 +45,6 @@ version: 0.1.0 appVersion: "latest" dependencies: - - name: postgresql - version: 11.*.* - repository: https://charts.bitnami.com/bitnami - alias: postgres - condition: postgres.enabled - - name: demand-capacity-management-backend - alias: dcm-backend - version: 0.1.0 - name: demand-capacity-management-frontend alias: dcm-frontend version: 0.1.0 diff --git a/charts/values.yaml b/charts/values.yaml index d2aa9a66..bf2e54f0 100644 --- a/charts/values.yaml +++ b/charts/values.yaml @@ -21,10 +21,10 @@ # Default values for vas. # This is a YAML-formatted file. # Declare variables to be passed into your templates. -dcm-backend: - image: - # -- Overrides the image tag whose default is the chart appVersion. - tag: "latest" +#dcm-backend: +# image: +# # -- Overrides the image tag whose default is the chart appVersion. +# tag: "latest" dcm-frontend: image: @@ -35,10 +35,10 @@ dcm-frontend: enabled: false #host: "dcm-capacity-mgmt-frontend.dev.demo.catena-x.net" -postgres: - enabled: true - auth: - database: dcm - username: dcm - password: "dcm" - postgres-password: "dcm" \ No newline at end of file +#postgres: +# enabled: true +# auth: +# database: dcm +# username: dcm +# password: "dcm" +# postgres-password: "dcm" \ No newline at end of file From 8811f248173272b778c74366b045fb0c2a9e39eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Mon, 28 Aug 2023 15:49:48 +0100 Subject: [PATCH 03/28] helm charts --- .../.helmignore | 23 --- .../Chart.yaml | 32 --- .../templates/NOTES.txt | 22 --- .../templates/deployment.yaml | 117 ----------- .../templates/hpa.yaml | 49 ----- .../templates/ingress.yaml | 82 -------- .../templates/pvc.yaml | 10 - .../templates/tests/test-connection.yaml | 36 ---- .../values.yaml | 180 ----------------- .../.helmignore | 23 --- .../Chart.yaml | 29 --- .../templates/NOTES.txt | 22 --- .../templates/_helpers.tpl | 53 ----- .../templates/hpa.yaml | 48 ----- .../templates/ingress.yaml | 57 ------ .../templates/tests/test-connection.yaml | 35 ---- .../values.yaml | 158 --------------- .../.gitignore | 0 .../.helmignore | 0 .../Chart.lock | 0 .../Chart.yaml | 10 +- .../templates/_helpers.tpl | 0 .../templates/configmap-backend.yaml} | 4 +- .../templates/configmap-frontend.yaml} | 4 +- .../templates/deployment-backend.yaml | 109 +++++++++++ .../templates/deployment-frontend.yaml} | 26 +-- .../templates/service-backend.yaml} | 10 +- .../templates/service-frontend.yaml} | 4 +- .../values-dev.yaml | 0 charts/demand-capacity-management/values.yaml | 184 ++++++++++++++++++ charts/values.yaml | 44 ----- .../src/main/resources/application.yml | 6 +- 32 files changed, 324 insertions(+), 1053 deletions(-) delete mode 100644 charts/charts/demand-capacity-management-backend/.helmignore delete mode 100644 charts/charts/demand-capacity-management-backend/Chart.yaml delete mode 100644 charts/charts/demand-capacity-management-backend/templates/NOTES.txt delete mode 100644 charts/charts/demand-capacity-management-backend/templates/deployment.yaml delete mode 100644 charts/charts/demand-capacity-management-backend/templates/hpa.yaml delete mode 100644 charts/charts/demand-capacity-management-backend/templates/ingress.yaml delete mode 100644 charts/charts/demand-capacity-management-backend/templates/pvc.yaml delete mode 100644 charts/charts/demand-capacity-management-backend/templates/tests/test-connection.yaml delete mode 100644 charts/charts/demand-capacity-management-backend/values.yaml delete mode 100644 charts/charts/demand-capacity-management-frontend/.helmignore delete mode 100644 charts/charts/demand-capacity-management-frontend/Chart.yaml delete mode 100644 charts/charts/demand-capacity-management-frontend/templates/NOTES.txt delete mode 100644 charts/charts/demand-capacity-management-frontend/templates/_helpers.tpl delete mode 100644 charts/charts/demand-capacity-management-frontend/templates/hpa.yaml delete mode 100644 charts/charts/demand-capacity-management-frontend/templates/ingress.yaml delete mode 100644 charts/charts/demand-capacity-management-frontend/templates/tests/test-connection.yaml delete mode 100644 charts/charts/demand-capacity-management-frontend/values.yaml rename charts/{ => demand-capacity-management}/.gitignore (100%) rename charts/{ => demand-capacity-management}/.helmignore (100%) rename charts/{ => demand-capacity-management}/Chart.lock (100%) rename charts/{ => demand-capacity-management}/Chart.yaml (92%) rename charts/{charts/demand-capacity-management-backend => demand-capacity-management}/templates/_helpers.tpl (100%) rename charts/{charts/demand-capacity-management-backend/templates/configmap.yaml => demand-capacity-management/templates/configmap-backend.yaml} (91%) rename charts/{charts/demand-capacity-management-frontend/templates/configmap.yaml => demand-capacity-management/templates/configmap-frontend.yaml} (90%) create mode 100644 charts/demand-capacity-management/templates/deployment-backend.yaml rename charts/{charts/demand-capacity-management-frontend/templates/deployment.yaml => demand-capacity-management/templates/deployment-frontend.yaml} (70%) rename charts/{charts/demand-capacity-management-backend/templates/service.yaml => demand-capacity-management/templates/service-backend.yaml} (77%) rename charts/{charts/demand-capacity-management-frontend/templates/service.yaml => demand-capacity-management/templates/service-frontend.yaml} (93%) rename charts/{ => demand-capacity-management}/values-dev.yaml (100%) create mode 100644 charts/demand-capacity-management/values.yaml delete mode 100644 charts/values.yaml diff --git a/charts/charts/demand-capacity-management-backend/.helmignore b/charts/charts/demand-capacity-management-backend/.helmignore deleted file mode 100644 index 0e8a0eb3..00000000 --- a/charts/charts/demand-capacity-management-backend/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/charts/charts/demand-capacity-management-backend/Chart.yaml b/charts/charts/demand-capacity-management-backend/Chart.yaml deleted file mode 100644 index dbe3eaff..00000000 --- a/charts/charts/demand-capacity-management-backend/Chart.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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: demand-capacity-management-backend -description: A Helm chart for Kubernetes to deploy tx-dcm-backend - -type: application - -version: 0.1.0 - -appVersion: "1.16.0" diff --git a/charts/charts/demand-capacity-management-backend/templates/NOTES.txt b/charts/charts/demand-capacity-management-backend/templates/NOTES.txt deleted file mode 100644 index db964735..00000000 --- a/charts/charts/demand-capacity-management-backend/templates/NOTES.txt +++ /dev/null @@ -1,22 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "tx-dcm-backend.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "tx-dcm-backend.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "tx-dcm-backend.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "tx-dcm-backend.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} diff --git a/charts/charts/demand-capacity-management-backend/templates/deployment.yaml b/charts/charts/demand-capacity-management-backend/templates/deployment.yaml deleted file mode 100644 index 53ff5a6d..00000000 --- a/charts/charts/demand-capacity-management-backend/templates/deployment.yaml +++ /dev/null @@ -1,117 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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: apps/v1 -kind: Deployment -metadata: - name: {{ include "tx-dcm-backend.fullname" . }} - labels: - {{- include "tx-dcm-backend.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "tx-dcm-backend.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "tx-dcm-backend.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.registry }}/{{ .Values.image.name }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - env: - - name: DCM_DATASOURCE_HOST - value: {{ include "dcm-backend.postgres.name" . }} - - name: DCM_DATASOURCE_NAME - value: {{ .Values.postgres.auth.database }} - - name: DCM_DATASOURCE_USER - value: {{ .Values.postgres.auth.username }} - - name: DCM_DATASOURCE_PASS - valueFrom: - secretKeyRef: - name: {{ include "dcm-backend.postgres.name" . }} - key: password - ports: - - name: http - containerPort: {{ .Values.service.port }} - protocol: TCP - livenessProbe: - httpGet: - path: {{ .Values.livenessProbe.path }} - port: {{ .Values.livenessProbe.port }} - scheme: HTTP - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - successThreshold: {{ .Values.livenessProbe.successThreshold }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - - readinessProbe: - httpGet: - path: {{ .Values.readinessProbe.path }} - port: {{ .Values.readinessProbe.port }} - scheme: HTTP - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - - resources: - {{- toYaml .Values.resources | nindent 12 }} - - volumeMounts: - - name: persistent-storage - mountPath: /path/to/mount # Replace with the desired mount path - - volumes: - - name: persistent-storage - persistentVolumeClaim: - claimName: pvc-persistent-tmp-demo # Reference your PVC here - - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/charts/charts/demand-capacity-management-backend/templates/hpa.yaml b/charts/charts/demand-capacity-management-backend/templates/hpa.yaml deleted file mode 100644 index 0fc3639b..00000000 --- a/charts/charts/demand-capacity-management-backend/templates/hpa.yaml +++ /dev/null @@ -1,49 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "tx-dcm-backend.fullname" . }} - labels: - {{- include "tx-dcm-backend.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "tx-dcm-backend.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/charts/charts/demand-capacity-management-backend/templates/ingress.yaml b/charts/charts/demand-capacity-management-backend/templates/ingress.yaml deleted file mode 100644 index 9c8467b4..00000000 --- a/charts/charts/demand-capacity-management-backend/templates/ingress.yaml +++ /dev/null @@ -1,82 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG - # Copyright (c) 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 "tx-dcm-backend.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "tx-dcm-backend.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ingress.className }} - {{- end }} - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} - {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/charts/charts/demand-capacity-management-backend/templates/pvc.yaml b/charts/charts/demand-capacity-management-backend/templates/pvc.yaml deleted file mode 100644 index 0ee34bef..00000000 --- a/charts/charts/demand-capacity-management-backend/templates/pvc.yaml +++ /dev/null @@ -1,10 +0,0 @@ -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: pvc-persistent-tmp-demo -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 50Mi \ No newline at end of file diff --git a/charts/charts/demand-capacity-management-backend/templates/tests/test-connection.yaml b/charts/charts/demand-capacity-management-backend/templates/tests/test-connection.yaml deleted file mode 100644 index df15e4e8..00000000 --- a/charts/charts/demand-capacity-management-backend/templates/tests/test-connection.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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: v1 -kind: Pod -metadata: - name: "{{ include "tx-dcm-backend.fullname" . }}-test-connection" - labels: - {{- include "tx-dcm-backend.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "tx-dcm-backend.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never diff --git a/charts/charts/demand-capacity-management-backend/values.yaml b/charts/charts/demand-capacity-management-backend/values.yaml deleted file mode 100644 index 52998635..00000000 --- a/charts/charts/demand-capacity-management-backend/values.yaml +++ /dev/null @@ -1,180 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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 -# ******************************************************************************** - - - -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - registry: "ghcr.io" - # -- Name of the docker image - name: "catenax-ng/tx-demand-capacity-mgmt-backend" - - - pullPolicy: Always - # -- Overrides the image tag whose default is the chart appVersion. - tag: "" - -certificate: - # -- Hostname for the certificate - host: "localhost" - -# -- Name of the backend service -appName: tx-dcm-capacity-mgmt-backend - -# -- List of secrets to be used -imagePullSecrets: [] -# -- Annotations to be added to the running pod -podAnnotations: {} - -# -- Configuration for security-related options of the running pod -podSecurityContext: - # -- Set the file system group ID for all containers in the pod - fsGroup: 2000 - - -# Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm -# @url: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod -securityContext: - # -- Specifies if processes running inside the container can gain more privileges than its initial user - allowPrivilegeEscalation: false - # -- Specifies whether the process inside the container should run as a non-root user - runAsNonRoot: true - # -- Specifies the user ID that the process inside the container should run - runAsUser: 10001 - # -- Specifies the group ID that the process inside the container should run - runAsGroup: 3000 - # -- Capabilities that the process inside the container should have - capabilities: - drop: - - ALL - -# -- Service that should be created for the pod -service: - # -- Type of service to be used - type: ClusterIP - # -- Service port - port: 8080 - -# -- Specifies whether autoscaling should be enabled for the pod -autoscaling: - enabled: false - -ingress: - # -- Class name - className: "" - # -- Ingress enabled or not - enabled: false - annotations: {} - -# Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm -# @url: https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-resource-requests-and-limits -resources: - # -- Maximum amount of resources that the deployment should be able to consume - limits: - cpu: 300m - memory: 1Gi - # -- Minimum amount of resources that the deployment should be guaranteed to receive - requests: - cpu: 200m - memory: 1Gi - -# -- Node placement constraints -nodeSelector: {} - -# -- Pod toleration constraints -tolerations: [] - -# Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm -# @url: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity -affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - # -- Match Pod rules - - key: app.kubernetes.io/name - operator: DoesNotExist - # -- Key that is used to determine the topology of the cluster - topologyKey: kubernetes.io/hostname - -# Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm -# @url: https://github.com/helm/charts/blob/master/stable/nginx-ingress/values.yaml#L210 -# -- Determines if a pod is still alive or not -livenessProbe: - failureThreshold: 3 - # -- Number of seconds to wait before performing the first liveness probe - initialDelaySeconds: 300 - # -- Number of seconds to wait between consecutive probes - periodSeconds: 30 - # -- Number of consecutive successful probes before a pod is considered healthy - successThreshold: 1 - # -- Number of seconds after which a liveness probe times out - timeoutSeconds: 1 - # -- HTTP endpoint - path: /actuator/health - # -- Port used - port: 8080 -# -- Determine when a pod is ready to start accepting requests -readinessProbe: - failureThreshold: 3 - initialDelaySeconds: 300 - periodSeconds: 30 - successThreshold: 1 - timeoutSeconds: 1 - path: /actuator/health - port: 8080 - -# -- Defines the client secret and client ID -applicationSecret: - # -- Value that specifies whether the application secret should be used - enabled: true - # -- String value that represents the client secret - clientSecret: "" # - # -- String value that represents the client ID - clientId: "" # - -configmap: - # Specifies whether a configmap should be created - create: true - data: - # -- Security configurations for the application - security_enabled: 'false' - -elastic: - # -- Should elastic be enabled or not - enabled: false - security: - # -- Information about the transport layer security (TLS) - tls: - # -- Encryption for the REST requests made to the Elastic cluster - restEncryption: false -postgres: - enabled: true - auth: - database: dcm - username: dcm - password: "dcm" - postgres-password: "dcm" \ No newline at end of file diff --git a/charts/charts/demand-capacity-management-frontend/.helmignore b/charts/charts/demand-capacity-management-frontend/.helmignore deleted file mode 100644 index 0e8a0eb3..00000000 --- a/charts/charts/demand-capacity-management-frontend/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/charts/charts/demand-capacity-management-frontend/Chart.yaml b/charts/charts/demand-capacity-management-frontend/Chart.yaml deleted file mode 100644 index b2f609d1..00000000 --- a/charts/charts/demand-capacity-management-frontend/Chart.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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: demand-capacity-management-frontend -description: A Helm chart for Kubernetes - -type: application - -version: 0.1.0 - -appVersion: "1.16.0" diff --git a/charts/charts/demand-capacity-management-frontend/templates/NOTES.txt b/charts/charts/demand-capacity-management-frontend/templates/NOTES.txt deleted file mode 100644 index a936ee27..00000000 --- a/charts/charts/demand-capacity-management-frontend/templates/NOTES.txt +++ /dev/null @@ -1,22 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "demand-capacity-management-frontend.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "demand-capacity-management-frontend.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "demand-capacity-management-frontend.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "demand-capacity-management-frontend.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} diff --git a/charts/charts/demand-capacity-management-frontend/templates/_helpers.tpl b/charts/charts/demand-capacity-management-frontend/templates/_helpers.tpl deleted file mode 100644 index 902fa1ec..00000000 --- a/charts/charts/demand-capacity-management-frontend/templates/_helpers.tpl +++ /dev/null @@ -1,53 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "demand-capacity-management-frontend.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "demand-capacity-management-frontend.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 "demand-capacity-management-frontend.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "demand-capacity-management-frontend.labels" -}} -helm.sh/chart: {{ include "demand-capacity-management-frontend.chart" . }} -{{ include "demand-capacity-management-frontend.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "demand-capacity-management-frontend.selectorLabels" -}} -app.kubernetes.io/name: {{ include "demand-capacity-management-frontend.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - diff --git a/charts/charts/demand-capacity-management-frontend/templates/hpa.yaml b/charts/charts/demand-capacity-management-frontend/templates/hpa.yaml deleted file mode 100644 index 255a26ae..00000000 --- a/charts/charts/demand-capacity-management-frontend/templates/hpa.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "demand-capacity-management-frontend.fullname" . }} - labels: - {{- include "demand-capacity-management-frontend.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "demand-capacity-management-frontend.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/charts/charts/demand-capacity-management-frontend/templates/ingress.yaml b/charts/charts/demand-capacity-management-frontend/templates/ingress.yaml deleted file mode 100644 index 379a664f..00000000 --- a/charts/charts/demand-capacity-management-frontend/templates/ingress.yaml +++ /dev/null @@ -1,57 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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 }} -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - # name of the ingress resource. -ingress suffix as suggestion for clear naming convention - name: {{ .Values.appName }}-ingress - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - ingressClassName: {{ .Values.ingress.className }} - rules: - # IMPORTANT: specifies the entrypoint (domain), myApp will be accessible from - - host: {{ .Values.certificate.host }} - http: - paths: - # specific path the app should be reachable on the host - # complete URL for the app consists of host AND path - - path: / - pathType: Prefix - backend: - service: - # Name of the service, the ingress controller should route the traffic to, if the host/path combination is called - # Adjust that to your service name - name: {{ include "demand-capacity-management-frontend.name" . }}-service - port: - # Port number, the kubernetes service is listening on - # Adjust that to your services' port - number: {{ .Values.service.port }} - tls: - - hosts: - - {{ .Values.certificate.host }} - # Default secret for certificate creation already provided to your namespace - secretName: tls-secret - -{{ end }} diff --git a/charts/charts/demand-capacity-management-frontend/templates/tests/test-connection.yaml b/charts/charts/demand-capacity-management-frontend/templates/tests/test-connection.yaml deleted file mode 100644 index f0d70eb7..00000000 --- a/charts/charts/demand-capacity-management-frontend/templates/tests/test-connection.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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: v1 -kind: Pod -metadata: - name: "{{ include "demand-capacity-management-frontend.fullname" . }}-test-connection" - labels: - {{- include "demand-capacity-management-frontend.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "demand-capacity-management-frontend.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never diff --git a/charts/charts/demand-capacity-management-frontend/values.yaml b/charts/charts/demand-capacity-management-frontend/values.yaml deleted file mode 100644 index 4a273078..00000000 --- a/charts/charts/demand-capacity-management-frontend/values.yaml +++ /dev/null @@ -1,158 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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 -# ******************************************************************************** - -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - registry: "ghcr.io" - name: "catenax-ng/demand-capacity-mgmt-frontend" - pullPolicy: Always - # Overrides the image tag whose default is the chart appVersion. - tag: "" - -certificate: - # -- Hostname for the certificate - host: "localhost" - -# -- Name of the backend service -appName: tx-demand-capacity-mgmt-frontend - -# -- List of secrets to be used -imagePullSecrets: [] -# -- Annotations to be added to the running pod -podAnnotations: {} - -# -- Configuration for security-related options of the running pod -podSecurityContext: - # -- Set the file system group ID for all containers in the pod - fsGroup: 2000 - - -# Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm -# @url: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod -securityContext: - # -- Specifies if processes running inside the container can gain more privileges than its initial user - allowPrivilegeEscalation: false - # -- Specifies whether the process inside the container should run as a non-root user - runAsNonRoot: true - # -- Specifies the user ID that the process inside the container should run - runAsUser: 101 - # -- Specifies the group ID that the process inside the container should run - runAsGroup: 3000 - # -- Capabilities that the process inside the container should have - capabilities: - drop: - - ALL - -# -- Service that should be created for the pod -service: - # -- Type of service to be used - type: ClusterIP - # -- Service port - port: 8080 - -# -- Specifies whether autoscaling should be enabled for the pod -autoscaling: - enabled: false - - -ingress: - # -- Ingress enabled or not - enabled: false - # -- Class name - className: - annotations: {} - - -# Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm -# @url: https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-resource-requests-and-limits -resources: - # -- Maximum amount of resources that the deployment should be able to consume - limits: - cpu: 300m - memory: 1Gi - # -- Minimum amount of resources that the deployment should be guaranteed to receive - requests: - cpu: 200m - memory: 1Gi - -# -- Node placement constraints -nodeSelector: {} - -# -- Pod toleration constraints -tolerations: [] - -# Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm -# @url: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity -affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - # -- Match Pod rules - - key: app.kubernetes.io/name - operator: DoesNotExist - # -- Key that is used to determine the topology of the cluster - topologyKey: kubernetes.io/hostname - -# Following Catena-X Helm Best Practices @url: https://catenax-ng.github.io/docs/kubernetes-basics/helm -# @url: https://github.com/helm/charts/blob/master/stable/nginx-ingress/values.yaml#L210 -# -- Determines if a pod is still alive or not -livenessProbe: - failureThreshold: 3 - # -- Number of seconds to wait before performing the first liveness probe - initialDelaySeconds: 10 - # -- Number of seconds to wait between consecutive probes - periodSeconds: 1000 - # -- Number of consecutive successful probes before a pod is considered healthy - successThreshold: 1 - # -- Number of seconds after which a liveness probe times out - timeoutSeconds: 1000 -# -- Determine when a pod is ready to start accepting requests -readinessProbe: - failureThreshold: 3 - initialDelaySeconds: 10 - periodSeconds: 1000 - successThreshold: 1 - timeoutSeconds: 1000 - -# -- Defines the client secret and client ID -applicationSecret: - enabled: false - -configmap: - # Specifies whether a configmap should be created - create: true - - -elastic: - # -- Should elastic be enabled or not - enabled: false - security: - # -- Information about the transport layer security (TLS) - tls: - # -- Encryption for the REST requests made to the Elastic cluster - restEncryption: false - diff --git a/charts/.gitignore b/charts/demand-capacity-management/.gitignore similarity index 100% rename from charts/.gitignore rename to charts/demand-capacity-management/.gitignore diff --git a/charts/.helmignore b/charts/demand-capacity-management/.helmignore similarity index 100% rename from charts/.helmignore rename to charts/demand-capacity-management/.helmignore diff --git a/charts/Chart.lock b/charts/demand-capacity-management/Chart.lock similarity index 100% rename from charts/Chart.lock rename to charts/demand-capacity-management/Chart.lock diff --git a/charts/Chart.yaml b/charts/demand-capacity-management/Chart.yaml similarity index 92% rename from charts/Chart.yaml rename to charts/demand-capacity-management/Chart.yaml index fdebfee7..ee17d903 100644 --- a/charts/Chart.yaml +++ b/charts/demand-capacity-management/Chart.yaml @@ -20,8 +20,9 @@ apiVersion: v2 -name: tx-dcm -description: A Helm chart for Kubernetes +name: demand-capacity-management +description: A Helm chart for the demand capacity management application + # A chart can be either an 'application' or a 'library' chart. # @@ -44,7 +45,4 @@ version: 0.1.0 # It is recommended to use it with quotes. appVersion: "latest" -dependencies: - - name: demand-capacity-management-frontend - alias: dcm-frontend - version: 0.1.0 + diff --git a/charts/charts/demand-capacity-management-backend/templates/_helpers.tpl b/charts/demand-capacity-management/templates/_helpers.tpl similarity index 100% rename from charts/charts/demand-capacity-management-backend/templates/_helpers.tpl rename to charts/demand-capacity-management/templates/_helpers.tpl diff --git a/charts/charts/demand-capacity-management-backend/templates/configmap.yaml b/charts/demand-capacity-management/templates/configmap-backend.yaml similarity index 91% rename from charts/charts/demand-capacity-management-backend/templates/configmap.yaml rename to charts/demand-capacity-management/templates/configmap-backend.yaml index 59398a5e..b29a68e4 100644 --- a/charts/charts/demand-capacity-management-backend/templates/configmap.yaml +++ b/charts/demand-capacity-management/templates/configmap-backend.yaml @@ -20,11 +20,11 @@ -{{ if .Values.configmap.create }} +{{ if .Values.backend.configmap.create }} apiVersion: v1 kind: ConfigMap metadata: name: config-backend data: - {{- toYaml .Values.configmap.data | nindent 2 }} + {{- toYaml .Values.backend.configmap.data | nindent 2 }} {{ end }} \ No newline at end of file diff --git a/charts/charts/demand-capacity-management-frontend/templates/configmap.yaml b/charts/demand-capacity-management/templates/configmap-frontend.yaml similarity index 90% rename from charts/charts/demand-capacity-management-frontend/templates/configmap.yaml rename to charts/demand-capacity-management/templates/configmap-frontend.yaml index 3b453ae1..457f2ec6 100644 --- a/charts/charts/demand-capacity-management-frontend/templates/configmap.yaml +++ b/charts/demand-capacity-management/templates/configmap-frontend.yaml @@ -18,11 +18,11 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************** - {{ if .Values.configmap.create }} + {{ if .Values.frontend.configmap.create }} apiVersion: v1 kind: ConfigMap metadata: name: config-frontend data: - {{- toYaml .Values.configmap.data | nindent 2 }} + {{- toYaml .Values.frontend.configmap.data | nindent 2 }} {{ end }} \ No newline at end of file diff --git a/charts/demand-capacity-management/templates/deployment-backend.yaml b/charts/demand-capacity-management/templates/deployment-backend.yaml new file mode 100644 index 00000000..b804b8d0 --- /dev/null +++ b/charts/demand-capacity-management/templates/deployment-backend.yaml @@ -0,0 +1,109 @@ +# ******************************************************************************* +# Copyright (c) 2023 BMW AG +# Copyright (c) 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: apps/v1 +kind: Deployment +metadata: + name: {{ include "demand-capacity-management-backend.fullname" . }} + labels: + {{- include "demand-capacity-management-backend.labels" . | nindent 4 }} +spec: + {{- if not .Values.backend.autoscaling.enabled }} + replicas: {{ .Values.backend.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "demand-capacity-management-backend.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.backend.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "demand-capacity-management-backend.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.backend.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.backend.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.backend.securityContext | nindent 12 }} + image: "{{ .Values.backend.image.registry }}/{{ .Values.backend.image.name }}:{{ .Values.backend.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.backend.image.pullPolicy }} + env: + - name: DCM_DATASOURCE_HOST + value: {{ include "dcm-backend.postgres.name" . }} + - name: DCM_DATASOURCE_NAME + value: {{ .Values.backend.postgres.auth.database }} + - name: DCM_DATASOURCE_USER + value: {{ .Values.backend.postgres.auth.username }} + - name: DCM_DATASOURCE_PASS + valueFrom: + secretKeyRef: + name: {{ include "dcm-backend.postgres.name" . }} + key: password + ports: + - name: http + containerPort: {{ .Values.backend.service.port }} + protocol: TCP + livenessProbe: + httpGet: + path: {{ .Values.backend.livenessProbe.path }} + port: {{ .Values.backend.livenessProbe.port }} + scheme: HTTP + initialDelaySeconds: {{ .Values.backend.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.backend.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.backend.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.backend.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.backend.livenessProbe.failureThreshold }} + + readinessProbe: + httpGet: + path: {{ .Values.backend.readinessProbe.path }} + port: {{ .Values.backend.readinessProbe.port }} + scheme: HTTP + initialDelaySeconds: {{ .Values.backend.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.backend.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.backend.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.backend.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.backend.readinessProbe.failureThreshold }} + + resources: + {{- toYaml .Values.backend.resources | nindent 12 }} + + + {{- with .Values.backend.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.backend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.backend.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/charts/demand-capacity-management-frontend/templates/deployment.yaml b/charts/demand-capacity-management/templates/deployment-frontend.yaml similarity index 70% rename from charts/charts/demand-capacity-management-frontend/templates/deployment.yaml rename to charts/demand-capacity-management/templates/deployment-frontend.yaml index f24737a6..bfeb05cf 100644 --- a/charts/charts/demand-capacity-management-frontend/templates/deployment.yaml +++ b/charts/demand-capacity-management/templates/deployment-frontend.yaml @@ -25,48 +25,48 @@ metadata: labels: {{- include "demand-capacity-management-frontend.labels" . | nindent 4 }} spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} + {{- if not .Values.frontend.autoscaling.enabled }} + replicas: {{ .Values.frontend.replicaCount }} {{- end }} selector: matchLabels: {{- include "demand-capacity-management-frontend.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} + {{- with .Values.frontend.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "demand-capacity-management-frontend.selectorLabels" . | nindent 8 }} spec: - {{- with .Values.imagePullSecrets }} + {{- with .Values.frontend.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- toYaml .Values.frontend.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.registry }}/{{ .Values.image.name }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- toYaml .Values.frontend.securityContext | nindent 12 }} + image: "{{ .Values.frontend.image.registry }}/{{ .Values.frontend.image.name }}:{{ .Values.frontend.frontend.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.frontend.image.pullPolicy }} ports: - name: http - containerPort: {{ .Values.service.port }} + containerPort: {{ .Values.frontend.service.port }} protocol: TCP resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.nodeSelector }} + {{- toYaml .Values.frontend.resources | nindent 12 }} + {{- with .Values.frontend.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- with .Values.frontend.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.tolerations }} + {{- with .Values.frontend.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/charts/demand-capacity-management-backend/templates/service.yaml b/charts/demand-capacity-management/templates/service-backend.yaml similarity index 77% rename from charts/charts/demand-capacity-management-backend/templates/service.yaml rename to charts/demand-capacity-management/templates/service-backend.yaml index b8c2fb6d..26c4b4d4 100644 --- a/charts/charts/demand-capacity-management-backend/templates/service.yaml +++ b/charts/demand-capacity-management/templates/service-backend.yaml @@ -22,15 +22,15 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "tx-dcm-backend.fullname" . }} + name: {{ include "demand-capacity-management-backend.fullname" . }} labels: - {{- include "tx-dcm-backend.labels" . | nindent 4 }} + {{- include "demand-capacity-management-backend.labels" . | nindent 4 }} spec: - type: {{ .Values.service.type }} + type: {{ .Values.backend.service.type }} ports: - - port: {{ .Values.service.port }} + - port: {{ .Values.backend.service.port }} targetPort: http protocol: TCP name: http selector: - {{- include "tx-dcm-backend.selectorLabels" . | nindent 4 }} \ No newline at end of file + {{- include "demand-capacity-management-backend.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/charts/charts/demand-capacity-management-frontend/templates/service.yaml b/charts/demand-capacity-management/templates/service-frontend.yaml similarity index 93% rename from charts/charts/demand-capacity-management-frontend/templates/service.yaml rename to charts/demand-capacity-management/templates/service-frontend.yaml index 34b34895..e85e0e5f 100644 --- a/charts/charts/demand-capacity-management-frontend/templates/service.yaml +++ b/charts/demand-capacity-management/templates/service-frontend.yaml @@ -25,9 +25,9 @@ metadata: labels: {{- include "demand-capacity-management-frontend.labels" . | nindent 4 }} spec: - type: {{ .Values.service.type }} + type: {{ .Values.frontend.service.type }} ports: - - port: {{ .Values.service.port }} + - port: {{ .Values.frontend.service.port }} targetPort: http protocol: TCP name: http diff --git a/charts/values-dev.yaml b/charts/demand-capacity-management/values-dev.yaml similarity index 100% rename from charts/values-dev.yaml rename to charts/demand-capacity-management/values-dev.yaml diff --git a/charts/demand-capacity-management/values.yaml b/charts/demand-capacity-management/values.yaml new file mode 100644 index 00000000..cff4cf8d --- /dev/null +++ b/charts/demand-capacity-management/values.yaml @@ -0,0 +1,184 @@ +# ******************************************************************************* +# Copyright (c) 2023 BMW AG +# Copyright (c) 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 +# ******************************************************************************** + + +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# Backend Settings +backend: + replicaCount: 1 + image: + registry: "ghcr.io" + name: "catenax-ng/demand-capacity-management-backend" + pullPolicy: Always + tag: "" + certificate: + host: "localhost" + appName: demand-capacity-management-backend + imagePullSecrets: [] + podAnnotations: {} + podSecurityContext: + fsGroup: 2000 + securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + runAsUser: 10001 + runAsGroup: 3000 + capabilities: + drop: + - ALL + service: + type: ClusterIP + port: 8888 + autoscaling: + enabled: false + ingress: + enabled: false + className: "" + annotations: {} + resources: + limits: + cpu: 300m + memory: 1Gi + requests: + cpu: 200m + memory: 1Gi + nodeSelector: {} + tolerations: [] + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: DoesNotExist + topologyKey: kubernetes.io/hostname + livenessProbe: + failureThreshold: 3 + initialDelaySeconds: 300 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 1 + path: /actuator/health + port: 8080 + readinessProbe: + failureThreshold: 3 + initialDelaySeconds: 300 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 1 + path: /actuator/health + port: 8080 + applicationSecret: + enabled: true + clientSecret: "" + clientId: "" + configmap: + create: true + data: + security_enabled: 'false' + elastic: + enabled: false + security: + tls: + restEncryption: false + postgres: + enabled: true + auth: + database: dcm + username: dcm + password: "dcm" + postgres-password: "dcm" + +# Frontend Settings +frontend: + replicaCount: 1 + image: + registry: "ghcr.io" + name: "catenax-ng/demand-capacity-management-frontend" + pullPolicy: Always + tag: "" + certificate: + host: "localhost" + appName: demand-capacity-management-frontend + imagePullSecrets: [] + podAnnotations: {} + podSecurityContext: + fsGroup: 2000 + securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + runAsUser: 101 + runAsGroup: 3000 + capabilities: + drop: + - ALL + service: + type: ClusterIP + port: 8080 + autoscaling: + enabled: false + ingress: + enabled: false + className: "" + annotations: {} + resources: + limits: + cpu: 300m + memory: 1Gi + requests: + cpu: 200m + memory: 1Gi + nodeSelector: {} + tolerations: [] + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: DoesNotExist + topologyKey: kubernetes.io/hostname + livenessProbe: + failureThreshold: 3 + initialDelaySeconds: 10 + periodSeconds: 1000 + successThreshold: 1 + timeoutSeconds: 1000 + readinessProbe: + failureThreshold: 3 + initialDelaySeconds: 10 + periodSeconds: 1000 + successThreshold: 1 + timeoutSeconds: 1000 + applicationSecret: + enabled: false + configmap: + create: true + elastic: + enabled: false + security: + tls: + restEncryption: false diff --git a/charts/values.yaml b/charts/values.yaml deleted file mode 100644 index bf2e54f0..00000000 --- a/charts/values.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2023 BMW AG -# Copyright (c) 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 -# ******************************************************************************** - -# Default values for vas. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. -#dcm-backend: -# image: -# # -- Overrides the image tag whose default is the chart appVersion. -# tag: "latest" - -dcm-frontend: - image: - # -- Overrides the image tag whose default is the chart appVersion. - tag: "latest" - - ingress: - enabled: false - #host: "dcm-capacity-mgmt-frontend.dev.demo.catena-x.net" - -#postgres: -# enabled: true -# auth: -# database: dcm -# username: dcm -# password: "dcm" -# postgres-password: "dcm" \ No newline at end of file diff --git a/demand-capacity-mgmt-backend/src/main/resources/application.yml b/demand-capacity-mgmt-backend/src/main/resources/application.yml index 93db5966..15647e30 100644 --- a/demand-capacity-mgmt-backend/src/main/resources/application.yml +++ b/demand-capacity-mgmt-backend/src/main/resources/application.yml @@ -24,9 +24,9 @@ spring: database: POSTGRESQL show-sql: true datasource: - url: jdbc:postgresql://${DCM_DATASOURCE_HOST:localhost:5432}/${DCM_DATASOURCE_NAME:dmc} - username: ${DCM_DATASOURCE_USER:dcm} - password: ${DCM_DATASOURCE_PASS:dcm} + url: jdbc:postgresql://${DCM_DATASOURCE_HOST:localhost:5432}/${DCM_DATASOURCE_NAME:dcm} + username: ${DCM_DATASOURCE_USER:postgres} + password: ${DCM_DATASOURCE_PASS:postgres} driverClassName: org.postgresql.Driver sql: init: From ff1cd57eae46cab3f21516a728905b3b5144824e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Tue, 29 Aug 2023 11:18:16 +0100 Subject: [PATCH 04/28] problem: helm charts not working --- charts/demand-capacity-management/Chart.yaml | 1 + .../templates/_helpers.tpl | 21 ++++++++++--------- .../templates/deployment-frontend.yaml | 6 +++--- .../templates/service-backend.yaml | 12 ++++++----- .../templates/service-frontend.yaml | 12 ++++++----- charts/demand-capacity-management/values.yaml | 11 ++++++---- 6 files changed, 36 insertions(+), 27 deletions(-) diff --git a/charts/demand-capacity-management/Chart.yaml b/charts/demand-capacity-management/Chart.yaml index ee17d903..68532839 100644 --- a/charts/demand-capacity-management/Chart.yaml +++ b/charts/demand-capacity-management/Chart.yaml @@ -27,6 +27,7 @@ description: A Helm chart for the demand capacity management application # A chart can be either an 'application' or a 'library' chart. # # Application charts are a collection of templates that can be packaged into versioned archives +# Application charts are a collection of templates that can be packaged into versioned archives # to be deployed. # # Library charts provide useful utilities or functions for the chart developer. They're included as diff --git a/charts/demand-capacity-management/templates/_helpers.tpl b/charts/demand-capacity-management/templates/_helpers.tpl index a254b9c3..fd1293da 100644 --- a/charts/demand-capacity-management/templates/_helpers.tpl +++ b/charts/demand-capacity-management/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "tx-dcm-backend.name" -}} +{{- define "chart.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). If release name contains chart name it will be used as a full name. */}} -{{- define "tx-dcm-backend.fullname" -}} +{{- define "chart.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,17 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "tx-dcm-backend.chart" -}} +{{- define "chart.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "tx-dcm-backend.labels" -}} -helm.sh/chart: {{ include "tx-dcm-backend.chart" . }} -{{ include "tx-dcm-backend.selectorLabels" . }} + +{{- define "chart.labels" -}} +helm.sh/chart: {{ include "chart.chart" . }} +{{ include "chart.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,17 +46,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "tx-dcm-backend.selectorLabels" -}} -app.kubernetes.io/name: {{ include "tx-dcm-backend.name" . }} +{{- define "chart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "chart.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "tx-dcm-backend.serviceAccountName" -}} +{{- define "chart.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "tx-dcm-backend.fullname" .) .Values.serviceAccount.name }} +{{- default (include "chart.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} diff --git a/charts/demand-capacity-management/templates/deployment-frontend.yaml b/charts/demand-capacity-management/templates/deployment-frontend.yaml index bfeb05cf..a983fb2e 100644 --- a/charts/demand-capacity-management/templates/deployment-frontend.yaml +++ b/charts/demand-capacity-management/templates/deployment-frontend.yaml @@ -23,14 +23,14 @@ kind: Deployment metadata: name: {{ include "demand-capacity-management-frontend.fullname" . }} labels: - {{- include "demand-capacity-management-frontend.labels" . | nindent 4 }} + {{- include ".Values.frontend.labels" . | nindent 4 }} spec: {{- if not .Values.frontend.autoscaling.enabled }} replicas: {{ .Values.frontend.replicaCount }} {{- end }} selector: matchLabels: - {{- include "demand-capacity-management-frontend.selectorLabels" . | nindent 6 }} + {{- include ".Values.frontend.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.frontend.podAnnotations }} @@ -38,7 +38,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "demand-capacity-management-frontend.selectorLabels" . | nindent 8 }} + {{- include ".Values.frontend.selectorLabels" . | nindent 8 }} spec: {{- with .Values.frontend.imagePullSecrets }} imagePullSecrets: diff --git a/charts/demand-capacity-management/templates/service-backend.yaml b/charts/demand-capacity-management/templates/service-backend.yaml index 26c4b4d4..a332aee0 100644 --- a/charts/demand-capacity-management/templates/service-backend.yaml +++ b/charts/demand-capacity-management/templates/service-backend.yaml @@ -22,15 +22,17 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "demand-capacity-management-backend.fullname" . }} + name: {{ .Values.backend.name }} + namespace: {{ .Values.namespace }} labels: - {{- include "demand-capacity-management-backend.labels" . | nindent 4 }} + {{- include "chart.labels" . | nindent 4 }} spec: type: {{ .Values.backend.service.type }} ports: - - port: {{ .Values.backend.service.port }} - targetPort: http + - port: {{ .Values.backend.service.port }} # host port + targetPort: 8888 # container port protocol: TCP name: http selector: - {{- include "demand-capacity-management-backend.selectorLabels" . | nindent 4 }} \ No newline at end of file + {{- include "chart.selectorLabels" . | nindent 4 }} + component: backend \ No newline at end of file diff --git a/charts/demand-capacity-management/templates/service-frontend.yaml b/charts/demand-capacity-management/templates/service-frontend.yaml index e85e0e5f..689a7c83 100644 --- a/charts/demand-capacity-management/templates/service-frontend.yaml +++ b/charts/demand-capacity-management/templates/service-frontend.yaml @@ -21,15 +21,17 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "demand-capacity-management-frontend.fullname" . }} + name: {{ .Values.frontend.name }} + namespace: {{ .Values.namespace }} labels: - {{- include "demand-capacity-management-frontend.labels" . | nindent 4 }} + {{- include "chart.labels" . | nindent 4 }} spec: type: {{ .Values.frontend.service.type }} ports: - - port: {{ .Values.frontend.service.port }} - targetPort: http + - port: {{ .Values.frontend.service.port }} # host port + targetPort: 8080 # container port protocol: TCP name: http selector: - {{- include "demand-capacity-management-frontend.selectorLabels" . | nindent 4 }} + {{- include "chart.selectorLabels" . | nindent 4 }} + component: frontend diff --git a/charts/demand-capacity-management/values.yaml b/charts/demand-capacity-management/values.yaml index cff4cf8d..317643a1 100644 --- a/charts/demand-capacity-management/values.yaml +++ b/charts/demand-capacity-management/values.yaml @@ -23,11 +23,14 @@ # Declare variables to be passed into your templates. # Backend Settings +name: "demand-capacity-management" +replicaCount: 1 +namespace: "" + backend: - replicaCount: 1 + name: "demand-capacity-management-backend" image: registry: "ghcr.io" - name: "catenax-ng/demand-capacity-management-backend" pullPolicy: Always tag: "" certificate: @@ -112,10 +115,9 @@ backend: # Frontend Settings frontend: - replicaCount: 1 + name: "demand-capacity-management-frontend" image: registry: "ghcr.io" - name: "catenax-ng/demand-capacity-management-frontend" pullPolicy: Always tag: "" certificate: @@ -182,3 +184,4 @@ frontend: security: tls: restEncryption: false + From a9fa8494b6d552fa8d991e8452a19ae2fcb14276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Tue, 29 Aug 2023 11:35:37 +0100 Subject: [PATCH 05/28] Still don't working, but had to change --- .../templates/deployment-frontend.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/demand-capacity-management/templates/deployment-frontend.yaml b/charts/demand-capacity-management/templates/deployment-frontend.yaml index a983fb2e..03d55021 100644 --- a/charts/demand-capacity-management/templates/deployment-frontend.yaml +++ b/charts/demand-capacity-management/templates/deployment-frontend.yaml @@ -21,7 +21,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "demand-capacity-management-frontend.fullname" . }} + name: {{ include ".Values.frontend.fullname" . }} labels: {{- include ".Values.frontend.labels" . | nindent 4 }} spec: From 25f420ce81213c6fa8e399f2fce3eb4d9fae17ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Tue, 29 Aug 2023 11:56:54 +0100 Subject: [PATCH 06/28] Update deployment-frontend.yaml --- .../templates/deployment-frontend.yaml | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/charts/demand-capacity-management/templates/deployment-frontend.yaml b/charts/demand-capacity-management/templates/deployment-frontend.yaml index 03d55021..a26b9a54 100644 --- a/charts/demand-capacity-management/templates/deployment-frontend.yaml +++ b/charts/demand-capacity-management/templates/deployment-frontend.yaml @@ -21,52 +21,50 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include ".Values.frontend.fullname" . }} + name: {{ .Values.frontend.name }} labels: - {{- include ".Values.frontend.labels" . | nindent 4 }} + {{- include "chart.labels" . | nindent 4 }} + namespace: {{ .Values.namespace }} spec: - {{- if not .Values.frontend.autoscaling.enabled }} - replicas: {{ .Values.frontend.replicaCount }} - {{- end }} + replicas: {{ .Values.replicaCount }} selector: matchLabels: - {{- include ".Values.frontend.selectorLabels" . | nindent 6 }} + {{- include "chart.selectorLabels" . | nindent 6 }} + component: frontend template: metadata: - {{- with .Values.frontend.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} labels: - {{- include ".Values.frontend.selectorLabels" . | nindent 8 }} + {{- include "chart.selectorLabels" . | nindent 8 }} + component: frontend spec: {{- with .Values.frontend.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} securityContext: - {{- toYaml .Values.frontend.podSecurityContext | nindent 8 }} + runAsUser: 10000 + fsGroup: 3000 containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.frontend.securityContext | nindent 12 }} - image: "{{ .Values.frontend.image.registry }}/{{ .Values.frontend.image.name }}:{{ .Values.frontend.frontend.image.tag | default .Chart.AppVersion }}" + image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.frontend.image.pullPolicy }} ports: - - name: http - containerPort: {{ .Values.frontend.service.port }} + - containerPort: 8080 + name: http protocol: TCP resources: - {{- toYaml .Values.frontend.resources | nindent 12 }} - {{- with .Values.frontend.nodeSelector }} + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.frontend.affinity }} + {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.frontend.tolerations }} + {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} From 930b47ae0d33592d048ea4b7d75aaa23fff31b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Tue, 29 Aug 2023 12:01:37 +0100 Subject: [PATCH 07/28] Update deployment-backend.yaml --- .../templates/deployment-backend.yaml | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/charts/demand-capacity-management/templates/deployment-backend.yaml b/charts/demand-capacity-management/templates/deployment-backend.yaml index b804b8d0..bc3b400f 100644 --- a/charts/demand-capacity-management/templates/deployment-backend.yaml +++ b/charts/demand-capacity-management/templates/deployment-backend.yaml @@ -22,36 +22,34 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "demand-capacity-management-backend.fullname" . }} + name: {{ .Values.backend.name }} labels: - {{- include "demand-capacity-management-backend.labels" . | nindent 4 }} + {{- include "chart.labels" . | nindent 4 }} + namespace: {{ .Values.namespace }} spec: - {{- if not .Values.backend.autoscaling.enabled }} - replicas: {{ .Values.backend.replicaCount }} - {{- end }} + replicas: {{ .Values.replicaCount }} selector: matchLabels: - {{- include "demand-capacity-management-backend.selectorLabels" . | nindent 6 }} + {{- include "chart.selectorLabels" . | nindent 6 }} + component: backend template: metadata: - {{- with .Values.backend.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} labels: - {{- include "demand-capacity-management-backend.selectorLabels" . | nindent 8 }} + {{- include "chart.selectorLabels" . | nindent 8 }} + component: backend spec: {{- with .Values.backend.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} securityContext: - {{- toYaml .Values.backend.podSecurityContext | nindent 8 }} + runAsUser: 10000 + fsGroup: 3000 containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.backend.securityContext | nindent 12 }} - image: "{{ .Values.backend.image.registry }}/{{ .Values.backend.image.name }}:{{ .Values.backend.image.tag | default .Chart.AppVersion }}" + image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.backend.image.pullPolicy }} env: - name: DCM_DATASOURCE_HOST From 1087f47cccdc11d6858519265c2933d56ba5affc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Tue, 29 Aug 2023 12:37:15 +0100 Subject: [PATCH 08/28] Update chart-release.yaml --- .github/workflows/chart-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-release.yml b/.github/workflows/chart-release.yml index 38f2d9bb..66a1370d 100644 --- a/.github/workflows/chart-release.yml +++ b/.github/workflows/chart-release.yml @@ -26,7 +26,7 @@ on: paths: - 'charts/**' branches: - - main + - 'feat/DCMFOSS-53' jobs: release: permissions: From 946bd2e64c98c326ef0a06303dc9d3a8001c820c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Tue, 29 Aug 2023 12:39:54 +0100 Subject: [PATCH 09/28] Update chart-release.yml --- .github/workflows/chart-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-release.yml b/.github/workflows/chart-release.yml index 66a1370d..1bb70c64 100644 --- a/.github/workflows/chart-release.yml +++ b/.github/workflows/chart-release.yml @@ -24,7 +24,7 @@ name: Release - Helm Charts on: push: paths: - - 'charts/**' + - 'charts/demand-capacity-management/Chart.yaml' branches: - 'feat/DCMFOSS-53' jobs: From e0408dee1fdb38e310b983d5073590821440f981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Tue, 29 Aug 2023 12:40:54 +0100 Subject: [PATCH 10/28] Update chart-release.yml --- .github/workflows/chart-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-release.yml b/.github/workflows/chart-release.yml index 1bb70c64..e1abac33 100644 --- a/.github/workflows/chart-release.yml +++ b/.github/workflows/chart-release.yml @@ -26,7 +26,7 @@ on: paths: - 'charts/demand-capacity-management/Chart.yaml' branches: - - 'feat/DCMFOSS-53' + - feat/DCMFOSS-53 jobs: release: permissions: From ce2a06fd411a6772646eb9c02a213154bc4f4313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Tue, 29 Aug 2023 12:42:45 +0100 Subject: [PATCH 11/28] Update chart-release.yml --- .github/workflows/chart-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-release.yml b/.github/workflows/chart-release.yml index e1abac33..1bb70c64 100644 --- a/.github/workflows/chart-release.yml +++ b/.github/workflows/chart-release.yml @@ -26,7 +26,7 @@ on: paths: - 'charts/demand-capacity-management/Chart.yaml' branches: - - feat/DCMFOSS-53 + - 'feat/DCMFOSS-53' jobs: release: permissions: From db0b7c82c5e44837e7437b587fd291e09b103636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Tue, 29 Aug 2023 14:25:32 +0100 Subject: [PATCH 12/28] Update values.yaml --- charts/demand-capacity-management/values.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/charts/demand-capacity-management/values.yaml b/charts/demand-capacity-management/values.yaml index 317643a1..233a8fd7 100644 --- a/charts/demand-capacity-management/values.yaml +++ b/charts/demand-capacity-management/values.yaml @@ -28,10 +28,11 @@ replicaCount: 1 namespace: "" backend: - name: "demand-capacity-management-backend" + name: "dcm-backend" image: registry: "ghcr.io" pullPolicy: Always + repository: ghcr.io/catenax-ng/tx-demand-capacity-mgmt/demand-capacity-mgmt-backend tag: "" certificate: host: "localhost" @@ -115,10 +116,11 @@ backend: # Frontend Settings frontend: - name: "demand-capacity-management-frontend" + name: "dcm-frontend" image: registry: "ghcr.io" pullPolicy: Always + repository: ghcr.io/catenax-ng/tx-demand-capacity-mgmt/demand-capacity-mgmt-frontend tag: "" certificate: host: "localhost" From a94cf5727bdee34bea9304ae9e125d00a335407a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Tue, 29 Aug 2023 15:23:40 +0100 Subject: [PATCH 13/28] fix: Added postgres dependency --- charts/demand-capacity-management/Chart.lock | 6 +++--- charts/demand-capacity-management/Chart.yaml | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/charts/demand-capacity-management/Chart.lock b/charts/demand-capacity-management/Chart.lock index 46a72682..55652f1e 100644 --- a/charts/demand-capacity-management/Chart.lock +++ b/charts/demand-capacity-management/Chart.lock @@ -1,6 +1,6 @@ dependencies: -- name: demand-capacity-management-frontend - repository: "" - version: 0.1.0 +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 11.9.13 digest: sha256:f74903e90415c9ced4a2f1077b295ad06d61b68db68a7e7fcf342437d6a02363 generated: "2023-07-10T23:02:40.988211+01:00" diff --git a/charts/demand-capacity-management/Chart.yaml b/charts/demand-capacity-management/Chart.yaml index 68532839..aa1243fe 100644 --- a/charts/demand-capacity-management/Chart.yaml +++ b/charts/demand-capacity-management/Chart.yaml @@ -46,4 +46,11 @@ version: 0.1.0 # It is recommended to use it with quotes. appVersion: "latest" +dependencies: + - name: postgresql + version: 11.*.* + repository: https://charts.bitnami.com/bitnami + alias: postgres + condition: postgres.enabled + From e31e0904d15b05366dd5c5da9d6d9eecdf78c96d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Wed, 30 Aug 2023 16:01:32 +0100 Subject: [PATCH 14/28] update: Missing values --- .../templates/deployment-backend.yaml | 13 ++++++------ .../templates/deployment-frontend.yaml | 6 +++--- charts/demand-capacity-management/values.yaml | 20 ++++++++++--------- .../src/main/resources/application.yml | 7 ++----- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/charts/demand-capacity-management/templates/deployment-backend.yaml b/charts/demand-capacity-management/templates/deployment-backend.yaml index bc3b400f..cc0c9efa 100644 --- a/charts/demand-capacity-management/templates/deployment-backend.yaml +++ b/charts/demand-capacity-management/templates/deployment-backend.yaml @@ -55,14 +55,15 @@ spec: - name: DCM_DATASOURCE_HOST value: {{ include "dcm-backend.postgres.name" . }} - name: DCM_DATASOURCE_NAME - value: {{ .Values.backend.postgres.auth.database }} + value: {{ .Values.postgres.auth.database }} - name: DCM_DATASOURCE_USER - value: {{ .Values.backend.postgres.auth.username }} + value: {{ .Values.postgres.auth.username }} - name: DCM_DATASOURCE_PASS - valueFrom: - secretKeyRef: - name: {{ include "dcm-backend.postgres.name" . }} - key: password + value: {{ .Values.postgres.auth.password }} + #valueFrom: + # secretKeyRef: + # name: {{ include "dcm-backend.postgres.name" . }} + # key: {{ .Values.postgres.auth.postgres_password }} ports: - name: http containerPort: {{ .Values.backend.service.port }} diff --git a/charts/demand-capacity-management/templates/deployment-frontend.yaml b/charts/demand-capacity-management/templates/deployment-frontend.yaml index a26b9a54..ab7e5ce7 100644 --- a/charts/demand-capacity-management/templates/deployment-frontend.yaml +++ b/charts/demand-capacity-management/templates/deployment-frontend.yaml @@ -55,16 +55,16 @@ spec: name: http protocol: TCP resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.frontend.resources | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- with .Values.frontend.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.tolerations }} + {{- with .Values.frontend.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/demand-capacity-management/values.yaml b/charts/demand-capacity-management/values.yaml index 233a8fd7..dcea0f8c 100644 --- a/charts/demand-capacity-management/values.yaml +++ b/charts/demand-capacity-management/values.yaml @@ -84,7 +84,7 @@ backend: successThreshold: 1 timeoutSeconds: 1 path: /actuator/health - port: 8080 + port: 8888 readinessProbe: failureThreshold: 3 initialDelaySeconds: 300 @@ -92,7 +92,7 @@ backend: successThreshold: 1 timeoutSeconds: 1 path: /actuator/health - port: 8080 + port: 8888 applicationSecret: enabled: true clientSecret: "" @@ -106,13 +106,7 @@ backend: security: tls: restEncryption: false - postgres: - enabled: true - auth: - database: dcm - username: dcm - password: "dcm" - postgres-password: "dcm" + # Frontend Settings frontend: @@ -187,3 +181,11 @@ frontend: tls: restEncryption: false +postgres: + enabled: true + auth: + database: dcm + username: dcm + password: dcm + postgres_password: "postgres-password" + diff --git a/demand-capacity-mgmt-backend/src/main/resources/application.yml b/demand-capacity-mgmt-backend/src/main/resources/application.yml index 15647e30..7300d792 100644 --- a/demand-capacity-mgmt-backend/src/main/resources/application.yml +++ b/demand-capacity-mgmt-backend/src/main/resources/application.yml @@ -25,8 +25,8 @@ spring: show-sql: true datasource: url: jdbc:postgresql://${DCM_DATASOURCE_HOST:localhost:5432}/${DCM_DATASOURCE_NAME:dcm} - username: ${DCM_DATASOURCE_USER:postgres} - password: ${DCM_DATASOURCE_PASS:postgres} + username: ${DCM_DATASOURCE_USER:dcm} + password: ${DCM_DATASOURCE_PASS:dcm} driverClassName: org.postgresql.Driver sql: init: @@ -35,6 +35,3 @@ spring: management: security: enable:false - - -#url: jdbc:oracle:thin:@//${ORACLEDB_HOST}:${ORACLEDB_PORT}/${ORACLEDB_SERVICENAME} \ No newline at end of file From 5429f3587f3670e4202926458fe88f891756c8f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Thu, 31 Aug 2023 12:41:38 +0100 Subject: [PATCH 15/28] added: .dockerignore --- charts/demand-capacity-management/Chart.lock | 4 ++-- demand-capacity-mgmt-frontend/.dockerignore | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 demand-capacity-mgmt-frontend/.dockerignore diff --git a/charts/demand-capacity-management/Chart.lock b/charts/demand-capacity-management/Chart.lock index 55652f1e..1a068ef1 100644 --- a/charts/demand-capacity-management/Chart.lock +++ b/charts/demand-capacity-management/Chart.lock @@ -2,5 +2,5 @@ dependencies: - name: postgresql repository: https://charts.bitnami.com/bitnami version: 11.9.13 -digest: sha256:f74903e90415c9ced4a2f1077b295ad06d61b68db68a7e7fcf342437d6a02363 -generated: "2023-07-10T23:02:40.988211+01:00" +digest: sha256:45475d1f1d0a2acc3ef70b7e01fcb8a23d3aa305d3d77b8f9429b78858fdd9c3 +generated: "2023-08-31T11:56:11.2978185+01:00" diff --git a/demand-capacity-mgmt-frontend/.dockerignore b/demand-capacity-mgmt-frontend/.dockerignore new file mode 100644 index 00000000..d2a6d9ca --- /dev/null +++ b/demand-capacity-mgmt-frontend/.dockerignore @@ -0,0 +1 @@ +/app/node_modules/.cache/.eslintcache \ No newline at end of file From 289f577206f528aceb64461d68c8dd0b5784e2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Thu, 31 Aug 2023 12:59:37 +0100 Subject: [PATCH 16/28] fix: backend values --- .github/workflows/build-master-frontend.yml | 2 +- charts/demand-capacity-management/values.yaml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-master-frontend.yml b/.github/workflows/build-master-frontend.yml index b64a3289..3d42af6f 100644 --- a/.github/workflows/build-master-frontend.yml +++ b/.github/workflows/build-master-frontend.yml @@ -26,7 +26,7 @@ on: paths: - 'demand-capacity-mgmt-frontend/**' branches: - - 'main' + - 'feat/DCMFOSS-53' tags: - 'v*.*.*' - 'v*.*.*-*' diff --git a/charts/demand-capacity-management/values.yaml b/charts/demand-capacity-management/values.yaml index dcea0f8c..7fbd4718 100644 --- a/charts/demand-capacity-management/values.yaml +++ b/charts/demand-capacity-management/values.yaml @@ -51,7 +51,7 @@ backend: - ALL service: type: ClusterIP - port: 8888 + port: 8080 autoscaling: enabled: false ingress: @@ -84,7 +84,7 @@ backend: successThreshold: 1 timeoutSeconds: 1 path: /actuator/health - port: 8888 + port: 8080 readinessProbe: failureThreshold: 3 initialDelaySeconds: 300 @@ -92,7 +92,7 @@ backend: successThreshold: 1 timeoutSeconds: 1 path: /actuator/health - port: 8888 + port: 8080 applicationSecret: enabled: true clientSecret: "" From 615b8060ae80af003bc3e3d6678044ee200396d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Thu, 31 Aug 2023 13:00:17 +0100 Subject: [PATCH 17/28] Update build-master-backend.yml --- .github/workflows/build-master-backend.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-master-backend.yml b/.github/workflows/build-master-backend.yml index 9cfc2474..2bb9ab16 100644 --- a/.github/workflows/build-master-backend.yml +++ b/.github/workflows/build-master-backend.yml @@ -27,7 +27,7 @@ on: - 'demand-capacity-mgmt-backend/**' - 'demand-capacity-mgmt-specification/**' branches: - - 'main' + - 'feat/DCMFOSS-53' tags: - 'v*.*.*' - 'v*.*.*-*' From 78675188d5ac5758acbdff89dd9398f402293611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Thu, 31 Aug 2023 13:01:48 +0100 Subject: [PATCH 18/28] testing workflows --- .../controllers/CapacityGroupController.java | 1 + demand-capacity-mgmt-frontend/.dockerignore | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/CapacityGroupController.java b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/CapacityGroupController.java index 3261c5ba..5597eb55 100644 --- a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/CapacityGroupController.java +++ b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/CapacityGroupController.java @@ -48,6 +48,7 @@ public ResponseEntity> getCapacityGroup() public ResponseEntity postCapacityGroup(CapacityGroupRequest capacityGroupRequest) throws Exception { capacityGroupService.createCapacityGroup(capacityGroupRequest); + return null; } } diff --git a/demand-capacity-mgmt-frontend/.dockerignore b/demand-capacity-mgmt-frontend/.dockerignore index d2a6d9ca..da6a83c0 100644 --- a/demand-capacity-mgmt-frontend/.dockerignore +++ b/demand-capacity-mgmt-frontend/.dockerignore @@ -1 +1 @@ -/app/node_modules/.cache/.eslintcache \ No newline at end of file +/node_modules/.cache/.eslintcache \ No newline at end of file From e704819031c84e752395c42caa7d05841b19eb64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Thu, 31 Aug 2023 13:47:17 +0100 Subject: [PATCH 19/28] fix: values for frontend kubernetes --- .github/workflows/build-master-backend.yml | 2 +- .github/workflows/build-master-frontend.yml | 2 +- charts/demand-capacity-management/values.yaml | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-master-backend.yml b/.github/workflows/build-master-backend.yml index 2bb9ab16..9cfc2474 100644 --- a/.github/workflows/build-master-backend.yml +++ b/.github/workflows/build-master-backend.yml @@ -27,7 +27,7 @@ on: - 'demand-capacity-mgmt-backend/**' - 'demand-capacity-mgmt-specification/**' branches: - - 'feat/DCMFOSS-53' + - 'main' tags: - 'v*.*.*' - 'v*.*.*-*' diff --git a/.github/workflows/build-master-frontend.yml b/.github/workflows/build-master-frontend.yml index 3d42af6f..b64a3289 100644 --- a/.github/workflows/build-master-frontend.yml +++ b/.github/workflows/build-master-frontend.yml @@ -26,7 +26,7 @@ on: paths: - 'demand-capacity-mgmt-frontend/**' branches: - - 'feat/DCMFOSS-53' + - 'main' tags: - 'v*.*.*' - 'v*.*.*-*' diff --git a/charts/demand-capacity-management/values.yaml b/charts/demand-capacity-management/values.yaml index 7fbd4718..1238411d 100644 --- a/charts/demand-capacity-management/values.yaml +++ b/charts/demand-capacity-management/values.yaml @@ -142,11 +142,11 @@ frontend: annotations: {} resources: limits: - cpu: 300m - memory: 1Gi + cpu: 500m + memory: 2Gi requests: - cpu: 200m - memory: 1Gi + cpu: 400m + memory: 2Gi nodeSelector: {} tolerations: [] affinity: From 41825bf85eb26d56135cee1309db64d62e04a252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Mon, 4 Sep 2023 12:46:00 +0100 Subject: [PATCH 20/28] Update INSTALL.md --- INSTALL.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index e69de29b..472f563e 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -0,0 +1,7 @@ +Prerequisites: +- Have helm installed on your machine +- +To install the images we need to run this command on the root folder: + +```helm install dcm ./charts/demand-capacity-management ``` + From 07f18a7f29e622749499ef6a63093eb984d8311a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Wed, 6 Sep 2023 09:16:20 +0100 Subject: [PATCH 21/28] fix: Some minor issues --- .github/workflows/chart-release.yml | 4 ++-- demand-capacity-mgmt-frontend/.dockerignore | 2 +- index.yaml | 12 ------------ 3 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 index.yaml diff --git a/.github/workflows/chart-release.yml b/.github/workflows/chart-release.yml index 1bb70c64..ec5b5fb0 100644 --- a/.github/workflows/chart-release.yml +++ b/.github/workflows/chart-release.yml @@ -24,9 +24,9 @@ name: Release - Helm Charts on: push: paths: - - 'charts/demand-capacity-management/Chart.yaml' + - 'charts/**' branches: - - 'feat/DCMFOSS-53' + - 'main' jobs: release: permissions: diff --git a/demand-capacity-mgmt-frontend/.dockerignore b/demand-capacity-mgmt-frontend/.dockerignore index da6a83c0..30bc1627 100644 --- a/demand-capacity-mgmt-frontend/.dockerignore +++ b/demand-capacity-mgmt-frontend/.dockerignore @@ -1 +1 @@ -/node_modules/.cache/.eslintcache \ No newline at end of file +/node_modules \ No newline at end of file diff --git a/index.yaml b/index.yaml deleted file mode 100644 index 18776905..00000000 --- a/index.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -entries: - my-chart: - - apiVersion: v2 - created: "2023-07-26T14:11:25.751539559Z" - description: An empty Helm chart - digest: 06875acc643ec23a8c800b0b2645a2e3d6a6f9ff1992a6f3949d0156bb9769e3 - name: my-chart - urls: - - https://github.com/catenax-ng/tx-demand-capacity-mgmt/releases/download/my-chart-0.1.0/my-chart-0.1.0.tgz - version: 0.1.0 -generated: "2023-07-26T14:11:25.751544659Z" From cbdd842a50142eceb81bc639bdb5acf708e491ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Wed, 6 Sep 2023 11:33:20 +0100 Subject: [PATCH 22/28] fix: change ghcr.io to docker.io --- charts/demand-capacity-management/values.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/demand-capacity-management/values.yaml b/charts/demand-capacity-management/values.yaml index 1238411d..9d65a64f 100644 --- a/charts/demand-capacity-management/values.yaml +++ b/charts/demand-capacity-management/values.yaml @@ -30,9 +30,9 @@ namespace: "" backend: name: "dcm-backend" image: - registry: "ghcr.io" + registry: "docker.io" pullPolicy: Always - repository: ghcr.io/catenax-ng/tx-demand-capacity-mgmt/demand-capacity-mgmt-backend + repository: docker.io/tractusx/tx-demand-capacity-mgmt/demand-capacity-mgmt-backend tag: "" certificate: host: "localhost" @@ -112,9 +112,9 @@ backend: frontend: name: "dcm-frontend" image: - registry: "ghcr.io" + registry: "docker.io" pullPolicy: Always - repository: ghcr.io/catenax-ng/tx-demand-capacity-mgmt/demand-capacity-mgmt-frontend + repository: docker.io/tractusx/tx-demand-capacity-mgmt/demand-capacity-mgmt-frontend tag: "" certificate: host: "localhost" From 86867071cba2d97346ea777aa618edd043fe49e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Wed, 6 Sep 2023 11:35:09 +0100 Subject: [PATCH 23/28] fix: change ghcr.io to docker.io --- .github/workflows/build-master-backend.yml | 2 +- .github/workflows/build-master-frontend.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-master-backend.yml b/.github/workflows/build-master-backend.yml index 9cfc2474..3fd8819c 100644 --- a/.github/workflows/build-master-backend.yml +++ b/.github/workflows/build-master-backend.yml @@ -34,7 +34,7 @@ on: env: IMAGE_NAME: 'demand-capacity-mgmt-backend' - REGISTRY: 'ghcr.io' + REGISTRY: 'docker.io' IMAGE_NAMESPACE: 'tractusx' diff --git a/.github/workflows/build-master-frontend.yml b/.github/workflows/build-master-frontend.yml index b64a3289..d14a4ec2 100644 --- a/.github/workflows/build-master-frontend.yml +++ b/.github/workflows/build-master-frontend.yml @@ -32,7 +32,7 @@ on: - 'v*.*.*-*' env: IMAGE_NAME: 'demand-capacity-mgmt-frontend' - REGISTRY: 'ghcr.io' + REGISTRY: 'docker.io' IMAGE_NAMESPACE: 'tractusx' jobs: From ebd62c039936c763200800db173effc9da111a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Thu, 14 Sep 2023 14:06:58 +0100 Subject: [PATCH 24/28] fix: repository: docker.io/tractusx/demand-capacity-mgmt- frontend and backend --- charts/demand-capacity-management/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/demand-capacity-management/values.yaml b/charts/demand-capacity-management/values.yaml index 9d65a64f..b7d26229 100644 --- a/charts/demand-capacity-management/values.yaml +++ b/charts/demand-capacity-management/values.yaml @@ -32,7 +32,7 @@ backend: image: registry: "docker.io" pullPolicy: Always - repository: docker.io/tractusx/tx-demand-capacity-mgmt/demand-capacity-mgmt-backend + repository: docker.io/tractusx/demand-capacity-mgmt-backend tag: "" certificate: host: "localhost" @@ -114,7 +114,7 @@ frontend: image: registry: "docker.io" pullPolicy: Always - repository: docker.io/tractusx/tx-demand-capacity-mgmt/demand-capacity-mgmt-frontend + repository: docker.io/tractusx/demand-capacity-mgmt-frontend tag: "" certificate: host: "localhost" From e2d7704e3771a0931209ba0ba026bd958d189273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Thu, 14 Sep 2023 14:18:00 +0100 Subject: [PATCH 25/28] fix: retrived password on postgres --- charts/demand-capacity-management/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/demand-capacity-management/values.yaml b/charts/demand-capacity-management/values.yaml index b7d26229..62043132 100644 --- a/charts/demand-capacity-management/values.yaml +++ b/charts/demand-capacity-management/values.yaml @@ -186,6 +186,6 @@ postgres: auth: database: dcm username: dcm - password: dcm - postgres_password: "postgres-password" + password: "" + postgres_password: "" From 1427987297a0077c826d5d9bd7dc2c1ff6372e6c Mon Sep 17 00:00:00 2001 From: Bailonis <72702458+Bailonis@users.noreply.github.com> Date: Mon, 18 Sep 2023 08:55:41 +0100 Subject: [PATCH 26/28] fix: typo --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 472f563e..ce920fb0 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,6 +1,6 @@ Prerequisites: - Have helm installed on your machine -- + To install the images we need to run this command on the root folder: ```helm install dcm ./charts/demand-capacity-management ``` From 992887b1f6c20b2f45b47edda1bc5f55dcf87ea7 Mon Sep 17 00:00:00 2001 From: Bailonis <72702458+Bailonis@users.noreply.github.com> Date: Mon, 18 Sep 2023 09:13:52 +0100 Subject: [PATCH 27/28] add: link to helm releases --- INSTALL.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index ce920fb0..b7b989aa 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,5 +1,7 @@ Prerequisites: - Have helm installed on your machine + +You can get helm from here: https://github.com/helm/helm/releases To install the images we need to run this command on the root folder: From d3b0c2905562248d3888d8f0c101e6822509b0d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Bail=C3=A3o?= Date: Mon, 25 Sep 2023 10:43:35 +0100 Subject: [PATCH 28/28] fix: merge conflict error --- .../controllers/CapacityGroupController.java | 1 - .../controllers/FavoriteController.java | 14 +++--- .../entities/FavoriteEntity.java | 7 ++- .../entities/enums/FavoriteType.java | 3 +- .../repositories/FavoriteRepository.java | 21 ++++----- .../services/FavoriteService.java | 3 +- .../services/impl/FavoriteServiceImpl.java | 45 ++++++++++--------- 7 files changed, 47 insertions(+), 47 deletions(-) diff --git a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/CapacityGroupController.java b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/CapacityGroupController.java index bf68147b..975cf19a 100644 --- a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/CapacityGroupController.java +++ b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/CapacityGroupController.java @@ -46,7 +46,6 @@ public ResponseEntity> getCapacityGroup() } @Override - public ResponseEntity getCapacityGroupById(String capacityGroupId) { CapacityGroupResponse responseDto = capacityGroupService.getCapacityGroupById(capacityGroupId); return ResponseEntity.status(HttpStatus.OK).body(responseDto); diff --git a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/FavoriteController.java b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/FavoriteController.java index 3b6eb8f9..af5df840 100644 --- a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/FavoriteController.java +++ b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/controllers/FavoriteController.java @@ -25,15 +25,14 @@ import eclipse.tractusx.demand_capacity_mgmt_specification.api.FavoriteApi; import eclipse.tractusx.demand_capacity_mgmt_specification.model.FavoriteRequest; import eclipse.tractusx.demand_capacity_mgmt_specification.model.FavoriteResponse; +import java.util.List; +import java.util.UUID; import lombok.AllArgsConstructor; import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.enums.FavoriteType; import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.services.FavoriteService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RestController; -import java.util.List; -import java.util.UUID; - @RestController @AllArgsConstructor public class FavoriteController implements FavoriteApi { @@ -65,8 +64,13 @@ public ResponseEntity> getFavoriteByType(String type) thr } @Override - public ResponseEntity updateFavorite(String id,String type, FavoriteRequest favoriteRequest) throws Exception { - FavoriteResponse response = favoriteService.updateFavorite(UUID.fromString(id), FavoriteType.valueOf(type),favoriteRequest); + public ResponseEntity updateFavorite(String id, String type, FavoriteRequest favoriteRequest) + throws Exception { + FavoriteResponse response = favoriteService.updateFavorite( + UUID.fromString(id), + FavoriteType.valueOf(type), + favoriteRequest + ); return ResponseEntity.status(200).body(response); } } diff --git a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/entities/FavoriteEntity.java b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/entities/FavoriteEntity.java index afc519ec..0dbe5787 100644 --- a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/entities/FavoriteEntity.java +++ b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/entities/FavoriteEntity.java @@ -22,15 +22,14 @@ package org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities; +import java.util.UUID; +import javax.persistence.*; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.enums.FavoriteType; -import javax.persistence.*; -import java.util.UUID; - @Entity @Table(name = "favorites") @Data @@ -44,7 +43,7 @@ public class FavoriteEntity { @Column(columnDefinition = "uuid", updatable = false, name = "user_id") private UUID id; - @Column(columnDefinition = "uuid",name = "favorite_id") + @Column(columnDefinition = "uuid", name = "favorite_id") private UUID favoriteId; @Column(name = "f_type", columnDefinition = "varchar") diff --git a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/entities/enums/FavoriteType.java b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/entities/enums/FavoriteType.java index 070bb735..b0287a33 100644 --- a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/entities/enums/FavoriteType.java +++ b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/entities/enums/FavoriteType.java @@ -34,5 +34,6 @@ public enum FavoriteType { MATERIAL_DEMAND, UNITY_OF_MEASURE, WEEK_BASED_MATERIAL_DEMAND, - WEEK_BASED,CAPACITY, + WEEK_BASED, + CAPACITY, } diff --git a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/repositories/FavoriteRepository.java b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/repositories/FavoriteRepository.java index 296ae32e..7cc21a58 100644 --- a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/repositories/FavoriteRepository.java +++ b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/repositories/FavoriteRepository.java @@ -22,29 +22,26 @@ package org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.repositories; +import java.util.List; +import java.util.UUID; +import javax.transaction.Transactional; import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.FavoriteEntity; import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.enums.FavoriteType; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.lang.NonNull; -import javax.transaction.Transactional; -import java.util.List; -import java.util.UUID; - public interface FavoriteRepository extends JpaRepository { - /* * - * - * We need @Transaction because we don't fetch the entity first - * that way Hibernate entity manager won't be blocked because of missing entity manager - * (since we don't fetch the entity at all we just send delete command) - * - * */ + * + * We need @Transaction because we don't fetch the entity first + * that way Hibernate entity manager won't be blocked because of missing entity manager + * (since we don't fetch the entity at all we just send delete command) + * + * */ @Transactional void deleteByFavoriteIdAndId(@NonNull UUID favoriteId, @NonNull UUID id); FavoriteEntity findByFavoriteIdAndTypeAndId(@NonNull UUID favoriteId, @NonNull FavoriteType type, @NonNull UUID id); List findByType(FavoriteType type); - } diff --git a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/services/FavoriteService.java b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/services/FavoriteService.java index af15cfa9..9e332732 100644 --- a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/services/FavoriteService.java +++ b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/services/FavoriteService.java @@ -24,10 +24,9 @@ import eclipse.tractusx.demand_capacity_mgmt_specification.model.FavoriteRequest; import eclipse.tractusx.demand_capacity_mgmt_specification.model.FavoriteResponse; -import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.enums.FavoriteType; - import java.util.List; import java.util.UUID; +import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.enums.FavoriteType; public interface FavoriteService { List getAllFavorites(); diff --git a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/services/impl/FavoriteServiceImpl.java b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/services/impl/FavoriteServiceImpl.java index 3ce8e2c0..c72e4bb5 100644 --- a/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/services/impl/FavoriteServiceImpl.java +++ b/demand-capacity-mgmt-backend/src/main/java/org/eclipse/tractusx/demandcapacitymgmt/demandcapacitymgmtbackend/services/impl/FavoriteServiceImpl.java @@ -24,18 +24,18 @@ import eclipse.tractusx.demand_capacity_mgmt_specification.model.FavoriteRequest; import eclipse.tractusx.demand_capacity_mgmt_specification.model.FavoriteResponse; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.FavoriteEntity; import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.enums.FavoriteType; -import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.exceptions.NotFoundException; +import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.exceptions.type.NotFoundException; import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.repositories.FavoriteRepository; import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.services.FavoriteService; import org.springframework.stereotype.Service; -import java.util.List; -import java.util.UUID; - @RequiredArgsConstructor @Service @Slf4j @@ -66,41 +66,42 @@ public FavoriteResponse createFavorite(FavoriteRequest favoriteRequest) { @Override public FavoriteResponse updateFavorite(UUID id, FavoriteType type, FavoriteRequest favoriteRequest) { FavoriteEntity entity = favoriteRepository.findByFavoriteIdAndTypeAndId( - id, - type, - UUID.fromString("8842f835-38e9-42b1-8c07-fb310b90ef3a")); //TODO FETCH USER ID TO UPDATE OPERATION + id, + type, + UUID.fromString("8842f835-38e9-42b1-8c07-fb310b90ef3a") + ); //TODO FETCH USER ID TO UPDATE OPERATION - if(entity != null){ + if (entity != null) { entity.setFavoriteId(UUID.fromString(favoriteRequest.getFavoriteId())); entity.setType(FavoriteType.valueOf(favoriteRequest.getfType())); favoriteRepository.saveAndFlush(entity); return convertFavoriteResponse(entity); } else throw new NotFoundException( - "Entity to update was not found in DB." - + "\n" + - "Did you meant to create?"); + 404, + "The capacity group provided was not found", + new ArrayList<>(List.of("UUID provided : " + UUID.fromString(favoriteRequest.getFavoriteId()))) + ); } + @Override public void deleteFavorite(UUID id) { //TODO PLACE USER ID IN HERE - favoriteRepository.deleteByFavoriteIdAndId( - id, - UUID.fromString("8842f835-38e9-42b1-8c07-fb310b90ef3a") - ); + favoriteRepository.deleteByFavoriteIdAndId(id, UUID.fromString("8842f835-38e9-42b1-8c07-fb310b90ef3a")); } - private FavoriteResponse convertFavoriteResponse(FavoriteEntity request){ + private FavoriteResponse convertFavoriteResponse(FavoriteEntity request) { FavoriteResponse response = new FavoriteResponse(); response.setFavoriteId(request.getId().toString()); response.setfType(request.getType().name()); return response; } - private FavoriteEntity generateFavoriteEntity(FavoriteRequest request){ - return FavoriteEntity.builder() - .id(UUID.randomUUID())//TODO USER ID HERE - .favoriteId(UUID.fromString(request.getFavoriteId())) - .type(FavoriteType.valueOf(request.getfType())) - .build(); + private FavoriteEntity generateFavoriteEntity(FavoriteRequest request) { + return FavoriteEntity + .builder() + .id(UUID.randomUUID()) //TODO USER ID HERE + .favoriteId(UUID.fromString(request.getFavoriteId())) + .type(FavoriteType.valueOf(request.getfType())) + .build(); } }