Documentation ¶
Index ¶
- Constants
- Variables
- func EqualRevision(lhs *apps.ControllerRevision, rhs *apps.ControllerRevision) bool
- func FindEqualRevisions(revisions []*apps.ControllerRevision, needle *apps.ControllerRevision) []*apps.ControllerRevision
- func SortControllerRevisions(revisions []*apps.ControllerRevision)
- type OwnerAdapter
- type RevisionManager
Constants ¶
const ControllerRevisionHashLabel = "controller.kubernetes.io/hash"
Variables ¶
var PodCodec = scheme.Codecs.LegacyCodec(corev1.SchemeGroupVersion)
Functions ¶
func EqualRevision ¶
func EqualRevision(lhs *apps.ControllerRevision, rhs *apps.ControllerRevision) bool
EqualRevision returns true if lhs and rhs are either both nil, or both have same labels and annotations, or bath point to non-nil ControllerRevisions that contain semantically equivalent data. Otherwise this method returns false.
func FindEqualRevisions ¶
func FindEqualRevisions(revisions []*apps.ControllerRevision, needle *apps.ControllerRevision) []*apps.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 SortControllerRevisions ¶
func SortControllerRevisions(revisions []*apps.ControllerRevision)
SortControllerRevisions sorts revisions by their Revision.
Types ¶
type OwnerAdapter ¶
type OwnerAdapter interface { GetSelector(obj metav1.Object) *metav1.LabelSelector GetCollisionCount(obj metav1.Object) *int32 GetHistoryLimit(obj metav1.Object) int32 GetPatch(obj metav1.Object) ([]byte, error) GetCurrentRevision(obj metav1.Object) string IsInUsed(obj metav1.Object, controllerRevision string) bool }
type RevisionManager ¶
func NewRevisionManager ¶
func NewRevisionManager(client client.Client, scheme *runtime.Scheme, ownerGetter OwnerAdapter) *RevisionManager
func (*RevisionManager) ConstructRevisions ¶
func (rm *RevisionManager) ConstructRevisions(set client.Object, dryRun bool) (*apps.ControllerRevision, *apps.ControllerRevision, []*apps.ControllerRevision, *int32, bool, error)
ConstructRevisions returns the current and update ControllerRevisions for set. It also returns a collision count that records the number of name collisions set saw when creating new ControllerRevisions. This count is incremented on every name collision and is used in building the ControllerRevision names for name collision avoidance. This method may create a new revision, or modify the Revision of an existing revision if an update to set is detected. This method expects that revisions is sorted when supplied.