Exemplo n.º 1
0
  Kubernetes REST API:
  %[1]s [OPTIONS] get|list|create|delete|update <%[2]s>[/<id>]

  Manage replication controllers:
  %[1]s [OPTIONS] stop|rm|rollingupdate <controller>
  %[1]s [OPTIONS] run <image> <replicas> <controller>
  %[1]s [OPTIONS] resize <controller> <replicas>
`, name, prettyWireStorage())
}

var parser = kubecfg.NewParser(map[string]interface{}{
	"pods":                    api.Pod{},
	"services":                api.Service{},
	"replicationControllers":  api.ReplicationController{},
	"minions":                 api.Minion{},
	"builds":                  buildapi.Build{},
	"buildConfigs":            buildapi.BuildConfig{},
	"images":                  imageapi.Image{},
	"imageRepositories":       imageapi.ImageRepository{},
	"imageRepositoryMappings": imageapi.ImageRepositoryMapping{},
})

func prettyWireStorage() string {
	types := parser.SupportedWireStorage()
	sort.Strings(types)
	return strings.Join(types, "|")
}

// readConfig reads and parses pod, replicationController, and service
// configuration files. If any errors log and exit non-zero.
func (c *KubeConfig) readConfig(storage string) []byte {
Exemplo n.º 2
0
	nsFile        = flag.String("ns_file", os.Getenv("HOME")+"/.kubernetes_ns", "Path to the namespace file")
)

func init() {
	flag.StringVar(&clientConfig.Host, "h", "", "The host to connect to.")
	flag.StringVar(&clientConfig.Version, "api_version", latest.Version, "The version of the API to use against this server.")
	flag.StringVar(&clientConfig.CAFile, "certificate_authority", "", "Path to a cert. file for the certificate authority")
	flag.StringVar(&clientConfig.CertFile, "client_certificate", "", "Path to a client certificate for TLS.")
	flag.StringVar(&clientConfig.KeyFile, "client_key", "", "Path to a client key file for TLS.")
	flag.BoolVar(&clientConfig.Insecure, "insecure_skip_tls_verify", clientConfig.Insecure, "If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.")
}

var parser = kubecfg.NewParser(map[string]runtime.Object{
	"pods":                   &api.Pod{},
	"services":               &api.Service{},
	"replicationControllers": &api.ReplicationController{},
	"minions":                &api.Node{},
	"nodes":                  &api.Node{},
	"events":                 &api.Event{},
})

func usage() {
	fmt.Fprintf(os.Stderr, `Usage: kubecfg -h [-c config/file.json|url|-] <method>

Kubernetes REST API:

  kubecfg [OPTIONS] get|list|create|delete|update <%s>[/<id>]

Manage replication controllers:

  kubecfg [OPTIONS] stop|rm <controller>
  kubecfg [OPTIONS] [-u <time>] [-image <image>] rollingupdate <controller>
Exemplo n.º 3
0
	portSpec      = flag.String("p", "", "The port spec, comma-separated list of <external>:<internal>,...")
	servicePort   = flag.Int("s", -1, "If positive, create and run a corresponding service on this port, only used with 'run'")
	authConfig    = flag.String("auth", os.Getenv("HOME")+"/.kubernetes_auth", "Path to the auth info file.  If missing, prompt the user.  Only used if doing https.")
	json          = flag.Bool("json", false, "If true, print raw JSON for responses")
	yaml          = flag.Bool("yaml", false, "If true, print raw YAML for responses")
	verbose       = flag.Bool("verbose", false, "If true, print extra information")
	proxy         = flag.Bool("proxy", false, "If true, run a proxy to the api server")
	www           = flag.String("www", "", "If -proxy is true, use this directory to serve static files")
	templateFile  = flag.String("template_file", "", "If present, load this file as a golang template and use it for output printing")
	templateStr   = flag.String("template", "", "If present, parse this string as a golang template and use it for output printing")
	imageName     = flag.String("image", "", "Image used when updating a replicationController.  Will apply to the first container in the pod template.")
)

var parser = kubecfg.NewParser(map[string]interface{}{
	"pods":                   api.Pod{},
	"services":               api.Service{},
	"replicationControllers": api.ReplicationController{},
	"minions":                api.Minion{},
})

func usage() {
	fmt.Fprintf(os.Stderr, `Usage: kubecfg -h [-c config/file.json] <method>

Kubernetes REST API:

  kubecfg [OPTIONS] get|list|create|delete|update <%s>[/<id>]

Manage replication controllers:

  kubecfg [OPTIONS] stop|rm <controller>
  kubecfg [OPTIONS] [-u <time>] [-image <image>] rollingupdate <controller>
  kubecfg [OPTIONS] resize <controller> <replicas>