From ef9a4ae3e6d173bc3a615271f6d130d927c6a378 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Tue, 26 Feb 2019 01:29:46 -0800 Subject: [PATCH] Update Kubernetes client libraries to 1.13.0 (#687) Signed-off-by: Tamal Saha --- backup.go | 4 ++-- check.go | 2 +- forget.go | 2 +- recover.go | 2 +- root.go | 6 +++--- run.go | 2 +- scaledown.go | 2 +- server/start.go | 17 +++++++++++------ snapshot.go | 2 +- 9 files changed, 22 insertions(+), 17 deletions(-) diff --git a/backup.go b/backup.go index a6d8da7a6..81dc059d1 100644 --- a/backup.go +++ b/backup.go @@ -7,8 +7,6 @@ import ( "github.com/appscode/go/log" v "github.com/appscode/go/version" - "github.com/appscode/kutil/meta" - "github.com/appscode/kutil/tools/cli" api "github.com/appscode/stash/apis/stash/v1alpha1" cs "github.com/appscode/stash/client/clientset/versioned" "github.com/appscode/stash/pkg/backup" @@ -18,6 +16,8 @@ import ( "github.com/spf13/cobra" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" + "kmodules.xyz/client-go/meta" + "kmodules.xyz/client-go/tools/cli" ) func NewCmdBackup() *cobra.Command { diff --git a/check.go b/check.go index 0d40c8b06..512be7668 100644 --- a/check.go +++ b/check.go @@ -2,12 +2,12 @@ package cmds import ( "github.com/appscode/go/log" - "github.com/appscode/kutil/meta" cs "github.com/appscode/stash/client/clientset/versioned/typed/stash/v1alpha1" "github.com/appscode/stash/pkg/check" "github.com/spf13/cobra" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" + "kmodules.xyz/client-go/meta" ) func NewCmdCheck() *cobra.Command { diff --git a/forget.go b/forget.go index a023e5d80..6a74a9845 100644 --- a/forget.go +++ b/forget.go @@ -3,12 +3,12 @@ package cmds import ( "fmt" - "github.com/appscode/kutil/meta" cs "github.com/appscode/stash/client/clientset/versioned/typed/stash/v1alpha1" "github.com/appscode/stash/pkg/registry/snapshot" "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/clientcmd" + "kmodules.xyz/client-go/meta" ) func NewCmdForget() *cobra.Command { diff --git a/recover.go b/recover.go index 07e00e0fa..7382b8e2c 100644 --- a/recover.go +++ b/recover.go @@ -4,12 +4,12 @@ import ( "time" "github.com/appscode/go/log" - "github.com/appscode/kutil/meta" cs "github.com/appscode/stash/client/clientset/versioned/typed/stash/v1alpha1" "github.com/appscode/stash/pkg/recovery" "github.com/spf13/cobra" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" + "kmodules.xyz/client-go/meta" ) func NewCmdRecover() *cobra.Command { diff --git a/root.go b/root.go index 889881927..7336cfff7 100644 --- a/root.go +++ b/root.go @@ -7,7 +7,6 @@ import ( "github.com/appscode/go/flags" "github.com/appscode/go/log/golog" v "github.com/appscode/go/version" - "github.com/appscode/kutil/tools/cli" "github.com/appscode/stash/apis" "github.com/appscode/stash/client/clientset/versioned/scheme" "github.com/appscode/stash/pkg/util" @@ -15,6 +14,8 @@ import ( genericapiserver "k8s.io/apiserver/pkg/server" clientsetscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/kubernetes/pkg/api/legacyscheme" + "kmodules.xyz/client-go/logs" + "kmodules.xyz/client-go/tools/cli" ) func NewRootCmd() *cobra.Command { @@ -33,8 +34,7 @@ func NewRootCmd() *cobra.Command { }, } rootCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine) - // ref: https://github.com/kubernetes/kubernetes/issues/17162#issuecomment-225596212 - flag.CommandLine.Parse([]string{}) + logs.ParseFlags() rootCmd.PersistentFlags().StringVar(&util.ServiceName, "service-name", "stash-operator", "Stash service name.") rootCmd.PersistentFlags().BoolVar(&cli.EnableAnalytics, "enable-analytics", cli.EnableAnalytics, "Send analytical events to Google Analytics") rootCmd.PersistentFlags().BoolVar(&apis.EnableStatusSubresource, "enable-status-subresource", apis.EnableStatusSubresource, "If true, uses sub resource for crds.") diff --git a/run.go b/run.go index 0ebc38282..15f485ac7 100644 --- a/run.go +++ b/run.go @@ -5,9 +5,9 @@ import ( "github.com/appscode/go/log" v "github.com/appscode/go/version" - "github.com/appscode/kutil/tools/cli" "github.com/appscode/stash/pkg/cmds/server" "github.com/spf13/cobra" + "kmodules.xyz/client-go/tools/cli" ) func NewCmdRun(out, errOut io.Writer, stopCh <-chan struct{}) *cobra.Command { diff --git a/scaledown.go b/scaledown.go index b1c5b8b17..287f929e7 100644 --- a/scaledown.go +++ b/scaledown.go @@ -2,11 +2,11 @@ package cmds import ( "github.com/appscode/go/log" - "github.com/appscode/kutil/meta" "github.com/appscode/stash/pkg/scale" "github.com/spf13/cobra" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" + "kmodules.xyz/client-go/meta" ) func NewCmdScaleDown() *cobra.Command { diff --git a/server/start.go b/server/start.go index c791b92cf..1b5896847 100644 --- a/server/start.go +++ b/server/start.go @@ -5,7 +5,6 @@ import ( "io" "net" - "github.com/appscode/kutil/tools/clientcmd" "github.com/appscode/stash/apis/repositories/v1alpha1" "github.com/appscode/stash/pkg/controller" "github.com/appscode/stash/pkg/server" @@ -14,6 +13,8 @@ import ( openapinamer "k8s.io/apiserver/pkg/endpoints/openapi" genericapiserver "k8s.io/apiserver/pkg/server" genericoptions "k8s.io/apiserver/pkg/server/options" + "kmodules.xyz/client-go/meta" + "kmodules.xyz/client-go/tools/clientcmd" ) const defaultEtcdPathPrefix = "/registry/stash.appscode.com" @@ -29,10 +30,14 @@ type StashOptions struct { func NewStashOptions(out, errOut io.Writer) *StashOptions { o := &StashOptions{ // TODO we will nil out the etcd storage options. This requires a later level of k8s.io/apiserver - RecommendedOptions: genericoptions.NewRecommendedOptions(defaultEtcdPathPrefix, server.Codecs.LegacyCodec(admissionv1beta1.SchemeGroupVersion)), - ExtraOptions: NewExtraOptions(), - StdOut: out, - StdErr: errOut, + RecommendedOptions: genericoptions.NewRecommendedOptions( + defaultEtcdPathPrefix, + server.Codecs.LegacyCodec(admissionv1beta1.SchemeGroupVersion), + genericoptions.NewProcessInfo("stash-operator", meta.Namespace()), + ), + ExtraOptions: NewExtraOptions(), + StdOut: out, + StdErr: errOut, } o.RecommendedOptions.Etcd = nil o.RecommendedOptions.Admission = nil @@ -67,7 +72,7 @@ func (o StashOptions) Config() (*server.StashConfig, error) { clientcmd.Fix(serverConfig.ClientConfig) serverConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(v1alpha1.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(server.Scheme)) - serverConfig.OpenAPIConfig.Info.Title = "stash-server" + serverConfig.OpenAPIConfig.Info.Title = "stash-operator" serverConfig.OpenAPIConfig.Info.Version = v1alpha1.SchemeGroupVersion.Version serverConfig.OpenAPIConfig.IgnorePrefixes = []string{ "/swaggerapi", diff --git a/snapshot.go b/snapshot.go index d56309e6a..ff49cfd25 100644 --- a/snapshot.go +++ b/snapshot.go @@ -4,12 +4,12 @@ import ( "encoding/json" "fmt" - "github.com/appscode/kutil/meta" cs "github.com/appscode/stash/client/clientset/versioned/typed/stash/v1alpha1" "github.com/appscode/stash/pkg/registry/snapshot" "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/clientcmd" + "kmodules.xyz/client-go/meta" ) func NewCmdSnapshots() *cobra.Command {