Skip to content

Commit

Permalink
Use Helm template storage backend for PostgreSQL and Mattermost insta…
Browse files Browse the repository at this point in the history
…llation (#66)
  • Loading branch information
pkosiec authored Apr 13, 2022
1 parent 9d655f4 commit fd4d2c9
Show file tree
Hide file tree
Showing 22 changed files with 272 additions and 37 deletions.
2 changes: 1 addition & 1 deletion manifests/implementation/aws/elasticsearch/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ spec:
- name: basicAuth
path: /yamls/basicAuth.yaml
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
2 changes: 1 addition & 1 deletion manifests/implementation/aws/rds/postgresql/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ spec:
- name: aws
path: /yamls/aws.yaml
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
2 changes: 1 addition & 1 deletion manifests/implementation/aws/redis/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ spec:
- name: provider-credentials
path: /yamls/providercredentials.yaml
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ spec:
path: /yamls/additionalinput.yaml
optional: true
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
2 changes: 1 addition & 1 deletion manifests/implementation/bitnami/minio/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ spec:
path: /yamls/additionalinput.yaml
optional: true
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
2 changes: 1 addition & 1 deletion manifests/implementation/bitnami/mongodb/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ spec:
path: /yamls/additionalinput.yaml
optional: true
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
54 changes: 44 additions & 10 deletions manifests/implementation/bitnami/postgresql/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ spec:
- name: cap.type.helm.release.storage
revision: 0.1.0
alias: helm-release-storage
# TODO: Uncomment once dynamic TypeInstances are supported in umbrella workflow
# - name: cap.type.helm.template.storage
# revision: 0.1.0
# alias: helm-template-storage
- name: cap.type.helm.template.storage
revision: 0.1.0
alias: helm-template-storage

imports:
- interfaceGroupPath: cap.interface.runner.helm
Expand Down Expand Up @@ -88,7 +87,7 @@ spec:
outputs:
artifacts:
- name: postgresql
from: "{{steps.helm-install.outputs.artifacts.additional}}"
from: "{{steps.resolve-psql-value.outputs.artifacts.ti-artifact}}"
steps:
- - name: create-helm-args
capact-action: jinja2.template
Expand All @@ -115,7 +114,7 @@ spec:
helmRelease:
useHelmReleaseStorage: true
additional:
useHelmTemplateStorage: false # TODO: Toggle to true and make sure it can be reused in umbrella workflows
useHelmTemplateStorage: true
goTemplate: |
host: '{{ template "common.names.fullname" . }}.{{ .Release.Namespace }}'
port: {{ template "postgresql.port" . }}
Expand All @@ -130,10 +129,7 @@ spec:

- - name: helm-install
capact-action: helm.install
capact-outputTypeInstances: # Defines which artifacts are output TypeInstances
- name: postgresql
from: additional
backend: helm-template-storage
capact-outputTypeInstances:
- name: psql-helm-release
from: helm-release
backend: helm-release-storage
Expand All @@ -149,3 +145,41 @@ spec:
- name: kubeconfig
from: "{{inputs.artifacts.kubeconfig}}"
optional: true

# allows reusing this workflow as a part of other umbrella workflows and read the artifact value
- - name: resolve-psql-value
template: resolve-ti-art-value
capact-outputTypeInstances:
- name: postgresql
from: ti-artifact
backend: helm-template-storage
arguments:
artifacts:
- name: ti-artifact
from: "{{steps.helm-install.outputs.artifacts.additional}}"
- name: backend
from: "{{workflow.outputs.artifacts.helm-template-storage}}"

- name: resolve-ti-art-value
inputs:
artifacts:
- name: ti-artifact
path: /tmp/input-ti.yaml
- name: backend
path: /tmp/storage-backend.yaml
outputs:
artifacts:
- name: ti-artifact
path: /tmp/output.yaml
container:
image: ghcr.io/capactio/ti-value-fetcher:2ada6f8
env:
- name: APP_LOGGER_DEV_MODE
value: "true"
- name: APP_INPUT_TI_FILE_PATH
value: "{{inputs.artifacts.ti-artifact.path}}"
- name: APP_INPUT_BACKEND_TI_FILE_PATH
value: "{{inputs.artifacts.backend.path}}"
- name: APP_OUTPUT_FILE_PATH
value: "{{outputs.artifacts.ti-artifact.path}}"

2 changes: 1 addition & 1 deletion manifests/implementation/bitnami/redis/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ spec:
path: /yamls/additionalinput.yaml
optional: true
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
2 changes: 1 addition & 1 deletion manifests/implementation/concourse/concourse/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ spec:
- name: user
path: /yamls/user.yaml
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ spec:
- name: postgresql
path: /yamls/postgresql.yaml
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
6 changes: 3 additions & 3 deletions manifests/implementation/helm/storage/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ spec:
chart:
name: "helm-storage-backend"
repo: "https://storage.googleapis.com/capactio-latest-charts"
version: <@ input.version | default("0.6.0-bf8d006") @>
version: <@ input.version | default("0.6.0-2ada6f8") @>
values:
affinity: <@ additionalinput.affinity | default({}) | tojson @>
autoscaling:
Expand All @@ -115,7 +115,7 @@ spec:
targetCPUUtilizationPercentage: <@ additionalinput.autoscaling.targetCPUUtilizationPercentage | default(80) @>
global:
containerRegistry:
overrideTag: <@ additionalinput.global.containerRegistry.overrideTag | default("bf8d006") @>
overrideTag: <@ additionalinput.global.containerRegistry.overrideTag | default("2ada6f8") @>
path: <@ additionalinput.global.containerRegistry.path | default("ghcr.io/capactio") @>
helmReleaseBackend:
enabled: <@ additionalinput.helmReleaseBackend.enabled | default(true) | tojson @>
Expand Down Expand Up @@ -314,7 +314,7 @@ spec:
path: /yamls/additionalinput.yaml
optional: true
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ spec:
outputs:
artifacts:
- name: mattermost-config
from: "{{steps.helm-install.outputs.artifacts.additional}}"
from: "{{steps.resolve-ti-value.outputs.artifacts.ti-artifact}}"
steps:
# Install DB
- - name: install-db
Expand All @@ -109,6 +109,7 @@ spec:
capact-outputTypeInstances:
- name: postgresql
from: postgresql
backend: helm-template-storage
arguments:
artifacts:
- name: input-parameters
Expand All @@ -118,8 +119,6 @@ spec:
username: superuser
defaultDBName: postgres
# TODO: Make PostgreSQL config TypeInstance dynamic and ensure it can be used in umbrella workflow

- - name: create-user
capact-action: postgresql.create-user
capact-outputTypeInstances:
Expand Down Expand Up @@ -466,9 +465,6 @@ spec:
- - name: helm-install
capact-action: helm.install
capact-outputTypeInstances:
- name: mattermost-config
from: additional
backend: helm-template-storage
- name: mattermost-helm-release
from: helm-release
backend: helm-release-storage
Expand All @@ -479,6 +475,20 @@ spec:
- name: runner-context
from: "{{workflow.outputs.artifacts.runner-context}}"

# allows reusing this workflow as a part of other umbrella workflows and read the artifact value
- - name: resolve-ti-value
template: resolve-ti-art-value
capact-outputTypeInstances:
- name: mattermost-config
from: ti-artifact
backend: helm-template-storage
arguments:
artifacts:
- name: ti-artifact
from: "{{steps.helm-install.outputs.artifacts.additional}}"
- name: backend
from: "{{workflow.outputs.artifacts.helm-template-storage}}"

- name: prepare-parameters
inputs:
artifacts:
Expand All @@ -494,8 +504,31 @@ spec:
- name: user
path: /yamls/user.yaml
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
path: /merged.yaml

- name: resolve-ti-art-value
inputs:
artifacts:
- name: ti-artifact
path: /tmp/input-ti.yaml
- name: backend
path: /tmp/storage-backend.yaml
outputs:
artifacts:
- name: ti-artifact
path: /tmp/output.yaml
container:
image: ghcr.io/capactio/ti-value-fetcher:2ada6f8
env:
- name: APP_LOGGER_DEV_MODE
value: "true"
- name: APP_INPUT_TI_FILE_PATH
value: "{{inputs.artifacts.ti-artifact.path}}"
- name: APP_INPUT_BACKEND_TI_FILE_PATH
value: "{{inputs.artifacts.backend.path}}"
- name: APP_OUTPUT_FILE_PATH
value: "{{outputs.artifacts.ti-artifact.path}}"
2 changes: 1 addition & 1 deletion manifests/implementation/minio/mc/create_bucket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ spec:
- name: s3
path: /yamls/s3.yaml
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
2 changes: 1 addition & 1 deletion manifests/implementation/postgresql/change-password.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ spec:
- name: postgresql
path: /yamls/postgresql.yaml
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
2 changes: 1 addition & 1 deletion manifests/implementation/rocketchat/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ spec:
- name: mongo
path: /yamls/mongo.yaml
container:
image: ghcr.io/capactio/pr/infra/merger:PR-657
image: ghcr.io/capactio/infra/merger:2ada6f8
outputs:
artifacts:
- name: merged
Expand Down
Loading

0 comments on commit fd4d2c9

Please sign in to comment.