From 3d7948a49d0b952cd360829176da05c487881015 Mon Sep 17 00:00:00 2001 From: David Blane <32327139+dblane-digicatapult@users.noreply.github.com> Date: Wed, 11 Oct 2023 14:22:46 +0100 Subject: [PATCH] DeployManager v2 (#30) * DeployManager v2 --- charts/deploymanager/Chart.lock | 4 +- charts/deploymanager/Chart.yaml | 6 +- charts/deploymanager/README.md | 66 ++++++++++ charts/deploymanager/templates/configmap.yaml | 25 ---- .../deploymanager/templates/deployment.yaml | 87 ++++++++++--- charts/deploymanager/values.yaml | 117 +++++++++++++----- 6 files changed, 228 insertions(+), 77 deletions(-) create mode 100644 charts/deploymanager/README.md delete mode 100644 charts/deploymanager/templates/configmap.yaml diff --git a/charts/deploymanager/Chart.lock b/charts/deploymanager/Chart.lock index d4dae94..3ba0059 100644 --- a/charts/deploymanager/Chart.lock +++ b/charts/deploymanager/Chart.lock @@ -2,5 +2,5 @@ dependencies: - name: postgresql repository: https://charts.bitnami.com/bitnami version: 12.12.10 -digest: sha256:4db62ecf2a15647b9902b5b4267a12aed89733f98b071bbc3c4219f464bb8479 -generated: "2023-09-27T13:39:51.206851+01:00" +digest: sha256:940cb5e45876deacafa82af06c585ece1cd95764c9507ef32d64c535ada13018 +generated: "2023-10-10T17:10:05.348118+01:00" diff --git a/charts/deploymanager/Chart.yaml b/charts/deploymanager/Chart.yaml index 27e6332..dd2e78f 100644 --- a/charts/deploymanager/Chart.yaml +++ b/charts/deploymanager/Chart.yaml @@ -1,14 +1,14 @@ apiVersion: v2 name: deploymanager -appVersion: 0.1.1 +appVersion: 1.1.0 description: A generated Helm Chart for Soniclabs T&M deploymanager -version: 0.0.8 +version: 1.0.0 type: application maintainers: - name: cdecatapult url: cdecatapult.github.io/soniclabs-helmcharts dependencies: - name: postgresql - version: '^12.1.14' + version: '^12.x.x' repository: https://charts.bitnami.com/bitnami condition: postgresql.enabled diff --git a/charts/deploymanager/README.md b/charts/deploymanager/README.md new file mode 100644 index 0000000..4a01458 --- /dev/null +++ b/charts/deploymanager/README.md @@ -0,0 +1,66 @@ +# DeployManager + +## Parameters + +### DeployManager Parameters + +| Name | Description | Value | +| -------------------------- | ----------------------------------------------------------------------- | ---------------- | +| `config.replicaCount` | The amount of containers to run | `1` | +| `config.type` | The type of service to create | `LoadBalancer` | +| `config.appPort` | The port to expose the service and application on | `8000` | +| `config.nodePort` | The nodePort to use if the the service type is LoadBalancer or NodePort | `30342` | +| `config.commonAnnotations` | The annotations to set on the Deploy Manager application | `{}` | +| `config.debug` | Whether or not to enable debug mode for the application | `False` | +| `config.logLevel` | The log level to use for the application | `DEBUG` | +| `config.gui.host` | The hostname of the GUI service | `portal` | +| `config.gui.port` | The port of the GUI service | `8000` | +| `config.sma.host` | The hostname of the Suite Manager service | `suitemanager` | +| `config.sma.port` | The port of the Suite Manager service | `8000` | +| `config.tma.host` | The hostname of the Test Manager service | `testmanager` | +| `config.tma.port` | The port of the Test Manager service | `8000` | +| `config.rma.host` | The hostname of the Results Manager service | `resultsmanager` | +| `config.rma.port` | The port of the Results Manager service | `8000` | +| `config.apg.host` | The hostname of the API Gateway service | `apigateway` | +| `config.apg.port` | The port of the API Gateway service | `8000` | +| `config.cma.host` | The hostname of the Config Manager service | `configmanager` | +| `config.cma.port` | The port of the Config Manager service | `8000` | + +### DeployManager Image Parameters + +| Name | Description | Value | +| ------------------- | ---------------------------------------------------- | --------------------------------------------- | +| `image.repository` | The repository to use for the Deploy Manager image | `ghcr.io/cdecatapult/soniclabs-deploymanager` | +| `image.pullPolicy` | The pull policy to use for the Deploy Manager image | `Always` | +| `image.tag` | The tag to use for the Deploy Manager image | `v1.1.0` | +| `image.pullSecrets` | The pull secrets to use for the Deploy Manager image | `["soniclabs"]` | + +### DeployManager Ingress parameters + +| Name | Description | Value | +| --------------------------- | ------------------------------------------------------------------------ | --------------------- | +| `ingress.enabled` | Whether or not to enable the ingress for the Deploy Manager application | `true` | +| `ingress.annotations` | The annotations to set on the ingress for the Deploy Manager application | `{}` | +| `ingress.ingressClassName` | The ingress class to use for the Deploy Manager application | `""` | +| `ingress.hostname` | The hostname to use for the Deploy Manager application | `deploymanager.local` | +| `ingress.paths` | The paths to use for the Deploy Manager application | | +| `ingress.paths[0].path` | The path to use for the Deploy Manager application | `/api/dma` | +| `ingress.paths[0].pathType` | The path type to use for the Deploy Manager application | `Prefix` | + +### DeployManager ServiceAccount parameters + +| Name | Description | Value | +| ---------------------------- | ------------------------------------------------------------------------- | ------- | +| `serviceAccount.create` | Whether or not to create a service account for the Deploy Manager service | `false` | +| `serviceAccount.annotations` | The annotations to use for the Deploy Manager service account | `{}` | +| `serviceAccount.name` | The name of the service account to use for the Deploy Manager service | `""` | + +### DeployManager PostgreSQL parameters + +| Name | Description | Value | +| --------------------------------------------- | ------------------------------------------------------------------------------- | --------------- | +| `postgresql.enabled` | Whether or not to enable the PostgreSQL SubChart for the Deploy Manager service | `true` | +| `postgresql.primary.service.ports.postgresql` | The port to expose the PostgreSQL database service on | `5432` | +| `postgresql.auth.username` | The username to use for the PostgreSQL database | `tamuser` | +| `postgresql.auth.password` | The password to use for the PostgreSQL database | `tampassword` | +| `postgresql.auth.database` | The name of the database to use for the PostgreSQL database | `deploymanager` | diff --git a/charts/deploymanager/templates/configmap.yaml b/charts/deploymanager/templates/configmap.yaml deleted file mode 100644 index 2f0c296..0000000 --- a/charts/deploymanager/templates/configmap.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "deploymanager.fullname" . }}-config - labels: - {{- include "deploymanager.labels" . | nindent 4 }} -data: - APP_DEBUG: {{ .Values.config.debug | quote }} - APP_LOG_LEVEL: {{ .Values.config.logLevel | quote }} - POSTGRES_HOST: {{ include "deploymanager.postgresql.fullname" . }} - POSTGRES_DB: {{ .Values.postgresql.auth.database | quote }} - TAM_GUI_HOST: {{ .Values.config.guiHost | quote }} - TAM_GUI_PORT: {{ .Values.config.guiPort | quote }} - TAM_CONFIG_MANAGER_HOST: {{ .Values.config.cmaHost | quote }} - TAM_CONFIG_MANAGER_PORT: {{ .Values.config.cmaPort | quote }} - TAM_SUITE_MANAGER_HOST: {{ .Values.config.smaHost | quote }} - TAM_SUITE_MANAGER_PORT: {{ .Values.config.smaPort | quote }} - TAM_TEST_MANAGER_HOST: {{ .Values.config.tmaHost | quote }} - TAM_TEST_MANAGER_PORT: {{ .Values.config.tmaPort | quote }} - TAM_RESULTS_MANAGER_HOST: {{ .Values.config.rmaHost | quote }} - TAM_RESULTS_MANAGER_PORT: {{ .Values.config.rmaPort | quote }} - TAM_API_GATEWAY_HOST: {{ .Values.config.apgHost | quote }} - TAM_API_GATEWAY_PORT: {{ .Values.config.apgPort | quote }} - TAM_DEPLOY_MANAGER_HOST: {{ .Values.config.dmaHost | quote }} - TAM_DEPLOY_MANAGER_PORT: {{ .Values.config.dmaPort | quote }} diff --git a/charts/deploymanager/templates/deployment.yaml b/charts/deploymanager/templates/deployment.yaml index df8d0ef..44aa05d 100644 --- a/charts/deploymanager/templates/deployment.yaml +++ b/charts/deploymanager/templates/deployment.yaml @@ -12,16 +12,35 @@ spec: template: metadata: annotations: - checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} + {{- if .Values.config.commonAnnotations }} + {{- toYaml .Values.config.commonAnnotations | nindent 6 }} + {{- end }} labels: {{- include "deploymanager.labels" . | nindent 8 }} spec: {{- include "deploymanager.imagePullSecrets" . | indent 6 }} initContainers: - - name: {{ include "deploymanager.fullname" . }}-init + - name: {{ include "deploymanager.fullname" . }}-db-init image: {{ template "deploymanager.image" .Values.image }} - command: ['sleep', '60'] + command: ['alembic', 'upgrade', 'head'] + env: + - name: POSTGRES_HOST + value: {{ include "deploymanager.postgresql.fullname" . }} + - name: POSTGRES_PORT + value: {{ .Values.postgresql.primary.service.ports.postgresql | quote }} + - name: POSTGRES_DB + value: {{ .Values.postgresql.auth.database | quote }} + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: {{ include "deploymanager.fullname" . }}-secret + key: POSTGRES_USER + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "deploymanager.fullname" . }}-secret + key: POSTGRES_PASSWORD containers: - name: {{ include "deploymanager.fullname" . }}-app image: {{ template "deploymanager.image" .Values.image }} @@ -32,20 +51,54 @@ spec: httpGet: path: /api/dma/healthchecks/readiness port: {{ .Values.config.appPort }} - initialDelaySeconds: 15 - timeoutSeconds: 15 - periodSeconds: 15 - envFrom: - - configMapRef: - name: {{ include "deploymanager.fullname" . }}-config - - secretRef: - name: {{ include "deploymanager.fullname" . }}-secret + timeoutSeconds: 3 + periodSeconds: 10 + failureThreshold: 3 + readinessProbe: + httpGet: + path: /api/dma/healthchecks/readiness + port: {{ .Values.config.appPort }} + timeoutSeconds: 3 + periodSeconds: 10 + failureThreshold: 3 env: - - name: HOST_IP + - name: APP_DEBUG + value: {{ .Values.config.debug | quote }} + - name: APP_LOG_LEVEL + value: {{ .Values.config.logLevel | quote }} + - name: POSTGRES_HOST + value: {{ include "deploymanager.postgresql.fullname" . }} + - name: POSTGRES_PORT + value: {{ .Values.postgresql.primary.service.ports.postgresql | quote }} + - name: POSTGRES_DB + value: {{ .Values.postgresql.auth.database | quote }} + - name: TAM_GUI_HOST + value: {{ .Values.config.gui.host | quote }} + - name: TAM_GUI_PORT + value: {{ .Values.config.gui.port | quote }} + - name: TAM_SUITE_MANAGER_HOST + value: {{ .Values.config.sma.host | quote }} + - name: TAM_SUITE_MANAGER_PORT + value: {{ .Values.config.sma.port | quote }} + - name: TAM_TEST_MANAGER_HOST + value: {{ .Values.config.tma.host | quote }} + - name: TAM_TEST_MANAGER_PORT + value: {{ .Values.config.tma.port | quote }} + - name: TAM_RESULTS_MANAGER_HOST + value: {{ .Values.config.rma.host | quote }} + - name: TAM_RESULTS_MANAGER_PORT + value: {{ .Values.config.rma.port | quote }} + - name: TAM_CONFIG_MANAGER_HOST + value: {{ .Values.config.cma.host | quote }} + - name: TAM_CONFIG_MANAGER_PORT + value: {{ .Values.config.cma.port | quote }} + - name: POSTGRES_USER valueFrom: - fieldRef: - fieldPath: status.hostIP - - name: POD_IP + secretKeyRef: + name: {{ include "deploymanager.fullname" . }}-secret + key: POSTGRES_USER + - name: POSTGRES_PASSWORD valueFrom: - fieldRef: - fieldPath: status.podIP + secretKeyRef: + name: {{ include "deploymanager.fullname" . }}-secret + key: POSTGRES_PASSWORD diff --git a/charts/deploymanager/values.yaml b/charts/deploymanager/values.yaml index 351f11a..e91da25 100644 --- a/charts/deploymanager/values.yaml +++ b/charts/deploymanager/values.yaml @@ -1,45 +1,102 @@ -postgresql: - enabled: true - auth: - username: tamuser - password: tampassword - database: deploymanager - +## @section DeployManager Parameters +## config: +## @param config.replicaCount The amount of containers to run replicaCount: 1 - appPort: 8000 +## @param config.type The type of service to create type: LoadBalancer - nodePort: 30311 - debug: "True" + ## @param config.appPort The port to expose the service and application on + appPort: 8000 + ## @param config.nodePort The nodePort to use if the the service type is LoadBalancer or NodePort + nodePort: 30342 + ## @param config.commonAnnotations The annotations to set on the Deploy Manager application + commonAnnotations: {} + ## @param config.debug Whether or not to enable debug mode for the application + debug: "False" + ## @param config.logLevel The log level to use for the application logLevel: DEBUG - guiHost: portal - guiPort: 8000 - cmaHost: configmanager - cmaPort: 8000 - smaHost: suitemanager - smaPort: 8000 - tmaHost: testmanager - tmaPort: 8000 - rmaHost: resultsmanager - rmaPort: 8000 - apgHost: apigateway - apgPort: 8000 - dmaHost: deploymanager - dmaPort: 8000 + gui: + ## @param config.gui.host The hostname of the GUI service + host: portal + ## @param config.gui.port The port of the GUI service + port: 8000 + sma: + ## @param config.sma.host The hostname of the Suite Manager service + host: suitemanager + ## @param config.sma.port The port of the Suite Manager service + port: 8000 + tma: + ## @param config.tma.host The hostname of the Test Manager service + host: testmanager + ## @param config.tma.port The port of the Test Manager service + port: 8000 + rma: + ## @param config.rma.host The hostname of the Results Manager service + host: resultsmanager + ## @param config.rma.port The port of the Results Manager service + port: 8000 + apg: + ## @param config.apg.host The hostname of the API Gateway service + host: apigateway + ## @param config.apg.port The port of the API Gateway service + port: 8000 + cma: + ## @param config.cma.host The hostname of the Config Manager service + host: configmanager + ## @param config.cma.port The port of the Config Manager service + port: 8000 +## @section DeployManager Image Parameters image: + ## @param image.repository The repository to use for the Deploy Manager image repository: ghcr.io/cdecatapult/soniclabs-deploymanager + ## @param image.pullPolicy The pull policy to use for the Deploy Manager image pullPolicy: Always - tag: sha256:853dc8715d72807ab91a763a78feef6eff29d2b2200dba56c5d2bbf2c5457cd9 + ## @param image.tag The tag to use for the Deploy Manager image + tag: v1.1.0 + ## @param image.pullSecrets The pull secrets to use for the Deploy Manager image pullSecrets: ['soniclabs'] -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 +## @section DeployManager Ingress parameters +## +ingress: + ## @param ingress.enabled Whether or not to enable the ingress for the Deploy Manager application + enabled: true + ## @param ingress.annotations The annotations to set on the ingress for the Deploy Manager application + annotations: {} + ## @param ingress.ingressClassName The ingress class to use for the Deploy Manager application + ingressClassName: "" + ## @param ingress.hostname The hostname to use for the Deploy Manager application + hostname: deploymanager.local + ## @extra ingress.paths The paths to use for the Deploy Manager application + paths: + ## @param ingress.paths[0].path The path to use for the Deploy Manager application + ## @param ingress.paths[0].pathType The path type to use for the Deploy Manager application + - path: /api/dma + pathType: Prefix +## @section DeployManager ServiceAccount parameters serviceAccount: + ## @param serviceAccount.create Whether or not to create a service account for the Deploy Manager service create: false + ## @param serviceAccount.annotations The annotations to use for the Deploy Manager service account annotations: {} + ## @param serviceAccount.name The name of the service account to use for the Deploy Manager service name: "" + +## @section DeployManager PostgreSQL parameters +postgresql: + ## @param postgresql.enabled Whether or not to enable the PostgreSQL SubChart for the Deploy Manager service + enabled: true + ## @param postgresql.primary.service.ports.postgresql The port to expose the PostgreSQL database service on + primary: + service: + ports: + postgresql: 5432 + auth: + ## @param postgresql.auth.username The username to use for the PostgreSQL database + username: tamuser + ## @param postgresql.auth.password The password to use for the PostgreSQL database + password: tampassword + ## @param postgresql.auth.database The name of the database to use for the PostgreSQL database + database: deploymanager