package cmd
import "k8s.io/kubernetes/pkg/kubectl/cmd"
Example (PrintServiceWithLabels)¶
Code:
{
tf := cmdtesting.NewTestFactory()
defer tf.Cleanup()
ns := legacyscheme.Codecs
tf.Client = &fake.RESTClient{
NegotiatedSerializer: ns,
Client: nil,
}
cmd := resource.NewCmdGet(tf, 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()
cmd.Flags().Set("label-columns", "l1")
err := cmdutil.PrintObject(cmd, svc, ld)
if err != nil {
fmt.Printf("Unexpected error: %v", err)
}
// Output:
// |NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE L1|
// |svc1 ClusterIP 10.1.1.1 <none> 53/UDP,53/TCP 10y value|
// |svc2 ClusterIP 10.1.1.2 <none> 80/TCP,8080/TCP 10y dolla-bill-yall|
// ||
}
Output:
|NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE L1| |svc1 ClusterIP 10.1.1.1 <none> 53/UDP,53/TCP 10y value| |svc2 ClusterIP 10.1.1.2 <none> 80/TCP,8080/TCP 10y dolla-bill-yall| ||
Index ¶
- Constants
- func DescribeMatchingResources(f cmdutil.Factory, namespace, rsrc, prefix string, describerSettings *printers.DescriberSettings, out io.Writer, originalError error) error
- func NewCmdAlpha(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Command
- func NewCmdAnnotate(f cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdApiResources(f cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdApiVersions(f cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdApply(baseName string, f cmdutil.Factory, out, errOut io.Writer) *cobra.Command
- func NewCmdApplyEditLastApplied(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command
- func NewCmdApplySetLastApplied(f cmdutil.Factory, out, errout io.Writer) *cobra.Command
- func NewCmdApplyViewLastApplied(f cmdutil.Factory, out, err 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 NewCmdCertificate(f cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdCertificateApprove(f cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdCertificateDeny(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(out io.Writer, boilerPlate string) *cobra.Command
- func NewCmdConvert(f cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdCordon(f cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdCp(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command
- func NewCmdDelete(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command
- func NewCmdDescribe(f cmdutil.Factory, out, cmdErr io.Writer) *cobra.Command
- func NewCmdDiff(f cmdutil.Factory, stdout, stderr io.Writer) *cobra.Command
- func NewCmdDrain(f cmdutil.Factory, out, errOut 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 NewCmdForPlugin(f cmdutil.Factory, plugin *plugins.Plugin, runner plugins.PluginRunner, in io.Reader, out, errout io.Writer) *cobra.Command
- func NewCmdHelp() *cobra.Command
- func NewCmdLabel(f cmdutil.Factory, out, errout io.Writer) *cobra.Command
- func NewCmdLogs(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command
- func NewCmdOptions(out io.Writer) *cobra.Command
- func NewCmdPatch(f cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdPlugin(f cmdutil.Factory, in io.Reader, out, err 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, errOut io.Writer) *cobra.Command
- func NewCmdRollingUpdate(f cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdRun(f cmdutil.Factory, in io.Reader, out, errOut io.Writer) *cobra.Command
- func NewCmdScale(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command
- func NewCmdTaint(f cmdutil.Factory, out io.Writer) *cobra.Command
- func NewCmdTop(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command
- func NewCmdTopNode(f cmdutil.Factory, options *TopNodeOptions, out io.Writer) *cobra.Command
- func NewCmdTopPod(f cmdutil.Factory, options *TopPodOptions, 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 NewDefaultKubectlCommand() *cobra.Command
- func NewKubectlCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Command
- func RunApiVersions(f cmdutil.Factory, w io.Writer) error
- func RunClusterInfo(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error
- func RunCompletion(out io.Writer, boilerPlate string, cmd *cobra.Command, args []string) error
- func RunDescribe(f cmdutil.Factory, out, cmdErr io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions, describerSettings *printers.DescriberSettings) error
- func RunDiff(f cmdutil.Factory, diff *DiffProgram, options *DiffOptions, from, to 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, options *resource.FilenameOptions) error
- func RunHelp(cmd *cobra.Command, args []string)
- func RunPatch(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, options *PatchOptions) error
- func RunProxy(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error
- func RunRollingUpdate(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions) error
- func RunScale(f cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, args []string, shortOutput bool, options *resource.FilenameOptions) error
- func ScaleJob(info *resource.Info, jobsClient batchclient.JobsGetter, count uint, preconditions *kubectl.ScalePrecondition, retry, waitForReplicas *kubectl.RetryParams) error
- func SupportEviction(clientset kubernetes.Interface) (string, error)
- func SupportedMetricsAPIVersionAvailable(discoveredAPIGroups *metav1.APIGroupList) bool
- type AnnotateOptions
- func NewAnnotateOptions(out io.Writer) *AnnotateOptions
- func (o *AnnotateOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error
- func (o AnnotateOptions) RunAnnotate(f cmdutil.Factory, cmd *cobra.Command) error
- func (o AnnotateOptions) Validate() error
- type ApiResourcesOptions
- func (o *ApiResourcesOptions) Complete(cmd *cobra.Command) error
- func (o *ApiResourcesOptions) RunApiResources(cmd *cobra.Command, f cmdutil.Factory) error
- func (o *ApiResourcesOptions) Validate(cmd *cobra.Command) error
- type ApplyOptions
- func NewApplyOptions(out, errout io.Writer) *ApplyOptions
- func (o *ApplyOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error
- func (o *ApplyOptions) Run(f cmdutil.Factory, cmd *cobra.Command) error
- type AttachOptions
- func (p *AttachOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, argsIn []string) error
- func (p *AttachOptions) GetContainerName(pod *api.Pod) (string, error)
- func (p *AttachOptions) Run() error
- func (p *AttachOptions) Validate() error
- type AutoscaleOptions
- func NewAutoscaleOptions() *AutoscaleOptions
- func (o *AutoscaleOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error
- func (o *AutoscaleOptions) RunAutoscale(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error
- type CertificateOptions
- func (options *CertificateOptions) Complete(cmd *cobra.Command, args []string) error
- func (options *CertificateOptions) RunCertificateApprove(f cmdutil.Factory, out io.Writer, force bool) error
- func (options *CertificateOptions) RunCertificateDeny(f cmdutil.Factory, out io.Writer, force bool) error
- func (options *CertificateOptions) Validate() error
- type ConvertOptions
- func NewConvertOptions() *ConvertOptions
- func (o *ConvertOptions) Complete(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) (err error)
- func (o *ConvertOptions) RunConvert() error
- type DefaultRemoteAttach
- type DefaultRemoteExecutor
- type DeleteFlags
- func NewDeleteCommandFlags(usage string) *DeleteFlags
- func NewDeleteFlags(usage string) *DeleteFlags
- func (f *DeleteFlags) AddFlags(cmd *cobra.Command)
- func (f *DeleteFlags) ToOptions(out, errOut io.Writer) *DeleteOptions
- type DeleteOptions
- func (o *DeleteOptions) Complete(f cmdutil.Factory, out, errOut io.Writer, args []string, cmd *cobra.Command) error
- func (o *DeleteOptions) DeleteResult(r *resource.Result) error
- func (o *DeleteOptions) PrintObj(info *resource.Info)
- func (o *DeleteOptions) ReapResult(r *resource.Result, isDefaultDelete, quiet bool) error
- func (o *DeleteOptions) RunDelete() error
- func (o *DeleteOptions) Validate(cmd *cobra.Command) error
- type DiffOptions
- type DiffProgram
- type DiffVersion
- func NewDiffVersion(name string) (*DiffVersion, error)
- func (v *DiffVersion) Print(obj Object, printer Printer) error
- type Differ
- func NewDiffer(from, to string) (*Differ, error)
- func (d *Differ) Diff(obj Object, printer Printer) error
- func (d *Differ) Run(diff *DiffProgram) error
- func (d *Differ) TearDown()
- type Directory
- func CreateDirectory(prefix string) (*Directory, error)
- func (d *Directory) Delete() error
- func (d *Directory) NewFile(name string) (*os.File, error)
- type DrainOptions
- func NewDrainOptions(f cmdutil.Factory, out, errOut io.Writer) *DrainOptions
- func (o *DrainOptions) RunCordonOrUncordon(desired bool) error
- func (o *DrainOptions) RunDrain() error
- func (o *DrainOptions) SetupDrain(cmd *cobra.Command, args []string) error
- type ExecOptions
- func (p *ExecOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, argsIn []string, argsLenAtDash int) error
- func (p *ExecOptions) Run() error
- func (p *ExecOptions) Validate() error
- type FileNameFlags
- func (o *FileNameFlags) AddFlags(cmd *cobra.Command)
- func (o *FileNameFlags) ToOptions() resource.FilenameOptions
- type HeapsterTopOptions
- type InfoObject
- func (obj InfoObject) Last() (map[string]interface{}, error)
- func (obj InfoObject) Live() (map[string]interface{}, error)
- func (obj InfoObject) Local() (map[string]interface{}, error)
- func (obj InfoObject) Merged() (map[string]interface{}, error)
- func (obj InfoObject) Name() string
- type LabelOptions
- func (o *LabelOptions) Complete(out io.Writer, cmd *cobra.Command, args []string) (err error)
- func (o *LabelOptions) RunLabel(f cmdutil.Factory, cmd *cobra.Command) error
- func (o *LabelOptions) Validate() error
- type LogsOptions
- func (o *LogsOptions) Complete(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error
- func (o LogsOptions) RunLogs() error
- func (o LogsOptions) Validate() error
- type Object
- type PatchBuffer
- type PatchOptions
- type PortForwardOptions
- func (o *PortForwardOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error
- func (o PortForwardOptions) RunPortForward() error
- func (o PortForwardOptions) Validate() error
- type Printer
- type RemoteAttach
- type RemoteExecutor
- type ReplaceOpts
- func (o *ReplaceOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error
- func (o *ReplaceOpts) Run() error
- func (o *ReplaceOpts) Validate(cmd *cobra.Command) error
- type RunObject
- type RunOptions
- func NewRunOptions(in io.Reader, out, errOut io.Writer) *RunOptions
- func (o *RunOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error
- func (o *RunOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) error
- type SetLastAppliedOptions
- func NewSetLastAppliedOptions(out, errout io.Writer) *SetLastAppliedOptions
- func (o *SetLastAppliedOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error
- func (o *SetLastAppliedOptions) RunSetLastApplied(f cmdutil.Factory, cmd *cobra.Command) error
- func (o *SetLastAppliedOptions) Validate(f cmdutil.Factory, cmd *cobra.Command) error
- type StreamOptions
- type TaintOptions
- func (o *TaintOptions) Complete(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) (err error)
- func (o TaintOptions) RunTaint() error
- func (o TaintOptions) Validate() error
- type TopNodeOptions
- func (o *TopNodeOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string, out io.Writer) error
- func (o TopNodeOptions) RunTopNode() error
- func (o *TopNodeOptions) Validate() error
- type TopPodOptions
- func (o *TopPodOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string, out io.Writer) error
- func (o TopPodOptions) RunTopPod() error
- func (o *TopPodOptions) Validate() error
- type Version
- type VersionOptions
- func (o *VersionOptions) Complete(cmd *cobra.Command) error
- func (o *VersionOptions) Run(f cmdutil.Factory, out io.Writer) error
- func (o *VersionOptions) Validate() error
- type ViewLastAppliedOptions
- func NewViewLastAppliedOptions(out, err io.Writer) *ViewLastAppliedOptions
- func (o *ViewLastAppliedOptions) Complete(cmd *cobra.Command, f cmdutil.Factory, args []string) error
- func (o *ViewLastAppliedOptions) RunApplyViewLastApplied(cmd *cobra.Command) error
- func (o *ViewLastAppliedOptions) Validate(cmd *cobra.Command) error
Examples ¶
Constants ¶
const ( EvictionKind = "Eviction" EvictionSubresource = "pods/eviction" )
Functions ¶
func DescribeMatchingResources ¶
func DescribeMatchingResources(f cmdutil.Factory, namespace, rsrc, prefix string, describerSettings *printers.DescriberSettings, out io.Writer, originalError error) error
func NewCmdAlpha ¶
NewCmdAlpha creates a command that acts as an alternate root command for features in alpha
func NewCmdAnnotate ¶
func NewCmdApiResources ¶
func NewCmdApiVersions ¶
func NewCmdApply ¶
func NewCmdApplyEditLastApplied ¶
func NewCmdApplySetLastApplied ¶
func NewCmdApplyViewLastApplied ¶
func NewCmdAttach ¶
func NewCmdAutoscale ¶
func NewCmdCertificate ¶
func NewCmdCertificateApprove ¶
func NewCmdCertificateDeny ¶
func NewCmdClusterInfo ¶
func NewCmdClusterInfoDump ¶
NewCmdCreateSecret groups subcommands to create various types of secrets
func NewCmdCompletion ¶
func NewCmdConvert ¶
NewCmdConvert creates a command object for the generic "convert" action, which translates the config file into a given version.
func NewCmdCordon ¶
func NewCmdCp ¶
NewCmdCp creates a new Copy command.
func NewCmdDelete ¶
func NewCmdDescribe ¶
func NewCmdDiff ¶
func NewCmdDrain ¶
func NewCmdEdit ¶
func NewCmdExec ¶
func NewCmdExplain ¶
NewCmdExplain returns a cobra command for swagger docs
func NewCmdExposeService ¶
func NewCmdForPlugin ¶
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 ¶
func NewCmdLabel ¶
func NewCmdLogs ¶
NewCmdLogs creates a new pod logs command
func NewCmdOptions ¶
NewCmdOptions implements the options command
func NewCmdPatch ¶
func NewCmdPlugin ¶
NewCmdPlugin creates the command that is the top-level for plugin commands.
func NewCmdPortForward ¶
func NewCmdProxy ¶
func NewCmdReplace ¶
func NewCmdRollingUpdate ¶
func NewCmdRun ¶
func NewCmdScale ¶
NewCmdScale returns a cobra command with the appropriate configuration and flags to run scale
func NewCmdTaint ¶
func NewCmdTop ¶
func NewCmdTopNode ¶
func NewCmdTopPod ¶
func NewCmdUncordon ¶
func NewCmdVersion ¶
func NewDefaultKubectlCommand ¶
func NewKubectlCommand ¶
NewKubectlCommand creates the `kubectl` command and its nested children.
func RunApiVersions ¶
func RunClusterInfo ¶
func RunCompletion ¶
func RunDescribe ¶
func RunDescribe(f cmdutil.Factory, out, cmdErr io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions, describerSettings *printers.DescriberSettings) error
func RunDiff ¶
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 RunExplain ¶
RunExplain executes the appropriate steps to print a model's documentation
func RunExpose ¶
func RunExpose(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions) error
func RunHelp ¶
func RunPatch ¶
func RunPatch(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, options *PatchOptions) error
func RunProxy ¶
func RunRollingUpdate ¶
func RunRollingUpdate(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions) error
func RunScale ¶
func RunScale(f cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, args []string, shortOutput bool, options *resource.FilenameOptions) error
RunScale executes the scaling
func ScaleJob ¶
func ScaleJob(info *resource.Info, jobsClient batchclient.JobsGetter, count uint, preconditions *kubectl.ScalePrecondition, retry, waitForReplicas *kubectl.RetryParams) error
func SupportEviction ¶
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 ""
func SupportedMetricsAPIVersionAvailable ¶
func SupportedMetricsAPIVersionAvailable(discoveredAPIGroups *metav1.APIGroupList) bool
Types ¶
type AnnotateOptions ¶
type AnnotateOptions struct { // Filename options resource.FilenameOptions RecordFlags *genericclioptions.RecordFlags Recorder genericclioptions.Recorder // contains filtered or unexported fields }
AnnotateOptions have the data required to perform the annotate operation
func NewAnnotateOptions ¶
func NewAnnotateOptions(out io.Writer) *AnnotateOptions
func (*AnnotateOptions) Complete ¶
Complete adapts from the command line args and factory to the data required.
func (AnnotateOptions) RunAnnotate ¶
RunAnnotate does the work
func (AnnotateOptions) Validate ¶
func (o AnnotateOptions) Validate() error
Validate checks to the AnnotateOptions to see if there is sufficient information run the command.
type ApiResourcesOptions ¶
type ApiResourcesOptions struct { Output string APIGroup string Namespaced bool NoHeaders bool // contains filtered or unexported fields }
ApiResourcesOptions 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()
func (*ApiResourcesOptions) Complete ¶
func (o *ApiResourcesOptions) Complete(cmd *cobra.Command) error
func (*ApiResourcesOptions) RunApiResources ¶
func (*ApiResourcesOptions) Validate ¶
func (o *ApiResourcesOptions) Validate(cmd *cobra.Command) error
type ApplyOptions ¶
type ApplyOptions struct { RecordFlags *genericclioptions.RecordFlags FilenameOptions resource.FilenameOptions Recorder genericclioptions.Recorder Selector string Force bool Prune bool Cascade bool GracePeriod int PruneResources []pruneResource Timeout time.Duration All bool Overwrite bool OpenApiPatch bool PruneWhitelist []string Out io.Writer ErrOut io.Writer // contains filtered or unexported fields }
func NewApplyOptions ¶
func NewApplyOptions(out, errout io.Writer) *ApplyOptions
func (*ApplyOptions) Complete ¶
func (*ApplyOptions) Run ¶
TODO(juanvallejo): break dependency on factory and cmd
type AttachOptions ¶
type AttachOptions struct { StreamOptions CommandName string SuggestedCmdUsage 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 ¶
Complete verifies command line arguments and loads data from the command environment
func (*AttachOptions) GetContainerName ¶
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 ¶
func (p *AttachOptions) Run() error
Run executes a validated remote execution against a pod.
func (*AttachOptions) Validate ¶
func (p *AttachOptions) Validate() error
Validate checks that the provided attach options are specified.
type AutoscaleOptions ¶
type AutoscaleOptions struct { FilenameOptions resource.FilenameOptions RecordFlags *genericclioptions.RecordFlags Recorder genericclioptions.Recorder }
func NewAutoscaleOptions ¶
func NewAutoscaleOptions() *AutoscaleOptions
func (*AutoscaleOptions) Complete ¶
func (*AutoscaleOptions) RunAutoscale ¶
func (o *AutoscaleOptions) RunAutoscale(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error
type CertificateOptions ¶
type CertificateOptions struct { resource.FilenameOptions // contains filtered or unexported fields }
func (*CertificateOptions) Complete ¶
func (options *CertificateOptions) Complete(cmd *cobra.Command, args []string) error
func (*CertificateOptions) RunCertificateApprove ¶
func (options *CertificateOptions) RunCertificateApprove(f cmdutil.Factory, out io.Writer, force bool) error
func (*CertificateOptions) RunCertificateDeny ¶
func (options *CertificateOptions) RunCertificateDeny(f cmdutil.Factory, out io.Writer, force bool) error
func (*CertificateOptions) Validate ¶
func (options *CertificateOptions) Validate() error
type ConvertOptions ¶
type ConvertOptions struct { resource.FilenameOptions // contains filtered or unexported fields }
ConvertOptions have the data required to perform the convert operation
func NewConvertOptions ¶
func NewConvertOptions() *ConvertOptions
func (*ConvertOptions) Complete ¶
Complete collects information required to run Convert command from command line.
func (*ConvertOptions) RunConvert ¶
func (o *ConvertOptions) RunConvert() error
RunConvert implements the generic Convert command
type DefaultRemoteAttach ¶
type DefaultRemoteAttach struct{}
DefaultRemoteAttach is the standard implementation of attaching
func (*DefaultRemoteAttach) Attach ¶
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 ¶
type DefaultRemoteExecutor struct{}
DefaultRemoteExecutor is the standard implementation of remote command execution
func (*DefaultRemoteExecutor) Execute ¶
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 DeleteFlags ¶
type DeleteFlags struct { FileNameFlags *FileNameFlags All *bool Cascade *bool Force *bool GracePeriod *int IgnoreNotFound *bool Now *bool Timeout *time.Duration Output *string }
PrintFlags composes common printer flag structs used for commands requiring deletion logic.
func NewDeleteCommandFlags ¶
func NewDeleteCommandFlags(usage string) *DeleteFlags
NewDeleteCommandFlags provides default flags and values for use with the "delete" command
func NewDeleteFlags ¶
func NewDeleteFlags(usage string) *DeleteFlags
NewDeleteFlags provides default flags and values for use in commands outside of "delete"
func (*DeleteFlags) AddFlags ¶
func (f *DeleteFlags) AddFlags(cmd *cobra.Command)
func (*DeleteFlags) ToOptions ¶
func (f *DeleteFlags) ToOptions(out, errOut io.Writer) *DeleteOptions
type DeleteOptions ¶
type DeleteOptions struct { resource.FilenameOptions Selector string DeleteAll bool IgnoreNotFound bool Cascade bool DeleteNow bool ForceDeletion bool WaitForDeletion bool Reaper func(mapping *meta.RESTMapping) (kubectl.Reaper, error) GracePeriod int Timeout time.Duration Output string Mapper meta.RESTMapper Result *resource.Result Out io.Writer ErrOut io.Writer }
func (*DeleteOptions) Complete ¶
func (o *DeleteOptions) Complete(f cmdutil.Factory, out, errOut io.Writer, args []string, cmd *cobra.Command) error
func (*DeleteOptions) DeleteResult ¶
func (o *DeleteOptions) DeleteResult(r *resource.Result) error
func (*DeleteOptions) PrintObj ¶
func (o *DeleteOptions) PrintObj(info *resource.Info)
deletion printing is special because we do not have an object to print. This mirrors name printer behavior
func (*DeleteOptions) ReapResult ¶
func (o *DeleteOptions) ReapResult(r *resource.Result, isDefaultDelete, quiet bool) error
func (*DeleteOptions) RunDelete ¶
func (o *DeleteOptions) RunDelete() error
func (*DeleteOptions) Validate ¶
func (o *DeleteOptions) Validate(cmd *cobra.Command) error
type DiffOptions ¶
type DiffOptions struct { FilenameOptions resource.FilenameOptions }
type DiffProgram ¶
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 ¶
func (d *DiffProgram) Run(from, to string) error
Run runs the detected diff program. `from` and `to` are the directory to diff.
type DiffVersion ¶
DiffVersion gets the proper version of objects, and aggregate them into a directory.
func NewDiffVersion ¶
func NewDiffVersion(name string) (*DiffVersion, error)
NewDiffVersion creates a new DiffVersion with the named version.
func (*DiffVersion) Print ¶
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 ¶
type Differ struct { From *DiffVersion To *DiffVersion }
Differ creates two DiffVersion and diffs them.
func NewDiffer ¶
func (*Differ) Diff ¶
Diff diffs to versions of a specific object, and print both versions to directories.
func (*Differ) Run ¶
func (d *Differ) Run(diff *DiffProgram) error
Run runs the diff program against both directories.
func (*Differ) TearDown ¶
func (d *Differ) TearDown()
TearDown removes both temporary directories recursively.
type Directory ¶
type Directory struct { Name string }
Directory creates a new temp directory, and allows to easily create new files.
func CreateDirectory ¶
CreateDirectory does create the actual disk directory, and return a new representation of it.
func (*Directory) Delete ¶
Delete removes the directory recursively.
func (*Directory) NewFile ¶
NewFile creates a new file in the directory.
type DrainOptions ¶
type DrainOptions struct { Factory cmdutil.Factory Force bool DryRun bool GracePeriodSeconds int IgnoreDaemonsets bool Timeout time.Duration DeleteLocalData bool Selector string PodSelector string Out io.Writer ErrOut io.Writer // contains filtered or unexported fields }
func NewDrainOptions ¶
func NewDrainOptions(f cmdutil.Factory, out, errOut io.Writer) *DrainOptions
func (*DrainOptions) RunCordonOrUncordon ¶
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 ¶
func (o *DrainOptions) RunDrain() error
RunDrain runs the 'drain' command
func (*DrainOptions) SetupDrain ¶
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 ¶
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 ¶
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 ¶
func (p *ExecOptions) Run() error
Run executes a validated remote execution against a pod.
func (*ExecOptions) Validate ¶
func (p *ExecOptions) Validate() error
Validate checks that the provided exec options are specified.
type FileNameFlags ¶
func (*FileNameFlags) AddFlags ¶
func (o *FileNameFlags) AddFlags(cmd *cobra.Command)
func (*FileNameFlags) ToOptions ¶
func (o *FileNameFlags) ToOptions() resource.FilenameOptions
type HeapsterTopOptions ¶
func (*HeapsterTopOptions) Bind ¶
func (o *HeapsterTopOptions) Bind(flags *pflag.FlagSet)
type InfoObject ¶
InfoObject is an implementation of the Object interface. It gets all the information from the Info object.
func (InfoObject) Last ¶
func (obj InfoObject) Last() (map[string]interface{}, error)
func (InfoObject) Live ¶
func (obj InfoObject) Live() (map[string]interface{}, error)
func (InfoObject) Local ¶
func (obj InfoObject) Local() (map[string]interface{}, error)
func (InfoObject) Merged ¶
func (obj InfoObject) Merged() (map[string]interface{}, error)
func (InfoObject) Name ¶
func (obj InfoObject) Name() string
type LabelOptions ¶
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 ¶
Complete adapts from the command line args and factory to the data required.
func (*LabelOptions) RunLabel ¶
RunLabel does the work
func (*LabelOptions) Validate ¶
func (o *LabelOptions) Validate() error
Validate checks to the LabelOptions to see if there is sufficient information run the command.
type LogsOptions ¶
type LogsOptions struct { Namespace string ResourceArg string AllContainers bool 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 ¶
func (o *LogsOptions) Complete(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error
func (LogsOptions) RunLogs ¶
func (o LogsOptions) RunLogs() error
RunLogs retrieves a pod log
func (LogsOptions) Validate ¶
func (o LogsOptions) Validate() error
type Object ¶
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 ¶
type PatchOptions ¶
type PatchOptions struct { resource.FilenameOptions Local bool DryRun 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 ¶
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 ¶
Complete completes all the required options for port-forward cmd.
func (PortForwardOptions) RunPortForward ¶
func (o PortForwardOptions) RunPortForward() error
RunPortForward implements all the necessary functionality for port-forward cmd.
func (PortForwardOptions) Validate ¶
func (o PortForwardOptions) Validate() error
Validate validates all the required options for port-forward cmd.
type Printer ¶
type Printer struct{}
Printer is used to print an object.
func (*Printer) Print ¶
Print the object inside the writer w.
type RemoteAttach ¶
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 ¶
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 ReplaceOpts ¶
type ReplaceOpts struct { PrintFlags *printers.PrintFlags DeleteFlags *DeleteFlags DeleteOptions *DeleteOptions PrintObj func(obj runtime.Object) error Schema validation.Schema Builder func() *resource.Builder BuilderArgs []string ShouldRecord func(info *resource.Info) bool Namespace string EnforceNamespace bool Out io.Writer ErrOut io.Writer // contains filtered or unexported fields }
func (*ReplaceOpts) Complete ¶
func (*ReplaceOpts) Run ¶
func (o *ReplaceOpts) Run() error
func (*ReplaceOpts) Validate ¶
func (o *ReplaceOpts) Validate(cmd *cobra.Command) error
type RunObject ¶
type RunObject struct { Versioned runtime.Object Object runtime.Object Kind string Mapping *meta.RESTMapping }
type RunOptions ¶
type RunOptions struct { PrintFlags *printers.PrintFlags DeleteFlags *DeleteFlags DeleteOptions *DeleteOptions RecordFlags *genericclioptions.RecordFlags DryRun bool PrintObj func(runtime.Object) error Recorder genericclioptions.Recorder ArgsLenAtDash int Attach bool Expose bool Generator string Image string Interactive bool LeaveStdinOpen bool Port string Quiet bool Schedule string TTY bool In io.Reader Out io.Writer ErrOut io.Writer }
func NewRunOptions ¶
func NewRunOptions(in io.Reader, out, errOut io.Writer) *RunOptions
func (*RunOptions) Complete ¶
func (*RunOptions) Run ¶
type SetLastAppliedOptions ¶
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 PatchBufferList []PatchBuffer Factory cmdutil.Factory Out io.Writer ErrOut io.Writer }
func NewSetLastAppliedOptions ¶
func NewSetLastAppliedOptions(out, errout io.Writer) *SetLastAppliedOptions
func (*SetLastAppliedOptions) Complete ¶
func (*SetLastAppliedOptions) RunSetLastApplied ¶
func (*SetLastAppliedOptions) Validate ¶
type StreamOptions ¶
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 ¶
type TaintOptions struct {
// contains filtered or unexported fields
}
TaintOptions have the data required to perform the taint operation
func (*TaintOptions) Complete ¶
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 ¶
func (o TaintOptions) RunTaint() error
RunTaint does the work
func (TaintOptions) Validate ¶
func (o TaintOptions) Validate() error
Validate checks to the TaintOptions to see if there is sufficient information run the command.
type TopNodeOptions ¶
type TopNodeOptions struct { ResourceName string Selector string NodeClient corev1.CoreV1Interface HeapsterOptions HeapsterTopOptions Client *metricsutil.HeapsterMetricsClient Printer *metricsutil.TopCmdPrinter DiscoveryClient discovery.DiscoveryInterface MetricsClient metricsclientset.Interface }
TopNodeOptions contains all the options for running the top-node cli command.
func (*TopNodeOptions) Complete ¶
func (o *TopNodeOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string, out io.Writer) error
func (TopNodeOptions) RunTopNode ¶
func (o TopNodeOptions) RunTopNode() error
func (*TopNodeOptions) Validate ¶
func (o *TopNodeOptions) Validate() error
type TopPodOptions ¶
type TopPodOptions struct { ResourceName string Namespace string Selector string AllNamespaces bool PrintContainers bool PodClient corev1.PodsGetter HeapsterOptions HeapsterTopOptions Client *metricsutil.HeapsterMetricsClient Printer *metricsutil.TopCmdPrinter DiscoveryClient discovery.DiscoveryInterface MetricsClient metricsclientset.Interface }
func (*TopPodOptions) Complete ¶
func (o *TopPodOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string, out io.Writer) error
func (TopPodOptions) RunTopPod ¶
func (o TopPodOptions) RunTopPod() error
func (*TopPodOptions) Validate ¶
func (o *TopPodOptions) Validate() error
type Version ¶
type Version struct { ClientVersion *apimachineryversion.Info `json:"clientVersion,omitempty" yaml:"clientVersion,omitempty"` ServerVersion *apimachineryversion.Info `json:"serverVersion,omitempty" yaml:"serverVersion,omitempty"` }
type VersionOptions ¶
type VersionOptions struct {
// contains filtered or unexported fields
}
VersionOptions: describe the options available to users of the "kubectl version" command.
func (*VersionOptions) Complete ¶
func (o *VersionOptions) Complete(cmd *cobra.Command) error
func (*VersionOptions) Run ¶
func (*VersionOptions) Validate ¶
func (o *VersionOptions) Validate() error
type ViewLastAppliedOptions ¶
type ViewLastAppliedOptions struct { FilenameOptions resource.FilenameOptions Selector string LastAppliedConfigurationList []string OutputFormat string All bool Factory cmdutil.Factory Out io.Writer ErrOut io.Writer }
func NewViewLastAppliedOptions ¶
func NewViewLastAppliedOptions(out, err io.Writer) *ViewLastAppliedOptions
func (*ViewLastAppliedOptions) Complete ¶
func (o *ViewLastAppliedOptions) Complete(cmd *cobra.Command, f cmdutil.Factory, args []string) error
func (*ViewLastAppliedOptions) RunApplyViewLastApplied ¶
func (o *ViewLastAppliedOptions) RunApplyViewLastApplied(cmd *cobra.Command) error
func (*ViewLastAppliedOptions) Validate ¶
func (o *ViewLastAppliedOptions) Validate(cmd *cobra.Command) error
Source Files ¶
alpha.go annotate.go apiresources.go apiversions.go apply.go apply_edit_last_applied.go apply_set_last_applied.go apply_view_last_applied.go attach.go autoscale.go certificates.go clusterinfo.go clusterinfo_dump.go cmd.go completion.go convert.go cp.go delete.go delete_flags.go describe.go diff.go drain.go edit.go exec.go explain.go expose.go help.go label.go logs.go options.go patch.go plugin.go portforward.go proxy.go replace.go rollingupdate.go run.go scale.go taint.go top.go top_node.go top_pod.go version.go
Directories ¶
Path | Synopsis |
---|---|
pkg/kubectl/cmd/auth | |
pkg/kubectl/cmd/config | |
pkg/kubectl/cmd/create | |
pkg/kubectl/cmd/resource | |
pkg/kubectl/cmd/rollout | |
pkg/kubectl/cmd/scalejob | Package scalejob is deprecated This package contains deprecated functions used to "scale" jobs in a way inconsistent with normal scaling rules |
pkg/kubectl/cmd/set | |
pkg/kubectl/cmd/templates | |
pkg/kubectl/cmd/testing | |
pkg/kubectl/cmd/util | |
pkg/kubectl/cmd/util/editor | |
pkg/kubectl/cmd/util/env | Package env provides functions to incorporate environment variables into kubectl commands. |
pkg/kubectl/cmd/util/jsonmerge | |
pkg/kubectl/cmd/util/openapi | Package openapi is a collection of libraries for fetching the openapi spec from a Kubernetes server and then indexing the type definitions. |
pkg/kubectl/cmd/util/openapi/testing | |
pkg/kubectl/cmd/util/openapi/validation | |
pkg/kubectl/cmd/util/sanity |
- Version
- v1.11.0-alpha.1
- Published
- Apr 19, 2018
- Platform
- js/wasm
- Imports
- 109 packages
- Last checked
- 34 seconds ago –
Tools for package owners.