Skip to content

fix: remove kubectl image usage from helm pre-delete hook. - #345

Merged
aerosouund merged 3 commits into
kyverno:mainfrom
mastersans:remove-kubectl
May 12, 2026
Merged

aerosouund merged 3 commits into
kyverno:mainfrom
mastersans:remove-kubectl

Conversation

@mastersans

@mastersans mastersans commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Replaces the pre-delete Helm hook that ran kubectl delete apiservice with native Kubernetes garbage collection. APIServices now carry an OwnerReference pointing at the chart's ClusterRole, so when the chart is uninstalled the API server prunes them
automatically.

Motivation

The pre-delete hook had a few sharp edges:

  • Required a separate kubectl container image, its own ServiceAccount/RBAC, and pod scheduling (tolerations, nodeSelector, affinity, securityContext) duplicated in values.yaml.
  • Raced with pod termination, the hook waited for pod readiness with a 120s timeout and could fail on slow clusters or when the deployment was already unhealthy.
  • Left orphaned APIServices behind if the hook Job failed or was skipped (--no-hooks).

@codecov

codecov Bot commented May 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (5e58d04) to head (0c9711a).

Files with missing lines Patch % Lines
pkg/server/config.go 0.00% 26 Missing ⚠️
pkg/server/apiservice.go 0.00% 7 Missing ⚠️
pkg/app/opts/options.go 0.00% 1 Missing ⚠️
pkg/app/policyserver.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #345   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         33      33           
  Lines      19063   19089   +26     
=====================================
- Misses     19063   19089   +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread pkg/server/config.go Outdated
Comment thread pkg/server/config.go
Comment thread pkg/server/config.go Outdated
Comment thread pkg/server/config.go Outdated
Comment thread pkg/server/config.go Outdated
Comment thread pkg/app/opts/options.go Outdated
@aerosouund

Copy link
Copy Markdown
Member

@mastersans
please run make codegen to fix CI

@mastersans

Copy link
Copy Markdown
Contributor Author

Hi @aerosouund Thanks for the comments, I have made the changes addressing comments please take a look and let me know if anything else is needed.

@mastersans
mastersans requested a review from aerosouund May 11, 2026 13:48
Signed-off-by: Sanskar Sharma <sanskar.sharma@nirmata.com>
Signed-off-by: Sanskar Sharma <sanskar.sharma@nirmata.com>
Signed-off-by: Sanskar Sharma <sanskar.sharma@nirmata.com>
@aerosouund
aerosouund merged commit 6cc5d7f into kyverno:main May 12, 2026
22 checks passed
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.

2 participants