forked from open-cluster-management-io/clusteradm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexec.go
35 lines (29 loc) · 894 Bytes
/
exec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright Contributors to the Open Cluster Management project
package version
import (
"fmt"
"github.com/spf13/cobra"
clusteradm "open-cluster-management.io/clusteradm"
version "open-cluster-management.io/clusteradm/pkg/helpers/version"
)
func (o *Options) complete(cmd *cobra.Command, args []string) (err error) {
return nil
}
func (o *Options) validate() error {
return nil
}
func (o *Options) run() (err error) {
fmt.Printf("client\t\tversion\t:%s\n", clusteradm.GetVersion())
discoveryClient, err := o.ClusteradmFlags.KubectlFactory.ToDiscoveryClient()
if err != nil {
return err
}
serverVersion, err := discoveryClient.ServerVersion()
if err != nil {
return err
}
fmt.Printf("server release\tversion\t:%s\n", serverVersion.GitVersion)
bundleVersion := version.GetDefaultBundleVersion()
fmt.Printf("default bundle\tversion\t:%s\n", bundleVersion)
return nil
}