kubectlk8s.io/kubectl/pkg/cmd/annotate Index | Files

package annotate

import "k8s.io/kubectl/pkg/cmd/annotate"

Index

Functions

func NewCmdAnnotate

func NewCmdAnnotate(parent string, f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewCmdAnnotate creates the `annotate` command

Types

type AnnotateFlags

type AnnotateFlags struct {
	// Common user flags
	All            bool
	AllNamespaces  bool
	DryRunStrategy cmdutil.DryRunStrategy
	FieldManager   string
	FieldSelector  string
	resource.FilenameOptions
	List         bool
	Local        bool
	OutputFormat string

	PrintFlags  *genericclioptions.PrintFlags
	RecordFlags *genericclioptions.RecordFlags

	Selector string

	genericiooptions.IOStreams
	// contains filtered or unexported fields
}

AnnotateFlags directly reflect the information that CLI is gathering via flags. They will be converted to Options, which reflect the runtime requirements for the command. This structure reduces the transformation to wiring and makes the logic itself easy to unit test

func NewAnnotateFlags

func NewAnnotateFlags(streams genericiooptions.IOStreams) *AnnotateFlags

NewAnnotateFlags returns a default AnnotateFlags

func (*AnnotateFlags) AddFlags

func (flags *AnnotateFlags) AddFlags(cmd *cobra.Command, ioStreams genericiooptions.IOStreams)

AddFlags registers flags for a cli.

func (*AnnotateFlags) ToOptions

func (flags *AnnotateFlags) ToOptions(f cmdutil.Factory, cmd *cobra.Command, args []string) (*AnnotateOptions, error)

ToOptions converts from CLI inputs to runtime inputs.

type AnnotateOptions

type AnnotateOptions struct {
	resource.FilenameOptions

	genericiooptions.IOStreams

	PrintObj printers.ResourcePrinterFunc

	Recorder genericclioptions.Recorder
	// contains filtered or unexported fields
}

AnnotateOptions have the data required to perform the annotate operation

func (AnnotateOptions) RunAnnotate

func (o AnnotateOptions) RunAnnotate() error

RunAnnotate does the work

Source Files

annotate.go

Version
v0.32.3 (latest)
Published
Mar 12, 2025
Platform
linux/amd64
Imports
23 packages
Last checked
5 days ago

Tools for package owners.