common

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: Apache-2.0 Imports: 11 Imported by: 29

Documentation

Index

Constants

View Source
const (
	// InventoryLabel is the label stored on the ConfigMap
	// inventory object. The value of the label is a unique
	// identifier (by default a UUID), representing the set of
	// objects applied at the same time as the inventory object.
	// This inventory object is used for pruning and deletion.
	InventoryLabel = "cli-utils.sigs.k8s.io/inventory-id"
	// InventoryHash defines an annotation which stores the hash of
	// the set of objects applied at the same time as the inventory
	// object. This annotation is set on the inventory object at the
	// time of the apply. The hash is computed from the sorted strings
	// of the applied object's metadata (ObjMetadata). The hash is
	// used as a suffix of the inventory object name. Example:
	//   inventory-1e5824fb
	InventoryHash = "cli-utils.sigs.k8s.io/inventory-hash"
	// Resource lifecycle annotation key for "on-remove" operations.
	OnRemoveAnnotation = "cli-utils.sigs.k8s.io/on-remove"
	// Resource lifecycle annotation value to prevent deletion.
	OnRemoveKeep = "keep"
)

Variables

Functions

func DemandOneDirectory

func DemandOneDirectory(paths []string) (genericclioptions.FileNameFlags, error)

DemandOneDirectoryOrStdin processes "paths" to ensure the single argument in the array is a directory. Returns FileNameFlags populated with the directory (recursive flag set), or the StdIn dash. An empty array gets treated as StdIn (adding dash to the array). Returns an error if more than one element in the array or the filepath is not a directory.

func ExpandPackageDir

ExpandPackageDir expands the one package directory entry in the flags to all the config file paths recursively. Excludes the inventory object (since this object is specially processed). Used for the diff command, so it will not always show a diff of the inventory object. Must be called AFTER DemandOneDirectory.

func FilterInputFile added in v0.13.0

func FilterInputFile(in io.Reader, tmpDir string) error

FilterInputFile copies the resource config on stdin into a file at the tmpDir, filtering the inventory object. It is the responsibility of the caller to clean up the tmpDir. Returns an error if one occurs.

func RandomStr added in v0.18.0

func RandomStr(seed int64) string

RandomStr returns an eight-digit (with leading zeros) string of a random number seeded with the parameter.

Types

type DryRunStrategy added in v0.18.0

type DryRunStrategy int
const (
	// DryRunNone indicates the client will make all mutating calls
	DryRunNone DryRunStrategy = iota

	// DryRunClient, or client-side dry-run, indicates the client will prevent
	// making mutating calls such as CREATE, PATCH, and DELETE
	DryRunClient

	// DryRunServer, or server-side dry-run, indicates the client will send
	// mutating calls to the APIServer with the dry-run parameter to prevent
	// persisting changes.
	//
	// Note that clients sending server-side dry-run calls should verify that
	// the APIServer and the resource supports server-side dry-run, and otherwise
	// clients should fail early.
	//
	// If a client sends a server-side dry-run call to an APIServer that doesn't
	// support server-side dry-run, then the APIServer will persist changes inadvertently.
	DryRunServer
)

func (DryRunStrategy) ClientDryRun added in v0.18.0

func (drs DryRunStrategy) ClientDryRun() bool

ClientDryRun returns true if input drs is DryRunClient

func (DryRunStrategy) ClientOrServerDryRun added in v0.18.0

func (drs DryRunStrategy) ClientOrServerDryRun() bool

ClientOrServerDryRun returns true if input drs is either client or server dry run

func (DryRunStrategy) ServerDryRun added in v0.18.0

func (drs DryRunStrategy) ServerDryRun() bool

ServerDryRun returns true if input drs is DryRunServer

Jump to

Keyboard shortcuts

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