kubernetes: github.com/aeneasr/kubernetes/pkg/kubectl/cmd Index | Examples | Files | Directories

package cmd

import "github.com/aeneasr/kubernetes/pkg/kubectl/cmd"

Code:

f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, true, false, false, false, []string{})
tf.Client = &fake.RESTClient{
    Codec:  codec,
    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   AGE       CONTAINER(S)   IMAGE(S)               SELECTOR
foo       1         1         10y       foo,foo2       someimage,someimage2   foo=bar

Code:

f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, false, false, false, []string{})
tf.Client = &fake.RESTClient{
    Codec:  codec,
    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

Code:

f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, true, false, false, []string{})
tf.Client = &fake.RESTClient{
    Codec:  codec,
    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

Code:

f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, false, true, false, []string{})
tf.Client = &fake.RESTClient{
    Codec:  codec,
    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

Code:

f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, true, false, false, false, []string{})
tf.Client = &fake.RESTClient{
    Codec:  codec,
    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},
        },
    },
}
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       NODE
test1     1/2       podPhase   6          10y       kubernetes-minion-abcd

Code:

f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, false, false, false, []string{})
tf.Client = &fake.RESTClient{
    Codec:  codec,
    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   AGE
foo       1         1         10y

Code:

f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, true, false, false, false, false, []string{})
tf.Client = &fake.RESTClient{
    Codec:  codec,
    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,
    },
}
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   AGE
beep        foo       1         1         10y

Code:

f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, true, false, false, false, false, []string{"l1"})
tf.Client = &fake.RESTClient{
    Codec:  codec,
    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 := util.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

Examples

Package Files

annotate.go apiversions.go apply.go attach.go autoscale.go clusterinfo.go cmd.go convert.go create.go create_configmap.go create_namespace.go create_secret.go create_serviceaccount.go delete.go describe.go drain.go edit.go exec.go explain.go expose.go get.go label.go logs.go namespace.go patch.go portforward.go proxy.go replace.go rollingupdate.go run.go scale.go stop.go version.go

func CreateConfigMap Uses

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

CreateConfigMap is the implementation of the create configmap command.

func CreateNamespace Uses

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 CreateSecretDockerRegistry Uses

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 Uses

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 CreateServiceAccount Uses

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 DeleteResult Uses

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

func DescribeMatchingResources Uses

func DescribeMatchingResources(mapper meta.RESTMapper, typer runtime.ObjectTyper, f *cmdutil.Factory, namespace, rsrc, prefix string, out io.Writer, originalError error) error

func NameFromCommandArgs Uses

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 NewCmdAnnotate Uses

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

func NewCmdApiVersions Uses

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

func NewCmdApply Uses

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

func NewCmdAttach Uses

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

func NewCmdAutoscale Uses

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

func NewCmdClusterInfo Uses

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

func NewCmdConvert Uses

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 Uses

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

func NewCmdCreate Uses

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

func NewCmdCreateConfigMap Uses

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

ConfigMap is a command to ease creating ConfigMaps.

func NewCmdCreateNamespace Uses

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

NewCmdCreateNamespace is a macro command to create a new namespace

func NewCmdCreateSecret Uses

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

NewCmdCreateSecret groups subcommands to create various types of secrets

func NewCmdCreateSecretDockerRegistry Uses

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 Uses

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 NewCmdCreateServiceAccount Uses

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

NewCmdCreateServiceAccount is a macro command to create a new service account

func NewCmdDelete Uses

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

func NewCmdDescribe Uses

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

func NewCmdDrain Uses

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

func NewCmdEdit Uses

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

func NewCmdExec Uses

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

func NewCmdExplain Uses

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

NewCmdExplain returns a cobra command for swagger docs

func NewCmdExposeService Uses

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

func NewCmdGet Uses

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

NewCmdGet creates a command object for the generic "get" action, which retrieves one or more resources from a server.

func NewCmdLabel Uses

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

func NewCmdLogs Uses

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

NewCmdLog creates a new pod logs command

func NewCmdNamespace Uses

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

TODO remove once people have been given enough time to notice

func NewCmdPatch Uses

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

func NewCmdPortForward Uses

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

func NewCmdProxy Uses

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

func NewCmdReplace Uses

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

func NewCmdRollingUpdate Uses

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

func NewCmdRun Uses

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

func NewCmdScale Uses

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 NewCmdStop Uses

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

func NewCmdUncordon Uses

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

func NewCmdVersion Uses

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

func NewKubectlCommand Uses

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 Uses

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

func Run Uses

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

func RunApiVersions Uses

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

func RunApply Uses

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

func RunAutoscale Uses

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

func RunClusterInfo Uses

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

func RunCreate Uses

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

func RunCreateSubcommand Uses

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

RunCreateSubcommand executes a create subcommand using the specified options

func RunDelete Uses

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

func RunDescribe Uses

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

func RunEdit Uses

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

func RunExplain Uses

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

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

func RunExpose Uses

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

func RunGet Uses

func RunGet(f *cmdutil.Factory, out 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 RunLabel Uses

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

func RunPatch Uses

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

func RunPortForward Uses

func RunPortForward(f *cmdutil.Factory, cmd *cobra.Command, args []string, fw portForwarder) error

func RunProxy Uses

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

func RunReplace Uses

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

func RunRollingUpdate Uses

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

func RunScale Uses

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

RunScale executes the scaling

func RunStop Uses

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

func RunVersion Uses

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

func ValidateArgs Uses

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

type AnnotateOptions Uses

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

AnnotateOptions have the data required to perform the annotate operation

func (*AnnotateOptions) Complete Uses

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 Uses

func (o AnnotateOptions) RunAnnotate() error

RunAnnotate does the work

func (AnnotateOptions) Validate Uses

func (o AnnotateOptions) Validate(args []string) error

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

type ApplyOptions Uses

type ApplyOptions struct {
    Filenames []string
    Recursive bool
}

ApplyOptions stores cmd.Flag values for apply. As new fields are added, add them here instead of referencing the cmd.Flags()

type AttachOptions Uses

type AttachOptions struct {
    Namespace     string
    PodName       string
    ContainerName string
    Stdin         bool
    TTY           bool
    CommandName   string

    // InterruptParent, if set, is used to handle interrupts while attached
    InterruptParent *interrupt.Handler

    In  io.Reader
    Out io.Writer
    Err io.Writer

    Pod *api.Pod

    Attach RemoteAttach
    Client *client.Client
    Config *restclient.Config
}

AttachOptions declare the arguments accepted by the Exec command

func (*AttachOptions) Complete Uses

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) GetContainer Uses

func (p *AttachOptions) GetContainer(pod *api.Pod) api.Container

GetContainer returns the container to attach to, with a fallback.

func (*AttachOptions) GetContainerName Uses

func (p *AttachOptions) GetContainerName(pod *api.Pod) string

GetContainerName returns the name of the container to attach to, with a fallback.

func (*AttachOptions) Run Uses

func (p *AttachOptions) Run() error

Run executes a validated remote execution against a pod.

func (*AttachOptions) Validate Uses

func (p *AttachOptions) Validate() error

Validate checks that the provided attach options are specified.

type AutoscaleOptions Uses

type AutoscaleOptions struct {
    Filenames []string
    Recursive bool
}

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 Uses

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

ConvertOptions have the data required to perform the convert operation

func (*ConvertOptions) Complete Uses

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 Uses

func (o *ConvertOptions) RunConvert() error

RunConvert implements the generic Convert command

type CreateOptions Uses

type CreateOptions struct {
    Filenames []string
    Recursive bool
}

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 Uses

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 Uses

type DefaultRemoteAttach struct{}

DefaultRemoteAttach is the standard implementation of attaching

func (*DefaultRemoteAttach) Attach Uses

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

type DefaultRemoteExecutor Uses

type DefaultRemoteExecutor struct{}

DefaultRemoteExecutor is the standard implementation of remote command execution

func (*DefaultRemoteExecutor) Execute Uses

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

type DeleteOptions Uses

type DeleteOptions struct {
    Filenames []string
    Recursive bool
}

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 Uses

type DescribeOptions struct {
    Filenames []string
    Recursive bool
}

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 Uses

type DrainOptions struct {
    Force              bool
    GracePeriodSeconds int
    IgnoreDaemonsets   bool
    // contains filtered or unexported fields
}

func (*DrainOptions) GetPodsForDeletion Uses

func (o *DrainOptions) GetPodsForDeletion() ([]api.Pod, error)

GetPodsForDeletion returns all the pods we're going to delete. If there are any unmanaged pods and the user didn't pass --force, we return that list in an error.

func (*DrainOptions) RunCordonOrUncordon Uses

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 Uses

func (o *DrainOptions) RunDrain() error

RunDrain runs the 'drain' command

func (*DrainOptions) SetupDrain Uses

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 Uses

type EditOptions struct {
    Filenames []string
    Recursive bool
}

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 Uses

type ExecOptions struct {
    Namespace     string
    PodName       string
    ContainerName string
    Stdin         bool
    TTY           bool
    Command       []string

    In  io.Reader
    Out io.Writer
    Err io.Writer

    Executor RemoteExecutor
    Client   *client.Client
    Config   *restclient.Config
}

ExecOptions declare the arguments accepted by the Exec command

func (*ExecOptions) Complete Uses

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 Uses

func (p *ExecOptions) Run() error

Run executes a validated remote execution against a pod.

func (*ExecOptions) Validate Uses

func (p *ExecOptions) Validate() error

Validate checks that the provided exec options are specified.

type ExposeOptions Uses

type ExposeOptions struct {
    Filenames []string
    Recursive bool
}

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 Uses

type GetOptions struct {
    Filenames []string
    Recursive bool
}

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 Uses

type LabelOptions struct {
    Filenames []string
    Recursive bool
}

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 Uses

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) Complete Uses

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

func (LogsOptions) RunLogs Uses

func (o LogsOptions) RunLogs() (int64, error)

RunLogs retrieves a pod log

func (LogsOptions) Validate Uses

func (o LogsOptions) Validate() error

type PatchOptions Uses

type PatchOptions struct {
    Filenames []string
    Recursive bool
}

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 RemoteAttach Uses

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

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

type RemoteExecutor Uses

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

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

type ReplaceOptions Uses

type ReplaceOptions struct {
    Filenames []string
    Recursive bool
}

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 Uses

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 Uses

type ScaleOptions struct {
    Filenames []string
    Recursive bool
}

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 Uses

type StopOptions struct {
    Filenames []string
    Recursive bool
}

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

Directories

PathSynopsis
config
rollout
util
util/editor
util/jsonmerge

Package cmd imports 62 packages (graph). Updated 2018-08-25. Refresh now. Tools for package owners.