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

docs(changelog): changelog for v1.10.0-RC1 #88

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
v1.10.0-RC1 / 2020-05-13
========================
* Adding support to restore remote backup in different namespace ([#72](https://github.com/openebs/velero-plugin/pull/72),[@mynktl](https://github.com/mynktl))
* Adding support for multiple s3 profile to backup cstor volumes to different s3 location ([#76](https://github.com/openebs/velero-plugin/pull/76),[@mynktl](https://github.com/mynktl))
* Fixing failure restic backup of cstor volumes, restored by velero-plugin [issue:84](https://github.com/openebs/velero-plugin/issues/84) ([#85](https://github.com/openebs/velero-plugin/pull/85),[@mynktl](https://github.com/mynktl))
* Fixed panic, created because of empty snapshotID, while deleting failed backup ([#79](https://github.com/openebs/velero-plugin/pull/79),[@mynktl](https://github.com/mynktl))



1.9.0 / 2020-04-14
========================
* ARM build for velero-plugin, ARM image is published under openebs/velero-plugin-arm64 ([#61](https://github.com/openebs/velero-plugin/pull/61),[@akhilerm](https://github.com/akhilerm))
Expand Down
1 change: 1 addition & 0 deletions changelogs/released/v1.10.0-RC1/85-mynktl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixing failure restic backup of cstor volumes, restored by velero-plugin [issue:84](https://github.com/openebs/velero-plugin/issues/84)
42 changes: 41 additions & 1 deletion pkg/cstor/pvc_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"encoding/json"
"time"

v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1"
velero "github.com/openebs/velero-plugin/pkg/velero"
"github.com/pkg/errors"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -117,7 +118,9 @@ func (p *Plugin) createPVC(volumeID, snapName string) (*Volume, error) {
p.Log.Infof("Creating PVC for volumeID:%s snapshot:%s in namespace=%s", volumeID, snapName, targetedNs)

pvc.Annotations = make(map[string]string)
pvc.Annotations["openebs.io/created-through"] = "restore"
// Add annotation PVCreatedByKey, with value 'restore' to PVC
// So that Maya-APIServer skip updating target IPAddress in CVR
pvc.Annotations[v1alpha1.PVCreatedByKey] = "restore"
rpvc, err := p.K8sClient.
CoreV1().
PersistentVolumeClaims(pvc.Namespace).
Expand Down Expand Up @@ -162,6 +165,15 @@ func (p *Plugin) createPVC(volumeID, snapName string) (*Volume, error) {
if err = p.waitForAllCVR(vol); err != nil {
return nil, err
}

// CVRs are created and updated, now we can remove the annotation 'PVCreatedByKey' from PVC
if err = p.removePVCAnnotationKey(pvc, v1alpha1.PVCreatedByKey); err != nil {
p.Log.Warningf("Failed to remove restore annotation from PVC=%s/%s err=%s", pvc.Namespace, pvc.Name, err)
return nil, errors.Wrapf(err,
"failed to clear restore-annotation=%s from PVC=%s/%s",
v1alpha1.PVCreatedByKey, pvc.Namespace, pvc.Name,
)
}
return vol, nil
}

Expand Down Expand Up @@ -224,6 +236,17 @@ func (p *Plugin) getVolumeFromPVC(pvc v1.PersistentVolumeClaim) (*Volume, error)
if err = p.waitForAllCVR(vol); err != nil {
return nil, errors.Wrapf(err, "cvr not ready")
}

// remove the annotation 'PVCreatedByKey' from PVC
// There might be chances of stale PVCreatedByKey annotation in PVC
if err = p.removePVCAnnotationKey(rpvc, v1alpha1.PVCreatedByKey); err != nil {
p.Log.Warningf("Failed to remove restore annotation from PVC=%s/%s err=%s", rpvc.Namespace, rpvc.Name, err)
return nil, errors.Wrapf(err,
"failed to clear restore-annotation=%s from PVC=%s/%s",
v1alpha1.PVCreatedByKey, rpvc.Namespace, rpvc.Name,
)
}

return vol, nil
}

Expand All @@ -243,3 +266,20 @@ func (p *Plugin) downloadPVC(volumeID, snapName string) (*v1.PersistentVolumeCla

return pvc, nil
}

// removePVCAnnotationKey remove the given annotation key from the PVC and update it
func (p *Plugin) removePVCAnnotationKey(pvc *v1.PersistentVolumeClaim, annotationKey string) error {
var err error

if pvc.Annotations == nil {
return nil
}

delete(pvc.Annotations, annotationKey)

_, err = p.K8sClient.
CoreV1().
PersistentVolumeClaims(pvc.Namespace).
Update(pvc)
return err
}