Skip to content

Commit

Permalink
Update Kustomize resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
ropable committed Dec 10, 2024
1 parent f61a6a4 commit 681103b
Show file tree
Hide file tree
Showing 9 changed files with 170 additions and 166 deletions.
10 changes: 5 additions & 5 deletions kustomize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Declarative management of CSW Kubernetes resources using Kustomize.

# How to use
## How to use

Within an overlay directory, create a `.env` file to contain required secret
values in the format KEY=value (i.e. `overlays/uat/.env`). Required values:
Expand All @@ -22,8 +22,8 @@ Run `kubectl` with the `-k` flag to generate resources for a given overlay:
kubectl apply -k kustomize/overlays/uat --namespace sss --dry-run=client
```

# References:
## References

* https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/
* https://github.com/kubernetes-sigs/kustomize
* https://github.com/kubernetes-sigs/kustomize/tree/master/examples
- <https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/>
- <https://github.com/kubernetes-sigs/kustomize>
- <https://github.com/kubernetes-sigs/kustomize/tree/master/examples>
124 changes: 62 additions & 62 deletions kustomize/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,68 +16,68 @@ spec:
app: csw-deployment
spec:
containers:
- name: csw
image: ghcr.io/dbca-wa/csw
imagePullPolicy: Always
env:
- name: ALLOWED_HOSTS
value: ".dbca.wa.gov.au"
- name: CSRF_TRUSTED_ORIGINS
value: "https://*.dbca.wa.gov.au"
- name: CSRF_COOKIE_SECURE
value: "True"
- name: SESSION_COOKIE_SECURE
value: "True"
- name: TZ
value: "Australia/Perth"
resources:
requests:
memory: "100Mi"
cpu: "5m"
limits:
memory: "2Gi"
cpu: "1000m"
startupProbe:
httpGet:
path: /livez
port: 8080
scheme: HTTP
initialDelaySeconds: 3
periodSeconds: 15
timeoutSeconds: 10
successThreshold: 1
failureThreshold: 3
livenessProbe:
httpGet:
path: /livez
port: 8080
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 15
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 10
readinessProbe:
httpGet:
path: /readyz
port: 8080
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 15
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 10
securityContext:
runAsNonRoot: true
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmpfs-ram
- name: csw
image: ghcr.io/dbca-wa/csw
imagePullPolicy: Always
env:
- name: ALLOWED_HOSTS
value: ".dbca.wa.gov.au"
- name: CSRF_TRUSTED_ORIGINS
value: "https://*.dbca.wa.gov.au"
- name: CSRF_COOKIE_SECURE
value: "True"
- name: SESSION_COOKIE_SECURE
value: "True"
- name: TZ
value: "Australia/Perth"
resources:
requests:
memory: "100Mi"
cpu: "5m"
limits:
memory: "2Gi"
cpu: "1000m"
startupProbe:
httpGet:
path: /livez
port: 8080
scheme: HTTP
initialDelaySeconds: 3
periodSeconds: 15
timeoutSeconds: 10
successThreshold: 1
failureThreshold: 3
livenessProbe:
httpGet:
path: /livez
port: 8080
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 15
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 10
readinessProbe:
httpGet:
path: /readyz
port: 8080
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 15
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 10
securityContext:
runAsNonRoot: true
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmpfs-ram
volumes:
- name: tmpfs-ram
emptyDir:
Expand Down
8 changes: 4 additions & 4 deletions kustomize/base/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
type: ClusterIP
ports:
- name: wsgi
port: 8080
protocol: TCP
targetPort: 8080
- name: wsgi
port: 8080
protocol: TCP
targetPort: 8080
76 changes: 38 additions & 38 deletions kustomize/overlays/prod/deployment_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,41 @@ spec:
template:
spec:
containers:
- name: csw
imagePullPolicy: IfNotPresent
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: csw-env-prod
key: DATABASE_URL
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: csw-env-prod
key: SECRET_KEY
- name: BASE_URL
valueFrom:
secretKeyRef:
name: csw-env-prod
key: BASE_URL
- name: CORS_URL
valueFrom:
secretKeyRef:
name: csw-env-prod
key: CORS_URL
- name: AZURE_ACCOUNT_NAME
valueFrom:
secretKeyRef:
name: csw-env-prod
key: AZURE_ACCOUNT_NAME
- name: AZURE_ACCOUNT_KEY
valueFrom:
secretKeyRef:
name: csw-env-prod
key: AZURE_ACCOUNT_KEY
- name: AZURE_CONTAINER
valueFrom:
secretKeyRef:
name: csw-env-prod
key: AZURE_CONTAINER
- name: csw
imagePullPolicy: IfNotPresent
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: csw-env-prod
key: DATABASE_URL
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: csw-env-prod
key: SECRET_KEY
- name: BASE_URL
valueFrom:
secretKeyRef:
name: csw-env-prod
key: BASE_URL
- name: CORS_URL
valueFrom:
secretKeyRef:
name: csw-env-prod
key: CORS_URL
- name: AZURE_ACCOUNT_NAME
valueFrom:
secretKeyRef:
name: csw-env-prod
key: AZURE_ACCOUNT_NAME
- name: AZURE_ACCOUNT_KEY
valueFrom:
secretKeyRef:
name: csw-env-prod
key: AZURE_ACCOUNT_KEY
- name: AZURE_CONTAINER
valueFrom:
secretKeyRef:
name: csw-env-prod
key: AZURE_CONTAINER
20 changes: 10 additions & 10 deletions kustomize/overlays/prod/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ metadata:
spec:
ingressClassName: nginx
rules:
- host: csw.dbca.wa.gov.au
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: csw-clusterip-prod
port:
number: 8080
- host: csw.dbca.wa.gov.au
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: csw-clusterip-prod
port:
number: 8080
2 changes: 2 additions & 0 deletions kustomize/overlays/prod/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ secretGenerator:
type: Opaque
envs:
- .env
generatorOptions:
disableNameSuffixHash: true
labels:
- includeSelectors: true
pairs:
Expand Down
74 changes: 37 additions & 37 deletions kustomize/overlays/uat/deployment_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,40 @@ spec:
template:
spec:
containers:
- name: csw
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: csw-env-uat
key: DATABASE_URL
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: csw-env-uat
key: SECRET_KEY
- name: BASE_URL
valueFrom:
secretKeyRef:
name: csw-env-uat
key: BASE_URL
- name: CORS_URL
valueFrom:
secretKeyRef:
name: csw-env-uat
key: CORS_URL
- name: AZURE_ACCOUNT_NAME
valueFrom:
secretKeyRef:
name: csw-env-uat
key: AZURE_ACCOUNT_NAME
- name: AZURE_ACCOUNT_KEY
valueFrom:
secretKeyRef:
name: csw-env-uat
key: AZURE_ACCOUNT_KEY
- name: AZURE_CONTAINER
valueFrom:
secretKeyRef:
name: csw-env-uat
key: AZURE_CONTAINER
- name: csw
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: csw-env-uat
key: DATABASE_URL
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: csw-env-uat
key: SECRET_KEY
- name: BASE_URL
valueFrom:
secretKeyRef:
name: csw-env-uat
key: BASE_URL
- name: CORS_URL
valueFrom:
secretKeyRef:
name: csw-env-uat
key: CORS_URL
- name: AZURE_ACCOUNT_NAME
valueFrom:
secretKeyRef:
name: csw-env-uat
key: AZURE_ACCOUNT_NAME
- name: AZURE_ACCOUNT_KEY
valueFrom:
secretKeyRef:
name: csw-env-uat
key: AZURE_ACCOUNT_KEY
- name: AZURE_CONTAINER
valueFrom:
secretKeyRef:
name: csw-env-uat
key: AZURE_CONTAINER
20 changes: 10 additions & 10 deletions kustomize/overlays/uat/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ metadata:
spec:
ingressClassName: nginx
rules:
- host: csw-uat.dbca.wa.gov.au
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: csw-clusterip-uat
port:
number: 8080
- host: csw-uat.dbca.wa.gov.au
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: csw-clusterip-uat
port:
number: 8080
2 changes: 2 additions & 0 deletions kustomize/overlays/uat/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ secretGenerator:
type: Opaque
envs:
- .env
generatorOptions:
disableNameSuffixHash: true
labels:
- includeSelectors: true
pairs:
Expand Down

0 comments on commit 681103b

Please sign in to comment.