-
Notifications
You must be signed in to change notification settings - Fork 13
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
Refuse to modify PVCs/PVs with a VAC associated #28
Conversation
Works on live cluster:
|
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.
Left one more error message suggestion but LGTM.
Currently testing that no issues will come from modifying via annotation, then VAC, but that test will take 5 more hours... (Out of scope for this PR, but in scope for new release of sidecar)
Thanks!
pkg/controller/controller.go
Outdated
@@ -261,6 +261,14 @@ func (c *modifyController) modifyPVC(pv *v1.PersistentVolume, pvc *v1.Persistent | |||
c.addPVCToInProgressList(pvc.Name) | |||
defer c.removePVCFromInProgressList(pvc.Name) | |||
|
|||
if pvc.Spec.VolumeAttributesClassName != nil && *pvc.Spec.VolumeAttributesClassName != "" { | |||
c.eventRecorder.Eventf(pvc, v1.EventTypeWarning, VolumeModificationFailed, "Refusing to modify %s because PVC %s has a VAC associated", pv.Name, pvc.Name) |
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.
For increased clarity, consider adding 'via PVC annotation': "Refusing to modify %s because PVC %s has a VAC associated" -> "Refusing to modify %s via PVC annotation because PVC %s has a VAC associated"
Similar change for lines 265, 266, 268, 269.
I'm expecting some poor souls to forget there are two different ways to modify a volume.
Signed-off-by: Connor Catlett <[email protected]>
Signed-off-by: Connor Catlett <[email protected]>
a802a74
to
d7fc875
Compare
/approve |
Issue #, if available:
N/A
Description of changes:
Refuses to modify volumes with a VAC associated, thus preventing multiple modifiers fighting over the same volume. We do not intend to support modifying volumes that are VAC-managed with
volume-modifier-for-k8s
.(Also bumps all the dependencies which was needed to get the
VolumeAttributesClassName
field available inclient-go
)By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.