syncer

package
v3.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 65 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceKindPVC               = "PersistentVolumeClaim"
	ResourceKindSnapshot          = "VolumeSnapshot"
	PVCQuotaExtensionServiceName  = "volume.cns.vsphere.vmware.com"
	SnapQuotaExtensionServiceName = "snapshot.cns.vsphere.vmware.com"
)

Variables

View Source
var (

	// COInitParams stores the input params required for initiating the
	// CO agnostic orchestrator for the syncer container.
	COInitParams interface{}

	// MetadataSyncer instance for the syncer container.
	MetadataSyncer *metadataSyncInformer

	// IsPodVMOnStretchSupervisorFSSEnabled is true when PodVMOnStretchedSupervisor FSS is enabled.
	IsPodVMOnStretchSupervisorFSSEnabled bool

	// ResourceAPIgroupPVC is an empty string as PVC belongs to the core resource group denoted by `""`.
	ResourceAPIgroupPVC = ""

	// ResourceAPIgroupSnapshot is API group for volume snapshot
	ResourceAPIgroupSnapshot = "snapshot.storage.k8s.io"
)
View Source
var Version string

Version of the syncer. This should be set via ldflags.

Functions

func CsiFullSync

func CsiFullSync(ctx context.Context, metadataSyncer *metadataSyncInformer, vc string) error

CsiFullSync reconciles volume metadata on a vanilla k8s cluster with volume metadata on CNS.

func HasMigratedToAnnotationUpdate

func HasMigratedToAnnotationUpdate(ctx context.Context, prevAnnotations map[string]string,
	newAnnotations map[string]string, objectName string) bool

HasMigratedToAnnotationUpdate returns true if the migrated-to annotation is found in the newer object.

func InitMetadataSyncer

func InitMetadataSyncer(ctx context.Context, clusterFlavor cnstypes.CnsClusterFlavor,
	configInfo *cnsconfig.ConfigurationInfo) error

InitMetadataSyncer initializes the Metadata Sync Informer.

func IsMultiAttachAllowed

func IsMultiAttachAllowed(pv *v1.PersistentVolume) bool

IsMultiAttachAllowed helps check accessModes on the PV and return true if volume can be attached to multiple nodes.

func IsValidVolume

func IsValidVolume(ctx context.Context, volume v1.Volume, pod *v1.Pod,
	metadataSyncer *metadataSyncInformer) (bool, *v1.PersistentVolume, *v1.PersistentVolumeClaim)

IsValidVolume determines if the given volume mounted by a POD is a valid vsphere volume. Returns the pv and pvc object if true.

func PatchStoragePolicyUsage added in v3.2.0

func PatchStoragePolicyUsage(ctx context.Context, cnsOperatorClient client.Client,
	oldObj *storagepolicyusagev1alpha1.StoragePolicyUsage,
	newObj *storagepolicyusagev1alpha1.StoragePolicyUsage) error

PatchStoragePolicyUsage patches the StoragePolicyUsage CR based

func PvcsiFullSync

func PvcsiFullSync(ctx context.Context, metadataSyncer *metadataSyncInformer) error

PvcsiFullSync reconciles PV/PVC/Pod metadata on the guest cluster with cnsvolumemetadata objects on the supervisor cluster for the guest cluster.

func ReloadConfiguration

func ReloadConfiguration(metadataSyncer *metadataSyncInformer, reconnectToVCFromNewConfig bool) error

ReloadConfiguration reloads configuration from the secret, and update controller's cached configs. The function takes metadatasyncerInformer and reconnectToVCFromNewConfig as parameters. If reconnectToVCFromNewConfig is set to true, the function re-establishes connection with VC. Otherwise, based on the configuration data changed during reload, the function resets config, reloads VC connection when credentials are changed and returns appropriate error.

func SyncerInitConfigInfo

func SyncerInitConfigInfo(ctx context.Context) (*cnsconfig.ConfigurationInfo, error)

SyncerInitConfigInfo initializes the ConfigurationInfo struct

Types

type ResizeReconciler

type ResizeReconciler interface {
	// Run starts the reconciler.
	Run(workers int, ctx context.Context)
}

ResizeReconciler is the interface of resizeReconciler.

type VolumeHealthReconciler

type VolumeHealthReconciler interface {
	// Run starts the reconciler.
	Run(ctx context.Context, workers int)
}

VolumeHealthReconciler is the interface for volume health reconciler.

func NewVolumeHealthReconciler

func NewVolumeHealthReconciler(

	tkgKubeClient kubernetes.Interface,

	svcKubeClient kubernetes.Interface,
	resyncPeriod time.Duration,
	tkgInformerFactory informers.SharedInformerFactory,
	svcInformerFactory informers.SharedInformerFactory,
	svcPVCRateLimiter workqueue.RateLimiter,
	supervisorNamespace string, stopCh <-chan struct{}) (VolumeHealthReconciler, error)

NewVolumeHealthReconciler returns a VolumeHealthReconciler.

Jump to

Keyboard shortcuts

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