Skip to content

Commit

Permalink
chore: add optional argocd sync waves to jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
chliddle committed Dec 16, 2024
1 parent 3a332ba commit 1a10533
Show file tree
Hide file tree
Showing 4 changed files with 276 additions and 4 deletions.
260 changes: 260 additions & 0 deletions charts/namada-indexer/argo-desired-manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
helm.sh/hook-weight: '-10'
labels:
app.kubernetes.io/instance: namada-indexer
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: namada-indexer
app.kubernetes.io/version: '1.0'
argocd.argoproj.io/instance: namada-indexer
helm.sh/chart: namada-indexer-0.0.0-development
name: namada-indexer
namespace: namada-indexer
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: namada-indexer
app.kubernetes.io/name: namada-indexer
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
app.kubernetes.io/instance: namada-indexer
app.kubernetes.io/name: namada-indexer
spec:
containers:
- env:
- name: DB_USER
valueFrom:
secretKeyRef:
key: username
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
envFrom: null
image: null
imagePullPolicy: IfNotPresent
name: chain
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 50m
memory: 64Mi
- env:
- name: DB_USER
valueFrom:
secretKeyRef:
key: username
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
envFrom: null
image: postgres:15-alpine
imagePullPolicy: IfNotPresent
name: debug
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 50m
memory: 64Mi
- env:
- name: DB_USER
valueFrom:
secretKeyRef:
key: username
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
envFrom: null
image: null
imagePullPolicy: IfNotPresent
name: governance
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 50m
memory: 64Mi
- env:
- name: DB_USER
valueFrom:
secretKeyRef:
key: username
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
envFrom: null
image: null
imagePullPolicy: IfNotPresent
name: parameters
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 50m
memory: 64Mi
- env:
- name: DB_USER
valueFrom:
secretKeyRef:
key: username
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
envFrom: null
image: null
imagePullPolicy: IfNotPresent
name: pos
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 50m
memory: 64Mi
- env:
- name: DB_USER
valueFrom:
secretKeyRef:
key: username
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
envFrom: null
image: null
imagePullPolicy: IfNotPresent
name: rewards
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 50m
memory: 64Mi
- env:
- name: DB_USER
valueFrom:
secretKeyRef:
key: username
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
envFrom: null
image: null
imagePullPolicy: IfNotPresent
name: transactions
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 50m
memory: 64Mi
- env:
- name: DB_USER
valueFrom:
secretKeyRef:
key: username
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
envFrom: null
image: null
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
httpGet:
path: /health
port: 5001
initialDelaySeconds: 15
periodSeconds: 15
startPeriod: 10
timeoutSeconds: 10
name: webserver
ports:
- containerPort: 5001
name: http
protocol: TCP
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 50m
memory: 64Mi
initContainers:
- command: []
env:
- name: DB_USER
valueFrom:
secretKeyRef:
key: username
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: >-
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do
envFrom: null
image: postgres:15-alpine
imagePullPolicy: IfNotPresent
name: init-db
restartPolicy: Always
securityContext: {}
serviceAccountName: namada-indexer
volumes: null
8 changes: 6 additions & 2 deletions charts/namada-indexer/templates/dependencies-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ kind: Job
metadata:
name: {{ include "namada-indexer.fullname" . }}-wait-dependencies
annotations:
"helm.sh/hook": post-install
"helm.sh/hook": "pre-install,pre-upgrade"
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
"helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
{{- if .Values.argocd.deployment }}
"argocd.argoproj.io/hook": "PreSync"
"argocd.argoproj.io/sync-wave": "-1"
{{- end }}
labels:
{{- include "namada-indexer.labels" . | nindent 4 }}
spec:
Expand Down
8 changes: 6 additions & 2 deletions charts/namada-indexer/templates/postgresql-cleanup-hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ kind: Job
metadata:
name: {{ include "namada-indexer.fullname" . }}-db-cleanup
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
"helm.sh/hook": "pre-delete"
"helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
{{- if .Values.argocd.deployment }}
"argocd.argoproj.io/hook": "PreDelete"
"argocd.argoproj.io/sync-wave": "-2"
{{- end }}
spec:
template:
spec:
Expand Down
4 changes: 4 additions & 0 deletions charts/namada-indexer/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
replicaCount: 1

# If deployed by argocd add sync waves to batch jobs
argocd:
deployment: true

# Common configurations in ConfigMaps
configmaps:
config:
Expand Down

0 comments on commit 1a10533

Please sign in to comment.