Skip to content

Commit

Permalink
Turn osm-adiff-service into a worker that can scale (#28)
Browse files Browse the repository at this point in the history
remove the related cron job
  • Loading branch information
sunu authored Apr 18, 2024
1 parent 2560a6f commit d32914f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 46 deletions.
45 changes: 45 additions & 0 deletions helm/osmcha/templates/adiff-service-worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: osmcha-adiff-service-worker
labels:
app: osmcha-adiff-service-worker
environment: {{ .Values.config.environment }}
release: {{ .Release.Name }}
spec:
replicas: {{ .Values.adiff_service.replicas}}
selector:
matchLabels:
app: osmcha-adiff-service-worker
template:
metadata:
labels:
app: osmcha-adiff-service-worker
spec:
containers:
- name: osmcha-adiff-service-worker
image: {{ .Values.adiff_service.image.repository }}:{{ .Values.adiff_service.image.tag }}
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- yarn update-queue
env:
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: osmcha-real-changesets-credentials
key: access_key
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: osmcha-real-changesets-credentials
key: secret_key
- name: OsmchaAdminToken
valueFrom:
secretKeyRef:
name: osmcha-admin-token
key: osmcha_admin_token
- name: RedisServer
value: {{ .Values.adiff_service.redis_url }}
restartPolicy: Never
45 changes: 0 additions & 45 deletions helm/osmcha/templates/cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,48 +51,3 @@ spec:
- name: REDIS_URL
value: {{ .Values.app.api.redis_url }}
restartPolicy: Never

---

apiVersion: batch/v1
kind: CronJob
metadata:
name: osmcha-adiff-service-cronjob
labels:
app: osmcha
environment: {{ .Values.config.environment }}
release: {{ .Release.Name }}
spec:
schedule: "*/1 * * * *"
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
containers:
- name: osmcha-adiff-service-process-replication
image: {{ .Values.adiff_service.image.repository }}:{{ .Values.adiff_service.image.tag }}
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- timeout 600s yarn update-queue
env:
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: osmcha-real-changesets-credentials
key: access_key
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: osmcha-real-changesets-credentials
key: secret_key
- name: OsmchaAdminToken
valueFrom:
secretKeyRef:
name: osmcha-admin-token
key: osmcha_admin_token
- name: RedisServer
value: {{ .Values.adiff_service.redis_url }}
restartPolicy: Never
3 changes: 2 additions & 1 deletion helm/osmcha/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ app:
# OSMCha adiff service
adiff_service:
replicas: 2
image:
repository: ghcr.io/osmcha/osm-adiff-service
tag: 49c757613671784a53d6066725674a133424310f
tag: 145be426880b33072b1db8300f7d736feb780e97
redis_url: redis://redis-master:6379

0 comments on commit d32914f

Please sign in to comment.