controller

package
v0.0.0-...-f2730a8 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2018 License: Apache-2.0, BSD-3-Clause, MIT Imports: 64 Imported by: 0

Documentation

Overview

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Package controller is used to provide the core functionalities of machine-controller-manager

Index

Constants

View Source
const (

	// ClassAnnotation is the annotation used to identify a machine class
	ClassAnnotation = "machine.sapcloud.io/class"
	// MachineIDAnnotation is the annotation used to identify a machine ID
	MachineIDAnnotation = "machine.sapcloud.io/id"
	// DeleteFinalizerName is the finalizer used to identify the controller acting on an object
	DeleteFinalizerName = "machine.sapcloud.io/machine-controller-manager"
)
View Source
const (
	// ExpectationsTimeout - If a watch drops a delete event for a machine, it'll take this long
	// before a dormant controller waiting for those packets is woken up anyway. It is
	// specifically targeted at the case where some problem prevents an update
	// of expectations, without it the controller could stay asleep forever. This should
	// be set based on the expected latency of watch events.
	//
	// Currently a controller can service (create *and* observe the watch events for said
	// creation) about 10 machines a second, so it takes about 1 min to service
	// 500 machines. Just creation is limited to 20qps, and watching happens with ~10-30s
	// latency/machine at the scale of 3000 machines over 100 nodes.
	ExpectationsTimeout = 5 * time.Minute
	// SlowStartInitialBatchSize - When batching machine creates, is the size of the
	// initial batch.  The size of each successive batch is twice the size of
	// the previous batch.  For example, for a value of 1, batch sizes would be
	// 1, 2, 4, 8, ...  and for a value of 10, batch sizes would be
	// 10, 20, 40, 80, ...  Setting the value higher means that quota denials
	// will result in more doomed API calls and associated event spam.  Setting
	// the value lower will result in more API call round trip periods for
	// large batches.
	//
	// Given a number of machines to start "N":
	// The number of doomed calls per sync once quota is exceeded is given by:
	//      min(N,SlowStartInitialBatchSize)
	// The number of batches is given by:
	//      1+floor(log_2(ceil(N/SlowStartInitialBatchSize)))
	SlowStartInitialBatchSize = 1
)
View Source
const (
	// FailedCreateMachineReason is added in an event and in a machine set condition
	// when a machine for a machine set is failed to be created.
	FailedCreateMachineReason = "FailedCreate"
	// SuccessfulCreateMachineReason is added in an event when a machine for a machine set
	// is successfully created.
	SuccessfulCreateMachineReason = "SuccessfulCreate"
	// FailedDeleteMachineReason is added in an event and in a machine set condition
	// when a machine for a machine set is failed to be deleted.
	FailedDeleteMachineReason = "FailedDelete"
	// SuccessfulDeletemachineReason is added in an event when a machine for a machine set
	// is successfully deleted.
	SuccessfulDeleteMachineReason = "SuccessfulDelete"
)

Reasons for machine events

View Source
const (
	// RevisionAnnotation is the revision annotation of a deployment's machine sets which records its rollout sequence
	RevisionAnnotation = "deployment.kubernetes.io/revision"
	// RevisionHistoryAnnotation maintains the history of all old revisions that a machine set has served for a deployment.
	RevisionHistoryAnnotation = "deployment.kubernetes.io/revision-history"
	// DesiredReplicasAnnotation is the desired replicas for a deployment recorded as an annotation
	// in its machine sets. Helps in separating scaling events from the rollout process and for
	// determining if the new machine set for a deployment is really saturated.
	DesiredReplicasAnnotation = "deployment.kubernetes.io/desired-replicas"
	// MaxReplicasAnnotation is the maximum replicas a deployment can have at a given point, which
	// is deployment.spec.replicas + maxSurge. Used by the underlying machine sets to estimate their
	// proportions in case the deployment has surge replicas.
	MaxReplicasAnnotation = "deployment.kubernetes.io/max-replicas"

	// RollbackRevisionNotFound is not found rollback event reason
	RollbackRevisionNotFound = "DeploymentRollbackRevisionNotFound"
	// RollbackTemplateUnchanged is the template unchanged rollback event reason
	RollbackTemplateUnchanged = "DeploymentRollbackTemplateUnchanged"
	// RollbackDone is the done rollback event reason
	RollbackDone = "DeploymentRollback"

	// MachineSetUpdatedReason is added in a deployment when one of its machine sets is updated as part
	// of the rollout process.
	MachineSetUpdatedReason = "MachineSetUpdated"
	// FailedISCreateReason is added in a deployment when it cannot create a new machine set.
	FailedISCreateReason = "MachineSetCreateError"
	// NewMachineSetReason is added in a deployment when it creates a new machine set.
	NewMachineSetReason = "NewMachineSetCreated"
	// FoundNewISReason is added in a deployment when it adopts an existing machine set.
	FoundNewISReason = "FoundNewMachineSet"
	// NewISAvailableReason is added in a deployment when its newest machine set is made available
	// ie. the number of new machines that have passed readiness checks and run for at least minReadySeconds
	// is at least the minimum available machines that need to run for the deployment.
	NewISAvailableReason = "NewMachineSetAvailable"
	// TimedOutReason is added in a deployment when its newest machine set fails to show any progress
	// within the given deadline (progressDeadlineSeconds).
	TimedOutReason = "ProgressDeadlineExceeded"
	// PausedMachineDeployReason is added in a deployment when it is paused. Lack of progress shouldn't be
	// estimated once a deployment is paused.
	PausedMachineDeployReason = "DeploymentPaused"
	// ResumedMachineDeployReason is added in a deployment when it is resumed. Useful for not failing accidentally
	// deployments that paused amidst a rollout and are bounded by a deadline.
	ResumedMachineDeployReason = "DeploymentResumed"

	// MinimumReplicasAvailable is added in a deployment when it has its minimum replicas required available.
	MinimumReplicasAvailable = "MinimumReplicasAvailable"
	// MinimumReplicasUnavailable is added in a deployment when it doesn't have the minimum required replicas
	// available.
	MinimumReplicasUnavailable = "MinimumReplicasUnavailable"
)
View Source
const (
	// EvictionKind is the kind used for eviction
	EvictionKind = "Eviction"
	// EvictionSubresource is the kind used for evicting pods
	EvictionSubresource = "pods/eviction"

	// Interval is the default Poll interval
	Interval = time.Second * 1
)
View Source
const (
	// OverShootingReplicaCount freeze reason when replica count overshoots
	OverShootingReplicaCount = "OverShootingReplicaCount"
	// TimeoutOccurred freeze reason when machineSet timeout occurs
	TimeoutOccurred = "MachineSetTimeoutOccurred"
	// LastReplicaUpdate contains the last timestamp when the
	// number of replicas was changed
	LastReplicaUpdate = "safety.machine.sapcloud.io/lastreplicaupdate"
)
View Source
const (
	// BurstReplicas - Realistic value of the burstReplica field for the machine set manager based off
	// performance requirements for kubernetes 1.0.
	BurstReplicas = 100
)
View Source
const MachineClassKind = "MachineClass"

MachineClassKind is used to identify the machineClassKind

View Source
const (
	// MachinePriority is the annotation used to specify priority
	// associated with a machine while deleting it. The less its
	// priority the more likely it is to be deleted first
	// Default priority for a machine is set to 3
	MachinePriority = "machinepriority.machine.sapcloud.io"
)

Variables

View Source
var ExpKeyFunc = func(obj interface{}) (string, error) {
	if e, ok := obj.(*ControlleeExpectations); ok {
		return e.key, nil
	}
	return "", fmt.Errorf("Could not find key for obj %#v", obj)
}

ExpKeyFunc to parse out the key from a ControlleeExpectation

View Source
var GroupVersionKind = "machine.sapcloud.io/v1alpha1"

GroupVersionKind is the version kind used to identify objects managed by machine-controller-manager

View Source
var (
	// KeyFunc is the variable that stores the function that retreives the object key from an object
	KeyFunc = cache.DeletionHandlingMetaNamespaceKeyFunc
)
View Source
var (

	// ScrapeFailedCounter is a Prometheus metric, which counts errors during metrics collection.
	ScrapeFailedCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "mcm_scrape_failure_total",
		Help: "Total count of scrape failures.",
	}, []string{"kind"})
)
View Source
var UIDSetKeyFunc = func(obj interface{}) (string, error) {
	if u, ok := obj.(*UIDSet); ok {
		return u.key, nil
	}
	return "", fmt.Errorf("Could not find key for obj %#v", obj)
}

UIDSetKeyFunc to parse out the key from a UIDSet.

View Source
var UpdateTaintBackoff = wait.Backoff{
	Steps:    5,
	Duration: 100 * time.Millisecond,
	Jitter:   1.0,
}

UpdateTaintBackoff is the backoff period used while updating taint

Functions

func AddOrUpdateTaintOnNode

func AddOrUpdateTaintOnNode(c clientset.Interface, nodeName string, taints ...*v1.Taint) error

AddOrUpdateTaintOnNode add taints to the node. If taint was added into node, it'll issue API calls to update nodes; otherwise, no API calls. Return error if any.

func BenchmarkAdler

func BenchmarkAdler(b *testing.B)

BenchmarkAdler is used to fetch machineTemplateSpecOldHash

func BenchmarkFnv

func BenchmarkFnv(b *testing.B)

BenchmarkFnv is used the computeHash

func ComputeHash

func ComputeHash(template *v1alpha1.MachineTemplateSpec, collisionCount *int32) uint32

ComputeHash returns a hash value calculated from machine template and a collisionCount to avoid hash collision

func EqualIgnoreHash

func EqualIgnoreHash(template1, template2 *v1alpha1.MachineTemplateSpec) bool

EqualIgnoreHash returns true if two given machineTemplateSpec are equal, ignoring the diff in value of Labels[machine-template-hash] We ignore machine-template-hash because the hash result would be different upon machineTemplateSpec API changes (e.g. the addition of a new field will cause the hash code to change) Note that we assume input machineTemplateSpecs contain non-empty labels

func FilterActiveMachineSets

func FilterActiveMachineSets(machineSets []*v1alpha1.MachineSet) []*v1alpha1.MachineSet

FilterActiveMachineSets returns machine sets that have (or at least ought to have) machines.

func FilterMachineSets

func FilterMachineSets(ISes []*v1alpha1.MachineSet, filterFn filterIS) []*v1alpha1.MachineSet

FilterMachineSets returns machine sets that are filtered by filterFn (all returned ones should match filterFn).

func FindActiveOrLatest

func FindActiveOrLatest(newIS *v1alpha1.MachineSet, oldISs []*v1alpha1.MachineSet) *v1alpha1.MachineSet

FindActiveOrLatest returns the only active or the latest machine set in case there is at most one active machine set. If there are more active machine sets, then we should proportionally scale them.

func FindNewMachineSet

func FindNewMachineSet(deployment *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet) *v1alpha1.MachineSet

FindNewMachineSet returns the new RS this given deployment targets (the one with the same machine template).

func FindOldMachineSets

func FindOldMachineSets(deployment *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet) ([]*v1alpha1.MachineSet, []*v1alpha1.MachineSet)

FindOldMachineSets returns the old machine sets targeted by the given Deployment, with the given slice of RSes. Note that the first set of old machine sets doesn't include the ones with no machines, and the second set of old machine sets include all old machine sets.

func GetActualReplicaCountForMachineSets

func GetActualReplicaCountForMachineSets(MachineSets []*v1alpha1.MachineSet) int32

GetActualReplicaCountForMachineSets returns the sum of actual replicas of the given machine sets.

func GetAllMachineSets

GetAllMachineSets returns the old and new machine sets targeted by the given Deployment. It gets MachineList and MachineSetList from client interface. Note that the first set of old machine sets doesn't include the ones with no machines, and the second set of old machine sets include all old machine sets. The third returned value is the new machine set, and it may be nil if it doesn't exist yet.

func GetAvailableReplicaCountForMachineSets

func GetAvailableReplicaCountForMachineSets(MachineSets []*v1alpha1.MachineSet) int32

GetAvailableReplicaCountForMachineSets returns the number of available machines corresponding to the given machine sets.

func GetCondition

GetCondition returns a MachineSet condition with the provided type if it exists.

func GetDesiredReplicasAnnotation

func GetDesiredReplicasAnnotation(is *v1alpha1.MachineSet) (int32, bool)

GetDesiredReplicasAnnotation returns the number of desired replicas

func GetMachineDeploymentCondition

GetMachineDeploymentCondition returns the condition with the provided type.

func GetMachineDeploymentConditionInternal

func GetMachineDeploymentConditionInternal(status v1alpha1.MachineDeploymentStatus, condType v1alpha1.MachineDeploymentConditionType) *v1alpha1.MachineDeploymentCondition

GetMachineDeploymentConditionInternal returns the condition with the provided type. Avoiding Internal versions, use standard versions only. TODO: remove the duplicate

func GetMachineFromTemplate

func GetMachineFromTemplate(template *v1alpha1.MachineTemplateSpec, parentObject runtime.Object, controllerRef *metav1.OwnerReference) (*v1alpha1.Machine, error)

GetMachineFromTemplate passes the machine template spec to return the machine object

func GetMachineSetHash

func GetMachineSetHash(is *v1alpha1.MachineSet, uniquifier *int32) (string, error)

GetMachineSetHash returns the hash of a machineSet

func GetNewMachineSet

GetNewMachineSet returns a machine set that matches the intent of the given deployment; get MachineSetList from client interface. Returns nil if the new machine set doesn't exist yet.

func GetOldMachineSets

GetOldMachineSets returns the old machine sets targeted by the given Deployment; get MachineList and MachineSetList from client interface. Note that the first set of old machine sets doesn't include the ones with no machines, and the second set of old machine sets include all old machine sets.

func GetProportion

func GetProportion(is *v1alpha1.MachineSet, d v1alpha1.MachineDeployment, deploymentReplicasToAdd, deploymentReplicasAdded int32) int32

GetProportion will estimate the proportion for the provided machine set using 1. the current size of the parent deployment, 2. the replica count that needs be added on the machine sets of the deployment, and 3. the total replicas added in the machine sets of the deployment so far.

func GetReadyReplicaCountForMachineSets

func GetReadyReplicaCountForMachineSets(MachineSets []*v1alpha1.MachineSet) int32

GetReadyReplicaCountForMachineSets returns the number of ready machines corresponding to the given machine sets.

func GetReplicaCountForMachineSets

func GetReplicaCountForMachineSets(MachineSets []*v1alpha1.MachineSet) int32

GetReplicaCountForMachineSets returns the sum of Replicas of the given machine sets.

func IsMachineActive

func IsMachineActive(p *v1alpha1.Machine) bool

IsMachineActive checks if machine was active

func IsMachineFailed

func IsMachineFailed(p *v1alpha1.Machine) bool

IsMachineFailed checks if machine has failed

func IsRollingUpdate

func IsRollingUpdate(deployment *v1alpha1.MachineDeployment) bool

IsRollingUpdate returns true if the strategy type is a rolling update.

func IsSaturated

func IsSaturated(deployment *v1alpha1.MachineDeployment, is *v1alpha1.MachineSet) bool

IsSaturated checks if the new machine set is saturated by comparing its size with its deployment size. Both the deployment and the machine set have to believe this machine set can own all of the desired replicas in the deployment and the annotation helps in achieving that. All machines of the MachineSet need to be available.

func LabelMachinesWithHash

func LabelMachinesWithHash(machineList *v1alpha1.MachineList, c v1alpha1client.ClusterV1alpha1Interface, machineLister v1alpha1listers.MachineLister, namespace, name, hash string) error

LabelMachinesWithHash labels all machines in the given machineList with the new hash label.

func LastRevision

func LastRevision(allISs []*v1alpha1.MachineSet) int64

LastRevision finds the second max revision number in all machine sets (the last revision)

func ListMachineSets

func ListMachineSets(deployment *v1alpha1.MachineDeployment, getISList IsListFunc) ([]*v1alpha1.MachineSet, error)

ListMachineSets returns a slice of RSes the given deployment targets. Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan), because only the controller itself should do that. However, it does filter out anything whose ControllerRef doesn't match.

func ListMachineSetsInternal

func ListMachineSetsInternal(deployment *v1alpha1.MachineDeployment, getISList func(string, metav1.ListOptions) ([]*v1alpha1.MachineSet, error)) ([]*v1alpha1.MachineSet, error)

ListMachineSetsInternal is ListMachineSets for v1alpha1. TODO: Remove the duplicate when call sites are updated to ListMachineSets.

func ListMachines

func ListMachines(deployment *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, getMachineList machineListFunc) (*v1alpha1.MachineList, error)

ListMachines for given machineDeployment

func MachineDeploymentComplete

func MachineDeploymentComplete(deployment *v1alpha1.MachineDeployment, newStatus *v1alpha1.MachineDeploymentStatus) bool

MachineDeploymentComplete considers a deployment to be complete once all of its desired replicas are updated and available, and no old machines are running.

func MachineDeploymentProgressing

func MachineDeploymentProgressing(deployment *v1alpha1.MachineDeployment, newStatus *v1alpha1.MachineDeploymentStatus) bool

MachineDeploymentProgressing reports progress for a deployment. Progress is estimated by comparing the current with the new status of the deployment that the controller is observing. More specifically, when new machines are scaled up or become ready or available, or old machines are scaled down, then we consider the deployment is progressing.

func MachineDeploymentTimedOut

func MachineDeploymentTimedOut(deployment *v1alpha1.MachineDeployment, newStatus *v1alpha1.MachineDeploymentStatus) bool

MachineDeploymentTimedOut considers a deployment to have timed out once its condition that reports progress is older than progressDeadlineSeconds or a Progressing condition with a TimedOutReason reason already exists.

func MachineKey

func MachineKey(machine *v1alpha1.Machine) string

MachineKey is the function used to get the machine name from machine object ToCheck : as machine-namespace does not matter

func MachineSetToMachineDeploymentCondition

func MachineSetToMachineDeploymentCondition(cond v1alpha1.MachineSetCondition) v1alpha1.MachineDeploymentCondition

MachineSetToMachineDeploymentCondition converts a machine set condition into a deployment condition. Useful for promoting machine set failure conditions into deployments.

func MaxRevision

func MaxRevision(allISs []*v1alpha1.MachineSet) int64

MaxRevision finds the highest revision in the machine sets

func MaxSurge

func MaxSurge(deployment v1alpha1.MachineDeployment) int32

MaxSurge returns the maximum surge machines a rolling deployment can take.

func MaxUnavailable

func MaxUnavailable(deployment v1alpha1.MachineDeployment) int32

MaxUnavailable returns the maximum unavailable machines a rolling deployment can take.

func MinAvailable

func MinAvailable(deployment *v1alpha1.MachineDeployment) int32

MinAvailable returns the minimum available machines of a given deployment

func NewISNewReplicas

func NewISNewReplicas(deployment *v1alpha1.MachineDeployment, allISs []*v1alpha1.MachineSet, newIS *v1alpha1.MachineSet) (int32, error)

NewISNewReplicas calculates the number of replicas a deployment's new IS should have. When one of the followings is true, we're rolling out the deployment; otherwise, we're scaling it. 1) The new RS is saturated: newRS's replicas == deployment's replicas 2) Max number of machines allowed is reached: deployment's replicas + maxSurge == all RSs' replicas

func NewMachineDeploymentCondition

func NewMachineDeploymentCondition(condType v1alpha1.MachineDeploymentConditionType, status v1alpha1.ConditionStatus, reason, message string) *v1alpha1.MachineDeploymentCondition

NewMachineDeploymentCondition creates a new deployment condition.

func NewMachineSetCondition

func NewMachineSetCondition(condType v1alpha1.MachineSetConditionType, status v1alpha1.ConditionStatus, reason, msg string) v1alpha1.MachineSetCondition

NewMachineSetCondition creates a new MachineSet condition.

func NoResyncPeriodFunc

func NoResyncPeriodFunc() time.Duration

NoResyncPeriodFunc Returns 0 for resyncPeriod in case resyncing is not needed.

func PatchNodeTaints

func PatchNodeTaints(c clientset.Interface, nodeName string, oldNode *v1.Node, newNode *v1.Node) error

PatchNodeTaints patches node's taints.

func RecheckDeletionTimestamp

func RecheckDeletionTimestamp(getObject func() (metav1.Object, error)) func() error

RecheckDeletionTimestamp returns a CanAdopt() function to recheck deletion.

The CanAdopt() function calls getObject() to fetch the latest value, and denies adoption attempts if that object has a non-nil DeletionTimestamp.

func RemoveCondition

func RemoveCondition(status *v1alpha1.MachineSetStatus, condType v1alpha1.MachineSetConditionType)

RemoveCondition removes the condition with the provided type from the MachineSet status.

func RemoveMachineDeploymentCondition

func RemoveMachineDeploymentCondition(status *v1alpha1.MachineDeploymentStatus, condType v1alpha1.MachineDeploymentConditionType)

RemoveMachineDeploymentCondition removes the deployment condition with the provided type.

func RemoveTaintOffNode

func RemoveTaintOffNode(c clientset.Interface, nodeName string, node *v1.Node, taints ...*v1.Taint) error

RemoveTaintOffNode is for cleaning up taints temporarily added to node, won't fail if target taint doesn't exist or has been removed. If passed a node it'll check if there's anything to be done, if taint is not present it won't issue any API calls.

func ResolveFenceposts

func ResolveFenceposts(maxSurge, maxUnavailable *intstrutil.IntOrString, desired int32) (int32, int32, error)

ResolveFenceposts resolves both maxSurge and maxUnavailable. This needs to happen in one step. For example:

2 desired, max unavailable 1%, surge 0% - should scale old(-1), then new(+1), then old(-1), then new(+1) 1 desired, max unavailable 1%, surge 0% - should scale old(-1), then new(+1) 2 desired, max unavailable 25%, surge 1% - should scale new(+1), then old(-1), then new(+1), then old(-1) 1 desired, max unavailable 25%, surge 1% - should scale new(+1), then old(-1) 2 desired, max unavailable 0%, surge 1% - should scale new(+1), then old(-1), then new(+1), then old(-1) 1 desired, max unavailable 0%, surge 1% - should scale new(+1), then old(-1)

func Revision

func Revision(obj runtime.Object) (int64, error)

Revision returns the revision number of the input object.

func SetCondition

func SetCondition(status *v1alpha1.MachineSetStatus, condition v1alpha1.MachineSetCondition)

SetCondition adds/replaces the given condition in the MachineSet status. If the condition that we are about to add already exists and has the same status and reason then we are not going to update.

func SetFromMachineSetTemplate

func SetFromMachineSetTemplate(deployment *v1alpha1.MachineDeployment, template v1alpha1.MachineTemplateSpec) *v1alpha1.MachineDeployment

SetFromMachineSetTemplate sets the desired MachineTemplateSpec from a machine set template to the given deployment.

func SetMachineDeploymentAnnotationsTo

func SetMachineDeploymentAnnotationsTo(deployment *v1alpha1.MachineDeployment, rollbackToIS *v1alpha1.MachineSet)

SetMachineDeploymentAnnotationsTo sets deployment's annotations as given RS's annotations. This action should be done if and only if the deployment is rolling back to this rs. Note that apply and revision annotations are not changed.

func SetMachineDeploymentCondition

func SetMachineDeploymentCondition(status *v1alpha1.MachineDeploymentStatus, condition v1alpha1.MachineDeploymentCondition)

SetMachineDeploymentCondition updates the deployment to include the provided condition. If the condition that we are about to add already exists and has the same status and reason then we are not going to update.

func SetMachineDeploymentRevision

func SetMachineDeploymentRevision(deployment *v1alpha1.MachineDeployment, revision string) bool

SetMachineDeploymentRevision updates the revision for a deployment.

func SetNewMachineSetAnnotations

func SetNewMachineSetAnnotations(deployment *v1alpha1.MachineDeployment, newIS *v1alpha1.MachineSet, newRevision string, exists bool) bool

SetNewMachineSetAnnotations sets new machine set's annotations appropriately by updating its revision and copying required deployment annotations to it; it returns true if machine set's annotation is changed.

func SetReplicasAnnotations

func SetReplicasAnnotations(is *v1alpha1.MachineSet, desiredReplicas, maxReplicas int32) bool

SetReplicasAnnotations sets the desiredReplicas and maxReplicas into the annotations

func SupportEviction

func SupportEviction(clientset kubernetes.Interface) (string, error)

SupportEviction uses Discovery API to find out if the server support eviction subresource If support, it will return its groupVersion; Otherwise, it will return ""

func TestMachineTemplateSpecHash

func TestMachineTemplateSpecHash(t *testing.T)

TestMachineTemplateSpecHash tests the templateSpecHash for any collisions

func UpdateISWithRetries

func UpdateISWithRetries(isClient v1alpha1client.MachineSetInterface, isLister v1alpha1listers.MachineSetLister, namespace, name string, applyUpdate updateISFunc) (*v1alpha1.MachineSet, error)

UpdateISWithRetries updates a RS with given applyUpdate function. Note that RS not found error is ignored. The returned bool value can be used to tell if the RS is actually updated.

func UpdateMachineWithRetries

func UpdateMachineWithRetries(machineClient v1alpha1client.MachineInterface, machineLister v1alpha1listers.MachineLister, namespace, name string, applyUpdate updateMachineFunc) (*v1alpha1.Machine, error)

UpdateMachineWithRetries updates a machine with given applyUpdate function. Note that machine not found error is ignored. The returned bool value can be used to tell if the machine is actually updated.

func WaitForCacheSync

func WaitForCacheSync(controllerName string, stopCh <-chan struct{}, cacheSyncs ...cache.InformerSynced) bool

WaitForCacheSync is a wrapper around cache.WaitForCacheSync that generates log messages indicating that the controller identified by controllerName is waiting for syncs, followed by either a successful or failed sync.

func WaitForMachineSetUpdated

func WaitForMachineSetUpdated(c v1alpha1listers.MachineSetLister, desiredGeneration int64, namespace, name string) error

WaitForMachineSetUpdated polls the machine set until it is updated.

func WaitForMachinesHashPopulated

func WaitForMachinesHashPopulated(c v1alpha1listers.MachineSetLister, desiredGeneration int64, namespace, name string) error

WaitForMachinesHashPopulated polls the machine set until updated and fully labeled.

func WaitForObservedDeploymentInternal

func WaitForObservedDeploymentInternal(getDeploymentFunc func() (*v1alpha1.MachineDeployment, error), desiredGeneration int64, interval, timeout time.Duration) error

WaitForObservedDeploymentInternal polls for deployment to be updated so that deployment.Status.ObservedGeneration >= desiredGeneration. Returns error if polling timesout. TODO: remove the duplicate

func WaitForObservedMachineDeployment

func WaitForObservedMachineDeployment(getDeploymentFunc func() (*v1alpha1.MachineDeployment, error), desiredGeneration int64, interval, timeout time.Duration) error

WaitForObservedMachineDeployment polls for deployment to be updated so that deployment.Status.ObservedGeneration >= desiredGeneration. Returns error if polling timesout.

Types

type ActiveMachines

type ActiveMachines []*v1alpha1.Machine

ActiveMachines type allows custom sorting of machines so a controller can pick the best ones to delete.

func (ActiveMachines) Len

func (s ActiveMachines) Len() int

func (ActiveMachines) Less

func (s ActiveMachines) Less(i, j int) bool

func (ActiveMachines) Swap

func (s ActiveMachines) Swap(i, j int)

type BaseControllerRefManager

type BaseControllerRefManager struct {
	Controller metav1.Object
	Selector   labels.Selector

	CanAdoptFunc func() error
	// contains filtered or unexported fields
}

BaseControllerRefManager is the struct is used to identify the base controller of the object

func (*BaseControllerRefManager) CanAdopt

func (m *BaseControllerRefManager) CanAdopt() error

CanAdopt is used to identify if the object can be adopted by the controller

func (*BaseControllerRefManager) ClaimObject

func (m *BaseControllerRefManager) ClaimObject(obj metav1.Object, match func(metav1.Object) bool, adopt, release func(metav1.Object) error) (bool, error)

ClaimObject tries to take ownership of an object for this controller.

It will reconcile the following:

  • Adopt orphans if the match function returns true.
  • Release owned objects if the match function returns false.

A non-nil error is returned if some form of reconciliation was attempted and failed. Usually, controllers should try again later in case reconciliation is still needed.

If the error is nil, either the reconciliation succeeded, or no reconciliation was necessary. The returned boolean indicates whether you now own the object.

No reconciliation will be attempted if the controller is being deleted.

type ClientBuilder

type ClientBuilder interface {
	// Config returns a new restclient.Config with the given user agent name.
	Config(name string) (*restclient.Config, error)
	// ConfigOrDie return a new restclient.Config with the given user agent
	// name, or logs a fatal error.
	ConfigOrDie(name string) *restclient.Config
	// Client returns a new clientset.Interface with the given user agent
	// name.
	Client(name string) (clientset.Interface, error)
	// ClientOrDie returns a new clientset.Interface with the given user agent
	// name or logs a fatal error, destroying the computer and killing the
	// operator and programmer.
	ClientOrDie(name string) clientset.Interface
}

ClientBuilder allows you to get clients and configs for controllers

type ContExpectations

type ContExpectations struct {
	cache.Store
}

ContExpectations is a cache mapping controllers to what they expect to see before being woken up for a sync.

func NewContExpectations

func NewContExpectations() *ContExpectations

NewContExpectations returns a store for ContExpectations.

func (*ContExpectations) CreationObserved

func (r *ContExpectations) CreationObserved(controllerKey string)

CreationObserved atomically decrements the `add` expectation count of the given controller.

func (*ContExpectations) DeleteExpectations

func (r *ContExpectations) DeleteExpectations(controllerKey string)

DeleteExpectations deletes the expectations of the given controller from the TTLStore.

func (*ContExpectations) DeletionObserved

func (r *ContExpectations) DeletionObserved(controllerKey string)

DeletionObserved atomically decrements the `del` expectation count of the given controller.

func (*ContExpectations) ExpectCreations

func (r *ContExpectations) ExpectCreations(controllerKey string, adds int) error

ExpectCreations adds creations to an existing expectation

func (*ContExpectations) ExpectDeletions

func (r *ContExpectations) ExpectDeletions(controllerKey string, dels int) error

ExpectDeletions deletion creations to an existing expectation

func (*ContExpectations) GetExpectations

func (r *ContExpectations) GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error)

GetExpectations returns the ControlleeExpectations of the given controller.

func (*ContExpectations) LowerExpectations

func (r *ContExpectations) LowerExpectations(controllerKey string, add, del int)

LowerExpectations Decrements the expectation counts of the given controller.

func (*ContExpectations) RaiseExpectations

func (r *ContExpectations) RaiseExpectations(controllerKey string, add, del int)

RaiseExpectations Increments the expectation counts of the given controller.

func (*ContExpectations) SatisfiedExpectations

func (r *ContExpectations) SatisfiedExpectations(controllerKey string) bool

SatisfiedExpectations returns true if the required adds/dels for the given controller have been observed. Add/del counts are established by the controller at sync time, and updated as controllees are observed by the controller manager.

func (*ContExpectations) SetExpectations

func (r *ContExpectations) SetExpectations(controllerKey string, add, del int) error

SetExpectations registers new expectations for the given controller. Forgets existing expectations.

type ControlleeExpectations

type ControlleeExpectations struct {
	// contains filtered or unexported fields
}

ControlleeExpectations track controllee creates/deletes.

func (*ControlleeExpectations) Add

func (exp *ControlleeExpectations) Add(add, del int64)

Add increments the add and del counters.

func (*ControlleeExpectations) Fulfilled

func (exp *ControlleeExpectations) Fulfilled() bool

Fulfilled returns true if this expectation has been fulfilled.

func (*ControlleeExpectations) GetExpectations

func (exp *ControlleeExpectations) GetExpectations() (int64, int64)

GetExpectations returns the add and del expectations of the controllee.

type Controller

type Controller interface {
	// Run runs the controller until the given stop channel can be read from.
	// workers specifies the number of goroutines, per resource, processing work
	// from the resource workqueues
	Run(workers int, stopCh <-chan struct{})
}

Controller describes a controller for

func NewController

func NewController(
	namespace string,
	controlMachineClient machineapi.ClusterV1alpha1Interface,
	controlCoreClient kubernetes.Interface,
	targetCoreClient kubernetes.Interface,
	secretInformer coreinformers.SecretInformer,
	nodeInformer coreinformers.NodeInformer,
	machineClassInformer machineinformers.MachineClassInformer,
	machineInformer machineinformers.MachineInformer,
	machineSetInformer machineinformers.MachineSetInformer,
	machineDeploymentInformer machineinformers.MachineDeploymentInformer,
	recorder record.EventRecorder,
	safetyOptions options.SafetyOptions,
) (Controller, error)

NewController returns a new Node controller.

type ControllersByCreationTimestamp

type ControllersByCreationTimestamp []*v1.ReplicationController

ControllersByCreationTimestamp sorts a list of ReplicationControllers by creation timestamp, using their names as a tie breaker.

func (ControllersByCreationTimestamp) Len

func (ControllersByCreationTimestamp) Less

func (ControllersByCreationTimestamp) Swap

func (o ControllersByCreationTimestamp) Swap(i, j int)

type DrainOptions

type DrainOptions struct {
	Force              bool
	GracePeriodSeconds int
	IgnoreDaemonsets   bool
	Timeout            time.Duration
	DeleteLocalData    bool

	Out    io.Writer
	ErrOut io.Writer
	// contains filtered or unexported fields
}

DrainOptions are configurable options while draining a node before deletion

func NewDrainOptions

func NewDrainOptions(
	client kubernetes.Interface,
	timeout time.Duration,
	nodeName string,
	gracePeriodSeconds int,
	force bool,
	ignoreDaemonsets bool,
	deleteLocalData bool,
	out io.Writer,
	errOut io.Writer,
) *DrainOptions

NewDrainOptions creates a new DrainOptions struct and returns a pointer to it

func (*DrainOptions) RunCordonOrUncordon

func (o *DrainOptions) RunCordonOrUncordon(desired bool) error

RunCordonOrUncordon runs either Cordon or Uncordon. The desired value for "Unschedulable" is passed as the first arg.

func (*DrainOptions) RunDrain

func (o *DrainOptions) RunDrain() error

RunDrain runs the 'drain' command

type Expectations

type Expectations interface {
	Fulfilled() bool
}

Expectations are either fulfilled, or expire naturally.

type ExpectationsInterface

type ExpectationsInterface interface {
	GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error)
	SatisfiedExpectations(controllerKey string) bool
	DeleteExpectations(controllerKey string)
	SetExpectations(controllerKey string, add, del int) error
	ExpectCreations(controllerKey string, adds int) error
	ExpectDeletions(controllerKey string, dels int) error
	CreationObserved(controllerKey string)
	DeletionObserved(controllerKey string)
	RaiseExpectations(controllerKey string, add, del int)
	LowerExpectations(controllerKey string, add, del int)
}

ExpectationsInterface is an interface that allows users to set and wait on expectations. Only abstracted out for testing. Warning: if using KeyFunc it is not safe to use a single ExpectationsInterface with different types of controllers, because the keys might conflict across types.

type IsListFunc

type IsListFunc func(string, metav1.ListOptions) ([]*v1alpha1.MachineSet, error)

IsListFunc is used to list all machineSets for a given list option TODO: switch this to full namespacers

func IsListFromClient

IsListFromClient returns an rsListFunc that wraps the given client.

type MachineControlInterface

type MachineControlInterface interface {
	// Createmachines creates new machines according to the spec.
	CreateMachines(namespace string, template *v1alpha1.MachineTemplateSpec, object runtime.Object) error
	// CreatemachinesWithControllerRef creates new machines according to the spec, and sets object as the machine's controller.
	CreateMachinesWithControllerRef(namespace string, template *v1alpha1.MachineTemplateSpec, object runtime.Object, controllerRef *metav1.OwnerReference) error
	// Deletemachine deletes the machine identified by machineID.
	DeleteMachine(namespace string, machineID string, object runtime.Object) error
	// Patchmachine patches the machine.
	PatchMachine(namespace string, name string, data []byte) error
}

MachineControlInterface is the interface used by the machine-set controller to interact with the machine controller

type MachineControllerRefManager

type MachineControllerRefManager struct {
	BaseControllerRefManager
	// contains filtered or unexported fields
}

MachineControllerRefManager is the struct used to manage the machines

func NewMachineControllerRefManager

func NewMachineControllerRefManager(
	machineControl MachineControlInterface,
	controller metav1.Object,
	selector labels.Selector,
	controllerKind schema.GroupVersionKind,
	canAdopt func() error,
) *MachineControllerRefManager

NewMachineControllerRefManager returns a MachineControllerRefManager that exposes methods to manage the controllerRef of Machines.

The CanAdopt() function can be used to perform a potentially expensive check (such as a live GET from the API server) prior to the first adoption. It will only be called (at most once) if an adoption is actually attempted. If CanAdopt() returns a non-nil error, all adoptions will fail.

NOTE: Once CanAdopt() is called, it will not be called again by the same

MachineControllerRefManager machine. Create a new machine if it makes
sense to check CanAdopt() again (e.g. in a different sync pass).

func (*MachineControllerRefManager) AdoptMachine

func (m *MachineControllerRefManager) AdoptMachine(machine *v1alpha1.Machine) error

AdoptMachine sends a patch to take control of the Machine. It returns the error if the patching fails.

func (*MachineControllerRefManager) ClaimMachines

func (m *MachineControllerRefManager) ClaimMachines(machines []*v1alpha1.Machine, filters ...func(*v1alpha1.Machine) bool) ([]*v1alpha1.Machine, error)

ClaimMachines tries to take ownership of a list of Machines.

It will reconcile the following:

  • Adopt orphans if the selector matches.
  • Release owned objects if the selector no longer matches.

Optional: If one or more filters are specified, a Machine will only be claimed if all filters return true.

A non-nil error is returned if some form of reconciliation was attempted and failed. Usually, controllers should try again later in case reconciliation is still needed.

If the error is nil, either the reconciliation succeeded, or no reconciliation was necessary. The list of Machines that you now own is returned.

func (*MachineControllerRefManager) ReleaseMachine

func (m *MachineControllerRefManager) ReleaseMachine(machine *v1alpha1.Machine) error

ReleaseMachine sends a patch to free the Machine from the control of the controller. It returns the error if the patching fails. 404 and 422 errors are ignored.

type MachineDeploymentListerExpansion

type MachineDeploymentListerExpansion interface {
	GetMachineDeploymentsForMachineSet(is *v1alpha1.MachineSet) ([]*v1alpha1.MachineDeployment, error)
}

MachineDeploymentListerExpansion allows custom methods to be added to MachineDeploymentLister.

type MachineDeploymentNamespaceListerExpansion

type MachineDeploymentNamespaceListerExpansion interface{}

MachineDeploymentNamespaceListerExpansion allows custom methods to be added to MachineDeploymentNamespaceLister.

type MachineSetControlInterface

type MachineSetControlInterface interface {
	PatchMachineSet(namespace, name string, data []byte) error
}

MachineSetControlInterface is an interface that knows how to add or delete MachineSets, as well as increment or decrement them. It is used by the deployment controller to ease testing of actions that it takes.

type MachineSetControllerRefManager

type MachineSetControllerRefManager struct {
	BaseControllerRefManager
	// contains filtered or unexported fields
}

MachineSetControllerRefManager is used to manage controllerRef of MachineSets. Three methods are defined on this object 1: Classify 2: AdoptMachineSet and 3: ReleaseMachineSet which are used to classify the MachineSets into appropriate categories and accordingly adopt or release them. See comments on these functions for more details.

func NewMachineSetControllerRefManager

func NewMachineSetControllerRefManager(
	machineSetControl MachineSetControlInterface,
	controller metav1.Object,
	selector labels.Selector,
	controllerKind schema.GroupVersionKind,
	canAdopt func() error,
) *MachineSetControllerRefManager

NewMachineSetControllerRefManager returns a MachineSetControllerRefManager that exposes methods to manage the controllerRef of MachineSets.

The CanAdopt() function can be used to perform a potentially expensive check (such as a live GET from the API server) prior to the first adoption. It will only be called (at most once) if an adoption is actually attempted. If CanAdopt() returns a non-nil error, all adoptions will fail.

NOTE: Once CanAdopt() is called, it will not be called again by the same

MachineSetControllerRefManager machine. Create a new machine if it
makes sense to check CanAdopt() again (e.g. in a different sync pass).

func (*MachineSetControllerRefManager) AdoptMachineSet

func (m *MachineSetControllerRefManager) AdoptMachineSet(is *v1alpha1.MachineSet) error

AdoptMachineSet sends a patch to take control of the MachineSet. It returns the error if the patching fails.

func (*MachineSetControllerRefManager) ClaimMachineSets

func (m *MachineSetControllerRefManager) ClaimMachineSets(sets []*v1alpha1.MachineSet) ([]*v1alpha1.MachineSet, error)

ClaimMachineSets tries to take ownership of a list of MachineSets.

It will reconcile the following:

  • Adopt orphans if the selector matches.
  • Release owned objects if the selector no longer matches.

A non-nil error is returned if some form of reconciliation was attempted and failed. Usually, controllers should try again later in case reconciliation is still needed.

If the error is nil, either the reconciliation succeeded, or no reconciliation was necessary. The list of MachineSets that you now own is returned.

func (*MachineSetControllerRefManager) ReleaseMachineSet

func (m *MachineSetControllerRefManager) ReleaseMachineSet(machineSet *v1alpha1.MachineSet) error

ReleaseMachineSet sends a patch to free the MachineSet from the control of the MachineDeployment controller. It returns the error if the patching fails. 404 and 422 errors are ignored.

type MachineSetsByCreationTimestamp

type MachineSetsByCreationTimestamp []*v1alpha1.MachineSet

MachineSetsByCreationTimestamp sorts a list of MachineSet by creation timestamp, using their names as a tie breaker. ***************** For MachineSet *********************

func (MachineSetsByCreationTimestamp) Len

func (MachineSetsByCreationTimestamp) Less

func (MachineSetsByCreationTimestamp) Swap

func (o MachineSetsByCreationTimestamp) Swap(i, j int)

type MachineSetsBySizeNewer

type MachineSetsBySizeNewer []*v1alpha1.MachineSet

MachineSetsBySizeNewer sorts a list of MachineSet by size in descending order, using their creation timestamp or name as a tie breaker. By using the creation timestamp, this sorts from new to old machine sets.

func (MachineSetsBySizeNewer) Len

func (o MachineSetsBySizeNewer) Len() int

func (MachineSetsBySizeNewer) Less

func (o MachineSetsBySizeNewer) Less(i, j int) bool

func (MachineSetsBySizeNewer) Swap

func (o MachineSetsBySizeNewer) Swap(i, j int)

type MachineSetsBySizeOlder

type MachineSetsBySizeOlder []*v1alpha1.MachineSet

MachineSetsBySizeOlder sorts a list of MachineSet by size in descending order, using their creation timestamp or name as a tie breaker. By using the creation timestamp, this sorts from old to new machine sets.

func (MachineSetsBySizeOlder) Len

func (o MachineSetsBySizeOlder) Len() int

func (MachineSetsBySizeOlder) Less

func (o MachineSetsBySizeOlder) Less(i, j int) bool

func (MachineSetsBySizeOlder) Swap

func (o MachineSetsBySizeOlder) Swap(i, j int)

type RealControllerRevisionControl

type RealControllerRevisionControl struct {
	KubeClient clientset.Interface
}

RealControllerRevisionControl is the default implementation of RevisionControlInterface.

func (RealControllerRevisionControl) PatchControllerRevision

func (r RealControllerRevisionControl) PatchControllerRevision(namespace, name string, data []byte) error

PatchControllerRevision is the patch method used to patch the controller revision

type RealMachineControl

type RealMachineControl struct {
	Recorder record.EventRecorder
	// contains filtered or unexported fields
}

RealMachineControl is the default implementation of machineControlInterface.

func (RealMachineControl) CreateMachines

func (r RealMachineControl) CreateMachines(namespace string, template *v1alpha1.MachineTemplateSpec, object runtime.Object) error

CreateMachines initiates a create machine for a RealMachineControl

func (RealMachineControl) CreateMachinesWithControllerRef

func (r RealMachineControl) CreateMachinesWithControllerRef(namespace string, template *v1alpha1.MachineTemplateSpec, controllerObject runtime.Object, controllerRef *metav1.OwnerReference) error

CreateMachinesWithControllerRef creates a machine with controller reference

func (RealMachineControl) DeleteMachine

func (r RealMachineControl) DeleteMachine(namespace string, machineID string, object runtime.Object) error

DeleteMachine deletes a machine attached to the RealMachineControl

func (RealMachineControl) PatchMachine

func (r RealMachineControl) PatchMachine(namespace string, name string, data []byte) error

PatchMachine applies a patch on machine

type RealMachineSetControl

type RealMachineSetControl struct {
	Recorder record.EventRecorder
	// contains filtered or unexported fields
}

RealMachineSetControl is the default implementation of RSControllerInterface.

func (RealMachineSetControl) PatchMachineSet

func (r RealMachineSetControl) PatchMachineSet(namespace, name string, data []byte) error

PatchMachineSet patches the machineSet object

type ResyncPeriodFunc

type ResyncPeriodFunc func() time.Duration

ResyncPeriodFunc is the function that returns the resync duration

func StaticResyncPeriodFunc

func StaticResyncPeriodFunc(resyncPeriod time.Duration) ResyncPeriodFunc

StaticResyncPeriodFunc returns the resync period specified

type RevisionControlInterface

type RevisionControlInterface interface {
	PatchControllerRevision(namespace, name string, data []byte) error
}

RevisionControlInterface is an interface that knows how to patch ControllerRevisions, as well as increment or decrement them. It is used by the daemonset controller to ease testing of actions that it takes. TODO: merge the controller revision interface in controller_history.go with this one

type SimpleClientBuilder

type SimpleClientBuilder struct {
	// ClientConfig is a skeleton config to clone and use as the basis for each controller client
	ClientConfig *restclient.Config
}

SimpleClientBuilder returns a fixed client with different user agents

func (SimpleClientBuilder) Client

Client returns a new clientset.Interface with the given user agent name.

func (SimpleClientBuilder) ClientOrDie

func (b SimpleClientBuilder) ClientOrDie(name string) clientset.Interface

ClientOrDie returns a new clientset.Interface with the given user agent name or logs a fatal error, destroying the computer and killing the operator and programmer.

func (SimpleClientBuilder) Config

func (b SimpleClientBuilder) Config(name string) (*restclient.Config, error)

Config returns a new restclient.Config with the given user agent name.

func (SimpleClientBuilder) ConfigOrDie

func (b SimpleClientBuilder) ConfigOrDie(name string) *restclient.Config

ConfigOrDie return a new restclient.Config with the given user agent name, or logs a fatal error.

type UIDSet

type UIDSet struct {
	sets.String
	// contains filtered or unexported fields
}

UIDSet holds a key and a set of UIDs. Used by the UIDTrackingContExpectations to remember which UID it has seen/still waiting for.

type UIDTrackingContExpectations

type UIDTrackingContExpectations struct {
	ExpectationsInterface
	// contains filtered or unexported fields
}

UIDTrackingContExpectations tracks the UID of the machines it deletes. This cache is needed over plain old expectations to safely handle graceful deletion. The desired behavior is to treat an update that sets the DeletionTimestamp on an object as a delete. To do so consistently, one needs to remember the expected deletes so they aren't double counted. TODO: Track creates as well (#22599)

func NewUIDTrackingContExpectations

func NewUIDTrackingContExpectations(ce ExpectationsInterface) *UIDTrackingContExpectations

NewUIDTrackingContExpectations returns a wrapper around ContExpectations that is aware of deleteKeys.

func (*UIDTrackingContExpectations) DeleteExpectations

func (u *UIDTrackingContExpectations) DeleteExpectations(rcKey string)

DeleteExpectations deletes the UID set and invokes DeleteExpectations on the underlying ExpectationsInterface.

func (*UIDTrackingContExpectations) DeletionObserved

func (u *UIDTrackingContExpectations) DeletionObserved(rcKey, deleteKey string)

DeletionObserved records the given deleteKey as a deletion, for the given rc.

func (*UIDTrackingContExpectations) ExpectDeletions

func (u *UIDTrackingContExpectations) ExpectDeletions(rcKey string, deletedKeys []string) error

ExpectDeletions records expectations for the given deleteKeys, against the given controller.

func (*UIDTrackingContExpectations) GetUIDs

func (u *UIDTrackingContExpectations) GetUIDs(controllerKey string) sets.String

GetUIDs is a convenience method to avoid exposing the set of expected uids. The returned set is not thread safe, all modifications must be made holding the uidStoreLock.

Jump to

Keyboard shortcuts

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