k8s rollout: restart by image instead of variant label - #41
Closed
daanpersoons wants to merge 1 commit into
Closed
Conversation
The deploy pipelines restarted deployments via a synthesized `variant=<monorepo-folder>` label selector, which required every infra repo to hand-patch a `variant:` label onto its deployments — brittle and easy to miss (one image often backs several deployments). Instead, restart every deployment whose pods actually run the just-built image: - infra/k8s/rollout: new `rollout-image` input + image-match branch. Priority is deployments (explicit) > labels (explicit) > image (default) > all. - docker/setup: stop synthesizing the `variant=<path>` selector; pass K8S_LABELS through as-is. - docker-build-and-deploy / docker-promote-to-environment: pass rollout-image = <registry>/<image>. Backward compatible: repos that set K8S_DEPLOYMENTS or K8S_LABELS keep those as overrides. Repos that relied on the auto variant selector now restart by image (strictly more correct — catches api + worker + scheduler that share the image), and no longer need the variant label.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Change the k8s deploy rollout to restart every deployment running the just-built image, instead of relying on a synthesized
variant=<monorepo-folder>label selector.Why
Today
docker/setupappendsvariant=<path>to the rollout label selector, which forces every infra repo to hand-patch avariant:label onto its deployments.Matching on the image the pipeline just pushed is precise and needs zero labels.
Changes
infra/k8s/rollout— newrollout-imageinput + image-match branch. Selection priority (first match wins):rollout-deployments(explicit names) — overriderollout-labels(selector) — overriderollout-image— default:kubectl get deploy -o json | jq (image startswith) | xargs kubectl rollout restartdocker/setup— stop synthesizingvariant=<path>; passK8S_LABELSthrough as-is.docker-build-and-deploy/docker-promote-to-environment— passrollout-image = <registry>/<image>.Backward compatibility
Repos that set
K8S_DEPLOYMENTSorK8S_LABELSkeep them as overrides. Repos that relied on the autovariantselector now restart by image — strictly more correct (catches all deployments sharing the image) and thevariant:label patch becomes unnecessary.