Skip to content
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

refactor(CSI-330): use native kubernetes client for handling labels and remove reliance on kubectl init container #460

Open
wants to merge 1 commit into
base: sergey/ci-update-runners-group
Choose a base branch
from

Conversation

sergeyberezansky
Copy link
Collaborator

@sergeyberezansky sergeyberezansky commented Feb 16, 2025

TL;DR

Removes kubectl dependency and improves node label cleanup during CSI driver shutdown.

What changed?

  • Removed kubectl binary and version from Dockerfile
  • Replaced init container node label management with in-code Kubernetes client
  • Added graceful shutdown handling with SIGTERM/SIGINT signals
  • Implemented node label cleanup using k8s client-go instead of kubectl commands
  • Added context propagation through driver initialization and runtime
  • Added driver reference to config for improved state management

How to test?

  1. Deploy the CSI driver in a Kubernetes cluster
  2. Verify node labels are properly cleaned up when:
    • The driver starts up
    • The driver shuts down gracefully (SIGTERM)
    • The driver is forcefully terminated (SIGINT)
  3. Confirm no kubectl-related errors appear in logs

Why make this change?

The previous implementation relied on kubectl commands for node label management, which added unnecessary dependencies and potential security risks. Moving to the official Kubernetes client library provides better reliability, security, and error handling while reducing the container image size.

…nd remove reliance on kubectl init container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant