Exemplo n.º 1
0
func RunVersion(f *Factory, out io.Writer, cmd *cobra.Command) error {
	if util.GetFlagBool(cmd, "client") {
		kubectl.GetClientVersion(out)
		return nil
	}

	client, err := f.Client()
	if err != nil {
		return err
	}

	kubectl.GetVersion(out, client)
	return nil
}
Exemplo n.º 2
0
func NewCmdVersion(out io.Writer) *cobra.Command {
	cmd := &cobra.Command{
		Use:   "version",
		Short: "Print version of client and server",
		Run: func(cmd *cobra.Command, args []string) {
			if GetFlagBool(cmd, "client") {
				kubectl.GetClientVersion(out)
			} else {
				kubectl.GetVersion(out, getKubeClient(cmd))
			}
		},
	}
	cmd.Flags().BoolP("client", "c", false, "Client version only (no server required)")
	return cmd
}
Exemplo n.º 3
0
func (f *Factory) NewCmdVersion(out io.Writer) *cobra.Command {
	cmd := &cobra.Command{
		Use:   "version",
		Short: "Print version of client and server",
		Run: func(cmd *cobra.Command, args []string) {
			if GetFlagBool(cmd, "client") {
				kubectl.GetClientVersion(out)
				return
			}

			client, err := f.Client(cmd)
			checkErr(err)

			kubectl.GetVersion(out, client)
		},
	}
	cmd.Flags().BoolP("client", "c", false, "Client version only (no server required)")
	return cmd
}