2014-10-06 01:24:19 +00:00
|
|
|
/*
|
|
|
|
Copyright 2014 Google Inc. All rights reserved.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
|
2014-12-17 13:03:03 +00:00
|
|
|
cmdconfig "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/config"
|
2015-02-05 00:14:48 +00:00
|
|
|
cmdutil "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util"
|
2015-03-27 23:24:59 +00:00
|
|
|
"github.com/golang/glog"
|
2014-11-17 18:29:45 +00:00
|
|
|
|
2014-10-06 01:24:19 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2014-12-28 05:27:52 +00:00
|
|
|
// NewKubectlCommand creates the `kubectl` command and its nested children.
|
2015-04-07 18:21:25 +00:00
|
|
|
func NewKubectlCommand(f *cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Command {
|
2014-10-06 01:24:19 +00:00
|
|
|
// Parent command to which all subcommands are added.
|
|
|
|
cmds := &cobra.Command{
|
|
|
|
Use: "kubectl",
|
|
|
|
Short: "kubectl controls the Kubernetes cluster manager",
|
|
|
|
Long: `kubectl controls the Kubernetes cluster manager.
|
|
|
|
|
|
|
|
Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`,
|
|
|
|
Run: runHelp,
|
|
|
|
}
|
|
|
|
|
2014-12-28 05:27:52 +00:00
|
|
|
f.BindFlags(cmds.PersistentFlags())
|
2014-10-06 01:24:19 +00:00
|
|
|
|
2015-04-07 18:21:25 +00:00
|
|
|
cmds.AddCommand(NewCmdGet(f, out))
|
|
|
|
cmds.AddCommand(NewCmdDescribe(f, out))
|
|
|
|
cmds.AddCommand(NewCmdCreate(f, out))
|
|
|
|
cmds.AddCommand(NewCmdUpdate(f, out))
|
|
|
|
cmds.AddCommand(NewCmdDelete(f, out))
|
2014-10-27 02:21:31 +00:00
|
|
|
|
2014-10-21 18:11:53 +00:00
|
|
|
cmds.AddCommand(NewCmdNamespace(out))
|
2015-04-07 18:21:25 +00:00
|
|
|
cmds.AddCommand(NewCmdLog(f, out))
|
|
|
|
cmds.AddCommand(NewCmdRollingUpdate(f, out))
|
|
|
|
cmds.AddCommand(NewCmdResize(f, out))
|
2014-10-06 01:24:19 +00:00
|
|
|
|
2015-04-07 18:21:25 +00:00
|
|
|
cmds.AddCommand(NewCmdExec(f, in, out, err))
|
|
|
|
cmds.AddCommand(NewCmdPortForward(f))
|
|
|
|
cmds.AddCommand(NewCmdProxy(f, out))
|
2015-01-08 20:41:38 +00:00
|
|
|
|
2015-04-07 18:21:25 +00:00
|
|
|
cmds.AddCommand(NewCmdRunContainer(f, out))
|
|
|
|
cmds.AddCommand(NewCmdStop(f, out))
|
|
|
|
cmds.AddCommand(NewCmdExposeService(f, out))
|
2015-01-12 23:30:52 +00:00
|
|
|
|
2015-04-07 18:21:25 +00:00
|
|
|
cmds.AddCommand(NewCmdLabel(f, out))
|
2015-03-26 03:00:12 +00:00
|
|
|
|
2015-04-08 14:32:32 +00:00
|
|
|
cmds.AddCommand(cmdconfig.NewCmdConfig(cmdconfig.NewDefaultPathOptions(), out))
|
2015-04-07 18:21:25 +00:00
|
|
|
cmds.AddCommand(NewCmdClusterInfo(f, out))
|
|
|
|
cmds.AddCommand(NewCmdApiVersions(f, out))
|
|
|
|
cmds.AddCommand(NewCmdVersion(f, out))
|
2015-02-07 00:33:42 +00:00
|
|
|
|
2014-12-28 05:27:52 +00:00
|
|
|
return cmds
|
2014-10-06 01:24:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func runHelp(cmd *cobra.Command, args []string) {
|
|
|
|
cmd.Help()
|
|
|
|
}
|
|
|
|
|
2015-03-27 23:24:59 +00:00
|
|
|
func printDeprecationWarning(command, alias string) {
|
|
|
|
glog.Warningf("%s is DEPRECATED and will be removed in a future version. Use %s instead.", alias, command)
|
|
|
|
}
|