Skip to content

Commit

Permalink
Added Kustomize base and UAT overlays.
Browse files Browse the repository at this point in the history
  • Loading branch information
ropable committed Oct 23, 2023
1 parent 92def0e commit 991b38d
Show file tree
Hide file tree
Showing 10 changed files with 175 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mapproxy.yaml
.env
config.yaml
.python-version
__pycache__/
26 changes: 26 additions & 0 deletions kustomize/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# MapProxy Kubernetes Kustomize overlay configuration

Declarative management of MapProxy Kubernetes resources using Kustomize.

# How to use

Within an overlay directory, create a `config.yaml` file to configure the
proxied tile layers.

Review the built resource output using `kustomize`:

```bash
kustomize build kustomize/overlays/uat/ | less
```

Run `kubectl` with the `-k` flag to generate resources for a given overlay:

```bash
kubectl apply -k kustomize/overlays/uat --namespace sss --dry-run=client
```

# 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
51 changes: 51 additions & 0 deletions kustomize/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mapproxy-deployment
spec:
replicas: 2
strategy:
type: RollingUpdate
template:
spec:
containers:
- name: mapproxy
env:
- name: TZ
value: "Australia/Perth"
resources:
requests:
memory: "64Mi"
cpu: "10m"
limits:
memory: "4096Mi"
cpu: "1000m"
livenessProbe:
httpGet:
path: /demo/
port: 8080
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 3
failureThreshold: 3
successThreshold: 1
timeoutSeconds: 3
readinessProbe:
httpGet:
path: /demo/
port: 8080
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 3
failureThreshold: 3
successThreshold: 1
timeoutSeconds: 3
securityContext:
runAsNonRoot: true
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
restartPolicy: Always
3 changes: 3 additions & 0 deletions kustomize/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- deployment.yaml
- service.yaml
11 changes: 11 additions & 0 deletions kustomize/base/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: mapproxy-clusterip
spec:
type: ClusterIP
ports:
- name: wsgi
port: 8080
protocol: TCP
targetPort: 8080
28 changes: 28 additions & 0 deletions kustomize/overlays/uat/deployment_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mapproxy-deployment
labels:
app: mapproxy-uat
spec:
selector:
matchLabels:
app: mapproxy-uat
template:
metadata:
labels:
app: mapproxy-uat
spec:
containers:
- name: mapproxy
image: ghcr.io/dbca-wa/mapproxy
imagePullPolicy: Always
volumeMounts:
- mountPath: /app/config
name: mapproxy-configmap
volumes:
- configMap:
name: mapproxy-configmap-uat
defaultMode: 292
optional: false
name: mapproxy-configmap
17 changes: 17 additions & 0 deletions kustomize/overlays/uat/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mapproxy-ingress
spec:
ingressClassName: nginx
rules:
- host: mapproxy-uat.dbca.wa.gov.au
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: mapproxy-clusterip-uat
port:
number: 8080
18 changes: 18 additions & 0 deletions kustomize/overlays/uat/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
nameSuffix: -uat
resources:
- ../../base
- ingress.yaml
- pdb.yaml
labels:
- includeSelectors: true
pairs:
variant: uat
patches:
- path: deployment_patch.yaml
- path: service_patch.yaml
configMapGenerator:
- name: mapproxy-configmap
files:
- config.yaml
10 changes: 10 additions & 0 deletions kustomize/overlays/uat/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: mapproxy-pdb
spec:
minAvailable: 1
selector:
matchLabels:
app: mapproxy-uat
variant: uat
9 changes: 9 additions & 0 deletions kustomize/overlays/uat/service_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: mapproxy-clusterip
spec:
type: ClusterIP
selector:
app: mapproxy-uat
variant: uat

0 comments on commit 991b38d

Please sign in to comment.