@@ -8,12 +8,12 @@ import (
8
8
"github.com/appscode/go/log"
9
9
stringz "github.com/appscode/go/strings"
10
10
v "github.com/appscode/go/version"
11
+ "github.com/appscode/kutil/discovery"
11
12
"github.com/appscode/pat"
12
13
api "github.com/appscode/stash/apis/stash"
13
14
cs "github.com/appscode/stash/client/typed/stash/v1alpha1"
14
15
"github.com/appscode/stash/pkg/controller"
15
16
"github.com/appscode/stash/pkg/docker"
16
- "github.com/hashicorp/go-version"
17
17
"github.com/prometheus/client_golang/prometheus/promhttp"
18
18
"github.com/spf13/cobra"
19
19
crd_cs "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1"
@@ -49,15 +49,10 @@ func NewCmdRun() *cobra.Command {
49
49
crdClient := crd_cs .NewForConfigOrDie (config )
50
50
51
51
// get kube api server version
52
- info , err := kubeClient .Discovery (). ServerVersion ( )
52
+ opts . KubectlImageTag , err = discovery . GetBaseVersion ( kubeClient .Discovery ())
53
53
if err != nil {
54
- log .Fatalf ("Error getting server version, reason: %s\n " , err )
54
+ log .Fatalf ("Failed to detect server version, reason: %s\n " , err )
55
55
}
56
- gv , err := version .NewVersion (info .GitVersion )
57
- if err != nil {
58
- log .Fatalf ("Failed to parse server version, reason: %s\n " , err )
59
- }
60
- opts .KubectlImageTag = gv .ToMutator ().ResetMetadata ().ResetPrerelease ().ResetPatch ().String ()
61
56
62
57
ctrl := controller .New (kubeClient , crdClient , stashClient , opts )
63
58
err = ctrl .Setup ()
0 commit comments