Skip to content

Commit 88390f2

Browse files
authored
Improve kube deploy process. (#13397)
* switch bootloader to job and add recreate strategy to db * add comment about recreate strategy * Add comment about ttl on bootloader * add comment about Pod vs Job
1 parent 3072298 commit 88390f2

File tree

2 files changed

+51
-37
lines changed

2 files changed

+51
-37
lines changed

kube/resources/bootloader.yaml

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,51 @@
1-
apiVersion: v1
2-
kind: Pod
1+
# We would prefer to use Pod instead of Job here for exactly-once execution guarantee, however
2+
# Pods have a problem of sticking around after completion, causing errors upon upgrade if they
3+
# are not manually deleted first.
4+
# Using generateName would solve this by giving each bootloader pod a unique name, but Kustomize
5+
# does not currently support generateName.
6+
# Therefore, using Job here with a ttl is required in order to have a smooth upgrade process for kube.
7+
# See discussion about this on the PR: https://github.com/airbytehq/airbyte/pull/13397#discussion_r887600449
8+
apiVersion: batch/v1
9+
kind: Job
310
metadata:
411
name: airbyte-bootloader
512
spec:
6-
restartPolicy: Never
7-
containers:
8-
- name: airbyte-bootloader-container
9-
image: airbyte/bootloader
10-
env:
11-
- name: AIRBYTE_VERSION
12-
valueFrom:
13-
configMapKeyRef:
14-
name: airbyte-env
15-
key: AIRBYTE_VERSION
16-
- name: DATABASE_HOST
17-
valueFrom:
18-
configMapKeyRef:
19-
name: airbyte-env
20-
key: DATABASE_HOST
21-
- name: DATABASE_PORT
22-
valueFrom:
23-
configMapKeyRef:
24-
name: airbyte-env
25-
key: DATABASE_PORT
26-
- name: DATABASE_PASSWORD
27-
valueFrom:
28-
secretKeyRef:
29-
name: airbyte-secrets
30-
key: DATABASE_PASSWORD
31-
- name: DATABASE_URL
32-
valueFrom:
33-
configMapKeyRef:
34-
name: airbyte-env
35-
key: DATABASE_URL
36-
- name: DATABASE_USER
37-
valueFrom:
38-
secretKeyRef:
39-
name: airbyte-secrets
40-
key: DATABASE_USER
13+
# This ttl is necessary to prevent errors when upgrading airbyte
14+
ttlSecondsAfterFinished: 5
15+
template:
16+
spec:
17+
restartPolicy: Never
18+
containers:
19+
- name: airbyte-bootloader-container
20+
image: airbyte/bootloader
21+
env:
22+
- name: AIRBYTE_VERSION
23+
valueFrom:
24+
configMapKeyRef:
25+
name: airbyte-env
26+
key: AIRBYTE_VERSION
27+
- name: DATABASE_HOST
28+
valueFrom:
29+
configMapKeyRef:
30+
name: airbyte-env
31+
key: DATABASE_HOST
32+
- name: DATABASE_PORT
33+
valueFrom:
34+
configMapKeyRef:
35+
name: airbyte-env
36+
key: DATABASE_PORT
37+
- name: DATABASE_PASSWORD
38+
valueFrom:
39+
secretKeyRef:
40+
name: airbyte-secrets
41+
key: DATABASE_PASSWORD
42+
- name: DATABASE_URL
43+
valueFrom:
44+
configMapKeyRef:
45+
name: airbyte-env
46+
key: DATABASE_URL
47+
- name: DATABASE_USER
48+
valueFrom:
49+
secretKeyRef:
50+
name: airbyte-secrets
51+
key: DATABASE_USER

kube/resources/db.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ metadata:
1616
name: airbyte-db
1717
spec:
1818
replicas: 1
19+
# Recreate strategy is necessary to avoid multiple simultaneous db pods running and corrupting the db state
20+
strategy:
21+
type: Recreate
1922
selector:
2023
matchLabels:
2124
airbyte: db

0 commit comments

Comments
 (0)