-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Improve kube deploy process. #13397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve kube deploy process. #13397
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,51 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
# We would prefer to use Pod instead of Job here for exactly-once execution guarantee, however | ||
# Pods have a problem of sticking around after completion, causing errors upon upgrade if they | ||
# are not manually deleted first. | ||
# Using generateName would solve this by giving each bootloader pod a unique name, but Kustomize | ||
# does not currently support generateName. | ||
# Therefore, using Job here with a ttl is required in order to have a smooth upgrade process for kube. | ||
# See discussion about this on the PR: https://github.com/airbytehq/airbyte/pull/13397#discussion_r887600449 | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: airbyte-bootloader | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: airbyte-bootloader-container | ||
image: airbyte/bootloader | ||
env: | ||
- name: AIRBYTE_VERSION | ||
valueFrom: | ||
configMapKeyRef: | ||
name: airbyte-env | ||
key: AIRBYTE_VERSION | ||
- name: DATABASE_HOST | ||
valueFrom: | ||
configMapKeyRef: | ||
name: airbyte-env | ||
key: DATABASE_HOST | ||
- name: DATABASE_PORT | ||
valueFrom: | ||
configMapKeyRef: | ||
name: airbyte-env | ||
key: DATABASE_PORT | ||
- name: DATABASE_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: airbyte-secrets | ||
key: DATABASE_PASSWORD | ||
- name: DATABASE_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: airbyte-env | ||
key: DATABASE_URL | ||
- name: DATABASE_USER | ||
valueFrom: | ||
secretKeyRef: | ||
name: airbyte-secrets | ||
key: DATABASE_USER | ||
# This ttl is necessary to prevent errors when upgrading airbyte | ||
ttlSecondsAfterFinished: 5 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned in the PR description, this is necessary to avoid an error being about the airbyte-bootloader job being immutable. This isn't an ideal solution, because this means that the bootloader pod is deleted after it completes, making its logs inaccessible through kube. This was the only solution I could come up with that allowed us to still use Definitely open to feedback here if there are any other options I haven't considered. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add a comment explaining why we do this, please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure thing, done! |
||
template: | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: airbyte-bootloader-container | ||
image: airbyte/bootloader | ||
env: | ||
- name: AIRBYTE_VERSION | ||
valueFrom: | ||
configMapKeyRef: | ||
name: airbyte-env | ||
key: AIRBYTE_VERSION | ||
- name: DATABASE_HOST | ||
valueFrom: | ||
configMapKeyRef: | ||
name: airbyte-env | ||
key: DATABASE_HOST | ||
- name: DATABASE_PORT | ||
valueFrom: | ||
configMapKeyRef: | ||
name: airbyte-env | ||
key: DATABASE_PORT | ||
- name: DATABASE_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: airbyte-secrets | ||
key: DATABASE_PASSWORD | ||
- name: DATABASE_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: airbyte-env | ||
key: DATABASE_URL | ||
- name: DATABASE_USER | ||
valueFrom: | ||
secretKeyRef: | ||
name: airbyte-secrets | ||
key: DATABASE_USER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kube jobs only have best effort parallelism guarantees, which is why I don't really like using them for crucial workflows. Took a look and confirmed this is probably the best way of doing this with Kustomize. Can we add a comment here that we generally want to use
Pod
(our Helm charts use Pod) for the best exactly-once execution guarantees and cannot do so because Kustomize does not supportgenerateName
? Want to prevent confusion in the future.If Kustomize did support
generateName
, we should be able to instruct users to runkubectl create
on initial create andreplace
on subsequent runs.This happens relatively infrequently so risk is low. In the long term, I think we'll consolidate the Kube deploys into Helm so I think this is fine for now.