Skip to content

Commit

Permalink
Only watch apps/v1beta1 Deployment (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha authored Oct 7, 2017
1 parent 4f92ca6 commit b3ee076
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b3ee076

Please sign in to comment.