mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-08 06:15:40 +00:00
disable GC and backup deletion if Kubernetes is less than v1.7.5
Signed-off-by: Steve Kriss <steve@heptio.com>
This commit is contained in:
@@ -20,11 +20,14 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
api "github.com/heptio/ark/pkg/apis/ark/v1"
|
||||
"github.com/heptio/ark/pkg/client"
|
||||
"github.com/heptio/ark/pkg/cmd"
|
||||
"github.com/heptio/ark/pkg/controller"
|
||||
kubeutil "github.com/heptio/ark/pkg/util/kube"
|
||||
)
|
||||
|
||||
func NewDeleteCommand(f client.Factory, use string) *cobra.Command {
|
||||
@@ -37,6 +40,16 @@ func NewDeleteCommand(f client.Factory, use string) *cobra.Command {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
kubeClient, err := f.KubeClient()
|
||||
cmd.CheckError(err)
|
||||
|
||||
serverVersion, err := kubeutil.ServerVersion(kubeClient.Discovery())
|
||||
cmd.CheckError(err)
|
||||
|
||||
if !serverVersion.AtLeast(controller.MinVersionForDelete) {
|
||||
cmd.CheckError(errors.Errorf("this command requires the Kubernetes server version to be at least %s", controller.MinVersionForDelete))
|
||||
}
|
||||
|
||||
arkClient, err := f.Client()
|
||||
cmd.CheckError(err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user