mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Update bashcompletion codes for kubectl expose
This commit is contained in:
parent
84e3ee8ec4
commit
c9d34870ed
@ -314,7 +314,7 @@ __kubectl_require_pod_and_container()
|
||||
__custom_func() {
|
||||
case ${last_command} in
|
||||
kubectl_get | kubectl_describe | kubectl_delete | kubectl_label | kubectl_stop | kubectl_edit | kubectl_patch |\
|
||||
kubectl_annotate)
|
||||
kubectl_annotate | kubectl_expose)
|
||||
__kubectl_get_resource
|
||||
return
|
||||
;;
|
||||
@ -2251,7 +2251,21 @@ _kubectl_expose()
|
||||
|
||||
must_have_one_flag=()
|
||||
must_have_one_noun=()
|
||||
must_have_one_noun+=("deployment")
|
||||
must_have_one_noun+=("pod")
|
||||
must_have_one_noun+=("replicaset")
|
||||
must_have_one_noun+=("replicationcontroller")
|
||||
must_have_one_noun+=("service")
|
||||
noun_aliases=()
|
||||
noun_aliases+=("deployments")
|
||||
noun_aliases+=("po")
|
||||
noun_aliases+=("pods")
|
||||
noun_aliases+=("rc")
|
||||
noun_aliases+=("replicasets")
|
||||
noun_aliases+=("replicationcontrollers")
|
||||
noun_aliases+=("rs")
|
||||
noun_aliases+=("services")
|
||||
noun_aliases+=("svc")
|
||||
}
|
||||
|
||||
_kubectl_autoscale()
|
||||
|
@ -13,7 +13,7 @@ kubectl expose \- Take a replication controller, service, deployment or pod and
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Take a deployment, service, replica set, replication controller, or pod and expose it as a new Kubernetes service.
|
||||
Expose a resource as a new Kubernetes service.
|
||||
|
||||
.PP
|
||||
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector
|
||||
@ -23,6 +23,11 @@ i.e. when the selector contains only the matchLabels component. Note that if no
|
||||
\-\-port and the exposed resource has multiple ports, all will be re\-used by the new service. Also if no
|
||||
labels are specified, the new service will re\-use the labels from the resource it exposes.
|
||||
|
||||
.PP
|
||||
Possible resources include (case insensitive):
|
||||
pod (po), service (svc), replicationcontroller (rc),
|
||||
deployment, replicaset (rs)
|
||||
|
||||
|
||||
.SH OPTIONS
|
||||
.PP
|
||||
|
@ -39,7 +39,7 @@ Take a replication controller, service, deployment or pod and expose it as a new
|
||||
### Synopsis
|
||||
|
||||
|
||||
Take a deployment, service, replica set, replication controller, or pod and expose it as a new Kubernetes service.
|
||||
Expose a resource as a new Kubernetes service.
|
||||
|
||||
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector
|
||||
for that resource as the selector for a new service on the specified port. A deployment or replica set
|
||||
@ -48,6 +48,11 @@ i.e. when the selector contains only the matchLabels component. Note that if no
|
||||
--port and the exposed resource has multiple ports, all will be re-used by the new service. Also if no
|
||||
labels are specified, the new service will re-use the labels from the resource it exposes.
|
||||
|
||||
Possible resources include (case insensitive):
|
||||
pod (po), service (svc), replicationcontroller (rc),
|
||||
deployment, replicaset (rs)
|
||||
|
||||
|
||||
```
|
||||
kubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]
|
||||
```
|
||||
@ -138,7 +143,7 @@ kubectl expose deployment nginx --port=80 --target-port=8000
|
||||
|
||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||
|
||||
###### Auto generated by spf13/cobra on 30-Mar-2016
|
||||
###### Auto generated by spf13/cobra on 10-Apr-2016
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||
[]()
|
||||
|
@ -125,7 +125,7 @@ __kubectl_require_pod_and_container()
|
||||
__custom_func() {
|
||||
case ${last_command} in
|
||||
kubectl_get | kubectl_describe | kubectl_delete | kubectl_label | kubectl_stop | kubectl_edit | kubectl_patch |\
|
||||
kubectl_annotate)
|
||||
kubectl_annotate | kubectl_expose)
|
||||
__kubectl_get_resource
|
||||
return
|
||||
;;
|
||||
|
@ -19,6 +19,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@ -38,14 +39,21 @@ type ExposeOptions struct {
|
||||
}
|
||||
|
||||
const (
|
||||
expose_long = `Take a deployment, service, replica set, replication controller, or pod and expose it as a new Kubernetes service.
|
||||
expose_resources = `
|
||||
pod (po), service (svc), replicationcontroller (rc),
|
||||
deployment, replicaset (rs)
|
||||
`
|
||||
|
||||
expose_long = `Expose a resource as a new Kubernetes service.
|
||||
|
||||
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector
|
||||
for that resource as the selector for a new service on the specified port. A deployment or replica set
|
||||
will be exposed as a service only if its selector is convertible to a selector that service supports,
|
||||
i.e. when the selector contains only the matchLabels component. Note that if no port is specified via
|
||||
--port and the exposed resource has multiple ports, all will be re-used by the new service. Also if no
|
||||
labels are specified, the new service will re-use the labels from the resource it exposes.`
|
||||
labels are specified, the new service will re-use the labels from the resource it exposes.
|
||||
|
||||
Possible resources include (case insensitive):` + expose_resources
|
||||
|
||||
expose_example = `# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.
|
||||
kubectl expose rc nginx --port=80 --target-port=8000
|
||||
@ -72,6 +80,13 @@ kubectl expose deployment nginx --port=80 --target-port=8000`
|
||||
func NewCmdExposeService(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
options := &ExposeOptions{}
|
||||
|
||||
validArgs, argAliases := []string{}, []string{}
|
||||
resources := regexp.MustCompile(`\s*,`).Split(expose_resources, -1)
|
||||
for _, r := range resources {
|
||||
validArgs = append(validArgs, strings.Fields(r)[0])
|
||||
argAliases = kubectl.ResourceAliases(validArgs)
|
||||
}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]",
|
||||
Short: "Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service",
|
||||
@ -81,6 +96,8 @@ func NewCmdExposeService(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
err := RunExpose(f, out, cmd, args, options)
|
||||
cmdutil.CheckErr(err)
|
||||
},
|
||||
ValidArgs: validArgs,
|
||||
ArgAliases: argAliases,
|
||||
}
|
||||
cmdutil.AddPrinterFlags(cmd)
|
||||
cmd.Flags().String("generator", "service/v2", "The name of the API generator to use. There are 2 generators: 'service/v1' and 'service/v2'. The only difference between them is that service port in v1 is named 'default', while it is left unnamed in v2. Default is 'service/v2'.")
|
||||
|
Loading…
Reference in New Issue
Block a user