-
Notifications
You must be signed in to change notification settings - Fork 40.5k
A new controller adds/removes finalizer to VAC for protection #123549
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Skipping CI for Draft Pull Request. |
Changelog suggestion (early feedback) -kube-controller-manager adds a new controller named volumeattributesclass-protection-controller which adds/removes finalizer to VAC for protection.
+Added a new controller, volumeattributesclass-protection-controller, into the kube-controller-manager.
+The new controller manages a protective finalizer on VolumeAttributesClass objects. |
d26fffc
to
6f04107
Compare
6f04107
to
8eecd8b
Compare
9da1a23
to
66de684
Compare
/cc @mikedanese |
2969147
to
fbd3650
Compare
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/controller_policy.go
Outdated
Show resolved
Hide resolved
Rules: []rbacv1.PolicyRule{ | ||
rbacv1helpers.NewRule("list", "watch", "get").Groups(legacyGroup).Resources("persistentvolumeclaims").RuleOrDie(), | ||
rbacv1helpers.NewRule("list", "watch", "get").Groups(legacyGroup).Resources("persistentvolumes").RuleOrDie(), | ||
rbacv1helpers.NewRule("get", "list", "watch", "update").Groups(storageGroup).Resources("volumeattributesclasses").RuleOrDie(), |
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.
is this going to use update or patch to remove the finalizer?
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.
Yep, it follows the same pattern as pvcprotection and pvprotection.
- https://github.com/carlory/kubernetes/blob/kep-3751-finalizer/pkg/controller/volume/pvprotection/pv_protection_controller.go#L176
- https://github.com/carlory/kubernetes/blob/kep-3751-finalizer/pkg/controller/volume/pvcprotection/pvc_protection_controller.go#L206
/cc @msau42
Should I use a patch instead of an update in this PR?
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.
/hold cancel
we discussed this at sig storage triage today. “Patch” is usually recommended, but “update” is fine here
/cc @liggitt
…protection-controller which adds/removes finalizer to VAC for protection
fbd3650
to
a9de9a3
Compare
/test pull-kubernetes-e2e-storage-kind-alpha-beta-features |
/test pull-kubernetes-node-e2e-containerd |
need to bump e2e hostpath manifests to fix csi bug /test pull-kubernetes-e2e-storage-kind-alpha-beta-features |
/test pull-kubernetes-e2e-storage-kind-alpha-beta-features |
/test pull-kubernetes-e2e-storage-kind-alpha-beta-features |
controllerContext.ClientBuilder.ClientOrDie("volumeattributesclass-protection-controller"), | ||
controllerContext.InformerFactory.Core().V1().PersistentVolumeClaims(), | ||
controllerContext.InformerFactory.Core().V1().PersistentVolumes(), | ||
controllerContext.InformerFactory.Storage().V1beta1().VolumeAttributesClasses(), |
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.
Does the controller only start when the feature gate is enabled? Because the beta API is optional, I believe if you start the informer and the API is not installed, then there will be lots of error messages.
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.
Does the controller only start when the feature gate is enabled?
@msau42 Yes, it is.
// StartController starts a controller with a specified ControllerContext
// and performs required pre- and post- checks/actions
func StartController(ctx context.Context, controllerCtx ControllerContext, controllerDescriptor *ControllerDescriptor,
unsecuredMux *mux.PathRecorderMux) (healthz.HealthChecker, error) {
logger := klog.FromContext(ctx)
controllerName := controllerDescriptor.Name()
for _, featureGate := range controllerDescriptor.GetRequiredFeatureGates() {
if !utilfeature.DefaultFeatureGate.Enabled(featureGate) {
logger.Info("Controller is disabled by a feature gate", "controller", controllerName, "requiredFeatureGates", controllerDescriptor.GetRequiredFeatureGates())
return nil, nil
}
}
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.
the controller is gated with features.VolumeAttributesClass
in its controller descriptor.
requiredFeatureGates: []featuregate.Feature{
features.VolumeAttributesClass,
},
/lgtm |
LGTM label has been added. Git tree hash: 862a796a3c13e5479a4b5f5b8b9a55ff7daaf025
|
It looks good. Remember that this will be suffer from cache lag, so it's a "usually correct and helpful" versus "security/correctness requirement we can rely upon". /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: carlory, deads2k, msau42 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #119298
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: