Skip to content

Commit

Permalink
Added Kustomize resources: HorizontalPodAutoscaler for deployment wor…
Browse files Browse the repository at this point in the history
…kloads.
  • Loading branch information
ropable committed Apr 23, 2024
1 parent 022e3ee commit 92b9e8b
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 5 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ MapProxy service application
Basic MapProxy service used internally by the Department of Biodiversity,
Conservation and Attractions.

# Docker image

To build a new Docker image from the `Dockerfile`:

docker image build -t ghcr.io/dbca-wa/mapproxy .

# Running Docker container

When running this image as a container or workload, remember to provide a
configuration file at `/app/config/mapproxy.yaml` (this can be a bind-mounted
local file or a configmap in Kubernetes).
When running this image as a container, provide a configuration file
mounted at `/app/config/mapproxy.yaml` (this can be a bind-mounted
local file or a ConfigMap in Kubernetes).

Example:
Example using a local bind-mount file:

docker container run -p 8080:8080 -v $PWD/mapproxy.yaml:/app/config/mapproxy.yaml ghcr.io/dbca-wa/mapproxy
1 change: 0 additions & 1 deletion kustomize/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ kind: Deployment
metadata:
name: mapproxy-deployment
spec:
replicas: 2
strategy:
type: RollingUpdate
template:
Expand Down
17 changes: 17 additions & 0 deletions kustomize/base/deployment_hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: mapproxy-deployment-hpa
spec:
minReplicas: 1
maxReplicas: 3
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
metrics:
- resource:
name: cpu
target:
type: Utilization
averageUtilization: 250
type: Resource
1 change: 1 addition & 0 deletions kustomize/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- deployment_hpa.yaml
- pvc.yaml
- service.yaml
7 changes: 7 additions & 0 deletions kustomize/overlays/prod/deployment_hpa_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: mapproxy-deployment-hpa
spec:
scaleTargetRef:
name: mapproxy-deployment-prod
1 change: 1 addition & 0 deletions kustomize/overlays/prod/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ labels:
variant: prod
patches:
- path: deployment_patch.yaml
- path: deployment_hpa_patch.yaml
- path: service_patch.yaml
images:
- name: ghcr.io/dbca-wa/mapproxy
Expand Down
7 changes: 7 additions & 0 deletions kustomize/overlays/uat/deployment_hpa_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: mapproxy-deployment-hpa
spec:
scaleTargetRef:
name: mapproxy-deployment-uat
1 change: 1 addition & 0 deletions kustomize/overlays/uat/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ labels:
variant: uat
patches:
- path: deployment_patch.yaml
- path: deployment_hpa_patch.yaml
- path: service_patch.yaml
configMapGenerator:
- name: mapproxy-configmap
Expand Down

0 comments on commit 92b9e8b

Please sign in to comment.