From 0d3ffc067daf0cf6f5d8894eeeb6ec8e3d3fe3bb Mon Sep 17 00:00:00 2001 From: Evelyn Gurschler Date: Wed, 12 Jun 2024 15:52:13 +0200 Subject: [PATCH] feat(helm): consolidate structure in values.yaml rename policyhub node to service and policyhubmigrations to migrations --- .github/workflows/chart-test.yml | 4 +- .github/workflows/owasp-zap.yml | 2 +- charts/policy-hub/README.md | 38 +++++++++---------- .../policy-hub/templates/deployment-hub.yaml | 28 +++++++------- .../templates/job-policy-hub-migrations.yaml | 14 +++---- charts/policy-hub/values.yaml | 4 +- .../argocd-app-templates/appsetup-stable.yaml | 2 +- consortia/environments/values-beta.yaml | 4 +- consortia/environments/values-dev.yaml | 4 +- consortia/environments/values-int.yaml | 4 +- consortia/environments/values-pen.yaml | 4 +- consortia/environments/values-rc.yaml | 4 +- 12 files changed, 56 insertions(+), 56 deletions(-) diff --git a/.github/workflows/chart-test.yml b/.github/workflows/chart-test.yml index d83a2cf9..d67e1e5d 100644 --- a/.github/workflows/chart-test.yml +++ b/.github/workflows/chart-test.yml @@ -103,7 +103,7 @@ jobs: run: ct lint --validate-maintainers=false --check-version-increment=false --target-branch ${{ github.event.repository.default_branch }} - name: Run chart-testing (install) - run: ct install --charts charts/policy-hub --config charts/chart-testing-config.yaml --helm-extra-set-args "--set policyhub.image.name=kind-registry:5000/policy-hub-service --set policyhub.image.tag=testing --set policyhubmigrations.image.name=kind-registry:5000/policy-hub-migrations --set policyhubmigrations.image.tag=testing" + run: ct install --charts charts/policy-hub --config charts/chart-testing-config.yaml --helm-extra-set-args "--set service.image.name=kind-registry:5000/policy-hub-service --set service.image.tag=testing --set migrations.image.name=kind-registry:5000/policy-hub-migrations --set migrations.image.tag=testing" if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true' # Upgrade the released chart version with the locally available chart @@ -114,5 +114,5 @@ jobs: helm repo add tractusx-dev https://eclipse-tractusx.github.io/charts/dev helm install policy-hub tractusx-dev/policy-hub --version ${{ github.event.inputs.upgrade_from || '0.1.0' }} --namespace upgrade --create-namespace helm dependency update charts/policy-hub - helm upgrade policy-hub charts/policy-hub --set policyhub.image.name=kind-registry:5000/policy-hub-service --set policyhub.image.tag=testing --set policyhubmigrations.image.name=kind-registry:5000/policy-hub-migrations --set policyhubmigrations.image.tag=testing --namespace upgrade + helm upgrade policy-hub charts/policy-hub --set service.image.name=kind-registry:5000/policy-hub-service --set service.image.tag=testing --set migrations.image.name=kind-registry:5000/policy-hub-migrations --set migrations.image.tag=testing --namespace upgrade if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true' diff --git a/.github/workflows/owasp-zap.yml b/.github/workflows/owasp-zap.yml index 139697b0..43be7bc9 100644 --- a/.github/workflows/owasp-zap.yml +++ b/.github/workflows/owasp-zap.yml @@ -89,7 +89,7 @@ jobs: helm dependency build - name: Install the chart on KinD cluster - run: helm install testing -n apps --create-namespace --wait --set policyhub.image.name=kind-registry:5000/policy-hub-service --set policyhub.image.tag=testing --set policyhubmigrations.image.name=kind-registry:5000/policy-hub-migrations --set policyhubmigrations.image.tag=testing --set policyhub.swaggerEnabled=true charts/policy-hub + run: helm install testing -n apps --create-namespace --wait --set service.image.name=kind-registry:5000/policy-hub-service --set service.image.tag=testing --set migrations.image.name=kind-registry:5000/policy-hub-migrations --set migrations.image.tag=testing --set service.swaggerEnabled=true charts/policy-hub - name: Configure port forward to app in KinD run: | diff --git a/charts/policy-hub/README.md b/charts/policy-hub/README.md index 58caadf4..92eaf901 100644 --- a/charts/policy-hub/README.md +++ b/charts/policy-hub/README.md @@ -46,25 +46,25 @@ dependencies: | Key | Type | Default | Description | |-----|------|---------|-------------| -| policyhub.image.name | string | `"docker.io/tractusx/policy-hub-service"` | | -| policyhub.image.tag | string | `""` | | -| policyhub.imagePullPolicy | string | `"IfNotPresent"` | | -| policyhub.resources | object | `{"limits":{"cpu":"45m","memory":"300M"},"requests":{"cpu":"15m","memory":"300M"}}` | We recommend to review the default resource limits as this should a conscious choice. | -| policyhub.logging.businessLogic | string | `"Information"` | | -| policyhub.logging.default | string | `"Information"` | | -| policyhub.healthChecks.startup.path | string | `"/health/startup"` | | -| policyhub.healthChecks.startup.tags[0].name | string | `"HEALTHCHECKS__0__TAGS__1"` | | -| policyhub.healthChecks.startup.tags[0].value | string | `"policyhubdb"` | | -| policyhub.healthChecks.liveness.path | string | `"/healthz"` | | -| policyhub.healthChecks.readyness.path | string | `"/ready"` | | -| policyhub.swaggerEnabled | bool | `false` | | -| policyhubmigrations.image.name | string | `"docker.io/tractusx/policy-hub-migrations"` | | -| policyhubmigrations.image.tag | string | `""` | | -| policyhubmigrations.imagePullPolicy | string | `"IfNotPresent"` | | -| policyhubmigrations.resources | object | `{"limits":{"cpu":"45m","memory":"105M"},"requests":{"cpu":"15m","memory":"105M"}}` | We recommend to review the default resource limits as this should a conscious choice. | -| policyhubmigrations.seeding.testDataEnvironments | string | `""` | | -| policyhubmigrations.seeding.testDataPaths | string | `"Seeder/Data"` | | -| policyhubmigrations.logging.default | string | `"Information"` | | +| service.image.name | string | `"docker.io/tractusx/policy-hub-service"` | | +| service.image.tag | string | `""` | | +| service.imagePullPolicy | string | `"IfNotPresent"` | | +| service.resources | object | `{"limits":{"cpu":"45m","memory":"300M"},"requests":{"cpu":"15m","memory":"300M"}}` | We recommend to review the default resource limits as this should a conscious choice. | +| service.logging.businessLogic | string | `"Information"` | | +| service.logging.default | string | `"Information"` | | +| service.healthChecks.startup.path | string | `"/health/startup"` | | +| service.healthChecks.startup.tags[0].name | string | `"HEALTHCHECKS__0__TAGS__1"` | | +| service.healthChecks.startup.tags[0].value | string | `"policyhubdb"` | | +| service.healthChecks.liveness.path | string | `"/healthz"` | | +| service.healthChecks.readyness.path | string | `"/ready"` | | +| service.swaggerEnabled | bool | `false` | | +| migrations.image.name | string | `"docker.io/tractusx/policy-hub-migrations"` | | +| migrations.image.tag | string | `""` | | +| migrations.imagePullPolicy | string | `"IfNotPresent"` | | +| migrations.resources | object | `{"limits":{"cpu":"45m","memory":"105M"},"requests":{"cpu":"15m","memory":"105M"}}` | We recommend to review the default resource limits as this should a conscious choice. | +| migrations.seeding.testDataEnvironments | string | `""` | | +| migrations.seeding.testDataPaths | string | `"Seeder/Data"` | | +| migrations.logging.default | string | `"Information"` | | | dotnetEnvironment | string | `"Production"` | | | dbConnection.schema | string | `"hub"` | | | dbConnection.sslMode | string | `"Disable"` | | diff --git a/charts/policy-hub/templates/deployment-hub.yaml b/charts/policy-hub/templates/deployment-hub.yaml index eb5ceb65..cfac247d 100644 --- a/charts/policy-hub/templates/deployment-hub.yaml +++ b/charts/policy-hub/templates/deployment-hub.yaml @@ -45,8 +45,8 @@ spec: - ALL readOnlyRootFilesystem: true runAsNonRoot: true - image: "{{ .Values.policyhub.image.name }}:{{ .Values.policyhub.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: "{{ .Values.policyhub.imagePullPolicy }}" + image: "{{ .Values.service.image.name }}:{{ .Values.service.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: "{{ .Values.service.imagePullPolicy }}" env: - name: DOTNET_ENVIRONMENT value: "{{ .Values.dotnetEnvironment }}" @@ -69,14 +69,14 @@ spec: value: "Server={{ .Values.externalDatabase.host }};Database={{ .Values.externalDatabase.database }};Port={{ .Values.externalDatabase.port }};User Id={{ .Values.externalDatabase.username }};Password=$(POLICY_HUB_PASSWORD);Ssl Mode={{ .Values.dbConnection.sslMode }};" {{- end }} - name: "HEALTHCHECKS__0__PATH" - value: "{{ .Values.policyhub.healthChecks.startup.path}}" - {{- if .Values.policyhub.healthChecks.startup.tags }} - {{- toYaml .Values.policyhub.healthChecks.startup.tags | nindent 8 }} + value: "{{ .Values.service.healthChecks.startup.path}}" + {{- if .Values.service.healthChecks.startup.tags }} + {{- toYaml .Values.service.healthChecks.startup.tags | nindent 8 }} {{- end }} - name: "HEALTHCHECKS__1__PATH" - value: "{{ .Values.policyhub.healthChecks.readyness.path}}" + value: "{{ .Values.service.healthChecks.readyness.path}}" - name: "HEALTHCHECKS__2__PATH" - value: "{{ .Values.policyhub.healthChecks.liveness.path}}" + value: "{{ .Values.service.healthChecks.liveness.path}}" - name: "JWTBEAREROPTIONS__METADATAADDRESS" value: "{{ .Values.centralidp.address }}{{ .Values.centralidp.jwtBearerOptions.metadataPath }}" - name: "JWTBEAREROPTIONS__REQUIREHTTPSMETADATA" @@ -88,18 +88,18 @@ spec: - name: "JWTBEAREROPTIONS__REFRESHINTERVAL" value: "{{ .Values.centralidp.jwtBearerOptions.refreshInterval }}" - name: "SERILOG__MINIMUMLEVEL__Default" - value: "{{ .Values.policyhub.logging.default }}" + value: "{{ .Values.service.logging.default }}" - name: "SERILOG__MINIMUMLEVEL__OVERRIDE__Org.Eclipse.TractusX.PolicyHub.Service" - value: "{{ .Values.policyhub.logging.businessLogic }}" + value: "{{ .Values.service.logging.businessLogic }}" - name: "SWAGGERENABLED" - value: "{{ .Values.policyhub.swaggerEnabled }}" + value: "{{ .Values.service.swaggerEnabled }}" ports: - name: http containerPort: {{ .Values.portContainer }} protocol: TCP startupProbe: httpGet: - path: {{ .Values.policyhub.healthChecks.startup.path }} + path: {{ .Values.service.healthChecks.startup.path }} port: {{ .Values.portContainer }} scheme: HTTP initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }} @@ -109,7 +109,7 @@ spec: failureThreshold: {{ .Values.startupProbe.failureThreshold }} livenessProbe: httpGet: - path: {{ .Values.policyhub.healthChecks.liveness.path }} + path: {{ .Values.service.healthChecks.liveness.path }} port: {{ .Values.portContainer }} scheme: HTTP initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} @@ -119,7 +119,7 @@ spec: failureThreshold: {{ .Values.livenessProbe.failureThreshold }} readinessProbe: httpGet: - path: {{ .Values.policyhub.healthChecks.readyness.path }} + path: {{ .Values.service.healthChecks.readyness.path }} port: {{ .Values.portContainer }} scheme: HTTP initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} @@ -128,7 +128,7 @@ spec: successThreshold: {{ .Values.readinessProbe.successThreshold }} failureThreshold: {{ .Values.readinessProbe.failureThreshold }} resources: - {{- toYaml .Values.policyhub.resources | nindent 10 }} + {{- toYaml .Values.service.resources | nindent 10 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/policy-hub/templates/job-policy-hub-migrations.yaml b/charts/policy-hub/templates/job-policy-hub-migrations.yaml index ebc785b5..12b2e01b 100644 --- a/charts/policy-hub/templates/job-policy-hub-migrations.yaml +++ b/charts/policy-hub/templates/job-policy-hub-migrations.yaml @@ -31,7 +31,7 @@ metadata: spec: template: metadata: - name: {{ .Values.policyhubmigrations.name }}-migrations + name: {{ .Values.migrations.name }}-migrations spec: restartPolicy: Never containers: @@ -43,8 +43,8 @@ spec: - ALL readOnlyRootFilesystem: true runAsNonRoot: true - image: "{{ .Values.policyhubmigrations.image.name }}:{{ .Values.policyhubmigrations.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: "{{ .Values.policyhubmigrations.imagePullPolicy }}" + image: "{{ .Values.migrations.image.name }}:{{ .Values.migrations.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: "{{ .Values.migrations.imagePullPolicy }}" env: - name: DOTNET_ENVIRONMENT value: "{{ .Values.dotnetEnvironment }}" @@ -67,14 +67,14 @@ spec: value: "Server={{ .Values.externalDatabase.host }};Database={{ .Values.externalDatabase.database }};Port={{ .Values.externalDatabase.port }};User Id={{ .Values.externalDatabase.username }};Password=$(POLICY_HUB_PASSWORD);Ssl Mode={{ .Values.dbConnection.sslMode }};" {{- end }} - name: "SEEDING__TESTDATAENVIRONMENTS__0" - value: "{{ .Values.policyhubmigrations.seeding.testDataEnvironments }}" + value: "{{ .Values.migrations.seeding.testDataEnvironments }}" - name: "SEEDING__DATAPATHS__0" - value: "{{ .Values.policyhubmigrations.seeding.testDataPaths }}" + value: "{{ .Values.migrations.seeding.testDataPaths }}" - name: "SERILOG__MINIMUMLEVEL__Default" - value: "{{ .Values.policyhubmigrations.logging.default }}" + value: "{{ .Values.migrations.logging.default }}" ports: - name: http containerPort: {{ .Values.portContainer }} protocol: TCP resources: - {{- toYaml .Values.policyhubmigrations.resources | nindent 10 }} + {{- toYaml .Values.migrations.resources | nindent 10 }} diff --git a/charts/policy-hub/values.yaml b/charts/policy-hub/values.yaml index 51746dd3..c03b8a2f 100644 --- a/charts/policy-hub/values.yaml +++ b/charts/policy-hub/values.yaml @@ -17,7 +17,7 @@ # SPDX-License-Identifier: Apache-2.0 ############################################################### -policyhub: +service: image: name: "docker.io/tractusx/policy-hub-service" tag: "" @@ -45,7 +45,7 @@ policyhub: path: "/ready" swaggerEnabled: false -policyhubmigrations: +migrations: image: name: "docker.io/tractusx/policy-hub-migrations" tag: "" diff --git a/consortia/argocd-app-templates/appsetup-stable.yaml b/consortia/argocd-app-templates/appsetup-stable.yaml index 48487ba6..39a2090e 100644 --- a/consortia/argocd-app-templates/appsetup-stable.yaml +++ b/consortia/argocd-app-templates/appsetup-stable.yaml @@ -55,7 +55,7 @@ spec: backend: service: "policy-hub-service" port: 8080 - policyhubmigrations: + migrations: logging: default: "Debug" postgresql: diff --git a/consortia/environments/values-beta.yaml b/consortia/environments/values-beta.yaml index 2fa43d2c..32d561c7 100644 --- a/consortia/environments/values-beta.yaml +++ b/consortia/environments/values-beta.yaml @@ -39,10 +39,10 @@ ingress: - path: "/api/policy-hub" pathType: "Prefix" -policyhub: +service: swaggerEnabled: true -policyhubmigrations: +migrations: logging: default: "Debug" diff --git a/consortia/environments/values-dev.yaml b/consortia/environments/values-dev.yaml index 30828de1..31449c23 100644 --- a/consortia/environments/values-dev.yaml +++ b/consortia/environments/values-dev.yaml @@ -45,13 +45,13 @@ keycloak: tokenValidationParameters: validAudience: "Cl23-CX-Policy-Hub" -policyhub: +service: image: tag: "dev" imagePullPolicy: "Always" swaggerEnabled: true -policyhubmigrations: +migrations: image: tag: "dev" imagePullPolicy: "Always" diff --git a/consortia/environments/values-int.yaml b/consortia/environments/values-int.yaml index f19857ab..0522143d 100644 --- a/consortia/environments/values-int.yaml +++ b/consortia/environments/values-int.yaml @@ -45,10 +45,10 @@ keycloak: tokenValidationParameters: validAudience: "Cl23-CX-Policy-Hub" -policyhub: +service: swaggerEnabled: true -policyhubmigrations: +migrations: logging: default: "Debug" diff --git a/consortia/environments/values-pen.yaml b/consortia/environments/values-pen.yaml index 7d063738..19ef791e 100644 --- a/consortia/environments/values-pen.yaml +++ b/consortia/environments/values-pen.yaml @@ -39,10 +39,10 @@ ingress: - path: "/api/policy-hub" pathType: "Prefix" -policyhub: +service: swaggerEnabled: true -policyhubmigrations: +migrations: logging: default: "Debug" diff --git a/consortia/environments/values-rc.yaml b/consortia/environments/values-rc.yaml index f8adcd34..1a02b8e2 100644 --- a/consortia/environments/values-rc.yaml +++ b/consortia/environments/values-rc.yaml @@ -39,13 +39,13 @@ ingress: - path: "/api/policy-hub" pathType: "Prefix" -policyhub: +service: image: tag: "rc" imagePullPolicy: "Always" swaggerEnabled: true -policyhubmigrations: +migrations: image: tag: "rc" imagePullPolicy: "Always"