Skip to content

Fix #2291: Add safe-to-evict annotation to audit pod#4580

Open
Mallikarjunadevops wants to merge 1 commit into
open-policy-agent:masterfrom
Mallikarjunadevops:fix/issue-2291-safe-to-evict
Open

Fix #2291: Add safe-to-evict annotation to audit pod#4580
Mallikarjunadevops wants to merge 1 commit into
open-policy-agent:masterfrom
Mallikarjunadevops:fix/issue-2291-safe-to-evict

Conversation

@Mallikarjunadevops

Copy link
Copy Markdown

Fixes #2291 by adding the cluster-autoscaler.kubernetes.io/safe-to-evict: "true" annotation to the audit deployment. This unblocks cluster autoscaler downscaling on nodes running the audit pod.

Copilot AI review requested due to automatic review settings May 19, 2026 02:30
@Mallikarjunadevops Mallikarjunadevops requested a review from a team as a code owner May 19, 2026 02:30
@linux-foundation-easycla

linux-foundation-easycla Bot commented May 19, 2026

Copy link
Copy Markdown

CLA Not Signed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +33 to +34
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
Comment thread config/manager/manager.yaml Outdated
Comment on lines +138 to +139
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
Comment thread deploy/gatekeeper.yaml Outdated
Comment on lines +5462 to +5464
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "true"

@JaydipGabani JaydipGabani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mallikarjunadevops why cant podAnnotations helm variable be used to solve the problem in the original issue?

@Mallikarjunadevops Mallikarjunadevops force-pushed the fix/issue-2291-safe-to-evict branch 2 times, most recently from 428761d to f601540 Compare May 19, 2026 13:17
@Mallikarjunadevops

Copy link
Copy Markdown
Author

@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>
@Mallikarjunadevops Mallikarjunadevops force-pushed the fix/issue-2291-safe-to-evict branch from f601540 to 2d50043 Compare May 19, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

safe to evict emptyDir local storage to unblock the cluster downscaling.

3 participants