Skip to content

Commit

Permalink
chore: deploy with kustomize
Browse files Browse the repository at this point in the history
  • Loading branch information
NilsOveTen committed Dec 13, 2024
1 parent 81a1a6d commit 660a45f
Show file tree
Hide file tree
Showing 11 changed files with 181 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prod&demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 43 additions & 0 deletions deploy/base/deployment-fdk-mqa-assmentator.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions deploy/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 14 additions & 0 deletions deploy/base/service-fdk-mqa-assmentator.yaml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions deploy/demo/env.yaml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions deploy/demo/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: demo
resources:
- ../base

patches:
- path: env.yaml
28 changes: 28 additions & 0 deletions deploy/prod/env.yaml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions deploy/prod/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: prod
resources:
- ../base

patches:
- path: env.yaml
28 changes: 28 additions & 0 deletions deploy/staging/env.yaml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions deploy/staging/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: staging
resources:
- ../base

patches:
- path: env.yaml

0 comments on commit 660a45f

Please sign in to comment.