cmd

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2017 License: Apache-2.0 Imports: 106 Imported by: 0

Documentation

Overview

Example (PrintMultiContainersReplicationControllerWithWide)
f, tf, _, ns := cmdtesting.NewAPIFactory()
p := printers.NewHumanReadablePrinter(nil, nil, printers.PrintOptions{
	Wide:         true,
	ColumnLabels: []string{},
})
printersinternal.AddHandlers(p)
tf.Printer = p
tf.Client = &fake.RESTClient{
	NegotiatedSerializer: ns,
	Client:               nil,
}
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
ctrl := &api.ReplicationController{
	ObjectMeta: metav1.ObjectMeta{
		Name:              "foo",
		Labels:            map[string]string{"foo": "bar"},
		CreationTimestamp: metav1.Time{Time: time.Now().AddDate(-10, 0, 0)},
	},
	Spec: api.ReplicationControllerSpec{
		Replicas: 1,
		Selector: map[string]string{"foo": "bar"},
		Template: &api.PodTemplateSpec{
			ObjectMeta: metav1.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()
err := f.PrintObject(cmd, false, mapper, ctrl, os.Stdout)
if err != nil {
	fmt.Printf("Unexpected error: %v", err)
}
Output:

NAME      DESIRED   CURRENT   READY     AGE       CONTAINERS   IMAGES                 SELECTOR
foo       1         1         0         10y       foo,foo2     someimage,someimage2   foo=bar
Example (PrintPodHideTerminated)
f, tf, _, ns := cmdtesting.NewAPIFactory()
p := printers.NewHumanReadablePrinter(nil, nil, printers.PrintOptions{
	ColumnLabels: []string{},
})
printersinternal.AddHandlers(p)
tf.Printer = p
tf.Client = &fake.RESTClient{
	NegotiatedSerializer: ns,
	Client:               nil,
}
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
podList := newAllPhasePodList()
// filter pods
filterFuncs := f.DefaultResourceFilterFunc()
filterOpts := cmdutil.ExtractCmdPrintOptions(cmd, false)
_, filteredPodList, errs := cmdutil.FilterResourceList(podList, filterFuncs, filterOpts)
if errs != nil {
	fmt.Printf("Unexpected filter error: %v\n", errs)
}
for _, pod := range filteredPodList {
	mapper, _ := f.Object()
	err := f.PrintObject(cmd, false, mapper, pod, 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 := cmdtesting.NewAPIFactory()
p := printers.NewHumanReadablePrinter(nil, nil, printers.PrintOptions{
	ShowAll:      true,
	ColumnLabels: []string{},
})
printersinternal.AddHandlers(p)
tf.Printer = p
tf.Client = &fake.RESTClient{
	NegotiatedSerializer: ns,
	Client:               nil,
}
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
podList := newAllPhasePodList()
mapper, _ := f.Object()
err := f.PrintObject(cmd, false, 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 := cmdtesting.NewAPIFactory()
p := printers.NewHumanReadablePrinter(nil, nil, printers.PrintOptions{
	ShowLabels:   true,
	ColumnLabels: []string{},
})
printersinternal.AddHandlers(p)
tf.Printer = p
tf.Client = &fake.RESTClient{
	NegotiatedSerializer: ns,
	Client:               nil,
}
nodeName := "kubernetes-node-abcd"
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
pod := &api.Pod{
	ObjectMeta: metav1.ObjectMeta{
		Name:              "test1",
		CreationTimestamp: metav1.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()
err := f.PrintObject(cmd, false, 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 := cmdtesting.NewAPIFactory()
p := printers.NewHumanReadablePrinter(nil, nil, printers.PrintOptions{
	Wide:         true,
	ColumnLabels: []string{},
})
printersinternal.AddHandlers(p)
tf.Printer = p
tf.Client = &fake.RESTClient{
	NegotiatedSerializer: ns,
	Client:               nil,
}
nodeName := "kubernetes-node-abcd"
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
pod := &api.Pod{
	ObjectMeta: metav1.ObjectMeta{
		Name:              "test1",
		CreationTimestamp: metav1.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()
err := f.PrintObject(cmd, false, 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-node-abcd
Example (PrintReplicationController)
f, tf, _, ns := cmdtesting.NewAPIFactory()
p := printers.NewHumanReadablePrinter(nil, nil, printers.PrintOptions{
	ColumnLabels: []string{},
})
printersinternal.AddHandlers(p)
tf.Printer = p
tf.Client = &fake.RESTClient{
	NegotiatedSerializer: ns,
	Client:               nil,
}
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
ctrl := &api.ReplicationController{
	ObjectMeta: metav1.ObjectMeta{
		Name:              "foo",
		Labels:            map[string]string{"foo": "bar"},
		CreationTimestamp: metav1.Time{Time: time.Now().AddDate(-10, 0, 0)},
	},
	Spec: api.ReplicationControllerSpec{
		Replicas: 1,
		Selector: map[string]string{"foo": "bar"},
		Template: &api.PodTemplateSpec{
			ObjectMeta: metav1.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()
err := f.PrintObject(cmd, false, 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 := cmdtesting.NewAPIFactory()
p := printers.NewHumanReadablePrinter(nil, nil, printers.PrintOptions{
	WithNamespace: true,
	ColumnLabels:  []string{},
})
printersinternal.AddHandlers(p)
tf.Printer = p
tf.Client = &fake.RESTClient{
	NegotiatedSerializer: ns,
	Client:               nil,
}
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
ctrl := &api.ReplicationController{
	ObjectMeta: metav1.ObjectMeta{
		Name:              "foo",
		Namespace:         "beep",
		Labels:            map[string]string{"foo": "bar"},
		CreationTimestamp: metav1.Time{Time: time.Now().AddDate(-10, 0, 0)},
	},
	Spec: api.ReplicationControllerSpec{
		Replicas: 1,
		Selector: map[string]string{"foo": "bar"},
		Template: &api.PodTemplateSpec{
			ObjectMeta: metav1.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()
err := f.PrintObject(cmd, false, 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 := cmdtesting.NewAPIFactory()
p := printers.NewHumanReadablePrinter(nil, nil, printers.PrintOptions{
	WithNamespace: true,
	ColumnLabels:  []string{"l1"},
})
printersinternal.AddHandlers(p)
tf.Printer = p
tf.Client = &fake.RESTClient{
	NegotiatedSerializer: ns,
	Client:               nil,
}
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
svc := &api.ServiceList{
	Items: []api.Service{
		{
			ObjectMeta: metav1.ObjectMeta{
				Name:              "svc1",
				Namespace:         "ns1",
				CreationTimestamp: metav1.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",
				Type:      api.ServiceTypeClusterIP,
			},
			Status: api.ServiceStatus{},
		},
		{
			ObjectMeta: metav1.ObjectMeta{
				Name:              "svc2",
				Namespace:         "ns2",
				CreationTimestamp: metav1.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",
				Type:      api.ServiceTypeClusterIP,
			},
			Status: api.ServiceStatus{},
		}},
}
ld := strings.NewLineDelimiter(os.Stdout, "|")
defer ld.Flush()
mapper, _ := f.Object()
err := f.PrintObject(cmd, false, mapper, svc, ld)
if err != nil {
	fmt.Printf("Unexpected error: %v", err)
}
Output:

|NAMESPACE   NAME      TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)           AGE       L1|
|ns1         svc1      ClusterIP   10.1.1.1     <none>        53/UDP,53/TCP     10y       value|
|ns2         svc2      ClusterIP   10.1.1.2     <none>        80/TCP,8080/TCP   10y       dolla-bill-yall|
||

Index

Examples

Constants

View Source
const (
	EvictionKind        = "Eviction"
	EvictionSubresource = "pods/eviction"
)

Variables

This section is empty.

Functions

func CreateClusterRoleBinding added in v1.6.0

func CreateClusterRoleBinding(f cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error

CreateClusterRoleBinding is the implementation of the create clusterrolebinding command.

func CreateConfigMap added in v1.2.0

func CreateConfigMap(f cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error

CreateConfigMap is the implementation of the create configmap command.

func CreateExternalNameService added in v1.6.0

func CreateExternalNameService(f cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error

CreateExternalNameService is the implementation of the create service externalname command

func CreateNamespace added in v1.2.0

func CreateNamespace(f cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error

CreateNamespace implements the behavior to run the create namespace command

func CreatePodDisruptionBudget added in v1.6.0

func CreatePodDisruptionBudget(f cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error

CreatePodDisruptionBudget implements the behavior to run the create pdb command.

func CreatePriorityClass added in v1.9.0

func CreatePriorityClass(f cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error

CreatePriorityClass implements the behavior to run the create priorityClass command.

func CreateQuota added in v1.4.0

func CreateQuota(f cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error

CreateQuota implements the behavior to run the create quota command

func CreateRoleBinding added in v1.6.0

func CreateRoleBinding(f cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error

func CreateSecretDockerRegistry added in v1.2.0

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.0

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

func CreateSecretTLS(f cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error

CreateSecretTLS is the implementation of the create secret tls command

func CreateServiceAccount added in v1.2.0

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.0

func CreateServiceClusterIP(f cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error

CreateServiceClusterIP is the implementation of the create service clusterip command

func CreateServiceLoadBalancer added in v1.4.0

func CreateServiceLoadBalancer(f cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error

CreateServiceLoadBalancer is the implementation of the create service loadbalancer command

func CreateServiceNodePort added in v1.4.0

func CreateServiceNodePort(f cmdutil.Factory, cmdOut io.Writer, cmd *cobra.Command, args []string) error

CreateServiceNodePort is the implementation of the create service nodeport command

func DeleteResult added in v0.16.2

func DeleteResult(r *resource.Result, f cmdutil.Factory, out io.Writer, ignoreNotFound bool, gracePeriod int, shortOutput bool, mapper meta.RESTMapper) error

func DescribeMatchingResources added in v0.17.1

func DescribeMatchingResources(f cmdutil.Factory, namespace, rsrc, prefix string, describerSettings *printers.DescriberSettings, out io.Writer, originalError error) error

func NameFromCommandArgs added in v1.2.0

func NameFromCommandArgs(cmd *cobra.Command, args []string) (string, error)

NameFromCommandArgs is a utility function for commands that assume the first argument is a resource name

func NewCmdAlpha added in v1.8.0

func NewCmdAlpha(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Command

NewCmdAlpha creates a command that acts as an alternate root command for features in alpha

func NewCmdAnnotate added in v1.1.1

func NewCmdAnnotate(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdApiVersions added in v0.15.0

func NewCmdApiVersions(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdApply added in v1.1.1

func NewCmdApply(baseName string, f cmdutil.Factory, out, errOut io.Writer) *cobra.Command

func NewCmdApplyEditLastApplied added in v1.7.0

func NewCmdApplyEditLastApplied(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command

func NewCmdApplySetLastApplied added in v1.6.0

func NewCmdApplySetLastApplied(f cmdutil.Factory, out, err io.Writer) *cobra.Command

func NewCmdApplyViewLastApplied added in v1.6.0

func NewCmdApplyViewLastApplied(f cmdutil.Factory, out, err io.Writer) *cobra.Command

func NewCmdAttach added in v1.1.1

func NewCmdAttach(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *cobra.Command

func NewCmdAutoscale added in v1.1.1

func NewCmdAutoscale(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdCertificate added in v1.5.0

func NewCmdCertificate(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdCertificateApprove added in v1.5.0

func NewCmdCertificateApprove(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdCertificateDeny added in v1.5.0

func NewCmdCertificateDeny(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdClusterInfo added in v0.15.0

func NewCmdClusterInfo(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdClusterInfoDump added in v1.3.0

func NewCmdClusterInfoDump(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreateSecret groups subcommands to create various types of secrets

func NewCmdCompletion added in v1.3.0

func NewCmdCompletion(out io.Writer, boilerPlate string) *cobra.Command

func NewCmdConvert added in v1.2.0

func NewCmdConvert(f cmdutil.Factory, out io.Writer) *cobra.Command

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.0

func NewCmdCordon(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdCp added in v1.5.0

func NewCmdCp(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command

NewCmdCp creates a new Copy command.

func NewCmdCreate added in v0.15.0

func NewCmdCreate(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command

func NewCmdCreateClusterRole added in v1.6.0

func NewCmdCreateClusterRole(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

ClusterRole is a command to ease creating ClusterRoles.

func NewCmdCreateClusterRoleBinding added in v1.6.0

func NewCmdCreateClusterRoleBinding(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

ClusterRoleBinding is a command to ease creating ClusterRoleBindings.

func NewCmdCreateConfigMap added in v1.2.0

func NewCmdCreateConfigMap(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

ConfigMap is a command to ease creating ConfigMaps.

func NewCmdCreateDeployment added in v1.4.0

func NewCmdCreateDeployment(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command

NewCmdCreateDeployment is a macro command to create a new deployment. This command is better known to users as `kubectl create deployment`. Note that this command overlaps significantly with the `kubectl run` command.

func NewCmdCreateNamespace added in v1.2.0

func NewCmdCreateNamespace(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreateNamespace is a macro command to create a new namespace

func NewCmdCreatePodDisruptionBudget added in v1.6.0

func NewCmdCreatePodDisruptionBudget(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreatePodDisruptionBudget is a macro command to create a new pod disruption budget.

func NewCmdCreatePriorityClass added in v1.9.0

func NewCmdCreatePriorityClass(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreatePriorityClass is a macro command to create a new priorityClass.

func NewCmdCreateQuota added in v1.4.0

func NewCmdCreateQuota(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreateQuota is a macro command to create a new quota

func NewCmdCreateRole added in v1.6.0

func NewCmdCreateRole(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

Role is a command to ease creating Roles.

func NewCmdCreateRoleBinding added in v1.6.0

func NewCmdCreateRoleBinding(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

RoleBinding is a command to ease creating RoleBindings.

func NewCmdCreateSecret added in v1.2.0

func NewCmdCreateSecret(f cmdutil.Factory, cmdOut, errOut io.Writer) *cobra.Command

NewCmdCreateSecret groups subcommands to create various types of secrets

func NewCmdCreateSecretDockerRegistry added in v1.2.0

func NewCmdCreateSecretDockerRegistry(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreateSecretDockerRegistry is a macro command for creating secrets to work with Docker registries

func NewCmdCreateSecretGeneric added in v1.2.0

func NewCmdCreateSecretGeneric(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreateSecretGeneric is a command to create generic secrets from files, directories, or literal values

func NewCmdCreateSecretTLS added in v1.3.0

func NewCmdCreateSecretTLS(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreateSecretTLS is a macro command for creating secrets to work with Docker registries

func NewCmdCreateService added in v1.4.0

func NewCmdCreateService(f cmdutil.Factory, cmdOut, errOut io.Writer) *cobra.Command

NewCmdCreateService is a macro command to create a new service

func NewCmdCreateServiceAccount added in v1.2.0

func NewCmdCreateServiceAccount(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreateServiceAccount is a macro command to create a new service account

func NewCmdCreateServiceClusterIP added in v1.4.0

func NewCmdCreateServiceClusterIP(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreateServiceClusterIP is a command to create a ClusterIP service

func NewCmdCreateServiceExternalName added in v1.6.0

func NewCmdCreateServiceExternalName(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreateServiceExternalName is a macro command for creating an ExternalName service

func NewCmdCreateServiceLoadBalancer added in v1.4.0

func NewCmdCreateServiceLoadBalancer(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreateServiceLoadBalancer is a macro command for creating a LoadBalancer service

func NewCmdCreateServiceNodePort added in v1.4.0

func NewCmdCreateServiceNodePort(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command

NewCmdCreateServiceNodePort is a macro command for creating a NodePort service

func NewCmdDelete added in v0.15.0

func NewCmdDelete(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command

func NewCmdDescribe added in v0.15.0

func NewCmdDescribe(f cmdutil.Factory, out, cmdErr io.Writer) *cobra.Command

func NewCmdDiff added in v1.9.0

func NewCmdDiff(f cmdutil.Factory, stdout, stderr io.Writer) *cobra.Command

func NewCmdDrain added in v1.2.0

func NewCmdDrain(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command

func NewCmdEdit added in v1.1.1

func NewCmdEdit(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command

func NewCmdExec added in v0.15.0

func NewCmdExec(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *cobra.Command

func NewCmdExplain added in v1.2.0

func NewCmdExplain(f cmdutil.Factory, out, cmdErr io.Writer) *cobra.Command

NewCmdExplain returns a cobra command for swagger docs

func NewCmdExposeService added in v0.15.0

func NewCmdExposeService(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdForPlugin added in v1.7.0

func NewCmdForPlugin(f cmdutil.Factory, plugin *plugins.Plugin, runner plugins.PluginRunner, in io.Reader, out, errout io.Writer) *cobra.Command

NewCmdForPlugin creates a command capable of running the provided plugin.

func NewCmdHelp added in v1.4.0

func NewCmdHelp() *cobra.Command

func NewCmdLabel added in v0.15.0

func NewCmdLabel(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdLogs added in v1.2.0

func NewCmdLogs(f cmdutil.Factory, out io.Writer) *cobra.Command

NewCmdLogs creates a new pod logs command

func NewCmdOptions added in v1.4.0

func NewCmdOptions(out io.Writer) *cobra.Command

NewCmdOptions implements the options command

func NewCmdPatch added in v0.21.0

func NewCmdPatch(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdPlugin added in v1.7.0

func NewCmdPlugin(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Command

NewCmdPlugin creates the command that is the top-level for plugin commands.

func NewCmdPortForward added in v0.15.0

func NewCmdPortForward(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command

func NewCmdProxy

func NewCmdProxy(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdReplace added in v0.21.0

func NewCmdReplace(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdRollingUpdate added in v0.15.0

func NewCmdRollingUpdate(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdRun added in v0.18.0

func NewCmdRun(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *cobra.Command

func NewCmdScale added in v0.18.0

func NewCmdScale(f cmdutil.Factory, out io.Writer) *cobra.Command

NewCmdScale returns a cobra command with the appropriate configuration and flags to run scale

func NewCmdTaint added in v1.3.0

func NewCmdTaint(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdTop added in v1.4.0

func NewCmdTop(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command

func NewCmdTopNode added in v1.4.0

func NewCmdTopNode(f cmdutil.Factory, options *TopNodeOptions, out io.Writer) *cobra.Command

func NewCmdTopPod added in v1.4.0

func NewCmdTopPod(f cmdutil.Factory, options *TopPodOptions, out io.Writer) *cobra.Command

func NewCmdUncordon added in v1.2.0

func NewCmdUncordon(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewCmdVersion

func NewCmdVersion(f cmdutil.Factory, out io.Writer) *cobra.Command

func NewKubectlCommand added in v0.15.0

func NewKubectlCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Command

NewKubectlCommand creates the `kubectl` command and its nested children.

func ReapResult added in v0.16.2

func ReapResult(r *resource.Result, f cmdutil.Factory, out io.Writer, isDefaultDelete, ignoreNotFound bool, timeout time.Duration, gracePeriod int, waitForDeletion, shortOutput bool, mapper meta.RESTMapper, quiet bool) error

func RunApiVersions added in v0.14.0

func RunApiVersions(f cmdutil.Factory, w io.Writer) error

func RunApply added in v1.1.1

func RunApply(f cmdutil.Factory, cmd *cobra.Command, out, errOut io.Writer, options *ApplyOptions) error

func RunAutoscale added in v1.1.1

func RunAutoscale(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions) error

func RunClusterInfo added in v0.13.1

func RunClusterInfo(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error

func RunCompletion added in v1.3.0

func RunCompletion(out io.Writer, boilerPlate string, cmd *cobra.Command, args []string) error

func RunCreate added in v0.13.1

func RunCreate(f cmdutil.Factory, cmd *cobra.Command, out, errOut io.Writer, options *CreateOptions) error

func RunCreateSubcommand added in v1.2.0

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 RunDescribe(f cmdutil.Factory, out, cmdErr io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions, describerSettings *printers.DescriberSettings) error

func RunDiff added in v1.9.0

func RunDiff(f cmdutil.Factory, diff *DiffProgram, options *DiffOptions, from, to string) error

RunDiff uses the factory to parse file arguments, find the version to diff, and find each Info object for each files, and runs against the differ.

func RunEditOnCreate added in v1.5.0

func RunEditOnCreate(f cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, options *resource.FilenameOptions) error

func RunExplain added in v1.2.0

func RunExplain(f cmdutil.Factory, out, cmdErr io.Writer, cmd *cobra.Command, args []string) error

RunExplain executes the appropriate steps to print a model's documentation

func RunExpose added in v0.13.1

func RunExpose(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions) error

func RunHelp added in v1.4.0

func RunHelp(cmd *cobra.Command, args []string)

func RunPatch added in v0.21.0

func RunPatch(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, options *PatchOptions) error

func RunProxy added in v0.13.1

func RunProxy(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error

func RunReplace added in v0.21.0

func RunReplace(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions) error

func RunRollingUpdate added in v0.13.1

func RunRollingUpdate(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions) error

func RunRun added in v1.8.0

func RunRun(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cobra.Command, args []string, argsLenAtDash int) error

func RunScale added in v0.18.0

func RunScale(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, shortOutput bool, options *resource.FilenameOptions) error

RunScale executes the scaling

func SupportEviction added in v1.5.0

func SupportEviction(clientset kubernetes.Interface) (string, error)

SupportEviction uses Discovery API to find out if the server support eviction subresource If support, it will return its groupVersion; Otherwise, it will return ""

Types

type AnnotateOptions added in v1.1.1

type AnnotateOptions struct {
	// Filename options
	resource.FilenameOptions
	// contains filtered or unexported fields
}

AnnotateOptions have the data required to perform the annotate operation

func (*AnnotateOptions) Complete added in v1.1.1

func (o *AnnotateOptions) Complete(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.1

func (o AnnotateOptions) RunAnnotate(f cmdutil.Factory, cmd *cobra.Command) error

RunAnnotate does the work

func (AnnotateOptions) Validate added in v1.1.1

func (o AnnotateOptions) Validate() error

Validate checks to the AnnotateOptions to see if there is sufficient information run the command.

type ApplyOptions added in v1.1.1

type ApplyOptions struct {
	FilenameOptions resource.FilenameOptions
	Selector        string
	Force           bool
	Prune           bool
	Cascade         bool
	GracePeriod     int
	PruneResources  []pruneResource
	Timeout         time.Duration
	// contains filtered or unexported fields
}

type AttachOptions added in v1.1.1

type AttachOptions struct {
	StreamOptions

	CommandName string

	Pod *api.Pod

	Attach        RemoteAttach
	PodClient     coreclient.PodsGetter
	GetPodTimeout time.Duration
	Config        *restclient.Config
}

AttachOptions declare the arguments accepted by the Exec command

func (*AttachOptions) Complete added in v1.1.1

func (p *AttachOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, argsIn []string) error

Complete verifies command line arguments and loads data from the command environment

func (*AttachOptions) GetContainerName added in v1.1.1

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.1

func (p *AttachOptions) Run() error

Run executes a validated remote execution against a pod.

func (*AttachOptions) Validate added in v1.1.1

func (p *AttachOptions) Validate() error

Validate checks that the provided attach options are specified.

type CertificateOptions added in v1.5.0

type CertificateOptions struct {
	resource.FilenameOptions
	// contains filtered or unexported fields
}

func (*CertificateOptions) Complete added in v1.5.0

func (options *CertificateOptions) Complete(cmd *cobra.Command, args []string) error

func (*CertificateOptions) RunCertificateApprove added in v1.5.0

func (options *CertificateOptions) RunCertificateApprove(f cmdutil.Factory, out io.Writer) error

func (*CertificateOptions) RunCertificateDeny added in v1.5.0

func (options *CertificateOptions) RunCertificateDeny(f cmdutil.Factory, out io.Writer) error

func (*CertificateOptions) Validate added in v1.5.0

func (options *CertificateOptions) Validate() error

type ConvertOptions added in v1.2.0

type ConvertOptions struct {
	resource.FilenameOptions
	// contains filtered or unexported fields
}

ConvertOptions have the data required to perform the convert operation

func (*ConvertOptions) Complete added in v1.2.0

func (o *ConvertOptions) Complete(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) (err error)

Complete collects information required to run Convert command from command line.

func (*ConvertOptions) RunConvert added in v1.2.0

func (o *ConvertOptions) RunConvert() error

RunConvert implements the generic Convert command

type CreateClusterRoleOptions added in v1.6.0

type CreateClusterRoleOptions struct {
	*CreateRoleOptions
	NonResourceURLs []string
}

func (*CreateClusterRoleOptions) Complete added in v1.7.0

func (c *CreateClusterRoleOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (*CreateClusterRoleOptions) RunCreateRole added in v1.6.0

func (c *CreateClusterRoleOptions) RunCreateRole() error

func (*CreateClusterRoleOptions) Validate added in v1.7.0

func (c *CreateClusterRoleOptions) Validate() error

type CreateOptions added in v1.1.1

type CreateOptions struct {
	FilenameOptions  resource.FilenameOptions
	Selector         string
	EditBeforeCreate bool
	Raw              string
}

func (*CreateOptions) ValidateArgs added in v1.9.0

func (o *CreateOptions) ValidateArgs(cmd *cobra.Command, args []string) error

type CreateRoleOptions added in v1.6.0

type CreateRoleOptions struct {
	Name          string
	Verbs         []string
	Resources     []ResourceOptions
	ResourceNames []string

	DryRun       bool
	OutputFormat string
	Namespace    string
	Client       clientgorbacv1.RbacV1Interface
	Mapper       meta.RESTMapper
	Out          io.Writer
	PrintObject  func(obj runtime.Object) error
	PrintSuccess func(mapper meta.RESTMapper, shortOutput bool, out io.Writer, resource, name string, dryRun bool, operation string)
}

func (*CreateRoleOptions) Complete added in v1.6.0

func (c *CreateRoleOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (*CreateRoleOptions) RunCreateRole added in v1.6.0

func (c *CreateRoleOptions) RunCreateRole() error

func (*CreateRoleOptions) Validate added in v1.6.0

func (c *CreateRoleOptions) Validate() error

type CreateSubcommandOptions added in v1.2.0

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 string
}

CreateSubcommandOptions is an options struct to support create subcommands

type DefaultRemoteAttach added in v1.1.1

type DefaultRemoteAttach struct{}

DefaultRemoteAttach is the standard implementation of attaching

func (*DefaultRemoteAttach) Attach added in v1.1.1

func (*DefaultRemoteAttach) Attach(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error

type DefaultRemoteExecutor added in v1.1.1

type DefaultRemoteExecutor struct{}

DefaultRemoteExecutor is the standard implementation of remote command execution

func (*DefaultRemoteExecutor) Execute added in v1.1.1

func (*DefaultRemoteExecutor) Execute(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error

type DeleteOptions added in v1.1.1

type DeleteOptions struct {
	resource.FilenameOptions

	Selector        string
	DeleteAll       bool
	IgnoreNotFound  bool
	Cascade         bool
	DeleteNow       bool
	ForceDeletion   bool
	WaitForDeletion bool

	GracePeriod int
	Timeout     time.Duration

	Include3rdParty bool
	Output          string

	Mapper meta.RESTMapper
	Result *resource.Result

	Out    io.Writer
	ErrOut io.Writer
	// contains filtered or unexported fields
}

func (*DeleteOptions) Complete added in v1.6.0

func (o *DeleteOptions) Complete(f cmdutil.Factory, out, errOut io.Writer, args []string, cmd *cobra.Command) error

func (*DeleteOptions) RunDelete added in v1.6.0

func (o *DeleteOptions) RunDelete() error

func (*DeleteOptions) Validate added in v1.6.0

func (o *DeleteOptions) Validate(cmd *cobra.Command) error

type DiffOptions added in v1.9.0

type DiffOptions struct {
	FilenameOptions resource.FilenameOptions
}

type DiffProgram added in v1.9.0

type DiffProgram struct {
	Exec   exec.Interface
	Stdout io.Writer
	Stderr io.Writer
}

DiffProgram finds and run the diff program. The value of KUBERNETES_EXTERNAL_DIFF environment variable will be used a diff program. By default, `diff(1)` will be used.

func (*DiffProgram) Run added in v1.9.0

func (d *DiffProgram) Run(from, to string) error

Run runs the detected diff program. `from` and `to` are the directory to diff.

type DiffVersion added in v1.9.0

type DiffVersion struct {
	Dir  *Directory
	Name string
}

DiffVersion gets the proper version of objects, and aggregate them into a directory.

func NewDiffVersion added in v1.9.0

func NewDiffVersion(name string) (*DiffVersion, error)

NewDiffVersion creates a new DiffVersion with the named version.

func (*DiffVersion) Print added in v1.9.0

func (v *DiffVersion) Print(obj Object, printer Printer) error

Print prints the object using the printer into a new file in the directory.

type Differ added in v1.9.0

type Differ struct {
	From *DiffVersion
	To   *DiffVersion
}

Differ creates two DiffVersion and diffs them.

func NewDiffer added in v1.9.0

func NewDiffer(from, to string) (*Differ, error)

func (*Differ) Diff added in v1.9.0

func (d *Differ) Diff(obj Object, printer Printer) error

Diff diffs to versions of a specific object, and print both versions to directories.

func (*Differ) Run added in v1.9.0

func (d *Differ) Run(diff *DiffProgram) error

Run runs the diff program against both directories.

func (*Differ) TearDown added in v1.9.0

func (d *Differ) TearDown()

TearDown removes both temporary directories recursively.

type Directory added in v1.9.0

type Directory struct {
	Name string
}

Directory creates a new temp directory, and allows to easily create new files.

func CreateDirectory added in v1.9.0

func CreateDirectory(prefix string) (*Directory, error)

CreateDirectory does create the actual disk directory, and return a new representation of it.

func (*Directory) Delete added in v1.9.0

func (d *Directory) Delete() error

Delete removes the directory recursively.

func (*Directory) NewFile added in v1.9.0

func (d *Directory) NewFile(name string) (*os.File, error)

NewFile creates a new file in the directory.

type DrainOptions added in v1.2.0

type DrainOptions struct {
	Factory            cmdutil.Factory
	Force              bool
	DryRun             bool
	GracePeriodSeconds int
	IgnoreDaemonsets   bool
	Timeout            time.Duration

	DeleteLocalData bool
	Selector        string

	Out    io.Writer
	ErrOut io.Writer
	// contains filtered or unexported fields
}

func (*DrainOptions) RunCordonOrUncordon added in v1.2.0

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.0

func (o *DrainOptions) RunDrain() error

RunDrain runs the 'drain' command

func (*DrainOptions) SetupDrain added in v1.2.0

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 ExecOptions added in v1.1.1

type ExecOptions struct {
	StreamOptions

	Command []string

	FullCmdName       string
	SuggestedCmdUsage string

	Executor  RemoteExecutor
	PodClient coreclient.PodsGetter
	Config    *restclient.Config
}

ExecOptions declare the arguments accepted by the Exec command

func (*ExecOptions) Complete added in v1.1.1

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.1

func (p *ExecOptions) Run() error

Run executes a validated remote execution against a pod.

func (*ExecOptions) Validate added in v1.1.1

func (p *ExecOptions) Validate() error

Validate checks that the provided exec options are specified.

type HeapsterTopOptions added in v1.6.0

type HeapsterTopOptions struct {
	Namespace string
	Service   string
	Scheme    string
	Port      string
}

func (*HeapsterTopOptions) Bind added in v1.6.0

func (o *HeapsterTopOptions) Bind(flags *pflag.FlagSet)

type InfoObject added in v1.9.0

type InfoObject struct {
	Info    *resource.Info
	Encoder runtime.Encoder
	Parser  *parse.Factory
}

InfoObject is an implementation of the Object interface. It gets all the information from the Info object.

func (InfoObject) Last added in v1.9.0

func (obj InfoObject) Last() (map[string]interface{}, error)

func (InfoObject) Live added in v1.9.0

func (obj InfoObject) Live() (map[string]interface{}, error)

func (InfoObject) Local added in v1.9.0

func (obj InfoObject) Local() (map[string]interface{}, error)

func (InfoObject) Merged added in v1.9.0

func (obj InfoObject) Merged() (map[string]interface{}, error)

func (InfoObject) Name added in v1.9.0

func (obj InfoObject) Name() string

type LabelOptions added in v1.1.1

type LabelOptions struct {
	// Filename options
	resource.FilenameOptions
	// contains filtered or unexported fields
}

LabelOptions have the data required to perform the label operation

func (*LabelOptions) Complete added in v1.5.0

func (o *LabelOptions) Complete(out io.Writer, cmd *cobra.Command, args []string) (err error)

Complete adapts from the command line args and factory to the data required.

func (*LabelOptions) RunLabel added in v1.5.0

func (o *LabelOptions) RunLabel(f cmdutil.Factory, cmd *cobra.Command) error

RunLabel does the work

func (*LabelOptions) Validate added in v1.5.0

func (o *LabelOptions) Validate() error

Validate checks to the LabelOptions to see if there is sufficient information run the command.

type LogsOptions added in v1.2.0

type LogsOptions struct {
	Namespace   string
	ResourceArg string
	Options     runtime.Object

	Mapper  meta.RESTMapper
	Typer   runtime.ObjectTyper
	Decoder runtime.Decoder

	Object        runtime.Object
	GetPodTimeout time.Duration
	LogsForObject func(object, options runtime.Object, timeout time.Duration) (*restclient.Request, error)

	Out io.Writer
}

func (*LogsOptions) Complete added in v1.2.0

func (o *LogsOptions) Complete(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error

func (LogsOptions) RunLogs added in v1.2.0

func (o LogsOptions) RunLogs() error

RunLogs retrieves a pod log

func (LogsOptions) Validate added in v1.2.0

func (o LogsOptions) Validate() error

type Object added in v1.9.0

type Object interface {
	Local() (map[string]interface{}, error)
	Live() (map[string]interface{}, error)
	Last() (map[string]interface{}, error)
	Merged() (map[string]interface{}, error)

	Name() string
}

Object is an interface that let's you retrieve multiple version of it.

type PatchBuffer added in v1.7.0

type PatchBuffer struct {
	Patch     []byte
	PatchType types.PatchType
}

type PatchOptions added in v1.1.1

type PatchOptions struct {
	resource.FilenameOptions

	Local bool

	OutputFormat string
}

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.0

type PortForwardOptions struct {
	Namespace     string
	PodName       string
	RESTClient    *restclient.RESTClient
	Config        *restclient.Config
	PodClient     coreclient.PodsGetter
	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.0

func (o *PortForwardOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

Complete completes all the required options for port-forward cmd.

func (PortForwardOptions) RunPortForward added in v1.4.0

func (o PortForwardOptions) RunPortForward() error

RunPortForward implements all the necessary functionality for port-forward cmd.

func (PortForwardOptions) Validate added in v1.4.0

func (o PortForwardOptions) Validate() error

Validate validates all the required options for port-forward cmd.

type Printer added in v1.9.0

type Printer struct{}

Printer is used to print an object.

func (*Printer) Print added in v1.9.0

func (p *Printer) Print(obj map[string]interface{}, w io.Writer) error

Print the object inside the writer w.

type RemoteAttach added in v1.1.1

type RemoteAttach interface {
	Attach(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error
}

RemoteAttach defines the interface accepted by the Attach command - provided for test stubbing

type RemoteExecutor added in v1.1.1

type RemoteExecutor interface {
	Execute(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error
}

RemoteExecutor defines the interface accepted by the Exec command - provided for test stubbing

type ResourceOptions added in v1.7.0

type ResourceOptions struct {
	Group       string
	Resource    string
	SubResource string
}

type RunObject added in v1.8.0

type RunObject struct {
	Object  runtime.Object
	Kind    string
	Mapper  meta.RESTMapper
	Mapping *meta.RESTMapping
}

type SetLastAppliedOptions added in v1.6.0

type SetLastAppliedOptions struct {
	FilenameOptions  resource.FilenameOptions
	Selector         string
	InfoList         []*resource.Info
	Mapper           meta.RESTMapper
	Typer            runtime.ObjectTyper
	Namespace        string
	EnforceNamespace bool
	DryRun           bool
	ShortOutput      bool
	CreateAnnotation bool
	Output           string
	Codec            runtime.Encoder
	PatchBufferList  []PatchBuffer
	Factory          cmdutil.Factory
	Out              io.Writer
	ErrOut           io.Writer
}

func (*SetLastAppliedOptions) Complete added in v1.6.0

func (o *SetLastAppliedOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error

func (*SetLastAppliedOptions) RunSetLastApplied added in v1.6.0

func (o *SetLastAppliedOptions) RunSetLastApplied(f cmdutil.Factory, cmd *cobra.Command) error

func (*SetLastAppliedOptions) Validate added in v1.6.0

func (o *SetLastAppliedOptions) Validate(f cmdutil.Factory, cmd *cobra.Command) error

type StreamOptions added in v1.4.0

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() error

Validate checks to the TaintOptions to see if there is sufficient information run the command.

type TopNodeOptions added in v1.4.0

type TopNodeOptions struct {
	ResourceName    string
	Selector        string
	NodeClient      corev1.CoreV1Interface
	HeapsterOptions HeapsterTopOptions
	Client          *metricsutil.HeapsterMetricsClient
	Printer         *metricsutil.TopCmdPrinter
}

TopNodeOptions contains all the options for running the top-node cli command.

func (*TopNodeOptions) Complete added in v1.4.0

func (o *TopNodeOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string, out io.Writer) error

func (TopNodeOptions) RunTopNode added in v1.4.0

func (o TopNodeOptions) RunTopNode() error

func (*TopNodeOptions) Validate added in v1.4.0

func (o *TopNodeOptions) Validate() error

type TopOptions added in v1.4.0

type TopOptions struct{}

TopOptions contains all the options for running the top cli command.

type TopPodOptions added in v1.4.0

type TopPodOptions struct {
	ResourceName    string
	Namespace       string
	Selector        string
	AllNamespaces   bool
	PrintContainers bool
	PodClient       corev1.PodsGetter
	HeapsterOptions HeapsterTopOptions
	Client          *metricsutil.HeapsterMetricsClient
	Printer         *metricsutil.TopCmdPrinter
}

func (*TopPodOptions) Complete added in v1.4.0

func (o *TopPodOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string, out io.Writer) error

func (TopPodOptions) RunTopPod added in v1.4.0

func (o TopPodOptions) RunTopPod() error

func (*TopPodOptions) Validate added in v1.4.0

func (o *TopPodOptions) Validate() error

type Version added in v1.7.0

type Version struct {
	ClientVersion *apimachineryversion.Info `json:"clientVersion,omitempty" yaml:"clientVersion,omitempty"`
	ServerVersion *apimachineryversion.Info `json:"serverVersion,omitempty" yaml:"serverVersion,omitempty"`
}

type VersionOptions added in v1.8.0

type VersionOptions struct {
	// contains filtered or unexported fields
}

VersionOptions: describe the options available to users of the "kubectl version" command.

func (*VersionOptions) Complete added in v1.8.0

func (o *VersionOptions) Complete(cmd *cobra.Command) error

func (*VersionOptions) Run added in v1.8.0

func (o *VersionOptions) Run(f cmdutil.Factory, out io.Writer) error

func (*VersionOptions) Validate added in v1.8.0

func (o *VersionOptions) Validate() error

type ViewLastAppliedOptions added in v1.6.0

type ViewLastAppliedOptions struct {
	FilenameOptions              resource.FilenameOptions
	Selector                     string
	LastAppliedConfigurationList []string
	OutputFormat                 string
	All                          bool
	Factory                      cmdutil.Factory
	Out                          io.Writer
	ErrOut                       io.Writer
}

func (*ViewLastAppliedOptions) Complete added in v1.6.0

func (o *ViewLastAppliedOptions) Complete(f cmdutil.Factory, args []string) error

func (*ViewLastAppliedOptions) RunApplyViewLastApplied added in v1.6.0

func (o *ViewLastAppliedOptions) RunApplyViewLastApplied() error

func (*ViewLastAppliedOptions) Validate added in v1.6.0

func (o *ViewLastAppliedOptions) Validate(cmd *cobra.Command) error

func (*ViewLastAppliedOptions) ValidateOutputArgs added in v1.6.0

func (o *ViewLastAppliedOptions) ValidateOutputArgs(cmd *cobra.Command) error

Directories

Path Synopsis
env
Package env provides functions to incorporate environment variables into kubectl commands.
Package env provides functions to incorporate environment variables into kubectl commands.
openapi
Package openapi is a collection of libraries for fetching the openapi spec from a Kubernetes server and then indexing the type definitions.
Package openapi is a collection of libraries for fetching the openapi spec from a Kubernetes server and then indexing the type definitions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL