Documentation ¶
Overview ¶
Example (PrintMultiContainersReplicationControllerWithWide) ¶
f, tf, _, ns := NewAPIFactory() tf.Printer = kubectl.NewHumanReadablePrinter(kubectl.PrintOptions{ Wide: true, ColumnLabels: []string{}, }) tf.Client = &fake.RESTClient{ NegotiatedSerializer: ns, Client: nil, } cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr) ctrl := &api.ReplicationController{ ObjectMeta: api.ObjectMeta{ Name: "foo", Labels: map[string]string{"foo": "bar"}, CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)}, }, Spec: api.ReplicationControllerSpec{ Replicas: 1, Selector: map[string]string{"foo": "bar"}, Template: &api.PodTemplateSpec{ ObjectMeta: api.ObjectMeta{ Labels: map[string]string{"foo": "bar"}, }, Spec: api.PodSpec{ Containers: []api.Container{ { Name: "foo", Image: "someimage", }, { Name: "foo2", Image: "someimage2", }, }, }, }, }, Status: api.ReplicationControllerStatus{ Replicas: 1, }, } mapper, _ := f.Object(false) err := f.PrintObject(cmd, mapper, ctrl, os.Stdout) if err != nil { fmt.Printf("Unexpected error: %v", err) }
Output: NAME DESIRED CURRENT READY AGE CONTAINER(S) IMAGE(S) SELECTOR foo 1 1 0 10y foo,foo2 someimage,someimage2 foo=bar
Example (PrintPodHideTerminated) ¶
f, tf, _, ns := NewAPIFactory() tf.Printer = kubectl.NewHumanReadablePrinter(kubectl.PrintOptions{ ColumnLabels: []string{}, }) tf.Client = &fake.RESTClient{ NegotiatedSerializer: ns, Client: nil, } cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr) podList := newAllPhasePodList() mapper, _ := f.Object(false) err := f.PrintObject(cmd, mapper, podList, os.Stdout) if err != nil { fmt.Printf("Unexpected error: %v", err) }
Output: NAME READY STATUS RESTARTS AGE test1 1/2 Pending 6 10y test2 1/2 Running 6 10y test5 1/2 Unknown 6 10y
Example (PrintPodShowAll) ¶
f, tf, _, ns := NewAPIFactory() tf.Printer = kubectl.NewHumanReadablePrinter(kubectl.PrintOptions{ ShowAll: true, ColumnLabels: []string{}, }) tf.Client = &fake.RESTClient{ NegotiatedSerializer: ns, Client: nil, } cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr) podList := newAllPhasePodList() mapper, _ := f.Object(false) err := f.PrintObject(cmd, mapper, podList, os.Stdout) if err != nil { fmt.Printf("Unexpected error: %v", err) }
Output: NAME READY STATUS RESTARTS AGE test1 1/2 Pending 6 10y test2 1/2 Running 6 10y test3 1/2 Succeeded 6 10y test4 1/2 Failed 6 10y test5 1/2 Unknown 6 10y
Example (PrintPodWithShowLabels) ¶
f, tf, _, ns := NewAPIFactory() tf.Printer = kubectl.NewHumanReadablePrinter(kubectl.PrintOptions{ ShowLabels: true, ColumnLabels: []string{}, }) tf.Client = &fake.RESTClient{ NegotiatedSerializer: ns, Client: nil, } nodeName := "kubernetes-minion-abcd" cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr) pod := &api.Pod{ ObjectMeta: api.ObjectMeta{ Name: "test1", CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)}, Labels: map[string]string{ "l1": "key", "l2": "value", }, }, Spec: api.PodSpec{ Containers: make([]api.Container, 2), NodeName: nodeName, }, Status: api.PodStatus{ Phase: "podPhase", ContainerStatuses: []api.ContainerStatus{ {Ready: true, RestartCount: 3, State: api.ContainerState{Running: &api.ContainerStateRunning{}}}, {RestartCount: 3}, }, }, } mapper, _ := f.Object(false) err := f.PrintObject(cmd, mapper, pod, os.Stdout) if err != nil { fmt.Printf("Unexpected error: %v", err) }
Output: NAME READY STATUS RESTARTS AGE LABELS test1 1/2 podPhase 6 10y l1=key,l2=value
Example (PrintPodWithWideFormat) ¶
f, tf, _, ns := NewAPIFactory() tf.Printer = kubectl.NewHumanReadablePrinter(kubectl.PrintOptions{ Wide: true, ColumnLabels: []string{}, }) tf.Client = &fake.RESTClient{ NegotiatedSerializer: ns, Client: nil, } nodeName := "kubernetes-minion-abcd" cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr) pod := &api.Pod{ ObjectMeta: api.ObjectMeta{ Name: "test1", CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)}, }, Spec: api.PodSpec{ Containers: make([]api.Container, 2), NodeName: nodeName, }, Status: api.PodStatus{ Phase: "podPhase", ContainerStatuses: []api.ContainerStatus{ {Ready: true, RestartCount: 3, State: api.ContainerState{Running: &api.ContainerStateRunning{}}}, {RestartCount: 3}, }, PodIP: "10.1.1.3", }, } mapper, _ := f.Object(false) err := f.PrintObject(cmd, mapper, pod, os.Stdout) if err != nil { fmt.Printf("Unexpected error: %v", err) }
Output: NAME READY STATUS RESTARTS AGE IP NODE test1 1/2 podPhase 6 10y 10.1.1.3 kubernetes-minion-abcd
Example (PrintReplicationController) ¶
f, tf, _, ns := NewAPIFactory() tf.Printer = kubectl.NewHumanReadablePrinter(kubectl.PrintOptions{ ColumnLabels: []string{}, }) tf.Client = &fake.RESTClient{ NegotiatedSerializer: ns, Client: nil, } cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr) ctrl := &api.ReplicationController{ ObjectMeta: api.ObjectMeta{ Name: "foo", Labels: map[string]string{"foo": "bar"}, CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)}, }, Spec: api.ReplicationControllerSpec{ Replicas: 1, Selector: map[string]string{"foo": "bar"}, Template: &api.PodTemplateSpec{ ObjectMeta: api.ObjectMeta{ Labels: map[string]string{"foo": "bar"}, }, Spec: api.PodSpec{ Containers: []api.Container{ { Name: "foo", Image: "someimage", }, { Name: "foo2", Image: "someimage", }, }, }, }, }, Status: api.ReplicationControllerStatus{ Replicas: 1, }, } mapper, _ := f.Object(false) err := f.PrintObject(cmd, mapper, ctrl, os.Stdout) if err != nil { fmt.Printf("Unexpected error: %v", err) }
Output: NAME DESIRED CURRENT READY AGE foo 1 1 0 10y
Example (PrintReplicationControllerWithNamespace) ¶
f, tf, _, ns := NewAPIFactory() tf.Printer = kubectl.NewHumanReadablePrinter(kubectl.PrintOptions{ WithNamespace: true, ColumnLabels: []string{}, }) tf.Client = &fake.RESTClient{ NegotiatedSerializer: ns, Client: nil, } cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr) ctrl := &api.ReplicationController{ ObjectMeta: api.ObjectMeta{ Name: "foo", Namespace: "beep", Labels: map[string]string{"foo": "bar"}, CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)}, }, Spec: api.ReplicationControllerSpec{ Replicas: 1, Selector: map[string]string{"foo": "bar"}, Template: &api.PodTemplateSpec{ ObjectMeta: api.ObjectMeta{ Labels: map[string]string{"foo": "bar"}, }, Spec: api.PodSpec{ Containers: []api.Container{ { Name: "foo", Image: "someimage", }, }, }, }, }, Status: api.ReplicationControllerStatus{ Replicas: 1, ReadyReplicas: 1, }, } mapper, _ := f.Object(false) err := f.PrintObject(cmd, mapper, ctrl, os.Stdout) if err != nil { fmt.Printf("Unexpected error: %v", err) }
Output: NAMESPACE NAME DESIRED CURRENT READY AGE beep foo 1 1 1 10y
Example (PrintServiceWithNamespacesAndLabels) ¶
f, tf, _, ns := NewAPIFactory() tf.Printer = kubectl.NewHumanReadablePrinter(kubectl.PrintOptions{ WithNamespace: true, ColumnLabels: []string{"l1"}, }) tf.Client = &fake.RESTClient{ NegotiatedSerializer: ns, Client: nil, } cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr) svc := &api.ServiceList{ Items: []api.Service{ { ObjectMeta: api.ObjectMeta{ Name: "svc1", Namespace: "ns1", CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)}, Labels: map[string]string{ "l1": "value", }, }, Spec: api.ServiceSpec{ Ports: []api.ServicePort{ {Protocol: "UDP", Port: 53}, {Protocol: "TCP", Port: 53}, }, Selector: map[string]string{ "s": "magic", }, ClusterIP: "10.1.1.1", }, Status: api.ServiceStatus{}, }, { ObjectMeta: api.ObjectMeta{ Name: "svc2", Namespace: "ns2", CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)}, Labels: map[string]string{ "l1": "dolla-bill-yall", }, }, Spec: api.ServiceSpec{ Ports: []api.ServicePort{ {Protocol: "TCP", Port: 80}, {Protocol: "TCP", Port: 8080}, }, Selector: map[string]string{ "s": "kazam", }, ClusterIP: "10.1.1.2", }, Status: api.ServiceStatus{}, }}, } ld := strings.NewLineDelimiter(os.Stdout, "|") defer ld.Flush() mapper, _ := f.Object(false) err := f.PrintObject(cmd, mapper, svc, ld) if err != nil { fmt.Printf("Unexpected error: %v", err) }
Output: |NAMESPACE NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE L1| |ns1 svc1 10.1.1.1 <unknown> 53/UDP,53/TCP 10y value| |ns2 svc2 10.1.1.2 <unknown> 80/TCP,8080/TCP 10y dolla-bill-yall| ||
Index ¶
- func CreateConfigMap(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
- func CreateDeployment(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
- func CreateNamespace(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
- func CreateQuota(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
- func CreateSecretDockerRegistry(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
- func CreateSecretGeneric(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
- func CreateSecretTLS(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
- func CreateServiceAccount(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
- func CreateServiceClusterIP(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
- func CreateServiceLoadBalancer(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
- func CreateServiceNodePort(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
- func DeleteResult(r *resource.Result, out io.Writer, ignoreNotFound bool, shortOutput bool, ...) error
- func Deprecated(baseName, to string, parent, cmd *cobra.Command) string
- func DescribeMatchingResources(mapper meta.RESTMapper, typer runtime.ObjectTyper, f *cmdutil.Factory, ...) error
- func NameFromCommandArgs(cmd *cobra.Command, args []string) (string, error)
- func NewCmdAnnotate(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdApiVersions(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdApply(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdAttach(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *cobra.Command
- func NewCmdAutoscale(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdClusterInfo(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdClusterInfoDump(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCompletion(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdConvert(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdCordon(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdCreate(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdCreateConfigMap(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCreateDeployment(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCreateNamespace(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCreateQuota(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCreateSecret(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCreateSecretDockerRegistry(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCreateSecretGeneric(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCreateSecretTLS(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCreateService(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCreateServiceAccount(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCreateServiceClusterIP(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCreateServiceLoadBalancer(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdCreateServiceNodePort(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command
- func NewCmdDelete(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdDescribe(f *cmdutil.Factory, out, cmdErr io.Writer) *cobra.Command
- func NewCmdDrain(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdEdit(f *cmdutil.Factory, out, errOut io.Writer) *cobra.Command
- func NewCmdExec(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *cobra.Command
- func NewCmdExplain(f *cmdutil.Factory, out, cmdErr io.Writer) *cobra.Command
- func NewCmdExposeService(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Command
- func NewCmdHelp(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdLabel(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdLogs(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdNamespace(out io.Writer) *cobra.Command
- func NewCmdOptions(out io.Writer) *cobra.Command
- func NewCmdPatch(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdPortForward(f *cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command
- func NewCmdProxy(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdReplace(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdRollingUpdate(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdRun(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *cobra.Command
- func NewCmdScale(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdStop(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdTaint(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdTop(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdTopNode(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdTopPod(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdUncordon(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdVersion(f *cmdutil.Factory, out io.Writer) *cobra.Command
- func NewKubectlCommand(f *cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Command
- func NewPatcher(encoder runtime.Encoder, decoder runtime.Decoder, mapping *meta.RESTMapping, ...) *patcher
- func ReapResult(r *resource.Result, f *cmdutil.Factory, out io.Writer, ...) error
- func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, ...) error
- func RunApiVersions(f *cmdutil.Factory, w io.Writer) error
- func RunApply(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *ApplyOptions) error
- func RunAutoscale(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, ...) error
- func RunClusterInfo(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error
- func RunCompletion(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error
- func RunCreate(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *CreateOptions) error
- func RunCreateSubcommand(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, ...) error
- func RunDelete(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, ...) error
- func RunDescribe(f *cmdutil.Factory, out, cmdErr io.Writer, cmd *cobra.Command, args []string, ...) error
- func RunEdit(f *cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, args []string, ...) error
- func RunExplain(f *cmdutil.Factory, out, cmdErr io.Writer, cmd *cobra.Command, args []string) error
- func RunExpose(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, ...) error
- func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Command, ...) error
- func RunHelp(cmd *cobra.Command, args []string)
- func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, ...) error
- func RunPatch(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, ...) error
- func RunProxy(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error
- func RunReplace(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, ...) error
- func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, ...) error
- func RunScale(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, ...) error
- func RunStop(f *cmdutil.Factory, cmd *cobra.Command, args []string, out io.Writer, ...) error
- func RunVersion(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error
- func ValidateArgs(cmd *cobra.Command, args []string) error
- type AnnotateOptions
- type ApplyOptions
- type AttachOptions
- type AutoscaleOptions
- type ConvertOptions
- type CreateOptions
- type CreateSubcommandOptions
- type DefaultRemoteAttach
- type DefaultRemoteExecutor
- type DeleteOptions
- type DescribeOptions
- type DrainOptions
- type EditOptions
- type ExecOptions
- type ExposeOptions
- type GetOptions
- type LabelOptions
- type LogsOptions
- type PatchOptions
- type PortForwardOptions
- type RemoteAttach
- type RemoteExecutor
- type ReplaceOptions
- type RollingUpdateOptions
- type ScaleOptions
- type StopOptions
- type StreamOptions
- type TaintOptions
- type TopNodeOptions
- type TopOptions
- type TopPodOptions
Examples ¶
- Package (PrintMultiContainersReplicationControllerWithWide)
- Package (PrintPodHideTerminated)
- Package (PrintPodShowAll)
- Package (PrintPodWithShowLabels)
- Package (PrintPodWithWideFormat)
- Package (PrintReplicationController)
- Package (PrintReplicationControllerWithNamespace)
- Package (PrintServiceWithNamespacesAndLabels)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateConfigMap ¶ added in v1.2.3
CreateConfigMap is the implementation of the create configmap command.
func CreateDeployment ¶ added in v1.4.2
func CreateDeployment(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
CreateDeployment implements the behavior to run the create deployment command
func CreateNamespace ¶ added in v1.2.3
CreateNamespace implements the behavior to run the create namespace command
func CreateQuota ¶ added in v1.4.2
CreateQuota implements the behavior to run the create quota command
func CreateSecretDockerRegistry ¶ added in v1.2.3
func CreateSecretDockerRegistry(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
CreateSecretDockerRegistry is the implementation of the create secret docker-registry command
func CreateSecretGeneric ¶ added in v1.2.3
func CreateSecretGeneric(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
CreateSecretGeneric is the implementation of the create secret generic command
func CreateSecretTLS ¶ added in v1.3.0
CreateSecretTLS is the implementation of the create secret tls command
func CreateServiceAccount ¶ added in v1.2.3
func CreateServiceAccount(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
CreateServiceAccount implements the behavior to run the create service account command
func CreateServiceClusterIP ¶ added in v1.4.2
func CreateServiceClusterIP(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
CreateServiceClusterIP implements the behavior to run the create namespace command
func CreateServiceLoadBalancer ¶ added in v1.4.2
func CreateServiceLoadBalancer(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
CreateServiceLoadBalancer is the implementation of the create secret tls command
func CreateServiceNodePort ¶ added in v1.4.2
func CreateServiceNodePort(f *cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error
CreateServiceNodePort is the implementation of the create secret docker-registry command
func DeleteResult ¶ added in v0.18.2
func Deprecated ¶ added in v1.4.2
func DescribeMatchingResources ¶ added in v0.18.2
func DescribeMatchingResources(mapper meta.RESTMapper, typer runtime.ObjectTyper, f *cmdutil.Factory, namespace, rsrc, prefix string, describerSettings *kubectl.DescriberSettings, out io.Writer, originalError error) error
func NameFromCommandArgs ¶ added in v1.2.3
NameFromCommandArgs is a utility function for commands that assume the first argument is a resource name
func NewCmdAnnotate ¶ added in v1.1.6
func NewCmdApiVersions ¶ added in v0.15.0
func NewCmdApply ¶ added in v1.1.6
func NewCmdAttach ¶ added in v1.1.6
func NewCmdAutoscale ¶ added in v1.1.6
func NewCmdClusterInfo ¶ added in v0.15.0
func NewCmdClusterInfoDump ¶ added in v1.3.0
NewCmdCreateSecret groups subcommands to create various types of secrets
func NewCmdCompletion ¶ added in v1.3.0
func NewCmdConvert ¶ added in v1.2.3
NewCmdConvert creates a command object for the generic "convert" action, which translates the config file into a given version.
func NewCmdCordon ¶ added in v1.2.3
func NewCmdCreate ¶ added in v0.15.0
func NewCmdCreateConfigMap ¶ added in v1.2.3
ConfigMap is a command to ease creating ConfigMaps.
func NewCmdCreateDeployment ¶ added in v1.4.2
NewCmdCreateDeployment is a macro command to create a new deployment
func NewCmdCreateNamespace ¶ added in v1.2.3
NewCmdCreateNamespace is a macro command to create a new namespace
func NewCmdCreateQuota ¶ added in v1.4.2
NewCmdCreateQuota is a macro command to create a new quota
func NewCmdCreateSecret ¶ added in v1.2.3
NewCmdCreateSecret groups subcommands to create various types of secrets
func NewCmdCreateSecretDockerRegistry ¶ added in v1.2.3
NewCmdCreateSecretDockerRegistry is a macro command for creating secrets to work with Docker registries
func NewCmdCreateSecretGeneric ¶ added in v1.2.3
NewCmdCreateSecretGeneric is a command to create generic secrets from files, directories, or literal values
func NewCmdCreateSecretTLS ¶ added in v1.3.0
NewCmdCreateSecretTLS is a macro command for creating secrets to work with Docker registries
func NewCmdCreateService ¶ added in v1.4.2
NewCmdCreateService is a macro command to create a new namespace
func NewCmdCreateServiceAccount ¶ added in v1.2.3
NewCmdCreateServiceAccount is a macro command to create a new service account
func NewCmdCreateServiceClusterIP ¶ added in v1.4.2
NewCmdCreateServiceClusterIP is a command to create generic secrets from files, directories, or literal values
func NewCmdCreateServiceLoadBalancer ¶ added in v1.4.2
NewCmdCreateServiceLoadBalancer is a macro command for creating secrets to work with Docker registries
func NewCmdCreateServiceNodePort ¶ added in v1.4.2
NewCmdCreateServiceNodePort is a macro command for creating secrets to work with Docker registries
func NewCmdDelete ¶ added in v0.15.0
func NewCmdDescribe ¶ added in v0.15.0
func NewCmdDrain ¶ added in v1.2.3
func NewCmdEdit ¶ added in v1.1.6
func NewCmdExec ¶ added in v0.15.0
func NewCmdExplain ¶ added in v1.2.3
NewCmdExplain returns a cobra command for swagger docs
func NewCmdExposeService ¶ added in v0.15.0
func NewCmdGet ¶ added in v0.15.0
NewCmdGet creates a command object for the generic "get" action, which retrieves one or more resources from a server.
func NewCmdLabel ¶ added in v0.15.0
func NewCmdLogs ¶ added in v1.2.3
NewCmdLog creates a new pod logs command
func NewCmdNamespace ¶
TODO remove once people have been given enough time to notice
func NewCmdOptions ¶ added in v1.4.2
NewCmdOptions implements the options command
func NewCmdPatch ¶ added in v0.21.1
func NewCmdPortForward ¶ added in v0.15.0
func NewCmdReplace ¶ added in v0.21.1
func NewCmdRollingUpdate ¶ added in v0.15.0
func NewCmdScale ¶ added in v0.18.2
NewCmdScale returns a cobra command with the appropriate configuration and flags to run scale
func NewCmdStop ¶ added in v0.15.0
func NewCmdTaint ¶ added in v1.3.0
func NewCmdTopNode ¶ added in v1.4.2
func NewCmdTopPod ¶ added in v1.4.2
func NewCmdUncordon ¶ added in v1.2.3
func NewKubectlCommand ¶ added in v0.15.0
NewKubectlCommand creates the `kubectl` command and its nested children.
func NewPatcher ¶ added in v1.3.0
func ReapResult ¶ added in v0.18.2
func RunAutoscale ¶ added in v1.1.6
func RunClusterInfo ¶ added in v0.13.1
func RunCompletion ¶ added in v1.3.0
func RunCreateSubcommand ¶ added in v1.2.3
func RunCreateSubcommand(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *CreateSubcommandOptions) error
RunCreateSubcommand executes a create subcommand using the specified options
func RunDescribe ¶ added in v0.13.1
func RunExplain ¶ added in v1.2.3
RunExplain executes the appropriate steps to print a model's documentation
func RunGet ¶ added in v0.9.2
func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Command, args []string, options *GetOptions) error
RunGet implements the generic Get command TODO: convert all direct flag accessors to a struct and pass that instead of cmd
func RunReplace ¶ added in v0.21.1
func RunRollingUpdate ¶ added in v0.13.1
func RunScale ¶ added in v0.18.2
func RunScale(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, shortOutput bool, options *ScaleOptions) error
RunScale executes the scaling
func RunVersion ¶ added in v0.13.1
Types ¶
type AnnotateOptions ¶ added in v1.1.6
type AnnotateOptions struct {
// contains filtered or unexported fields
}
AnnotateOptions have the data required to perform the annotate operation
func (*AnnotateOptions) Complete ¶ added in v1.1.6
func (o *AnnotateOptions) Complete(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) (err error)
Complete adapts from the command line args and factory to the data required.
func (AnnotateOptions) RunAnnotate ¶ added in v1.1.6
func (o AnnotateOptions) RunAnnotate() error
RunAnnotate does the work
func (AnnotateOptions) Validate ¶ added in v1.1.6
func (o AnnotateOptions) Validate(args []string) error
Validate checks to the AnnotateOptions to see if there is sufficient information run the command.
type ApplyOptions ¶ added in v1.1.6
ApplyOptions stores cmd.Flag values for apply. As new fields are added, add them here instead of referencing the cmd.Flags()
type AttachOptions ¶ added in v1.1.6
type AttachOptions struct { StreamOptions CommandName string Pod *api.Pod Attach RemoteAttach Client *client.Client Config *restclient.Config }
AttachOptions declare the arguments accepted by the Exec command
func (*AttachOptions) Complete ¶ added in v1.1.6
Complete verifies command line arguments and loads data from the command environment
func (*AttachOptions) GetContainerName ¶ added in v1.1.6
func (p *AttachOptions) GetContainerName(pod *api.Pod) (string, error)
GetContainerName returns the name of the container to attach to, with a fallback.
func (*AttachOptions) Run ¶ added in v1.1.6
func (p *AttachOptions) Run() error
Run executes a validated remote execution against a pod.
func (*AttachOptions) Validate ¶ added in v1.1.6
func (p *AttachOptions) Validate() error
Validate checks that the provided attach options are specified.
type AutoscaleOptions ¶ added in v1.3.0
AutoscaleOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type ConvertOptions ¶ added in v1.2.3
type ConvertOptions struct {
// contains filtered or unexported fields
}
ConvertOptions have the data required to perform the convert operation
func (*ConvertOptions) Complete ¶ added in v1.2.3
func (o *ConvertOptions) Complete(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) (err error)
Complete collects information required to run Convert command from command line.
func (*ConvertOptions) RunConvert ¶ added in v1.2.3
func (o *ConvertOptions) RunConvert() error
RunConvert implements the generic Convert command
type CreateOptions ¶ added in v1.1.6
CreateOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type CreateSubcommandOptions ¶ added in v1.2.3
type CreateSubcommandOptions struct { // Name of resource being created Name string // StructuredGenerator is the resource generator for the object being created StructuredGenerator kubectl.StructuredGenerator // DryRun is true if the command should be simulated but not run against the server DryRun bool // OutputFormat OutputFormat string }
CreateSubcommandOptions is an options struct to support create subcommands
type DefaultRemoteAttach ¶ added in v1.1.6
type DefaultRemoteAttach struct{}
DefaultRemoteAttach is the standard implementation of attaching
type DefaultRemoteExecutor ¶ added in v1.1.6
type DefaultRemoteExecutor struct{}
DefaultRemoteExecutor is the standard implementation of remote command execution
type DeleteOptions ¶ added in v1.1.6
DeleteOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type DescribeOptions ¶ added in v1.1.6
DescribeOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type DrainOptions ¶ added in v1.2.3
type DrainOptions struct { Force bool GracePeriodSeconds int IgnoreDaemonsets bool DeleteLocalData bool // contains filtered or unexported fields }
func (*DrainOptions) RunCordonOrUncordon ¶ added in v1.2.3
func (o *DrainOptions) RunCordonOrUncordon(desired bool) error
RunCordonOrUncordon runs either Cordon or Uncordon. The desired value for "Unschedulable" is passed as the first arg.
func (*DrainOptions) RunDrain ¶ added in v1.2.3
func (o *DrainOptions) RunDrain() error
RunDrain runs the 'drain' command
func (*DrainOptions) SetupDrain ¶ added in v1.2.3
func (o *DrainOptions) SetupDrain(cmd *cobra.Command, args []string) error
SetupDrain populates some fields from the factory, grabs command line arguments and looks up the node using Builder
type EditOptions ¶ added in v1.3.0
EditOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type ExecOptions ¶ added in v1.1.6
type ExecOptions struct { StreamOptions Command []string Executor RemoteExecutor Client *client.Client Config *restclient.Config }
ExecOptions declare the arguments accepted by the Exec command
func (*ExecOptions) Complete ¶ added in v1.1.6
func (p *ExecOptions) Complete(f *cmdutil.Factory, cmd *cobra.Command, argsIn []string, argsLenAtDash int) error
Complete verifies command line arguments and loads data from the command environment
func (*ExecOptions) Run ¶ added in v1.1.6
func (p *ExecOptions) Run() error
Run executes a validated remote execution against a pod.
func (*ExecOptions) Validate ¶ added in v1.1.6
func (p *ExecOptions) Validate() error
Validate checks that the provided exec options are specified.
type ExposeOptions ¶ added in v1.1.6
ExposeOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type GetOptions ¶ added in v1.1.6
GetOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type LabelOptions ¶ added in v1.1.6
LabelOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type LogsOptions ¶ added in v1.2.3
type LogsOptions struct { Namespace string ResourceArg string Options runtime.Object Mapper meta.RESTMapper Typer runtime.ObjectTyper ClientMapper resource.ClientMapper Decoder runtime.Decoder Object runtime.Object LogsForObject func(object, options runtime.Object) (*restclient.Request, error) Out io.Writer }
func (LogsOptions) RunLogs ¶ added in v1.2.3
func (o LogsOptions) RunLogs() (int64, error)
RunLogs retrieves a pod log
func (LogsOptions) Validate ¶ added in v1.2.3
func (o LogsOptions) Validate() error
type PatchOptions ¶ added in v1.1.6
PatchOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type PortForwardOptions ¶ added in v1.4.2
type PortForwardOptions struct { Namespace string PodName string Config *restclient.Config Client *client.Client Ports []string PortForwarder portForwarder StopChannel chan struct{} ReadyChannel chan struct{} }
PortForwardOptions contains all the options for running the port-forward cli command.
func (*PortForwardOptions) Complete ¶ added in v1.4.2
func (o *PortForwardOptions) Complete(f *cmdutil.Factory, cmd *cobra.Command, args []string, cmdOut io.Writer, cmdErr io.Writer) error
Complete completes all the required options for port-forward cmd.
func (PortForwardOptions) RunPortForward ¶ added in v1.4.2
func (o PortForwardOptions) RunPortForward() error
RunPortForward implements all the necessary functionality for port-forward cmd.
func (PortForwardOptions) Validate ¶ added in v1.4.2
func (o PortForwardOptions) Validate() error
Validate validates all the required options for port-forward cmd.
type RemoteAttach ¶ added in v1.1.6
type RemoteAttach interface {
Attach(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue term.TerminalSizeQueue) error
}
RemoteAttach defines the interface accepted by the Attach command - provided for test stubbing
type RemoteExecutor ¶ added in v1.1.6
type RemoteExecutor interface {
Execute(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue term.TerminalSizeQueue) error
}
RemoteExecutor defines the interface accepted by the Exec command - provided for test stubbing
type ReplaceOptions ¶ added in v1.1.6
ReplaceOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type RollingUpdateOptions ¶ added in v1.1.6
type RollingUpdateOptions struct {
Filenames []string
}
RollingUpdateOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type ScaleOptions ¶ added in v1.1.6
ScaleOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type StopOptions ¶ added in v1.1.6
StopOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()
type StreamOptions ¶ added in v1.4.2
type StreamOptions struct { Namespace string PodName string ContainerName string Stdin bool TTY bool // minimize unnecessary output Quiet bool // InterruptParent, if set, is used to handle interrupts while attached InterruptParent *interrupt.Handler In io.Reader Out io.Writer Err io.Writer // contains filtered or unexported fields }
type TaintOptions ¶ added in v1.3.0
type TaintOptions struct {
// contains filtered or unexported fields
}
TaintOptions have the data required to perform the taint operation
func (*TaintOptions) Complete ¶ added in v1.3.0
func (o *TaintOptions) Complete(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) (err error)
Complete adapts from the command line args and factory to the data required.
func (TaintOptions) RunTaint ¶ added in v1.3.0
func (o TaintOptions) RunTaint() error
RunTaint does the work
func (TaintOptions) Validate ¶ added in v1.3.0
func (o TaintOptions) Validate(args []string) error
Validate checks to the TaintOptions to see if there is sufficient information run the command.
type TopNodeOptions ¶ added in v1.4.2
type TopNodeOptions struct { ResourceName string Selector string Client *metricsutil.HeapsterMetricsClient Printer *metricsutil.TopCmdPrinter }
TopNodeOptions contains all the options for running the top-node cli command.
func (TopNodeOptions) RunTopNode ¶ added in v1.4.2
func (o TopNodeOptions) RunTopNode() error
func (*TopNodeOptions) Validate ¶ added in v1.4.2
func (o *TopNodeOptions) Validate() error
type TopOptions ¶ added in v1.4.2
type TopOptions struct{}
TopOptions contains all the options for running the top cli command.
type TopPodOptions ¶ added in v1.4.2
type TopPodOptions struct { ResourceName string Namespace string Selector string AllNamespaces bool PrintContainers bool Client *metricsutil.HeapsterMetricsClient Printer *metricsutil.TopCmdPrinter }
func (TopPodOptions) RunTopPod ¶ added in v1.4.2
func (o TopPodOptions) RunTopPod() error
func (*TopPodOptions) Validate ¶ added in v1.4.2
func (o *TopPodOptions) Validate() error
Source Files ¶
- annotate.go
- apiversions.go
- apply.go
- attach.go
- autoscale.go
- clusterinfo.go
- clusterinfo_dump.go
- cmd.go
- completion.go
- convert.go
- create.go
- create_configmap.go
- create_deployment.go
- create_namespace.go
- create_quota.go
- create_secret.go
- create_service.go
- create_serviceaccount.go
- delete.go
- describe.go
- drain.go
- edit.go
- exec.go
- explain.go
- expose.go
- get.go
- help.go
- label.go
- logs.go
- namespace.go
- options.go
- patch.go
- portforward.go
- proxy.go
- replace.go
- rollingupdate.go
- run.go
- scale.go
- stop.go
- taint.go
- top.go
- top_node.go
- top_pod.go
- version.go