-
Notifications
You must be signed in to change notification settings - Fork 0
sample-app: PDB + RollingUpdate strategy to contain bad rollouts #4
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,4 @@ resources: | |
| - service.yaml | ||
| - hpa.yaml | ||
| - networkpolicy.yaml | ||
| - pdb.yaml | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: policy/v1 | ||
| kind: PodDisruptionBudget | ||
| metadata: | ||
| name: sample-app | ||
| spec: | ||
| maxUnavailable: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: sample-app | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,3 +14,21 @@ for anything deploy-related, or the ArgoCD UI for sync/health state. | |
| | Need to add/change a new environment | Copy an existing overlay under `apps/sample-app/overlays/`, add matching ArgoCD `Application` under `argocd/apps/`, add it to `argocd/app-of-apps.yaml` | Keep `namespace:` unique per env | | ||
| | Bootstrapping ArgoCD on a fresh cluster | Follow "Bootstrap ArgoCD" section in `README.md` | | | ||
| | Rotating/adding a secret the app needs | Not yet supported — no secrets management is wired up in this repo yet (tracked separately, likely External Secrets Operator + SSM Parameter Store) | Don't hand-roll a Secret manifest into git in the meantime | | ||
|
|
||
| ## Bad rollout containment | ||
|
|
||
| - **Rollout strategy**: `Deployment.spec.strategy` is `RollingUpdate` with | ||
| `maxUnavailable: 0, maxSurge: 1` — a bad rollout won't take down existing | ||
| healthy pods until the new ones pass readiness. Combined with the readiness | ||
| probe, a crash-looping new version stalls the rollout instead of replacing | ||
| the whole fleet. | ||
| - **PodDisruptionBudget**: `maxUnavailable: 1` on `sample-app` protects | ||
|
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. |
||
| against voluntary disruptions (node drains, cluster-autoscaler, manual | ||
| `kubectl delete`) stacking with an in-progress bad rollout and taking out | ||
| every pod at once. In `dev` (1 replica) this still allows full disruption | ||
| when the single pod is intentionally evicted — that's expected there. | ||
| - **Not yet wired**: the `PodCrashLooping` alert (in `cluster-observability`) | ||
| doesn't yet carry a `runbook_url` annotation pointing back here, and there's | ||
| no automated rollback (no Argo Rollouts analysis step) — today, detection | ||
| is automatic but response is still a human reading this doc. Out of scope | ||
| for this repo/PR; tracked separately. | ||
Oops, something went wrong.
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.
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.
Since the application uses a Horizontal Pod Autoscaler (
hpa.yaml), the number of replicas can scale dynamically. Using a hardcoded absolute value ofmaxUnavailable: 1can become highly restrictive as the application scales up (e.g., during node drains or cluster upgrades, only one pod can be evicted at a time, which significantly slows down cluster maintenance).Consider using a percentage-based value like
maxUnavailable: "33%"instead. This scales dynamically with the replica count while maintaining the same behavior for lower replica counts:1 * 33% = 0.33(rounded up to1), allowing full disruption.2 * 33% = 0.66(rounded up to1), allowing at most 1 unavailable pod.3 * 33% = 0.99(rounded up to1), allowing at most 1 unavailable pod.