backup: ignore not found in delete
@@ -252,8 +252,10 @@ func DeleteBackupReplicaSetAndService(kubecli *unversioned.Client, clusterName,
name := MakeBackupName(clusterName)
err := kubecli.Services(ns).Delete(name)
if err != nil {
+ if !IsKubernetesResourceNotFoundError(err) {
return err
}
+ }
orphanOption := false
gracePeriod := int64(0)
err = kubecli.ReplicaSets(ns).Delete(name, &api.DeleteOptions{
@@ -261,13 +263,19 @@ func DeleteBackupReplicaSetAndService(kubecli *unversioned.Client, clusterName,
GracePeriodSeconds: &gracePeriod,
})
if err != nil {
+ if !IsKubernetesResourceNotFoundError(err) {
return err
}
+ }
return nil
}
func DeletePVC(kubecli *unversioned.Client, clusterName, ns string) error {
- return kubecli.PersistentVolumeClaims(ns).Delete(makePVCName(clusterName))
+ err := kubecli.PersistentVolumeClaims(ns).Delete(makePVCName(clusterName))
+ if !IsKubernetesResourceNotFoundError(err) {
+ return err
+ }
+ return nil
}
func CopyVolume(kubecli *unversioned.Client, fromClusterName, toClusterName, ns string) error {
