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

pb-5438: Resetting the pvc.Spec.Selector in the kdmp and csi as it is dynamic provisioning. #343

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/controllers/dataexport/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,11 @@ func (c *Controller) restoreSnapshot(ctx context.Context, snapshotDriver snapsho

func (c *Controller) createPVC(dataExport *kdmpapi.DataExport) (*corev1.PersistentVolumeClaim, error) {
pvc := dataExport.Status.RestorePVC
if pvc.Spec.Selector != nil {
// Remove the labelselector, as it is a dynamic provisioning.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a case where PVC is referenced to a PV not by name and based on label selector how would this work?
Eg
PV spec

apiVersion: v1
kind: PersistentVolume
metadata:
  name: test-pv
  labels:
    volume-type: ssd

PVC spec as follows which doesn't specify volumeMount but looks for a PV to match the label selector.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: test-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  selector:
    matchLabels:
      volume-type: ssd

logrus.Infof("createPVC: dataexport %v/%v pvc.Spec.Selector: %v", dataExport.Name, dataExport.Namespace, pvc.Spec.Selector)
pvc.Spec.Selector = nil
}
newPVC, err := core.Instance().CreatePersistentVolumeClaim(pvc)
if err != nil {
if k8sErrors.IsAlreadyExists(err) {
Expand Down
Loading