package diff
import "k8s.io/kubectl/pkg/cmd/diff"
Index ¶
- func NewCmdDiff(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command
- type DiffOptions
- func NewDiffOptions(ioStreams genericiooptions.IOStreams) *DiffOptions
- func (o *DiffOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error
- func (o *DiffOptions) Run() error
- func (o *DiffOptions) Validate() error
- type DiffProgram
- type DiffVersion
- func NewDiffVersion(name string) (*DiffVersion, error)
- func (v *DiffVersion) Print(name string, obj runtime.Object, printer Printer) error
- type Differ
- func NewDiffer(from, to string) (*Differ, error)
- func (d *Differ) Diff(obj Object, printer Printer, showManagedFields bool) 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 InfoObject
- func (obj InfoObject) Live() runtime.Object
- func (obj InfoObject) Merged() (runtime.Object, error)
- func (obj InfoObject) Name() string
- type Masker
- func NewMasker(from, to runtime.Object) (*Masker, error)
- func (m *Masker) From() runtime.Object
- func (m *Masker) To() runtime.Object
- type Object
- type Printer
Functions ¶
func NewCmdDiff ¶
Types ¶
type DiffOptions ¶
type DiffOptions struct { FilenameOptions resource.FilenameOptions ServerSideApply bool FieldManager string ForceConflicts bool ShowManagedFields bool Concurrency int Selector string OpenAPIGetter openapi.OpenAPIResourcesGetter OpenAPIV3Root openapi3.Root DynamicClient dynamic.Interface CmdNamespace string EnforceNamespace bool Builder *resource.Builder Diff *DiffProgram // contains filtered or unexported fields }
func NewDiffOptions ¶
func NewDiffOptions(ioStreams genericiooptions.IOStreams) *DiffOptions
func (*DiffOptions) Complete ¶
func (*DiffOptions) Run ¶
func (o *DiffOptions) Run() error
Run 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 (*DiffOptions) Validate ¶
func (o *DiffOptions) Validate() error
Validate makes sure provided values for DiffOptions are valid
type DiffProgram ¶
type DiffProgram struct { Exec exec.Interface genericiooptions.IOStreams }
DiffProgram finds and run the diff program. The value of KUBECTL_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 ¶
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 InfoObject ¶
type InfoObject struct { LocalObj runtime.Object Info *resource.Info Encoder runtime.Encoder OpenAPIGetter openapi.OpenAPIResourcesGetter OpenAPIV3Root openapi3.Root Force bool ServerSideApply bool FieldManager string ForceConflicts bool genericiooptions.IOStreams }
InfoObject is an implementation of the Object interface. It gets all the information from the Info object.
func (InfoObject) Live ¶
func (obj InfoObject) Live() runtime.Object
Returns the live version of the object
func (InfoObject) Merged ¶
func (obj InfoObject) Merged() (runtime.Object, error)
Returns the "merged" object, as it would look like if applied or created.
func (InfoObject) Name ¶
func (obj InfoObject) Name() string
type Masker ¶
type Masker struct {
// contains filtered or unexported fields
}
Masker masks sensitive values in an object while preserving diff-able changes.
All sensitive values in the object will be masked with a fixed-length asterisk mask. If two values are different, an additional suffix will be added so they can be diff-ed.
func NewMasker ¶
func (*Masker) From ¶
From returns the masked version of the 'from' object.
func (*Masker) To ¶
To returns the masked version of the 'to' object.
type Object ¶
Object is an interface that let's you retrieve multiple version of it.
type Printer ¶
type Printer struct{}
Printer is used to print an object.
func (*Printer) Print ¶
Print the object inside the writer w.
Source Files ¶
diff.go prune.go
- Version
- v0.32.3 (latest)
- Published
- Mar 12, 2025
- Platform
- linux/amd64
- Imports
- 32 packages
- Last checked
- 5 days ago –
Tools for package owners.