Skip to content

Commit aefc29f

Browse files
author
Ruben L. Mendoza
authored
Merge pull request #224 from developmentseed/kubernetes/hpa
Kubernetes horizontal autoscaling for web service
2 parents 7654dff + e0747a2 commit aefc29f

10 files changed

+34
-36
lines changed

osm-seed/templates/id-editor-service.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ spec:
2020
# In case cloudProvider=gcp
2121
{{- if eq .Values.cloudProvider "gcp" }}
2222
type: LoadBalancer
23-
loadBalancerIP : {{ .Values.idEditor.staticIp }}
2423
{{- end }}
2524
# In case cloudProvider=minikube
2625
{{ if eq .Values.cloudProvider "minikube" }}

osm-seed/templates/nominatim-api-service.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ spec:
2525
# In case cloudProvider=gcp
2626
{{- if eq .Values.cloudProvider "gcp" }}
2727
type: LoadBalancer
28-
loadBalancerIP : {{ .Values.nominatimApi.staticIp }}
2928
{{- end }}
3029
# In case cloudProvider=minikube
3130
{{- if eq .Values.cloudProvider "minikube" }}

osm-seed/templates/overpass-api-service.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,14 @@ spec:
2121
{{- if eq .Values.cloudProvider "aws" }}
2222
type: LoadBalancer
2323
{{- end }}
24-
2524
# In case cloudProvider=gcp
2625
{{- if eq .Values.cloudProvider "gcp" }}
2726
type: LoadBalancer
28-
loadBalancerIP : {{ .Values.overpassApi.staticIp }}
2927
{{- end }}
30-
3128
# In case cloudProvider=minikube
3229
{{- if eq .Values.cloudProvider "minikube" }}
3330
type: NodePort
3431
{{- end }}
35-
3632
ports:
3733
- port: 80
3834
targetPort: 80

osm-seed/templates/taginfo-service.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ spec:
2525
# In case cloudProvider=gcp
2626
{{- if eq .Values.cloudProvider "gcp" }}
2727
type: LoadBalancer
28-
loadBalancerIP : {{ .Values.taginfo.staticIp }}
2928
{{- end }}
3029
# In case cloudProvider=minikube
3130
{{- if eq .Values.cloudProvider "minikube" }}

osm-seed/templates/tasking-manager-api-service.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ spec:
2525
# In case cloudProvider=gcp
2626
{{- if eq .Values.cloudProvider "gcp" }}
2727
type: LoadBalancer
28-
loadBalancerIP : {{ .Values.tmApi.staticIp }}
2928
{{- end }}
3029
# In case cloudProvider=minikube
3130
{{- if eq .Values.cloudProvider "minikube" }}

osm-seed/templates/tiler-server-service.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,14 @@ spec:
2121
{{- if eq .Values.cloudProvider "aws" }}
2222
type: LoadBalancer
2323
{{- end }}
24-
2524
# In case cloudProvider=gcp
2625
{{- if eq .Values.cloudProvider "gcp" }}
2726
type: LoadBalancer
28-
loadBalancerIP : {{ .Values.tilerServer.staticIp }}
2927
{{- end }}
30-
3128
# In case cloudProvider=minikube
3229
{{- if eq .Values.cloudProvider "minikube" }}
3330
type: NodePort
3431
{{- end }}
35-
3632
ports:
3733
- port: {{ .Values.tilerServer.env.TILER_SERVER_PORT }}
3834
targetPort: {{ .Values.tilerServer.env.TILER_SERVER_PORT }}

osm-seed/templates/tiler-visor-service.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,14 @@ spec:
1717
{{- if eq .Values.cloudProvider "aws" }}
1818
type: LoadBalancer
1919
{{- end }}
20-
2120
# In case cloudProvider=gcp
2221
{{- if eq .Values.cloudProvider "gcp" }}
2322
type: LoadBalancer
24-
loadBalancerIP : {{ .Values.tilerVisor.staticIp }}
2523
{{- end }}
26-
2724
# In case cloudProvider=minikube
2825
{{- if eq .Values.cloudProvider "minikube" }}
2926
type: NodePort
3027
{{- end }}
31-
3228
ports:
3329
- port: {{ .Values.tilerVisor.env.TILER_VISOR_PORT }}
3430
targetPort: 80

osm-seed/templates/web-hpa.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- if .Values.web.enabled -}}
2+
{{- if .Values.web.autoscaling.enabled -}}
3+
apiVersion: autoscaling/v1
4+
kind: HorizontalPodAutoscaler
5+
metadata:
6+
name: {{ template "osm-seed.fullname" . }}-hpa-web
7+
spec:
8+
scaleTargetRef:
9+
apiVersion: apps/v1
10+
kind: Deployment
11+
name: {{ template "osm-seed.fullname" . }}-web
12+
minReplicas: {{ .Values.web.autoscaling.minReplicas }}
13+
maxReplicas: {{ .Values.web.autoscaling.maxReplicas }}
14+
targetCPUUtilizationPercentage: {{ .Values.web.autoscaling.cpuUtilization }}
15+
{{- end }}
16+
{{- end }}

osm-seed/templates/web-service.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ spec:
2525
# In case cloudProvider=gcp
2626
{{- if eq .Values.cloudProvider "gcp" }}
2727
type: LoadBalancer
28-
loadBalancerIP : {{ .Values.web.staticIp }}
2928
{{- end }}
3029
# In case cloudProvider=minikube
3130
{{- if eq .Values.cloudProvider "minikube" }}

osm-seed/values.yaml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ db:
6666
POSTGRES_USER: postgres
6767
POSTGRES_PASSWORD: '1234'
6868
persistenceDisk:
69-
enabled: true
69+
enabled: false
7070
mountPath: /var/lib/postgresql/data
7171
subPath: postgresql-db
7272
# Minikube
@@ -98,8 +98,6 @@ web:
9898
name: ''
9999
tag: ''
100100
replicaCount: 1
101-
# Set staticIp, if you are using cloudProvider=gcp
102-
staticIp: 35.247.6.238
103101
env:
104102
MAILER_ADDRESS: smtp.gmail.com
105103
MAILER_DOMAIN: gmail.com
@@ -116,6 +114,11 @@ web:
116114
cpu: '2'
117115
nodeSelector:
118116
enabled: false
117+
autoscaling:
118+
enabled: false
119+
minReplicas: 1
120+
maxReplicas: 3
121+
cpuUtilization: 80
119122

120123
# ====================================================================================================
121124
# Variables for memcached. Memcached is used to store session cookies
@@ -153,7 +156,7 @@ fullHistory:
153156
enabled: false
154157
label_key: nodegroup-type
155158
label_value: ohm-non-tiler
156-
schedule: '* */24 * * *'
159+
schedule: '* * * * *'
157160
env:
158161
OVERWRITE_FHISTORY_FILE: false
159162
resources:
@@ -173,10 +176,9 @@ dbBackupRestore:
173176
image:
174177
name: ''
175178
tag: ''
176-
schedule: '0 */1 * * *'
179+
schedule: '* * * * *'
177180
env:
178181
DB_ACTION: backup
179-
CLEAN_BACKUPS: true
180182
resources:
181183
enabled: false
182184
requests:
@@ -185,6 +187,8 @@ dbBackupRestore:
185187
limits:
186188
memory: '400Mi'
187189
cpu: '0.6'
190+
nodeSelector:
191+
enabled: false
188192

189193
# ====================================================================================================
190194
# Variables for osm-seed for osmosis, this configuration os to get the planet dump files from apidb
@@ -194,9 +198,9 @@ planetDump:
194198
image:
195199
name: ''
196200
tag: ''
197-
schedule: '0 */1 * * *'
201+
schedule: '* * * * *'
198202
env:
199-
CLEAN_BACKUPS: true
203+
OVERWRITE_PLANET_FILE: false
200204
resources:
201205
enabled: false
202206
requests:
@@ -286,7 +290,7 @@ tilerDb:
286290
POSTGRES_DB_MAINTENANCE_WORK_MEM: 64MB
287291
POSTGRES_DB_EFFECTIVE_CACHE_SIZE: 4GB
288292
persistenceDisk:
289-
enabled: true
293+
enabled: false
290294
accessMode: ReadWriteOnce
291295
mountPath: /var/lib/postgresql/data
292296
subPath: postgresql-d
@@ -325,7 +329,7 @@ tilerImposm:
325329
TILER_IMPORT_PBF_URL: http://download.geofabrik.de/europe/monaco-latest.osm.pbf
326330
TILER_IMPORT_LIMIT: https://gist.githubusercontent.com/Rub21/96bdcac5eb11f0b36ba8d0352ac537f4/raw/2606f2e207d4a0d895897a83efa1efacefd36eb4/monaco.geojson
327331
persistenceDisk:
328-
enabled: true
332+
enabled: false
329333
accessMode: ReadWriteOnce
330334
mountPath: /mnt/data
331335
# Minikube
@@ -358,8 +362,6 @@ tilerServer:
358362
name: ''
359363
tag: ''
360364
replicaCount: 1
361-
# Set staticIp, if you are using cloudProvider=gcp
362-
staticIp: 35.247.6.238
363365
env:
364366
TILER_SERVER_PORT: 9090
365367
TILER_CACHE_TYPE: s3 #In case TILER_CACHE_TYPE=s3, the kubernetes teemplate will come up with a deployment pod
@@ -373,7 +375,7 @@ tilerServer:
373375
command: './start.sh' # ./start.sh & ./tile_cache_downloader.sh & ./expire-watcher.sh
374376
# In case you use TILER_CACHE_TYPE: file with persistenceDisk
375377
persistenceDisk:
376-
enabled: true
378+
enabled: false
377379
accessMode: ReadWriteOnce
378380
mountPath: /mnt/data
379381
# Minikube
@@ -425,8 +427,6 @@ tilerVisor:
425427
name: ''
426428
tag: ''
427429
replicaCount: 1
428-
# Set staticIp, if you are using cloudProvider=gcp
429-
staticIp: 35.247.6.238
430430
env:
431431
TILER_VISOR_PROTOCOL: http
432432
TILER_VISOR_PORT: 8081
@@ -454,7 +454,6 @@ tmApi:
454454
nodeSelector:
455455
enabled: false
456456
replicaCount: 1
457-
staticIp: c
458457
env:
459458
POSTGRES_HOST: 'tm'
460459
POSTGRES_DB: 'tm'
@@ -517,7 +516,7 @@ nominatimDb:
517516
REPLICATION_UPDATE_INTERVAL: 86500
518517
REPLICATION_RECHECK_INTERVAL: 900
519518
persistenceDisk:
520-
enabled: true
519+
enabled: false
521520
accessMode: ReadWriteOnce
522521
mountPath: /var/lib/postgresql/data
523522
subPath: nominatim-pgdata
@@ -566,7 +565,7 @@ nominatimApi:
566565
# Variables for overpass-api
567566
# ====================================================================================================
568567
overpassApi:
569-
enabled: true
568+
enabled: false
570569
image:
571570
name: ''
572571
tag: ''
@@ -579,7 +578,7 @@ overpassApi:
579578
#OVERPASS_PLANET_PREPROCESS: 'mv /db/planet.osm.bz2 /db/planet.osm.pbf && osmium cat -o /db/planet.osm.bz2 /db/planet.osm.pbf && rm /db/planet.osm.pbf' # it is in case we pass planet files as PBF file uncommment this line
580579
OVERPASS_PLANET_PREPROCESS: 'ls'
581580
persistenceDisk:
582-
enabled: true
581+
enabled: false
583582
accessMode: ReadWriteOnce
584583
mountPath: /db
585584
# Minikube

0 commit comments

Comments
 (0)