apply

package module
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: Apache-2.0 Imports: 34 Imported by: 4

README

Go Report Card PkgGoDev Build Status

apply

kubectl apply packaged as a library

Acknowledgement

https://github.com/kubernetes/kubectl/tree/v0.18.9/pkg/cmd/apply

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmdApply

func NewCmdApply(baseName string, f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

NewCmdApply creates the `apply` command

Types

type ApplyOptions

type ApplyOptions struct {
	PrintFlags *genericclioptions.PrintFlags
	ToPrinter  func(string) (printers.ResourcePrinter, error)

	DeleteFlags   *delete.DeleteFlags
	DeleteOptions *delete.DeleteOptions

	ServerSideApply bool
	ForceConflicts  bool
	FieldManager    string
	Selector        string
	DryRunStrategy  cmdutil.DryRunStrategy
	DryRunVerifier  resource.Verifier

	All            bool
	Overwrite      bool
	OpenAPIPatch   bool
	PruneWhitelist []string

	Validator     validation.Schema
	Builder       *resource.Builder
	Mapper        meta.RESTMapper
	DynamicClient dynamic.Interface
	OpenAPISchema openapi.Resources

	Namespace        string
	EnforceNamespace bool

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

ApplyOptions defines flags and other configuration parameters for the `apply` command

func NewApplyOptions

func NewApplyOptions(ioStreams genericclioptions.IOStreams) *ApplyOptions

NewApplyOptions creates new ApplyOptions for the `apply` command

func (*ApplyOptions) ApplyOneObject

func (o *ApplyOptions) ApplyOneObject(info *resource.Info) error

func (*ApplyOptions) Complete

func (o *ApplyOptions) Complete(f cmdutil.Factory) error

Complete verifies if ApplyOptions are valid and without conflicts.

func (*ApplyOptions) CompleteFlags

func (o *ApplyOptions) CompleteFlags(f cmdutil.Factory, cmd *cobra.Command) error

CompleteFlags verifies if ApplyOptions are valid and without conflicts.

func (*ApplyOptions) GetObjects

func (o *ApplyOptions) GetObjects() ([]*resource.Info, error)

GetObjects returns a (possibly cached) version of all the valid objects to apply as a slice of pointer to resource.Info and an error if one or more occurred. IMPORTANT: This function can return both valid objects AND an error, since "ContinueOnError" is set on the builder. This function should not be called until AFTER the "complete" and "validate" methods have been called to ensure that the ApplyOptions is filled in and valid.

func (*ApplyOptions) Run

func (o *ApplyOptions) Run() error

Run executes the `apply` command.

func (*ApplyOptions) SetObjects

func (o *ApplyOptions) SetObjects(infos []*resource.Info)

SetObjects stores the set of objects (as resource.Info) to be subsequently applied.

type Patcher

type Patcher struct {
	Mapping       *meta.RESTMapping
	Helper        *resource.Helper
	DynamicClient dynamic.Interface

	Overwrite bool
	BackOff   clockwork.Clock

	Force        bool
	Cascade      bool
	Timeout      time.Duration
	GracePeriod  int
	ServerDryRun bool

	// If set, forces the patch against a specific resourceVersion
	ResourceVersion *string

	// Number of retries to make if the patch fails with conflict
	Retries int

	OpenapiSchema openapi.Resources
}

Patcher defines options to patch OpenAPI objects.

func (*Patcher) Patch

func (p *Patcher) Patch(current runtime.Object, modified []byte, source, namespace, name string, errOut io.Writer) ([]byte, runtime.Object, error)

Patch tries to patch an OpenAPI resource. On success, returns the merge patch as well the final patched object. On failure, returns an error.

Jump to

Keyboard shortcuts

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