Skip to content

Commit

Permalink
Merge pull request #499 from deepakkinni/xport-3
Browse files Browse the repository at this point in the history
[Cherry-pick] Remove health annotation from PVC (#498) and Update doc for 1.4.1 (#496)
  • Loading branch information
Deepak Kinni authored Nov 18, 2022
2 parents 795eaec + 7007cb5 commit 41c2384
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/vanilla.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

| Velero Plugin for vSphere Version | vSphere Version | Kubernetes Version | vSphere CSI Driver Version | Velero Version | Deprecated | EOL Date |
|-----------------------------------|------------------------|--------------------|-----------------------------------|----------------|------------|---------------|
| 1.4.0 | 6.7U3 P06 - 7.0U3 | 1.20-1.23 | 2.2.2, 2.3.1, 2.4.1, 2.5.1, 2.6.1 | 1.8.1 | No | N/A
| 1.4.1 | 8.0 | 1.24-1.25 | 2.7.0 | 1.9.2 | No | N/A |
| 1.4.0 | 6.7U3 P06 - 7.0U3 | 1.20-1.23 | 2.2.2, 2.3.1, 2.4.1, 2.5.1, 2.6.1 | 1.8.1 | No | N/A |
| 1.3.1 | 6.7U3 P06 - 7.0U3 | 1.19-1.22 | 2.2.2, 2.3.1, 2.4.1 | 1.7.0 | No | N/A |
| 1.3.0 | 6.7U3 P06 - 7.0U3 | 1.19-1.22 | 2.2.2, 2.3.1, 2.4.1 | 1.7.0 | Yes | December 2022 |
| 1.2.1 | 6.7U3 P06 - 7.0U2 | 1.19-1.21 | 2.1.2, 2.2.2, 2.3.1 | 1.5.1 | Yes | June 2023 |
Expand Down
20 changes: 18 additions & 2 deletions pkg/plugin/restore_pvc_action_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,28 @@ func (p *NewPVCRestoreItemAction) Execute(input *velero.RestoreItemActionExecute
return nil, errors.WithStack(err)
}

// Remove the volume health annotations before the restore
// because vSphere CSI driver has a webhook that prevents this annotation
// from being created/updated by a non-CSI driver system service account
healthAnnotations := []string{constants.AnnVolumeHealth, constants.AnnVolumeHealthTS}
pluginItem.RemoveAnnotations(&pvc.ObjectMeta, healthAnnotations)

// Update item with the PVC without the volume health annotations
// so that Velero can create a PVC without being rejected by the
// vSphere CSI driver webhook in the case of Skipping PVCRestoreItemAction
pvcMap, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&pvc)
if err != nil {
p.Log.Errorf("Error converting the pvc %s/%s to unstructured. Error: %v", pvc.Namespace, pvc.Name, err)
return nil, errors.WithStack(err)
}
item = &unstructured.Unstructured{Object: pvcMap}

// exit early if the RestorePVs option is disabled
p.Log.Info("Checking if the RestorePVs option is disabled in the Restore Spec")
if input.Restore.Spec.RestorePVs != nil && *input.Restore.Spec.RestorePVs == false {
p.Log.Infof("Skipping PVCRestoreItemAction for PVC %s/%s since the RestorePVs option is disabled in the Restore Spec.", pvc.Namespace, pvc.Name)
return &velero.RestoreItemActionExecuteOutput{
UpdatedItem: input.Item,
UpdatedItem: item,
}, nil
}

Expand Down Expand Up @@ -152,7 +168,7 @@ func (p *NewPVCRestoreItemAction) Execute(input *velero.RestoreItemActionExecute
// Skip PVCRestoreItemAction for PVC creation
// as it already exists
return &velero.RestoreItemActionExecuteOutput{
UpdatedItem: input.Item,
UpdatedItem: item,
}, nil
} // else, go ahead to create a new PVC

Expand Down

0 comments on commit 41c2384

Please sign in to comment.