From 660a45f878e287b46da3232c737f0d8ea5842b63 Mon Sep 17 00:00:00 2001 From: Nils Ove Tendenes Date: Thu, 12 Dec 2024 12:38:03 +0100 Subject: [PATCH] chore: deploy with kustomize --- .github/workflows/deploy-prod&demo.yaml | 2 +- .github/workflows/deploy-staging.yaml | 2 +- .../base/deployment-fdk-mqa-assmentator.yaml | 43 +++++++++++++++++++ deploy/base/kustomization.yaml | 11 +++++ deploy/base/service-fdk-mqa-assmentator.yaml | 14 ++++++ deploy/demo/env.yaml | 28 ++++++++++++ deploy/demo/kustomization.yaml | 9 ++++ deploy/prod/env.yaml | 28 ++++++++++++ deploy/prod/kustomization.yaml | 9 ++++ deploy/staging/env.yaml | 28 ++++++++++++ deploy/staging/kustomization.yaml | 9 ++++ 11 files changed, 181 insertions(+), 2 deletions(-) create mode 100644 deploy/base/deployment-fdk-mqa-assmentator.yaml create mode 100644 deploy/base/kustomization.yaml create mode 100644 deploy/base/service-fdk-mqa-assmentator.yaml create mode 100644 deploy/demo/env.yaml create mode 100644 deploy/demo/kustomization.yaml create mode 100644 deploy/prod/env.yaml create mode 100644 deploy/prod/kustomization.yaml create mode 100644 deploy/staging/env.yaml create mode 100644 deploy/staging/kustomization.yaml diff --git a/.github/workflows/deploy-prod&demo.yaml b/.github/workflows/deploy-prod&demo.yaml index c498d8a..731e0c3 100644 --- a/.github/workflows/deploy-prod&demo.yaml +++ b/.github/workflows/deploy-prod&demo.yaml @@ -41,7 +41,7 @@ jobs: deploy_demo: name: Deploy to demo environment with reusable workflow when prod deploy is successful needs: [deploy] - uses: Informasjonsforvaltning/workflows/.github/workflows/deploy.yaml@main + uses: Informasjonsforvaltning/workflows/.github/workflows/kustomize-deploy.yaml@main with: app_name: fdk-mqa-assmentator environment: demo diff --git a/.github/workflows/deploy-staging.yaml b/.github/workflows/deploy-staging.yaml index 771b438..deb1e59 100644 --- a/.github/workflows/deploy-staging.yaml +++ b/.github/workflows/deploy-staging.yaml @@ -31,7 +31,7 @@ jobs: name: Deploy to staging environment with reusable workflow when test and build is successful if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false }} needs: [test, build] - uses: Informasjonsforvaltning/workflows/.github/workflows/deploy.yaml@main + uses: Informasjonsforvaltning/workflows/.github/workflows/kustomize-deploy.yaml@main with: app_name: fdk-mqa-assmentator environment: staging diff --git a/deploy/base/deployment-fdk-mqa-assmentator.yaml b/deploy/base/deployment-fdk-mqa-assmentator.yaml new file mode 100644 index 0000000..839b498 --- /dev/null +++ b/deploy/base/deployment-fdk-mqa-assmentator.yaml @@ -0,0 +1,43 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: fdk-mqa-assmentator + labels: + app: fdk-mqa-assmentator + fdk.service: fdk-mqa-assmentator +spec: + replicas: 1 + selector: + matchLabels: + fdk.service: fdk-mqa-assmentator + strategy: + type: RollingUpdate + template: + metadata: + labels: + app: fdk-mqa-assmentator + fdk.service: fdk-mqa-assmentator + annotations: + prometheus.io/scrape: "true" + spec: + containers: + - name: fdk-mqa-assmentator + image: fdk-mqa-assmentator + imagePullPolicy: Always + ports: + - containerPort: 8080 + resources: + requests: + memory: "500Mi" + cpu: "100m" + limits: + memory: "500Mi" + livenessProbe: + exec: + command: + - "true" + readinessProbe: + exec: + command: + - "true" + restartPolicy: Always diff --git a/deploy/base/kustomization.yaml b/deploy/base/kustomization.yaml new file mode 100644 index 0000000..2844aaf --- /dev/null +++ b/deploy/base/kustomization.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - service-fdk-mqa-assmentator.yaml + - deployment-fdk-mqa-assmentator.yaml + +images: + - name: fdk-mqa-assmentator + newName: eu.gcr.io/digdir-fdk-infra/fdk-mqa-assmentator + newTag: $(GIT_COMMIT_SHA) diff --git a/deploy/base/service-fdk-mqa-assmentator.yaml b/deploy/base/service-fdk-mqa-assmentator.yaml new file mode 100644 index 0000000..8cbe6ca --- /dev/null +++ b/deploy/base/service-fdk-mqa-assmentator.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: fdk-mqa-assmentator +spec: + selector: + fdk.service: fdk-mqa-assmentator + ports: + - name: http + protocol: TCP + port: 8080 + targetPort: 8081 + type: NodePort diff --git a/deploy/demo/env.yaml b/deploy/demo/env.yaml new file mode 100644 index 0000000..ca18b49 --- /dev/null +++ b/deploy/demo/env.yaml @@ -0,0 +1,28 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: fdk-mqa-assmentator + labels: + app: fdk-mqa-assmentator + fdk.service: fdk-mqa-assmentator +spec: + template: + spec: + containers: + - name: fdk-mqa-assmentator + env: + - name: NAMESPACE + valueFrom: + secretKeyRef: + name: common-demo + key: NAMESPACE + - name: SCHEMA_REGISTRY + valueFrom: + secretKeyRef: + name: fdk-metadata-quality-demo + key: SCHEMA_REGISTRY + - name: BROKERS + valueFrom: + secretKeyRef: + name: fdk-metadata-quality-demo + key: BROKERS diff --git a/deploy/demo/kustomization.yaml b/deploy/demo/kustomization.yaml new file mode 100644 index 0000000..83f2c77 --- /dev/null +++ b/deploy/demo/kustomization.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: demo +resources: + - ../base + +patches: + - path: env.yaml diff --git a/deploy/prod/env.yaml b/deploy/prod/env.yaml new file mode 100644 index 0000000..5c60502 --- /dev/null +++ b/deploy/prod/env.yaml @@ -0,0 +1,28 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: fdk-mqa-assmentator + labels: + app: fdk-mqa-assmentator + fdk.service: fdk-mqa-assmentator +spec: + template: + spec: + containers: + - name: fdk-mqa-assmentator + env: + - name: NAMESPACE + valueFrom: + secretKeyRef: + name: common-prod + key: NAMESPACE + - name: SCHEMA_REGISTRY + valueFrom: + secretKeyRef: + name: fdk-metadata-quality-prod + key: SCHEMA_REGISTRY + - name: BROKERS + valueFrom: + secretKeyRef: + name: fdk-metadata-quality-prod + key: BROKERS diff --git a/deploy/prod/kustomization.yaml b/deploy/prod/kustomization.yaml new file mode 100644 index 0000000..913810f --- /dev/null +++ b/deploy/prod/kustomization.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: prod +resources: + - ../base + +patches: + - path: env.yaml diff --git a/deploy/staging/env.yaml b/deploy/staging/env.yaml new file mode 100644 index 0000000..f67f2d1 --- /dev/null +++ b/deploy/staging/env.yaml @@ -0,0 +1,28 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: fdk-mqa-assmentator + labels: + app: fdk-mqa-assmentator + fdk.service: fdk-mqa-assmentator +spec: + template: + spec: + containers: + - name: fdk-mqa-assmentator + env: + - name: NAMESPACE + valueFrom: + secretKeyRef: + name: common-staging + key: NAMESPACE + - name: SCHEMA_REGISTRY + valueFrom: + secretKeyRef: + name: fdk-metadata-quality-staging + key: SCHEMA_REGISTRY + - name: BROKERS + valueFrom: + secretKeyRef: + name: fdk-metadata-quality-staging + key: BROKERS diff --git a/deploy/staging/kustomization.yaml b/deploy/staging/kustomization.yaml new file mode 100644 index 0000000..71c8924 --- /dev/null +++ b/deploy/staging/kustomization.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: staging +resources: + - ../base + +patches: + - path: env.yaml