docs: add instructions for configuring cluster-autoscaler annotations#4580
docs: add instructions for configuring cluster-autoscaler annotations#4580Mallikarjunadevops wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds the Kubernetes cluster-autoscaler safe-to-evict pod annotation to Gatekeeper-related workloads so the autoscaler is allowed to evict them during scale-down/optimization.
Changes:
- Add
cluster-autoscaler.kubernetes.io/safe-to-evict: "true"to Gatekeeper audit-controller pod templates in rendered manifests. - Add the same annotation to the Helm chart template for the audit deployment.
- Add the same annotation to the manager deployment manifest.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| manifest_staging/deploy/gatekeeper.yaml | Adds safe-to-evict annotation to the audit-controller PodTemplate metadata in staging manifest. |
| manifest_staging/charts/gatekeeper/templates/gatekeeper-audit-deployment.yaml | Hard-codes safe-to-evict annotation into the Helm template for the audit deployment. |
| deploy/gatekeeper.yaml | Adds safe-to-evict annotation to the audit-controller PodTemplate metadata in deploy manifest. |
| config/manager/manager.yaml | Adds safe-to-evict annotation to the manager PodTemplate metadata. |
| annotations: | ||
| cluster-autoscaler.kubernetes.io/safe-to-evict: "true" |
| annotations: | ||
| cluster-autoscaler.kubernetes.io/safe-to-evict: "true" |
| metadata: | ||
| annotations: | ||
| cluster-autoscaler.kubernetes.io/safe-to-evict: "true" |
There was a problem hiding this comment.
@Mallikarjunadevops why cant podAnnotations helm variable be used to solve the problem in the original issue?
428761d to
f601540
Compare
|
@JaydipGabani Good point! You are absolutely right that users can manually configure this via podAnnotations. However, since Gatekeeper's audit and manager deployments use emptyDir by default for /tmp, they silently block cluster downscaling out-of-the-box for users who might be unaware of this interaction. To provide a better out-of-the-box experience while remaining configurable, I've updated this PR to remove the hardcoded annotations from the templates, and instead set them as defaults in the Helm values.yaml under both podAnnotations and auditPodAnnotations. This fully resolves the issue for Helm users by default while allowing them to override it if they prefer. Let me know if this approach looks better! |
…elm values Signed-off-by: Mallikarjunadevops <muchu.mallikarjunarpa@gmail.com>
f601540 to
2d50043
Compare
|
@Mallikarjunadevops I am hesitant to add default pod annotation, many users use upstream chart so this annotation will appear when they upgrade unless they manually chose to update. I would really like to keep this opted in so if there is a lack of documentation then we should update documentation for "how pod annotations can be set through helm" rather than changing defaults and surprise users after upgrading. |
Signed-off-by: Mallikarjunadevops <muchu.mallikarjunarpa@gmail.com>
|
@JaydipGabani Good call! You're absolutely right that changing the default behavior might surprise users who are not expecting it during an upgrade. I have reverted the Let me know if this new approach looks good to you! |
| ### Configuring Pod Annotations for Cluster Autoscaler | ||
|
|
||
| If you are using the [Kubernetes Cluster Autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler), you may want to allow downscaling of nodes running Gatekeeper pods. Since Gatekeeper uses `emptyDir` volumes for `/tmp`, the Cluster Autoscaler will block node downscaling by default. | ||
|
|
||
| To enable safe eviction for the manager and audit pods, you can pass the `safe-to-evict` pod annotations via Helm: |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jaydip Gabani <gabanijaydip@gmail.com>
|
|
||
| ### Configuring Pod Annotations for Cluster Autoscaler | ||
|
|
||
| If you are using the [Kubernetes Cluster Autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler), you may want to allow downscaling of nodes running Gatekeeper pods. Since Gatekeeper uses `emptyDir` volumes for `/tmp`, the Cluster Autoscaler will block node downscaling by default. |
|
|
||
| You can alter the variables in `charts/gatekeeper/values.yaml` to customize your deployment. To regenerate the base template, run `make manifests`. | ||
|
|
||
| ### Configuring Pod Annotations for Cluster Autoscaler |
| helm install gatekeeper/gatekeeper --name-template=gatekeeper --namespace gatekeeper-system --create-namespace \ | ||
| --set podAnnotations."cluster-autoscaler\.kubernetes\.io/safe-to-evict"="true" \ | ||
| --set auditPodAnnotations."cluster-autoscaler\.kubernetes\.io/safe-to-evict"="true" |
Signed-off-by: Mallikarjunadevops <muchu.mallikarjunarpa@gmail.com>
|
@JaydipGabani Just following up on this—I've gone ahead and thoroughly propagated this documentation update to all of the past versioned docs ( Additionally, based on some automated PR review feedback, I've refined the instructions to be 100% accurate:
Let me know if there's anything else you'd like me to tweak! |
Fixes #2291
What this PR does / why we need it:
This is a docs-only change that adds instructions to
website/docs/install.md(and all past versioned docs) explaining how users can configurecluster-autoscaler.kubernetes.io/safe-to-evict: "true"for the audit pod using Helm. Since the audit pod uses anemptyDirmount for/tmp/audit, it can block Cluster Autoscaler node downscaling by default.Rather than changing the default behavior out-of-the-box (which could surprise users upgrading), this PR ensures the capability is documented as an opt-in configuration for those who need it.
Which issue(s) this PR fixes:
Fixes #2291
Special notes for your reviewer:
--set-stringto prevent boolean type inference issues, and applied it strictly to the audit pod since the controller-manager no longer usesemptyDir.