-
Notifications
You must be signed in to change notification settings - Fork 360
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
fix for synced pvs and retain SC #1723
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,13 @@ func (s *persistentVolumeSyncer) translateUpdate(ctx context.Context, vPv *corev | |
updated.Spec.Capacity = vPv.Spec.Capacity | ||
} | ||
|
||
if !s.useFakePersistentVolumes && vPv.Spec.ClaimRef == nil { | ||
// if the virtual claimref is removed, we should also remove it in the | ||
// updated | ||
updated = translator.NewIfNil(updated, pPv) | ||
updated.Spec.ClaimRef = nil | ||
} | ||
|
||
if !equality.Semantic.DeepEqual(pPv.Spec.AccessModes, vPv.Spec.AccessModes) { | ||
updated = translator.NewIfNil(updated, pPv) | ||
updated.Spec.AccessModes = vPv.Spec.AccessModes | ||
|
@@ -124,6 +131,10 @@ func (s *persistentVolumeSyncer) translateUpdate(ctx context.Context, vPv *corev | |
} | ||
|
||
translatedStorageClassName := translateStorageClass(vPv.Spec.StorageClassName) | ||
if !s.useFakePersistentVolumes { | ||
translatedStorageClassName = vPv.Spec.StorageClassName | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because if we use real persistent volumes, they need to reference the proper storage class, for some reasons the storage class was updated to something different than the one at creation time when the persistent volume was updated |
||
} | ||
|
||
if !equality.Semantic.DeepEqual(pPv.Spec.StorageClassName, translatedStorageClassName) { | ||
updated = translator.NewIfNil(updated, pPv) | ||
updated.Spec.StorageClassName = translatedStorageClassName | ||
|
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.
Shouldn't we validate here that the ClaimRef.Namespace actually matches the namespace we are working in as vCluster?
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.
e.g. this could cause problematic errors if we cannot list in that namespace, which would make everything fail as a non not found error is thrown
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.
but isn't that what we want though? if the pv has a claimref with a pvc that we don't have access to, we don't own the pv