mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-07-30 12:02:44 +00:00
Change errors.Cause to errors.Is, because github.com/cockroachdb/errors New() function create a error with error stack with depth 1, but github.com/pkg/errors's New() function create error with no depth. Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
23 lines
586 B
Go
23 lines
586 B
Go
package k8s
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/cockroachdb/errors"
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
)
|
|
|
|
func InstallStorageClass(ctx context.Context, yaml string) error {
|
|
fmt.Printf("Install storage class with %s.\n", yaml)
|
|
err := KubectlApplyByFile(ctx, yaml)
|
|
return err
|
|
}
|
|
|
|
func DeleteStorageClass(ctx context.Context, client TestClient, name string) error {
|
|
if err := client.ClientGo.StorageV1().StorageClasses().Delete(ctx, name, metav1.DeleteOptions{}); err != nil {
|
|
return errors.Wrapf(err, "Could not retrieve storage classes %s", name)
|
|
}
|
|
return nil
|
|
}
|