From b3ee0765add2d64198df21d9db17bd1de04c173b Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Sat, 7 Oct 2017 05:16:47 -0700 Subject: [PATCH] Only watch apps/v1beta1 Deployment (#178) --- schedule.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/schedule.go b/schedule.go index c41390a08..1e1e35e51 100644 --- a/schedule.go +++ b/schedule.go @@ -10,11 +10,9 @@ import ( "github.com/appscode/kutil" scs "github.com/appscode/stash/client/typed/stash/v1alpha1" "github.com/appscode/stash/pkg/scheduler" - "github.com/appscode/stash/pkg/util" "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clientset "k8s.io/client-go/kubernetes" - apps "k8s.io/client-go/pkg/apis/apps/v1beta1" "k8s.io/client-go/tools/clientcmd" ) @@ -63,15 +61,8 @@ func NewCmdSchedule() *cobra.Command { case "Deployments", "Deployment", "deployments", "deployment": opt.AppKind = "Deployment" opt.SmartPrefix = "" - if util.IsPreferredAPIResource(kubeClient, apps.GroupName, opt.AppKind) { - _, err := kubeClient.AppsV1beta1().Deployments(opt.Namespace).Get(opt.AppName, metav1.GetOptions{}) - if err != nil { - _, err := kubeClient.ExtensionsV1beta1().Deployments(opt.Namespace).Get(opt.AppName, metav1.GetOptions{}) - if err != nil { - log.Fatalf(`Unknown Deployment %s@%s`, opt.AppName, opt.Namespace) - } - } - } else { + _, err := kubeClient.AppsV1beta1().Deployments(opt.Namespace).Get(opt.AppName, metav1.GetOptions{}) + if err != nil { _, err := kubeClient.ExtensionsV1beta1().Deployments(opt.Namespace).Get(opt.AppName, metav1.GetOptions{}) if err != nil { log.Fatalf(`Unknown Deployment %s@%s`, opt.AppName, opt.Namespace)