Version: v0.0.10 Latest Latest

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

Go to latest
Published: Oct 6, 2020 License: Apache-2.0 Imports: 19 Imported by: 0




View Source
const ControllerRevisionHashLabel = "controller.kubernetes.io/hash"


This section is empty.


func ControllerRevisionName

func ControllerRevisionName(prefix string, hash string) string

ControllerRevisionName returns the Name for a ControllerRevision in the form prefix-hash. If the length of prefix is greater than 223 bytes, it is truncated to allow for a name that is no larger than 253 bytes.

func EqualRevision

func EqualRevision(lhs *ketiv1.ControllerRevision, rhs *ketiv1.ControllerRevision) bool

EqualRevision returns true if lhs and rhs are either both nil, or both point to non-nil ControllerRevisions that contain semantically equivalent data. Otherwise this method returns false.

func FindEqualRevisions

func FindEqualRevisions(revisions []*ketiv1.ControllerRevision, needle *ketiv1.ControllerRevision) []*ketiv1.ControllerRevision

FindEqualRevisions returns all ControllerRevisions in revisions that are equal to needle using EqualRevision as the equality test. The returned slice preserves the order of revisions.

func HashControllerRevision

func HashControllerRevision(revision *ketiv1.ControllerRevision, probe *int32) string

HashControllerRevision hashes the contents of revision's Data using FNV hashing. If probe is not nil, the byte value of probe is added written to the hash as well. The returned hash will be a safe encoded string to avoid bad words.

func NewControllerRevision

func NewControllerRevision(parent metav1.Object,
	parentKind schema.GroupVersionKind,
	templateLabels map[string]string,
	data runtime.RawExtension,
	revision int64,
	collisionCount *int32) (*ketiv1.ControllerRevision, error)

func SortControllerRevisions

func SortControllerRevisions(revisions []*ketiv1.ControllerRevision)

SortControllerRevisions sorts revisions by their Revision.


type Interface

type Interface interface {
	// ListControllerRevisions lists all ControllerRevisions matching selector and owned by parent or no other
	// controller. If the returned error is nil the returned slice of ControllerRevisions is valid. If the
	// returned error is not nil, the returned slice is not valid.
	ListControllerRevisions(parent metav1.Object, selector labels.Selector) ([]*ketiv1.ControllerRevision, error)
	// CreateControllerRevision attempts to create the revision as owned by parent via a ControllerRef. If name
	// collision occurs, collisionCount (incremented each time collision occurs except for the first time) is
	// added to the hash of the revision and it is renamed using ControllerRevisionName. Implementations may
	// cease to attempt to retry creation after some number of attempts and return an error. If the returned
	// error is not nil, creation failed. If the returned error is nil, the returned ControllerRevision has been
	// created.
	// Callers must make sure that collisionCount is not nil. An error is returned if it is.
	CreateControllerRevision(parent metav1.Object, revision *ketiv1.ControllerRevision, collisionCount *int32) (*ketiv1.ControllerRevision, error)
	// DeleteControllerRevision attempts to delete revision. If the returned error is not nil, deletion has failed.
	DeleteControllerRevision(revision *ketiv1.ControllerRevision) error
	// UpdateControllerRevision updates revision such that its Revision is equal to newRevision. Implementations
	// may retry on conflict. If the returned error is nil, the update was successful and returned ControllerRevision
	// is valid. If the returned error is not nil, the update failed and the returned ControllerRevision is invalid.
	UpdateControllerRevision(revision *ketiv1.ControllerRevision, newRevision int64) (*ketiv1.ControllerRevision, error)
	// AdoptControllerRevision attempts to adopt revision by adding a ControllerRef indicating that the parent
	// Object of parentKind is the owner of revision. If revision is already owned, an error is returned. If the
	// resource patch fails, an error is returned. If no error is returned, the returned ControllerRevision is
	// valid.
	AdoptControllerRevision(parent metav1.Object, parentKind schema.GroupVersionKind, revision *ketiv1.ControllerRevision) (*ketiv1.ControllerRevision, error)
	// ReleaseControllerRevision attempts to release parent's ownership of revision by removing parent from the
	// OwnerReferences of revision. If an error is returned, parent remains the owner of revision. If no error is
	// returned, the returned ControllerRevision is valid.
	ReleaseControllerRevision(parent metav1.Object, revision *ketiv1.ControllerRevision) (*ketiv1.ControllerRevision, error)

Interface provides an interface allowing for management of a Controller's history as realized by recorded ControllerRevisions. An instance of Interface can be retrieved from NewHistory. Implementations must treat all pointer parameters as "in" parameter, and they must not be mutated.

func NewHistory

NewHistory returns an instance of Interface that uses client to communicate with the API Server and lister to list ControllerRevisions. This method should be used to create an Interface for all scenarios other than testing.

Source Files

Jump to

Keyboard shortcuts

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