Documentation
¶
Overview ¶
* This file is part of the KubeVirt project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Copyright 2019 Red Hat, Inc. *
Index ¶
- Constants
- Variables
- func AddFinalizer(object metav1.Object, finalizer string)
- func ApplyVolumeRequestOnVMISpec(vmiSpec *v1.VirtualMachineInstanceSpec, ...) *v1.VirtualMachineInstanceSpec
- func DataVolumeKey(dataVolume *cdiv1.DataVolume) string
- func GetControllerOf(pod *k8sv1.Pod) *metav1.OwnerReference
- func HandlePanic()
- func HasFinalizer(object metav1.Object, finalizer string) bool
- func IsControlledBy(pod *k8sv1.Pod, vmi *virtv1.VirtualMachineInstance) bool
- func MigrationKey(migration *v1.VirtualMachineInstanceMigration) string
- func NewListWatchFromClient(c cache.Getter, resource string, namespace string, ...) *cache.ListWatch
- func NewResourceEventHandlerFuncsForFunc(f func(interface{})) cache.ResourceEventHandlerFuncs
- func NewResourceEventHandlerFuncsForWorkqueue(queue workqueue.RateLimitingInterface) cache.ResourceEventHandlerFuncs
- func NoResyncPeriodFunc() time.Duration
- func ObservedLatestApiVersionAnnotation(object metav1.Object) bool
- func PodKey(pod *k8sv1.Pod) string
- func PodKeys(pods []*k8sv1.Pod) []string
- func RecheckDeletionTimestamp(getObject func() (metav1.Object, error)) func() error
- func RemoveFinalizer(object metav1.Object, finalizer string)
- func SetLatestApiVersionAnnotation(object metav1.Object)
- func VirtualMachineKey(vmi *v1.VirtualMachineInstance) string
- func VirtualMachineKeys(vmis []*v1.VirtualMachineInstance) []string
- func VolumeSnapshotClassInformer(clientSet kubecli.KubevirtClient, resyncPeriod time.Duration) cache.SharedIndexInformer
- func VolumeSnapshotInformer(clientSet kubecli.KubevirtClient, resyncPeriod time.Duration) cache.SharedIndexInformer
- type BaseControllerRefManager
- type ControlleeExpectations
- type ControllerExpectations
- func (r *ControllerExpectations) AllPendingCreations() (sum int64)
- func (r *ControllerExpectations) CreationObserved(controllerKey string)
- func (r *ControllerExpectations) DeleteExpectations(controllerKey string)
- func (r *ControllerExpectations) DeletionObserved(controllerKey string)
- func (r *ControllerExpectations) ExpectCreations(controllerKey string, adds int)
- func (r *ControllerExpectations) ExpectDeletions(controllerKey string, dels int)
- func (r *ControllerExpectations) GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error)
- func (r *ControllerExpectations) LowerExpectations(controllerKey string, add, del int)
- func (r *ControllerExpectations) RaiseExpectations(controllerKey string, add, del int)
- func (r *ControllerExpectations) SatisfiedExpectations(controllerKey string) bool
- func (r *ControllerExpectations) SetExpectations(controllerKey string, add, del int)
- type ControllerExpectationsInterface
- type Expectations
- type KubeInformerFactory
- type RealVirtualMachineControl
- type ResyncPeriodFunc
- type UIDSet
- type UIDTrackingControllerExpectations
- func (u *UIDTrackingControllerExpectations) AddExpectedDeletion(rcKey string, deletedKey string)
- func (u *UIDTrackingControllerExpectations) DeleteExpectations(rcKey string)
- func (u *UIDTrackingControllerExpectations) DeletionObserved(rcKey, deleteKey string)
- func (u *UIDTrackingControllerExpectations) ExpectDeletions(rcKey string, deletedKeys []string)
- func (u *UIDTrackingControllerExpectations) GetUIDs(controllerKey string) sets.String
- type VirtualMachineConditionManager
- func (d *VirtualMachineConditionManager) GetCondition(vm *v1.VirtualMachine, cond v1.VirtualMachineConditionType) *v1.VirtualMachineCondition
- func (d *VirtualMachineConditionManager) HasCondition(vm *v1.VirtualMachine, cond v1.VirtualMachineConditionType) bool
- func (d *VirtualMachineConditionManager) RemoveCondition(vm *v1.VirtualMachine, cond v1.VirtualMachineConditionType)
- type VirtualMachineControlInterface
- type VirtualMachineControllerRefManager
- func (m *VirtualMachineControllerRefManager) AdoptDataVolume(dataVolume *cdiv1.DataVolume) error
- func (m *VirtualMachineControllerRefManager) AdoptVirtualMachine(vmi *virtv1.VirtualMachineInstance) error
- func (m *VirtualMachineControllerRefManager) ClaimMatchedDataVolumes(dataVolumes []*cdiv1.DataVolume, ...) ([]*cdiv1.DataVolume, error)
- func (m *VirtualMachineControllerRefManager) ClaimVirtualMachineByName(vmi *virtv1.VirtualMachineInstance, ...) (*virtv1.VirtualMachineInstance, error)
- func (m *VirtualMachineControllerRefManager) ClaimVirtualMachines(vmis []*virtv1.VirtualMachineInstance, ...) ([]*virtv1.VirtualMachineInstance, error)
- func (m *VirtualMachineControllerRefManager) ReleaseDataVolume(dataVolume *cdiv1.DataVolume) error
- func (m *VirtualMachineControllerRefManager) ReleaseVirtualMachine(vmi *virtv1.VirtualMachineInstance) error
- type VirtualMachineInstanceConditionManager
- func (d *VirtualMachineInstanceConditionManager) AddPodCondition(vmi *v1.VirtualMachineInstance, cond *k8sv1.PodCondition)
- func (d *VirtualMachineInstanceConditionManager) CheckFailure(vmi *v1.VirtualMachineInstance, syncErr error, reason string) (changed bool)
- func (d *VirtualMachineInstanceConditionManager) GetCondition(vmi *v1.VirtualMachineInstance, cond v1.VirtualMachineInstanceConditionType) *v1.VirtualMachineInstanceCondition
- func (d *VirtualMachineInstanceConditionManager) GetPodCondition(pod *k8sv1.Pod, conditionType k8sv1.PodConditionType) *k8sv1.PodCondition
- func (d *VirtualMachineInstanceConditionManager) GetPodConditionWithStatus(pod *k8sv1.Pod, conditionType k8sv1.PodConditionType, ...) *k8sv1.PodCondition
- func (d *VirtualMachineInstanceConditionManager) HasCondition(vmi *v1.VirtualMachineInstance, cond v1.VirtualMachineInstanceConditionType) bool
- func (d *VirtualMachineInstanceConditionManager) HasConditionWithStatus(vmi *v1.VirtualMachineInstance, cond v1.VirtualMachineInstanceConditionType, ...) bool
- func (d *VirtualMachineInstanceConditionManager) HasConditionWithStatusAndReason(vmi *v1.VirtualMachineInstance, cond v1.VirtualMachineInstanceConditionType, ...) bool
- func (d *VirtualMachineInstanceConditionManager) PodHasCondition(pod *k8sv1.Pod, conditionType k8sv1.PodConditionType, ...) bool
- func (d *VirtualMachineInstanceConditionManager) RemoveCondition(vmi *v1.VirtualMachineInstance, cond v1.VirtualMachineInstanceConditionType)
- type VirtualMachineInstanceMigrationConditionManager
- func (d *VirtualMachineInstanceMigrationConditionManager) HasCondition(migration *v1.VirtualMachineInstanceMigration, ...) bool
- func (d *VirtualMachineInstanceMigrationConditionManager) HasConditionWithStatus(migration *v1.VirtualMachineInstanceMigration, ...) bool
- func (d *VirtualMachineInstanceMigrationConditionManager) RemoveCondition(migration *v1.VirtualMachineInstanceMigration, ...)
Constants ¶
const ( // BurstReplicas is the maximum amount of requests in a row for CRUD operations on resources by controllers, // to avoid unintentional DoS BurstReplicas uint = 250 )
const ( // If a watch drops a delete event for a pod, 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 pods a second, so it takes about 1 min to service // 500 pods. Just creation is limited to 20qps, and watching happens with ~10-30s // latency/pod at the scale of 3000 pods over 100 nodes. ExpectationsTimeout = 5 * time.Minute )
const (
OperatorLabel = kubev1.ManagedByLabel + "=" + kubev1.ManagedByLabelOperatorValue
)
Variables ¶
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
var (
KeyFunc = cache.DeletionHandlingMetaNamespaceKeyFunc
)
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.
var UpdateTaintBackoff = wait.Backoff{ Steps: 5, Duration: 100 * time.Millisecond, Jitter: 1.0, }
Functions ¶
func AddFinalizer ¶ added in v0.31.0
func ApplyVolumeRequestOnVMISpec ¶ added in v0.36.0
func ApplyVolumeRequestOnVMISpec(vmiSpec *v1.VirtualMachineInstanceSpec, request *v1.VirtualMachineVolumeRequest) *v1.VirtualMachineInstanceSpec
func DataVolumeKey ¶ added in v0.8.0
func DataVolumeKey(dataVolume *cdiv1.DataVolume) string
func GetControllerOf ¶ added in v0.1.0
func GetControllerOf(pod *k8sv1.Pod) *metav1.OwnerReference
GetControllerOf returns the controllerRef if controllee has a controller, otherwise returns nil.
func HandlePanic ¶
func HandlePanic()
func IsControlledBy ¶ added in v0.11.0
func IsControlledBy(pod *k8sv1.Pod, vmi *virtv1.VirtualMachineInstance) bool
func MigrationKey ¶ added in v0.9.2
func MigrationKey(migration *v1.VirtualMachineInstanceMigration) string
func NewListWatchFromClient ¶
func NewListWatchFromClient(c cache.Getter, resource string, namespace string, fieldSelector fields.Selector, labelSelector labels.Selector) *cache.ListWatch
NewListWatchFromClient creates a new ListWatch from the specified client, resource, kubevirtNamespace and field selector.
func NewResourceEventHandlerFuncsForFunc ¶
func NewResourceEventHandlerFuncsForFunc(f func(interface{})) cache.ResourceEventHandlerFuncs
func NewResourceEventHandlerFuncsForWorkqueue ¶
func NewResourceEventHandlerFuncsForWorkqueue(queue workqueue.RateLimitingInterface) cache.ResourceEventHandlerFuncs
func NoResyncPeriodFunc ¶
Returns 0 for resyncPeriod in case resyncing is not needed.
func ObservedLatestApiVersionAnnotation ¶ added in v0.20.0
func RecheckDeletionTimestamp ¶ added in v0.1.0
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 RemoveFinalizer ¶ added in v0.5.0
func SetLatestApiVersionAnnotation ¶ added in v0.20.0
func VirtualMachineKey ¶
func VirtualMachineKey(vmi *v1.VirtualMachineInstance) string
func VirtualMachineKeys ¶
func VirtualMachineKeys(vmis []*v1.VirtualMachineInstance) []string
func VolumeSnapshotClassInformer ¶ added in v0.31.0
func VolumeSnapshotClassInformer(clientSet kubecli.KubevirtClient, resyncPeriod time.Duration) cache.SharedIndexInformer
VolumeSnapshotClassInformer returns an informer for VolumeSnapshotClasses
func VolumeSnapshotInformer ¶ added in v0.31.0
func VolumeSnapshotInformer(clientSet kubecli.KubevirtClient, resyncPeriod time.Duration) cache.SharedIndexInformer
VolumeSnapshotInformer returns an informer for VolumeSnapshots
Types ¶
type BaseControllerRefManager ¶ added in v0.1.0
type BaseControllerRefManager struct { Controller metav1.Object Selector labels.Selector CanAdoptFunc func() error // contains filtered or unexported fields }
func (*BaseControllerRefManager) CanAdopt ¶ added in v0.1.0
func (m *BaseControllerRefManager) CanAdopt() error
func (*BaseControllerRefManager) ClaimObject ¶ added in v0.1.0
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 ControlleeExpectations ¶
type ControlleeExpectations struct {
// contains filtered or unexported fields
}
ControlleeExpectations track controllee creates/deletes.
func (*ControlleeExpectations) Add ¶
func (e *ControlleeExpectations) Add(add, del int64)
Add increments the add and del counters.
func (*ControlleeExpectations) Fulfilled ¶
func (e *ControlleeExpectations) Fulfilled() bool
Fulfilled returns true if this expectation has been fulfilled.
func (*ControlleeExpectations) GetExpectations ¶
func (e *ControlleeExpectations) GetExpectations() (int64, int64)
GetExpectations returns the add and del expectations of the controllee.
type ControllerExpectations ¶
ControllerExpectations is a cache mapping controllers to what they expect to see before being woken up for a sync.
func NewControllerExpectations ¶
func NewControllerExpectations() *ControllerExpectations
NewControllerExpectations returns a store for ControllerExpectations.
func NewControllerExpectationsWithName ¶ added in v0.12.0
func NewControllerExpectationsWithName(name string) *ControllerExpectations
func (*ControllerExpectations) AllPendingCreations ¶ added in v0.16.0
func (r *ControllerExpectations) AllPendingCreations() (sum int64)
func (*ControllerExpectations) CreationObserved ¶
func (r *ControllerExpectations) CreationObserved(controllerKey string)
CreationObserved atomically decrements the `add` expectation count of the given controller.
func (*ControllerExpectations) DeleteExpectations ¶
func (r *ControllerExpectations) DeleteExpectations(controllerKey string)
DeleteExpectations deletes the expectations of the given controller from the TTLStore.
func (*ControllerExpectations) DeletionObserved ¶
func (r *ControllerExpectations) DeletionObserved(controllerKey string)
DeletionObserved atomically decrements the `del` expectation count of the given controller.
func (*ControllerExpectations) ExpectCreations ¶
func (r *ControllerExpectations) ExpectCreations(controllerKey string, adds int)
func (*ControllerExpectations) ExpectDeletions ¶
func (r *ControllerExpectations) ExpectDeletions(controllerKey string, dels int)
func (*ControllerExpectations) GetExpectations ¶
func (r *ControllerExpectations) GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error)
GetExpectations returns the ControlleeExpectations of the given controller.
func (*ControllerExpectations) LowerExpectations ¶
func (r *ControllerExpectations) LowerExpectations(controllerKey string, add, del int)
Decrements the expectation counts of the given controller.
func (*ControllerExpectations) RaiseExpectations ¶
func (r *ControllerExpectations) RaiseExpectations(controllerKey string, add, del int)
Increments the expectation counts of the given controller.
func (*ControllerExpectations) SatisfiedExpectations ¶
func (r *ControllerExpectations) 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 (*ControllerExpectations) SetExpectations ¶
func (r *ControllerExpectations) SetExpectations(controllerKey string, add, del int)
SetExpectations registers new expectations for the given controller. Forgets existing expectations.
type ControllerExpectationsInterface ¶
type ControllerExpectationsInterface interface { GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error) SatisfiedExpectations(controllerKey string) bool DeleteExpectations(controllerKey string) SetExpectations(controllerKey string, add, del int) ExpectCreations(controllerKey string, adds int) ExpectDeletions(controllerKey string, dels int) CreationObserved(controllerKey string) DeletionObserved(controllerKey string) RaiseExpectations(controllerKey string, add, del int) LowerExpectations(controllerKey string, add, del int) AllPendingCreations() (creations int64) }
ControllerExpectationsInterface 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 ControllerExpectationsInterface with different types of controllers, because the keys might conflict across types.
type Expectations ¶
type Expectations interface {
Fulfilled() bool
}
Expectations are either fulfilled, or expire naturally.
type KubeInformerFactory ¶
type KubeInformerFactory interface { // Starts any informers that have not been started yet // This function is thread safe and idempotent Start(stopCh <-chan struct{}) // Watches for vmi objects VMI() cache.SharedIndexInformer // Watches for VirtualMachineInstanceReplicaSet objects VMIReplicaSet() cache.SharedIndexInformer // Watches for VirtualMachineInstancePreset objects VirtualMachinePreset() cache.SharedIndexInformer // Watches for pods related only to kubevirt KubeVirtPod() cache.SharedIndexInformer // Watches for nodes KubeVirtNode() cache.SharedIndexInformer // VirtualMachine handles the VMIs that are stopped or not running VirtualMachine() cache.SharedIndexInformer // Watches VirtualMachineInstanceMigration objects VirtualMachineInstanceMigration() cache.SharedIndexInformer // Watches VirtualMachineSnapshot objects VirtualMachineSnapshot() cache.SharedIndexInformer // Watches VirtualMachineSnapshot objects VirtualMachineSnapshotContent() cache.SharedIndexInformer // Watches VirtualMachineRestore objects VirtualMachineRestore() cache.SharedIndexInformer // Watches for k8s extensions api configmap ApiAuthConfigMap() cache.SharedIndexInformer // Watches for the kubevirt CA config map KubeVirtCAConfigMap() cache.SharedIndexInformer // ConfigMaps which are managed by the operator OperatorConfigMap() cache.SharedIndexInformer // Watches for ConfigMap objects ConfigMap() cache.SharedIndexInformer // Watches for PersistentVolumeClaim objects PersistentVolumeClaim() cache.SharedIndexInformer // Watches for LimitRange objects LimitRanges() cache.SharedIndexInformer // Watches for CDI DataVolume objects DataVolume() cache.SharedIndexInformer // Fake CDI DataVolume informer used when feature gate is disabled DummyDataVolume() cache.SharedIndexInformer // CRD CRD() cache.SharedIndexInformer // Wachtes for KubeVirt objects KubeVirt() cache.SharedIndexInformer // Service Accounts OperatorServiceAccount() cache.SharedIndexInformer // ClusterRole OperatorClusterRole() cache.SharedIndexInformer // ClusterRoleBinding OperatorClusterRoleBinding() cache.SharedIndexInformer // Roles OperatorRole() cache.SharedIndexInformer // RoleBinding OperatorRoleBinding() cache.SharedIndexInformer // CRD OperatorCRD() cache.SharedIndexInformer // Service OperatorService() cache.SharedIndexInformer // DaemonSet OperatorDaemonSet() cache.SharedIndexInformer // Deployment OperatorDeployment() cache.SharedIndexInformer // SecurityContextConstraints OperatorSCC() cache.SharedIndexInformer // Fake SecurityContextConstraints informer used when not on openshift DummyOperatorSCC() cache.SharedIndexInformer // ConfigMaps for operator install strategies OperatorInstallStrategyConfigMaps() cache.SharedIndexInformer // Jobs for dumping operator install strategies OperatorInstallStrategyJob() cache.SharedIndexInformer // KubeVirt infrastructure pods OperatorPod() cache.SharedIndexInformer // Webhooks created/managed by virt operator OperatorValidationWebhook() cache.SharedIndexInformer // Webhooks created/managed by virt operator OperatorMutatingWebhook() cache.SharedIndexInformer // APIServices created/managed by virt operator OperatorAPIService() cache.SharedIndexInformer // PodDisruptionBudgets created/managed by virt operator OperatorPodDisruptionBudget() cache.SharedIndexInformer // ServiceMonitors created/managed by virt operator OperatorServiceMonitor() cache.SharedIndexInformer // Managed secrets which hold data like certificates Secrets() cache.SharedIndexInformer // Fake ServiceMonitor informer used when Prometheus is not installed DummyOperatorServiceMonitor() cache.SharedIndexInformer // The namespace where kubevirt is deployed in Namespace() cache.SharedIndexInformer // PrometheusRules created/managed by virt operator OperatorPrometheusRule() cache.SharedIndexInformer // Fake PrometheusRule informer used when Prometheus not installed DummyOperatorPrometheusRule() cache.SharedIndexInformer // PVC StorageClasses StorageClass() cache.SharedIndexInformer // Pod returns an informer for ALL Pods in the system Pod() cache.SharedIndexInformer K8SInformerFactory() informers.SharedInformerFactory }
func NewKubeInformerFactory ¶
func NewKubeInformerFactory(restClient *rest.RESTClient, clientSet kubecli.KubevirtClient, aggregatorClient aggregatorclient.Interface, kubevirtNamespace string) KubeInformerFactory
type RealVirtualMachineControl ¶ added in v0.1.0
type RealVirtualMachineControl struct {
Clientset kubecli.KubevirtClient
}
func (RealVirtualMachineControl) PatchDataVolume ¶ added in v0.8.0
func (r RealVirtualMachineControl) PatchDataVolume(namespace, name string, data []byte) error
func (RealVirtualMachineControl) PatchVirtualMachine ¶ added in v0.1.0
func (r RealVirtualMachineControl) PatchVirtualMachine(namespace, name string, data []byte) error
type ResyncPeriodFunc ¶
func StaticResyncPeriodFunc ¶
func StaticResyncPeriodFunc(resyncPeriod time.Duration) ResyncPeriodFunc
StaticResyncPeriodFunc returns the resync period specified
type UIDSet ¶
UIDSet holds a key and a set of UIDs. Used by the UIDTrackingControllerExpectations to remember which UID it has seen/still waiting for.
type UIDTrackingControllerExpectations ¶
type UIDTrackingControllerExpectations struct { ControllerExpectationsInterface // contains filtered or unexported fields }
UIDTrackingControllerExpectations tracks the UID of the pods 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: RTCTimerTrack creates as well (#22599)
func NewUIDTrackingControllerExpectations ¶
func NewUIDTrackingControllerExpectations(ce ControllerExpectationsInterface) *UIDTrackingControllerExpectations
NewUIDTrackingControllerExpectations returns a wrapper around ControllerExpectations that is aware of deleteKeys.
func (*UIDTrackingControllerExpectations) AddExpectedDeletion ¶ added in v0.12.0
func (u *UIDTrackingControllerExpectations) AddExpectedDeletion(rcKey string, deletedKey string)
func (*UIDTrackingControllerExpectations) DeleteExpectations ¶
func (u *UIDTrackingControllerExpectations) DeleteExpectations(rcKey string)
DeleteExpectations deletes the UID set and invokes DeleteExpectations on the underlying ControllerExpectationsInterface.
func (*UIDTrackingControllerExpectations) DeletionObserved ¶
func (u *UIDTrackingControllerExpectations) DeletionObserved(rcKey, deleteKey string)
DeletionObserved records the given deleteKey as a deletion, for the given rc.
func (*UIDTrackingControllerExpectations) ExpectDeletions ¶
func (u *UIDTrackingControllerExpectations) ExpectDeletions(rcKey string, deletedKeys []string)
ExpectDeletions records expectations for the given deleteKeys, against the given controller.
func (*UIDTrackingControllerExpectations) GetUIDs ¶
func (u *UIDTrackingControllerExpectations) 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.
type VirtualMachineConditionManager ¶ added in v0.5.0
type VirtualMachineConditionManager struct { }
func NewVirtualMachineConditionManager ¶ added in v0.5.0
func NewVirtualMachineConditionManager() *VirtualMachineConditionManager
func (*VirtualMachineConditionManager) GetCondition ¶ added in v0.29.0
func (d *VirtualMachineConditionManager) GetCondition(vm *v1.VirtualMachine, cond v1.VirtualMachineConditionType) *v1.VirtualMachineCondition
func (*VirtualMachineConditionManager) HasCondition ¶ added in v0.5.0
func (d *VirtualMachineConditionManager) HasCondition(vm *v1.VirtualMachine, cond v1.VirtualMachineConditionType) bool
func (*VirtualMachineConditionManager) RemoveCondition ¶ added in v0.5.0
func (d *VirtualMachineConditionManager) RemoveCondition(vm *v1.VirtualMachine, cond v1.VirtualMachineConditionType)
type VirtualMachineControlInterface ¶ added in v0.1.0
type VirtualMachineControllerRefManager ¶ added in v0.1.0
type VirtualMachineControllerRefManager struct { BaseControllerRefManager // contains filtered or unexported fields }
func NewVirtualMachineControllerRefManager ¶ added in v0.1.0
func NewVirtualMachineControllerRefManager( virtualMachineControl VirtualMachineControlInterface, controller metav1.Object, selector labels.Selector, controllerKind schema.GroupVersionKind, canAdopt func() error, ) *VirtualMachineControllerRefManager
NewVirtualMachineControllerRefManager returns a VirtualMachineControllerRefManager that exposes methods to manage the controllerRef of virtual 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
VirtualMachineControllerRefManager instance. Create a new instance if it makes sense to check CanAdopt() again (e.g. in a different sync pass).
func (*VirtualMachineControllerRefManager) AdoptDataVolume ¶ added in v0.8.0
func (m *VirtualMachineControllerRefManager) AdoptDataVolume(dataVolume *cdiv1.DataVolume) error
AdoptDataVolume sends a patch to take control of the dataVolume. It returns the error if the patching fails.
func (*VirtualMachineControllerRefManager) AdoptVirtualMachine ¶ added in v0.1.0
func (m *VirtualMachineControllerRefManager) AdoptVirtualMachine(vmi *virtv1.VirtualMachineInstance) error
AdoptVirtualMachine sends a patch to take control of the vmi. It returns the error if the patching fails.
func (*VirtualMachineControllerRefManager) ClaimMatchedDataVolumes ¶ added in v0.8.0
func (m *VirtualMachineControllerRefManager) ClaimMatchedDataVolumes(dataVolumes []*cdiv1.DataVolume, filters ...func(machine *cdiv1.DataVolume) bool) ([]*cdiv1.DataVolume, error)
ClaimMatchedDataVolumes tries to take ownership of a list of DataVolumes.
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 DataVolume 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 DataVolumes that you now own is returned.
func (*VirtualMachineControllerRefManager) ClaimVirtualMachineByName ¶ added in v0.3.0
func (m *VirtualMachineControllerRefManager) ClaimVirtualMachineByName(vmi *virtv1.VirtualMachineInstance, filters ...func(machine *virtv1.VirtualMachineInstance) bool) (*virtv1.VirtualMachineInstance, error)
ClaimVirtualMachineByName tries to take ownership of a VirtualMachineInstance.
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 VirtualMachineInstance 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 VirtualMachines that you now own is returned.
func (*VirtualMachineControllerRefManager) ClaimVirtualMachines ¶ added in v0.1.0
func (m *VirtualMachineControllerRefManager) ClaimVirtualMachines(vmis []*virtv1.VirtualMachineInstance, filters ...func(machine *virtv1.VirtualMachineInstance) bool) ([]*virtv1.VirtualMachineInstance, error)
ClaimVirtualMachines tries to take ownership of a list of VirtualMachines.
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 VirtualMachineInstance 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 VirtualMachines that you now own is returned.
func (*VirtualMachineControllerRefManager) ReleaseDataVolume ¶ added in v0.8.0
func (m *VirtualMachineControllerRefManager) ReleaseDataVolume(dataVolume *cdiv1.DataVolume) error
ReleaseDataVolume sends a patch to free the dataVolume from the control of the controller. It returns the error if the patching fails. 404 and 422 errors are ignored.
func (*VirtualMachineControllerRefManager) ReleaseVirtualMachine ¶ added in v0.1.0
func (m *VirtualMachineControllerRefManager) ReleaseVirtualMachine(vmi *virtv1.VirtualMachineInstance) error
ReleaseVirtualMachine sends a patch to free the virtual machine from the control of the controller. It returns the error if the patching fails. 404 and 422 errors are ignored.
type VirtualMachineInstanceConditionManager ¶ added in v0.29.0
type VirtualMachineInstanceConditionManager struct { }
func NewVirtualMachineInstanceConditionManager ¶ added in v0.6.1
func NewVirtualMachineInstanceConditionManager() *VirtualMachineInstanceConditionManager
func (*VirtualMachineInstanceConditionManager) AddPodCondition ¶ added in v0.29.0
func (d *VirtualMachineInstanceConditionManager) AddPodCondition(vmi *v1.VirtualMachineInstance, cond *k8sv1.PodCondition)
AddPodCondition add pod condition to the VM.
func (*VirtualMachineInstanceConditionManager) CheckFailure ¶ added in v0.29.0
func (d *VirtualMachineInstanceConditionManager) CheckFailure(vmi *v1.VirtualMachineInstance, syncErr error, reason string) (changed bool)
func (*VirtualMachineInstanceConditionManager) GetCondition ¶ added in v0.29.0
func (d *VirtualMachineInstanceConditionManager) GetCondition(vmi *v1.VirtualMachineInstance, cond v1.VirtualMachineInstanceConditionType) *v1.VirtualMachineInstanceCondition
func (*VirtualMachineInstanceConditionManager) GetPodCondition ¶ added in v0.29.0
func (d *VirtualMachineInstanceConditionManager) GetPodCondition(pod *k8sv1.Pod, conditionType k8sv1.PodConditionType) *k8sv1.PodCondition
func (*VirtualMachineInstanceConditionManager) GetPodConditionWithStatus ¶ added in v0.29.0
func (d *VirtualMachineInstanceConditionManager) GetPodConditionWithStatus(pod *k8sv1.Pod, conditionType k8sv1.PodConditionType, status k8sv1.ConditionStatus) *k8sv1.PodCondition
func (*VirtualMachineInstanceConditionManager) HasCondition ¶ added in v0.29.0
func (d *VirtualMachineInstanceConditionManager) HasCondition(vmi *v1.VirtualMachineInstance, cond v1.VirtualMachineInstanceConditionType) bool
func (*VirtualMachineInstanceConditionManager) HasConditionWithStatus ¶ added in v0.29.0
func (d *VirtualMachineInstanceConditionManager) HasConditionWithStatus(vmi *v1.VirtualMachineInstance, cond v1.VirtualMachineInstanceConditionType, status k8sv1.ConditionStatus) bool
func (*VirtualMachineInstanceConditionManager) HasConditionWithStatusAndReason ¶ added in v0.35.0
func (d *VirtualMachineInstanceConditionManager) HasConditionWithStatusAndReason(vmi *v1.VirtualMachineInstance, cond v1.VirtualMachineInstanceConditionType, status k8sv1.ConditionStatus, reason string) bool
func (*VirtualMachineInstanceConditionManager) PodHasCondition ¶ added in v0.29.0
func (d *VirtualMachineInstanceConditionManager) PodHasCondition(pod *k8sv1.Pod, conditionType k8sv1.PodConditionType, status k8sv1.ConditionStatus) bool
func (*VirtualMachineInstanceConditionManager) RemoveCondition ¶ added in v0.29.0
func (d *VirtualMachineInstanceConditionManager) RemoveCondition(vmi *v1.VirtualMachineInstance, cond v1.VirtualMachineInstanceConditionType)
type VirtualMachineInstanceMigrationConditionManager ¶ added in v0.16.0
type VirtualMachineInstanceMigrationConditionManager struct { }
func NewVirtualMachineInstanceMigrationConditionManager ¶ added in v0.16.0
func NewVirtualMachineInstanceMigrationConditionManager() *VirtualMachineInstanceMigrationConditionManager
func (*VirtualMachineInstanceMigrationConditionManager) HasCondition ¶ added in v0.16.0
func (d *VirtualMachineInstanceMigrationConditionManager) HasCondition(migration *v1.VirtualMachineInstanceMigration, cond v1.VirtualMachineInstanceMigrationConditionType) bool
func (*VirtualMachineInstanceMigrationConditionManager) HasConditionWithStatus ¶ added in v0.16.0
func (d *VirtualMachineInstanceMigrationConditionManager) HasConditionWithStatus(migration *v1.VirtualMachineInstanceMigration, cond v1.VirtualMachineInstanceMigrationConditionType, status k8sv1.ConditionStatus) bool
func (*VirtualMachineInstanceMigrationConditionManager) RemoveCondition ¶ added in v0.16.0
func (d *VirtualMachineInstanceMigrationConditionManager) RemoveCondition(migration *v1.VirtualMachineInstanceMigration, cond v1.VirtualMachineInstanceMigrationConditionType)