Documentation
¶
Overview ¶
NOTE: Added to skip creating shadow manifests for localSecret struct +kubebuilder:skip
Index ¶
- Constants
- func AddAnnotation(obj client.Object, key, value string) bool
- func AddFinalizer(obj client.Object, finalizer string) bool
- func AddLabel(obj client.Object, key, value string) bool
- func AddOwnerReference(obj, owner metav1.Object, scheme *runtime.Scheme) (bool, error)
- func BuildManagedClusterViewName(resourceName, resourceNamespace, resource string) string
- func CheckImagesReadyToUse(ctx context.Context, k8sClient client.Client, ...) (bool, error)
- func CleanExpiredRDImages(ctx context.Context, k8sClient client.Client, ...) error
- func ClusterScopedResourceNameFromMCVName(mcvName string) string
- func ConditionAppend(object metav1.Object, conditions *[]metav1.Condition, conditionType string, ...)
- func ConditionUpdate(object metav1.Object, condition *metav1.Condition, ...)
- func CreateNamespaceIfNotExists(ctx context.Context, k8sClient client.Client, namespace string) error
- func CreateRamenOpsNamespace(ctx context.Context, k8sClient client.Client, ramenconfig *rmn.RamenConfig) error
- func CreateVGRName(prefix string, suffix string) string
- func DRPolicyClusterNames(drpolicy *rmn.DRPolicy) []string
- func DRPolicyClusterNamesAsASet(drpolicy *rmn.DRPolicy) sets.String
- func DRPolicyS3Profiles(drpolicy *rmn.DRPolicy, drclusters []rmn.DRCluster) sets.String
- func DeferDeleteImage(ctx context.Context, k8sClient client.Client, ...) error
- func DeleteKey(keys map[string]string, key string) bool
- func DeletePVC(ctx context.Context, k8sClient client.Client, pvcName, namespace string, ...) error
- func DeleteReplicationGroupDestination(ctx context.Context, k8sClient client.Client, ...) error
- func DeleteReplicationGroupSource(ctx context.Context, k8sClient client.Client, ...) error
- func DeleteVMs(ctx context.Context, k8sclient client.Client, foundVMs []virtv1.VirtualMachine, ...) error
- func DrpolicyContainsDrcluster(drpolicy *rmn.DRPolicy, drcluster string) bool
- func DrpolicyRegionNames(drpolicy *rmn.DRPolicy, drClusters []rmn.DRCluster) []string
- func DrpolicyRegionNamesAsASet(drpolicy *rmn.DRPolicy, drClusters []rmn.DRCluster) sets.String
- func DrpolicyValidated(drpolicy *rmn.DRPolicy) error
- func EnsureLocalVGSAPI(ctx context.Context, apiReader client.Reader) error
- func ExtractDRCConfigFromManifestWork(mw *ocmworkv1.ManifestWork) (*rmn.DRClusterConfig, error)
- func ExtractMModeFromManifestWork(mw *ocmworkv1.ManifestWork) (*rmn.MaintenanceMode, error)
- func ExtractResourceFromManifestWork(mw *ocmworkv1.ManifestWork, object client.Object, gvk schema.GroupVersionKind) error
- func ExtractVRGFromManifestWork(mw *ocmworkv1.ManifestWork) (*rmn.VolumeReplicationGroup, error)
- func FindCondition(existingConditions []metav1.Condition, conditionType string) *metav1.Condition
- func ForcePrivateVGSAPIForTesting()
- func GenerateCombinedName(name, storageID string) string
- func GeneratePolicyName(name string, maxLen int) string
- func GeneratePolicyResourceNames(secret string, format TargetSecretFormat) (policyName, plBindingName, plRuleName, configPolicyName string)
- func GenerateVeleroSecretName(sName string) string
- func GenericStatusConditionSet(object client.Object, conditions *[]metav1.Condition, conditionType string, ...) bool
- func GetAllDRPolicies(ctx context.Context, client client.Reader) (rmn.DRPolicyList, error)
- func GetHashedName(name string) string
- func GetJobName(namePrefix string, ownerName string) string
- func GetLocalReplicationName(pvcName string) string
- func GetLocalServiceNameForDiffRD(rdName string) string
- func GetLocalServiceNameForRD(rdName string) string
- func GetPVC(ctx context.Context, k8sClient client.Client, ...) (*corev1.PersistentVolumeClaim, error)
- func GetRID() string
- func GetRSMoverConfig(name, namespace string, moverConfigArr []ramendrv1alpha1.MoverConfig) *ramendrv1alpha1.MoverConfig
- func GetRawExtension(manifests []ocmworkv1.Manifest, gvk schema.GroupVersionKind) (*runtime.RawExtension, error)
- func GetRemoteServiceNameForDiffRDFromPVCName(pvcName, rdNamespace string) string
- func GetRemoteServiceNameForRDFromPVCName(pvcName, rdNamespace string) string
- func GetReplicationDestinationName(pvcName string) string
- func GetSecondsFromSchedulingInterval(drpolicy *rmn.DRPolicy) (float64, error)
- func GetServiceName(namePrefix string, ownerName string) string
- func GetTmpPVCNameForFinalSync(pvcName string) string
- func GetVolumeGroupSnapshot(ctx context.Context, k8sClient client.Client, name, namespace string) (client.Object, error)
- func GetVolumeGroupSnapshotClassFromPVCsStorageClass(ctx context.Context, k8sClient client.Client, ...) (string, error)
- func GetVolumeSnapshotsOwnedByVolumeGroupSnapshot(ctx context.Context, k8sClient client.Client, vgs client.Object, ...) ([]vsv1.VolumeSnapshot, error)
- func GlobalVGRName(groupReplicationID string) string
- func HasAnnotation(obj client.Object, key string) bool
- func HasLabel(obj client.Object, key string) bool
- func HasLabelWithValue(obj client.Object, key string, value string) bool
- func HasStatus(vgs client.Object) bool
- func HashPVC(pvc *corev1.PersistentVolumeClaim) string
- func IndexFieldsForVSHandler(ctx context.Context, fieldIndexer client.FieldIndexer) error
- func IsCGEnabledForVolRep(ctx context.Context, apiReader client.Reader) bool
- func IsCGEnabledForVolSync(ctx context.Context, apiReader client.Reader) bool
- func IsCRDInstalled(ctx context.Context, apiReader client.Reader, crdName string) bool
- func IsDiffSyncEnabled(annotations map[string]string) bool
- func IsManifestInAppliedState(mw *ocmworkv1.ManifestWork) bool
- func IsOwnedByVM(ctx context.Context, c client.Client, obj client.Object, log logr.Logger) (client.Object, error)
- func IsPVAttachedToNode(ctx context.Context, k8sClient client.Client, log logr.Logger, ...) (bool, error)
- func IsPVCInUseByPod(ctx context.Context, k8sClient client.Client, log logr.Logger, ...) (bool, error)
- func IsPVCMarkedForVolSync(annotations map[string]string) bool
- func IsRDExist(rdspec ramendrv1alpha1.VolSyncReplicationDestinationSpec, ...) bool
- func IsReplicationGroupDestinationReady(ctx context.Context, k8sClient client.Client, ...) (bool, error)
- func IsSubmarinerEnabled(annotations map[string]string) bool
- func IsVMDeletionInProgress(ctx context.Context, k8sclient client.Client, vmList []string, ...) ([]virtv1.VirtualMachine, bool, error)
- func ListPVCsByCGLabel(ctx context.Context, k8sClient client.Client, namespace string, ...) (*corev1.PersistentVolumeClaimList, error)
- func ListPVCsByPVCSelector(ctx context.Context, k8sClient client.Client, logger logr.Logger, ...) (*corev1.PersistentVolumeClaimList, error)
- func ListVMsByLabelSelector(ctx context.Context, k8sclient client.Client, logger logr.Logger, ...) ([]string, error)
- func ListVMsByVMNamespace(ctx context.Context, k8sclient client.Client, log logr.Logger, ...) ([]virtv1.VirtualMachine, error)
- func ListVolumeGroupSnapshots(ctx context.Context, k8sClient client.Client, listOptions ...client.ListOption) ([]client.Object, error)
- func ManifestWorkName(name, namespace, mwType string) string
- func MapCopy[M ~map[K]V, K, V comparable](src M, dst *M) bool
- func MapCopyF[M ~map[K]V, K, V comparable](src M, dstGet func() M, dstSet func(M)) bool
- func MapDelete[M ~map[K]V, K, V comparable](src M, dst *M) bool
- func MapDeleteF[M ~map[K]V, K, V comparable](src M, dstGet func() M, dstSet func(M)) bool
- func MapDoF[M ~map[K]V, K, V comparable, R any](src M, dstGet func() M, dstSet func(M), mapDo func(M, *M) R) R
- func MergeConditions(conditionSet func(*[]metav1.Condition, metav1.Condition) metav1.Condition, ...) metav1.Condition
- func Namespace(name string) *corev1.Namespace
- func NewVolumeGroupSnapshot(name, namespace string) client.Object
- func ObjectLabelsDelete(object metav1.Object, labels map[string]string) bool
- func ObjectLabelsDo[T any](object metav1.Object, labels map[string]string, ...) T
- func ObjectLabelsSet(object metav1.Object, labels map[string]string) bool
- func ObjectMetaEmbedded(objectMeta *metav1.ObjectMeta) metav1.ObjectMeta
- func ObjectOwnerSet(object, owner metav1.Object) bool
- func ObjectOwnerUnsetIfSet(object, owner metav1.Object) bool
- func ObjectsMap[ObjectType any, ClientObject interface{ ... }](objects ...ObjectType) map[client.ObjectKey]ObjectType
- func OptionalEqual(a, b string) bool
- func OwnerNamespaceNameAndName(labels Labels) (string, string, bool)
- func OwnerNamespacedName(owner metav1.Object) types.NamespacedName
- func OwnsAcrossNamespaces(builder *builder.Builder, scheme *runtime.Scheme, object client.Object, ...) *builder.Builder
- func OwnsVolumeGroupSnapshot(b *builder.Builder) bool
- func ParseVMInterfaceAddresses(raw string) map[string][]string
- func ProtectedPVCNamespacedName(pvc ramen.ProtectedPVC) types.NamespacedName
- func RemoveLabel(obj client.Object, key string, value *string) bool
- func RemoveOwnerReference(obj, owner metav1.Object, scheme *runtime.Scheme) (bool, error)
- func ReportIfNotPresent(recorder *EventReporter, instance runtime.Object, ...)
- func ResourceIsDeleted(obj client.Object) bool
- func SecretFinalizer(format TargetSecretFormat) string
- func SelectVGSGroupVersion(ctx context.Context, apiReader client.Reader) (schema.GroupVersion, error)
- func SetStatusCondition(existingConditions *[]metav1.Condition, newCondition metav1.Condition) metav1.Condition
- func SetStatusConditionIfNotFound(existingConditions *[]metav1.Condition, newCondition metav1.Condition)
- func SetVolumeGroupSnapshotClassName(vgs client.Object, className *string)
- func SetVolumeGroupSnapshotSourceSelector(vgs client.Object, selector *metav1.LabelSelector)
- func SyncPVCAnnotations(pvc *corev1.PersistentVolumeClaim, protectedAnnotations map[string]string)
- func SyncPVCLabels(pvc *corev1.PersistentVolumeClaim, protectedLabels map[string]string)
- func TrimToK8sResourceNameLength(name string) string
- func UpdateLabel(obj client.Object, key, newValue string) bool
- func UpdateStringMap(dst *map[string]string, src map[string]string)
- func UsePrivateVGSAPI() bool
- func UsePublicVGSAPI() bool
- func VSInRGD(vs vsv1.VolumeSnapshot, rgd *ramendrv1alpha1.ReplicationGroupDestination) bool
- func VolumeGroupSnapshotClassMatchStorageProviders(volumeGroupSnapshotClass VolumeGroupSnapshotClassWrapper, ...) bool
- func VolumeGroupSnapshotIsReady(vgs client.Object) bool
- func WatchesVolumeGroupSnapshotClass(b *builder.Builder, log logr.Logger, eventHandler handler.EventHandler, ...) *builder.Builder
- type Comparison
- func MapInsertOnlyAll[M ~map[K]V, K, V comparable](src M, dst *M) Comparison
- func MapInsertOnlyAllF[M ~map[K]V, K, V comparable](src M, dstGet func() M, dstSet func(M)) Comparison
- func ObjectLabelInsertOnlyAll(object metav1.Object, labels map[string]string) Comparison
- func ObjectOwnerSetIfNotAlready(object, owner metav1.Object) Comparison
- type CreateOrDeleteOrResourceVersionUpdatePredicate
- func (CreateOrDeleteOrResourceVersionUpdatePredicate) Create(e event.CreateEvent) bool
- func (CreateOrDeleteOrResourceVersionUpdatePredicate) Delete(e event.DeleteEvent) bool
- func (CreateOrDeleteOrResourceVersionUpdatePredicate) Generic(e event.GenericEvent) bool
- func (CreateOrDeleteOrResourceVersionUpdatePredicate) Update(e event.UpdateEvent) bool
- type CreateOrResourceVersionUpdatePredicate
- func (CreateOrResourceVersionUpdatePredicate) Create(event.CreateEvent) bool
- func (CreateOrResourceVersionUpdatePredicate) Delete(event.DeleteEvent) bool
- func (CreateOrResourceVersionUpdatePredicate) Generic(event.GenericEvent) bool
- func (CreateOrResourceVersionUpdatePredicate) Update(e event.UpdateEvent) bool
- type EventReporter
- type Labels
- type MWUtil
- func (mwu *MWUtil) BuildManifestWorkName(mwType string) string
- func (mwu *MWUtil) CreateOrUpdateDRCConfigManifestWork(cluster string, cConfig rmn.DRClusterConfig) error
- func (mwu *MWUtil) CreateOrUpdateDrClusterManifestWork(clusterName string, objectsToAppend []interface{}, ...) error
- func (mwu *MWUtil) CreateOrUpdateMModeManifestWork(name, cluster string, mMode rmn.MaintenanceMode, annotations map[string]string) error
- func (mwu *MWUtil) CreateOrUpdateNFManifestWork(name, homeCluster string, nf csiaddonsv1alpha1.NetworkFence, ...) error
- func (mwu *MWUtil) CreateOrUpdateNamespaceManifestWork(name string, namespaceName string, managedClusterNamespace string, ...) error
- func (mwu *MWUtil) CreateOrUpdateRecipeManifestWork(recipe *recipev1.Recipe, managedClusterNamespace string) error
- func (mwu *MWUtil) CreateOrUpdateVRGManifestWork(name, namespace, homeCluster string, vrg rmn.VolumeReplicationGroup, ...) (ctrlutil.OperationResult, error)
- func (mwu *MWUtil) DeleteManifestWork(mwName, mwNamespace string) error
- func (mwu *MWUtil) DeleteNamespaceManifestWork(mwName string, clusterName string) error
- func (mwu *MWUtil) DeleteRecipeManifestWork(clusterName string) error
- func (mwu *MWUtil) FindManifestWork(mwName, managedCluster string) (*ocmworkv1.ManifestWork, error)
- func (mwu *MWUtil) FindManifestWorkByType(mwType, managedCluster string) (*ocmworkv1.ManifestWork, error)
- func (mwu *MWUtil) GenerateManifest(obj interface{}) (*ocmworkv1.Manifest, error)
- func (mwu *MWUtil) GetDrClusterManifestWork(clusterName string) (*ocmworkv1.ManifestWork, error)
- func (mwu *MWUtil) IsManifestApplied(cluster, mwType string) bool
- func (mwu *MWUtil) ListMModeManifests(cluster string) (*ocmworkv1.ManifestWorkList, error)
- func (mwu *MWUtil) UpdateVRGManifestWork(vrg *rmn.VolumeReplicationGroup, mw *ocmworkv1.ManifestWork) error
- type ManagedClusterInstance
- type ManagedClusterViewGetter
- type ManagedClusterViewGetterImpl
- func (m ManagedClusterViewGetterImpl) DeleteDRClusterConfigManagedClusterView(clusterName string) error
- func (m ManagedClusterViewGetterImpl) DeleteManagedClusterView(clusterName, mcvName string, logger logr.Logger) error
- func (m ManagedClusterViewGetterImpl) DeleteNFManagedClusterView(resourceName, resourceNamespace, clusterName, resourceType string) error
- func (m ManagedClusterViewGetterImpl) DeleteNamespaceManagedClusterView(resourceName, resourceNamespace, clusterName, resourceType string) error
- func (m ManagedClusterViewGetterImpl) DeleteRecipeManagedClusterView(resourceName, resourceNamespace, clusterName string) error
- func (m ManagedClusterViewGetterImpl) DeleteVRGManagedClusterView(resourceName, resourceNamespace, clusterName, resourceType string) error
- func (m ManagedClusterViewGetterImpl) GetDRClusterConfigFromManagedCluster(clusterName string, annotations map[string]string) (*rmn.DRClusterConfig, error)
- func (m ManagedClusterViewGetterImpl) GetMModeFromManagedCluster(resourceName, managedCluster string, annotations map[string]string) (*rmn.MaintenanceMode, error)
- func (m ManagedClusterViewGetterImpl) GetNFClassFromManagedCluster(resourceName, managedCluster string, annotations map[string]string) (*csiaddonsv1alpha1.NetworkFenceClass, error)
- func (m ManagedClusterViewGetterImpl) GetNFFromManagedCluster(targetCluster, networkFenceClassName, resourceNamespace, managedCluster string, ...) (*csiaddonsv1alpha1.NetworkFence, error)
- func (m ManagedClusterViewGetterImpl) GetNSFromManagedCluster(cluster, resourceName string) (*corev1.Namespace, error)
- func (m ManagedClusterViewGetterImpl) GetRecipeFromManagedCluster(cluster, resourceName, resourceNamespace string) (*recipev1.Recipe, error)
- func (m ManagedClusterViewGetterImpl) GetResource(mcv *viewv1beta1.ManagedClusterView, resource interface{}) error
- func (m ManagedClusterViewGetterImpl) GetSClassFromManagedCluster(resourceName, managedCluster string, annotations map[string]string) (*storagev1.StorageClass, error)
- func (m ManagedClusterViewGetterImpl) GetVGRClassFromManagedCluster(resourceName, managedCluster string, annotations map[string]string) (*volrep.VolumeGroupReplicationClass, error)
- func (m ManagedClusterViewGetterImpl) GetVGSClassFromManagedCluster(resourceName, managedCluster string, annotations map[string]string) (VolumeGroupSnapshotClassWrapper, error)
- func (m ManagedClusterViewGetterImpl) GetVRClassFromManagedCluster(resourceName, managedCluster string, annotations map[string]string) (*volrep.VolumeReplicationClass, error)
- func (m ManagedClusterViewGetterImpl) GetVRGFromManagedCluster(resourceName, resourceNamespace, managedCluster string, ...) (*rmn.VolumeReplicationGroup, error)
- func (m ManagedClusterViewGetterImpl) GetVSClassFromManagedCluster(resourceName, managedCluster string, annotations map[string]string) (*snapv1.VolumeSnapshotClass, error)
- func (m ManagedClusterViewGetterImpl) ListMModesMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
- func (m ManagedClusterViewGetterImpl) ListNFClassMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
- func (m ManagedClusterViewGetterImpl) ListSClassMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
- func (m ManagedClusterViewGetterImpl) ListVGRClassMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
- func (m ManagedClusterViewGetterImpl) ListVGSClassMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
- func (m ManagedClusterViewGetterImpl) ListVRClassMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
- func (m ManagedClusterViewGetterImpl) ListVSClassMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
- type PvcSelector
- type RecipeElements
- type ResourceUpdater
- func (u *ResourceUpdater) AddAnnotation(key, value string) *ResourceUpdater
- func (u *ResourceUpdater) AddFinalizer(finalizerName string) *ResourceUpdater
- func (u *ResourceUpdater) AddLabel(key, value string) *ResourceUpdater
- func (u *ResourceUpdater) AddOwner(owner metav1.Object, scheme *runtime.Scheme) *ResourceUpdater
- func (u *ResourceUpdater) DeleteAnnotation(key string) *ResourceUpdater
- func (u *ResourceUpdater) DeleteLabel(key string) *ResourceUpdater
- func (u *ResourceUpdater) RemoveFinalizer(finalizerName string) *ResourceUpdater
- func (u *ResourceUpdater) RemoveOwner(owner metav1.Object, scheme *runtime.Scheme) *ResourceUpdater
- func (u *ResourceUpdater) Update(ctx context.Context, client client.Client) error
- type ResourceVersionUpdatePredicate
- type SecretsUtil
- type TargetSecretFormat
- type VMStaticIPInfo
- type VolumeGroupSnapshotClassWrapper
- func GetVolumeGroupSnapshotClasses(ctx context.Context, k8sClient client.Client, ...) ([]VolumeGroupSnapshotClassWrapper, error)
- func NewPrivateVGSCWrapper(vgsc *groupsnapv1beta1.VolumeGroupSnapshotClass) VolumeGroupSnapshotClassWrapper
- func NewPrivateVGSCWrappers(vgscs ...*groupsnapv1beta1.VolumeGroupSnapshotClass) []VolumeGroupSnapshotClassWrapper
- func NewVolumeGroupSnapshotClassForGV(gv schema.GroupVersion) (interface{}, VolumeGroupSnapshotClassWrapper, error)
Constants ¶
const ( // do not delete the vs in a vgs, only for testing SkipDeleteAnnotaion = "rgd.ramendr.openshift.io/do-not-delete" RGDOwnerLabel = "ramendr.openshift.io/rgd" RGSOwnerLabel string = "ramendr.openshift.io/rgs" )
const ( // EventReasonValidationFailed is used when VolumeReplicationGroup validation fails EventReasonValidationFailed = "FailedValidation" // EventReasonPVCListFailed is used when VRG fails to get the list of PVCs EventReasonPVCListFailed = "PVCListFailed" // EventReasonVRCreateFailed is used when VRG fails to create VolRep resource EventReasonVRCreateFailed = "VRCreateFailed" // EventReasonVRCreateFailed is used when VRG fails to update VolRep resource EventReasonVRUpdateFailed = "VRUpdateFailed" // EventReasonProtectPVCFailed is used when VRG fails to protect PVC EventReasonProtectPVCFailed = "ProtectPVCFailed" // EventReasonUploadFailed is used when VRG fails to upload PV cluster data EventReasonUploadFailed = "UploadFailed" // EventReasonVrgUploadFailed is used when VRG fails to upload VRG object EventReasonVrgUploadFailed = "VrgUploadFailed" // EventReasonPrimarySuccess is an event generated when VRG is successfully // processed as Primary. EventReasonPrimarySuccess = "PrimaryVRGProcessSuccess" // EventReasonSecondarySuccess is an event generated when VRG is successfully // processed as Primary. EventReasonSecondarySuccess = "SecondaryVRGProcessSuccess" // EventReasonSecondarySuccess is an event generated when VRG is successfully // processed as Primary. EventReasonDeleteSuccess = "VRGDeleteSuccess" // EventReasonDeploying is generated when DRPC begins to deploy ramen manged cluster // component(s) and the application EventReasonDeploying = "DRPCDeploying" // EventReasonDeployFail is an event generated when DRPC fails to do // a successful initial deployment of the application and ramen managed // cluster component(s) EventReasonDeployFail = "DRPCDeployFailed" // EventReasonDeploySuccess is an event generated when DRPC successfully // deploys ramen and the application in the managed cluster initially EventReasonDeploySuccess = "DRPCDeploySuccess" // EventReasonFailingOver is an event generated when DRPC starts the failover // process EventReasonFailingOver = "DRPCFailingOver" // EventReasonFailoverSuccess is an evenet generated when DRPC does a successful // failover EventReasonFailoverSuccess = "DRPCFailoverSuccess" // EventReasonRelocating is an event generated when DRPC starts relocating EventReasonRelocating = "DRPCRelocating" // EventReasonRelocationSuccess is an event generated when DRPC successfully // relocates an application along with ramen managed cluster component(s) EventReasonRelocationSuccess = "DRPCRelocationSuccess" // EventReasonSwitchFailed is generated when DRPC fails to switch the cluster // where the app is placed EventReasonSwitchFailed = "DRPCClusterSwitchFailed" )
const ( LabelOwnerNamespaceName = "ramendr.openshift.io/owner-namespace-name" LabelOwnerName = "ramendr.openshift.io/owner-name" MModesLabel = "ramendr.openshift.io/maintenancemodes" SClassLabel = "ramendr.openshift.io/storageclass" NFClassLabel = "ramendr.openshift.io/networkfenceclass" VSClassLabel = "ramendr.openshift.io/volumesnapshotclass" VGSClassLabel = "ramendr.openshift.io/volumegroupsnapshotclass" VRClassLabel = "ramendr.openshift.io/volumereplicationclass" VGRClassLabel = "ramendr.openshift.io/volumegroupreplicationclass" ExcludeFromVeleroBackup = "velero.io/exclude-from-backup" VeleroKubevirtMetadataOnlyBackupLabel = "velero.kubevirt.io/metadataBackup" )
const ( // Prefixes for various ClusterClaims CCSCPrefix = "storage.class" CCVSCPrefix = "snapshot.class" CCVRCPrefix = "replication.class" )
const ( OCMBackupLabelKey string = "cluster.open-cluster-management.io/backup" OCMBackupLabelValue string = "ramen" IsCGEnabledAnnotation = "drplacementcontrol.ramendr.openshift.io/is-cg-enabled" IsSubmarinerEnabledAnnotation = "drplacementcontrol.ramendr.openshift.io/is-submariner-enabled" // When this annotation is set to true, VolSync will protect RBD PVCs. UseVolSyncAnnotation = "drplacementcontrol.ramendr.openshift.io/use-volsync-for-pvc-protection" // When this annotation is set to true, differential (incremental) syncs will be enabled for CephFS CG. EnableDiffAnnotation = "drplacementcontrol.ramendr.openshift.io/enable-diff" MaxK8sLabelLength = validation.DNS1123LabelMaxLength MaxK8sNameLength = validation.DNS1123LabelMaxLength CreatedByRamenLabel = "ramendr.openshift.io/created-by-ramen" VGSCRDPrivateName = "volumegroupsnapshots.groupsnapshot.storage.openshift.io" VGSCRDName = "volumegroupsnapshots.groupsnapshot.storage.k8s.io" VGRCRDName = "volumegroupreplications.replication.storage.openshift.io" VRGOwnerNameLabel string = "volumereplicationgroups-owner" VRGOwnerNamespaceLabel string = "volumereplicationgroups-owner-namespace" MarkForDeletion = "ramendr.io/marked-for-deletion" )
const ( DrClusterManifestWorkName = "ramen-dr-cluster" ClusterRoleAggregateLabel = "open-cluster-management.io/aggregate-to-work" // ManifestWorkNameFormat is a formated a string used to generate the manifest name // The format is name-namespace-type-mw where: // - name is the DRPC name // - namespace is the DRPC namespace // - type is "vrg" ManifestWorkNameFormat string = "%s-%s-%s-mw" ManifestWorkNameFormatClusterScope string = "%s-%s-mw" ManifestWorkNameTypeFormat string = "%s-mw" // ManifestWork Types MWTypeVRG string = "vrg" MWTypeNS string = "ns" MWTypeNF string = "nf" MWTypeMMode string = "mmode" MWTypeSClass string = "sc" MWTypeNFClass string = "nfc" MWTypeVSClass string = "vsc" MWTypeVGSClass string = "vgsc" MWTypeVRClass string = "vrc" MWTypeVGRClass string = "vgrc" MWTypeDRCConfig string = "drcconfig" MWTypeRecipe string = "recipe" )
const ( CreatedByLabelKey = "app.kubernetes.io/created-by" CreatedByLabelValueVolSync = "volsync" PodVolumePVCClaimIndexName string = "spec.volumes.persistentVolumeClaim.claimName" VolumeAttachmentToPVIndexName string = "spec.source.persistentVolumeName" ConsistencyGroupLabel = "ramendr.openshift.io/consistency-group" SuffixForFinalsyncPVC = "-for-finalsync" ManagedAnnotationKeysMarker string = "ramendr.openshift.io/managed-annotation-keys" )
const ( //nolint:lll // See: https://github.com/stolostron/rhacm-docs/blob/2.4_stage/governance/custom_template.adoc#special-annotation-for-reprocessing PolicyTriggerAnnotation = "policy.open-cluster-management.io/trigger-update" // Finalizer on the secret SecretPolicyFinalizer string = "drpolicies.ramendr.openshift.io/policy-protection" VeleroSecretKeyNameDefault = "ramengenerated" )
const ( KindVirtualMachine = "VirtualMachine" KubeVirtAPIVersion = "kubevirt.io/v1" // VMStaticIPAnnotation is the annotation on spec.template.metadata that // pre-reserves a specific IP from an OVN-K8s UDN/CUDN network. // VMs carrying this annotation require IP translation during DR. VMStaticIPAnnotation = "network.kubevirt.io/addresses" )
const (
LastEventValidDuration = 10
)
This implementation of events infrastructure is mainly based on the way events is handled in the ocs-operator. https://github.com/openshift/ocs-operator/blob/master/controllers/util/events.go
const (
NetworkFencePrefix = "network-fence"
)
const RecipeElementsGetForPVC = "recipeElementsGetForPVC"
Variables ¶
This section is empty.
Functions ¶
func AddOwnerReference ¶
func BuildManagedClusterViewName ¶
outputs a string for use in creating a ManagedClusterView name example: when looking for a vrg with name 'demo' in the namespace 'ramen', input: ("demo", "ramen", "vrg") this will give output "demo-ramen-vrg-mcv"
func CheckImagesReadyToUse ¶
func CleanExpiredRDImages ¶
func CleanExpiredRDImages(ctx context.Context, k8sClient client.Client, rgd *ramendrv1alpha1.ReplicationGroupDestination, ) error
func ConditionAppend ¶
func ConditionUpdate ¶
func CreateRamenOpsNamespace ¶
func CreateVGRName ¶
func DRPolicyClusterNames ¶
func DRPolicyS3Profiles ¶
func DeferDeleteImage ¶
func DeleteVMs ¶
func DeleteVMs( ctx context.Context, k8sclient client.Client, foundVMs []virtv1.VirtualMachine, log logr.Logger, ) error
DeleteVMs deletes the given KubeVirt VMs across the provided namespaces. Stops on the first get/delete error and returns it;
func DrpolicyRegionNames ¶
func DrpolicyValidated ¶
func EnsureLocalVGSAPI ¶
EnsureLocalVGSAPI detects the local VGS API and stores it for UsePublicVGSAPI / UsePrivateVGSAPI. Call from SetupWithManager or reconcile before using VGS helpers. When ForcePrivateVGSAPIForTesting has been called, keeps the private pin.
func ExtractDRCConfigFromManifestWork ¶
func ExtractDRCConfigFromManifestWork(mw *ocmworkv1.ManifestWork) (*rmn.DRClusterConfig, error)
func ExtractMModeFromManifestWork ¶
func ExtractMModeFromManifestWork(mw *ocmworkv1.ManifestWork) (*rmn.MaintenanceMode, error)
func ExtractResourceFromManifestWork ¶
func ExtractResourceFromManifestWork( mw *ocmworkv1.ManifestWork, object client.Object, gvk schema.GroupVersionKind, ) error
func ExtractVRGFromManifestWork ¶
func ExtractVRGFromManifestWork(mw *ocmworkv1.ManifestWork) (*rmn.VolumeReplicationGroup, error)
func FindCondition ¶
func ForcePrivateVGSAPIForTesting ¶
func ForcePrivateVGSAPIForTesting()
ForcePrivateVGSAPIForTesting pins local VGS API selection to the private API. Use in envtest suites that ship both public and private VGS CRDs under hack/test but still exercise the private code path / existing private-typed tests. The pin is sticky: EnsureLocalVGSAPI will not override it via CRD detection.
func GenerateCombinedName ¶
GenerateCombinedName returns a string in the form "name-storageID", ensuring the total length does not exceed MaxK8sLabelLength. If the combined length is too long, it first replaces the name with its hash. If that's still too long, it hashes both the name and the storageID, returning "nameHash-storageIDHash".
func GeneratePolicyName ¶
GeneratePolicyName generates a policy name by combining the word "vs-secret-" with the name. However, if the length of the passed-in name is less than or equal to the 'maxLen', the passed-in name is returned as-is.
If the passed-in name and the namespace length exceeds 'maxLen', a unique hash of the passed-in name is computed using MD5 prepended to it "vs-secret-". If this combined name still exceeds 'maxLen', it is trimmed to fit within the limit by removing characters from the end of the hash up to maxLen.
Parameters:
potentialPolicyName: The preferred name of the policy. namespace: The namespace associated with the policy. maxLen: The maximum length of the generated name
Returns:
"vs-secret" + the generated name, which is either the passed-in name or a modified version that fits within the allowed length.
func GeneratePolicyResourceNames ¶
func GeneratePolicyResourceNames( secret string, format TargetSecretFormat, ) (policyName, plBindingName, plRuleName, configPolicyName string)
GeneratePolicyResourceNames returns names (in order) for policy resources that are created, policyName: Name of the policy plBindingName: Name of the PlacementBinding that ties a Policy to a PlacementRule plRuleName: Name of the PlacementRule configPolicyName: Name of the ConfigurationPolicy resource embedded within the Policy
func GetAllDRPolicies ¶
func GetHashedName ¶
Implements the string shortening algorithm, required to match volsync resources names. https://github.com/backube/volsync/pull/1519
func GetJobName ¶
func GetLocalReplicationName ¶
func GetLocalServiceNameForDiffRD ¶
GetLocalServiceNameForDiffRD returns the service name created by the ceph-volsync-plugin for External ReplicationDestinations using diff sync
func GetPVC ¶
func GetPVC(ctx context.Context, k8sClient client.Client, pvcNamespacedName types.NamespacedName, ) (*corev1.PersistentVolumeClaim, error)
func GetRSMoverConfig ¶
func GetRSMoverConfig(name, namespace string, moverConfigArr []ramendrv1alpha1.MoverConfig, ) *ramendrv1alpha1.MoverConfig
func GetRawExtension ¶
func GetRawExtension( manifests []ocmworkv1.Manifest, gvk schema.GroupVersionKind, ) (*runtime.RawExtension, error)
func GetRemoteServiceNameForDiffRDFromPVCName ¶
GetRemoteServiceNameForDiffRDFromPVCName returns the remote service name for diff sync RDs
func GetRemoteServiceNameForRDFromPVCName ¶
This is the remote service name that can be accessed from another cluster. This assumes submariner and that a ServiceExport is created for the service on the cluster that has the ReplicationDestination
func GetServiceName ¶
func GetVolumeGroupSnapshot ¶
func GetVolumeGroupSnapshot( ctx context.Context, k8sClient client.Client, name, namespace string, ) (client.Object, error)
GetVolumeGroupSnapshot retrieves a VolumeGroupSnapshot using the appropriate API. Requires a prior successful EnsureLocalVGSAPI (or ForcePrivateVGSAPIForTesting).
func GlobalVGRName ¶
func HasStatus ¶
HasStatus reports whether the VolumeGroupSnapshot status has been populated by the snapshotter (i.e. the Status pointer is non-nil).
func HashPVC ¶
func HashPVC(pvc *corev1.PersistentVolumeClaim) string
func IndexFieldsForVSHandler ¶
func IndexFieldsForVSHandler(ctx context.Context, fieldIndexer client.FieldIndexer) error
VSHandler will either look at VolumeAttachments or pods to determine if a PVC is mounted To do this, it requires an index on pods and volumeattachments to keep track of persistent volume claims mounted
func IsCGEnabledForVolRep ¶
IsCGEnabledForVolRep checks whether the workload has requested Consistency Group (CG) protection It checks whether the VolumeGroupReplication CRD is installed. This condition must be true for VolRep CG protection to be considered enabled.
func IsCGEnabledForVolSync ¶
IsCGEnabledForVolSync determines whether consistency group (CG) protection is enabled for CephFS volumes. It checks whether the VolumeGroupSnapshot CRD is installed. This condition must be true for CephFS CG protection to be considered enabled.
func IsCRDInstalled ¶
IsCRDInstalled checks whether a specific CustomResourceDefinition (CRD) is installed on the cluster.
func IsDiffSyncEnabled ¶
IsDiffSyncEnabled checks if the enable-diff annotation is set to true on the resource
func IsManifestInAppliedState ¶
func IsManifestInAppliedState(mw *ocmworkv1.ManifestWork) bool
func IsOwnedByVM ¶
func IsOwnedByVM( ctx context.Context, c client.Client, obj client.Object, log logr.Logger, ) (client.Object, error)
IsOwnedByVM walks the owner chain and returns the VM metadata object if found. It prefers KubeVirt VM owners (kind=VirtualMachine, apigroup starts with kubevirt.io/) Assuming all the owners are from same namespace Typical KubeVirt ownership depth (PVC→DV→VM or PVC→VMI→VM or virt-launcher-pod->VMI->VM)
func IsPVAttachedToNode ¶
func IsPVAttachedToNode(ctx context.Context, k8sClient client.Client, log logr.Logger, pvc *corev1.PersistentVolumeClaim, ) (bool, error)
For CSI drivers that support it, volume attachments will be created for the PV to indicate which node they are attached to. If a volume attachment exists, then we know the PV may not be ready to have a final replication sync performed (I/Os may still not be completely written out). This is a best-effort, as some CSI drivers may not support volume attachments (CSI driver Spec.AttachRequired: false) in this case, we won't find a volumeattachment and will just assume the PV is not in use anymore.
func IsPVCInUseByPod ¶
func IsPVCInUseByPod(ctx context.Context, k8sClient client.Client, log logr.Logger, pvcNamespacedName types.NamespacedName, inUsePodMustBeReady bool, ) (bool, error)
IsPVCInUseByPod determines if there are any pod resources that reference the pvcName in the current pvcNamespace and returns true if found. Further if inUsePodMustBeReady is true, returns true only if the pod is in Ready state. TODO: Should we trust the cached list here, or fetch it from the API server?
func IsPVCMarkedForVolSync ¶
func IsRDExist ¶
func IsRDExist(rdspec ramendrv1alpha1.VolSyncReplicationDestinationSpec, rdspecs []ramendrv1alpha1.VolSyncReplicationDestinationSpec, ) bool
func IsReplicationGroupDestinationReady ¶
func IsReplicationGroupDestinationReady( ctx context.Context, k8sClient client.Client, rgd *ramendrv1alpha1.ReplicationGroupDestination, ) (bool, error)
func IsSubmarinerEnabled ¶
func IsVMDeletionInProgress ¶
func IsVMDeletionInProgress(ctx context.Context, k8sclient client.Client, vmList []string, vmNamespaceList []string, log logr.Logger, ) ([]virtv1.VirtualMachine, bool, error)
IsVMDeletionInProgress returns true if any listed KubeVirt VM within the given protected NS is in deletion state. Skips VMs that cannot be fetched (likely already deleted); checks all (namespace, name) pairs.
func ListPVCsByCGLabel ¶
func ListPVCsByPVCSelector ¶
func ListPVCsByPVCSelector( ctx context.Context, k8sClient client.Client, logger logr.Logger, pvcLabelSelector metav1.LabelSelector, namespaces []string, volSyncDisabled bool, ) (*corev1.PersistentVolumeClaimList, error)
nolint:funlen
func ListVMsByLabelSelector ¶
func ListVMsByVMNamespace ¶
func ListVolumeGroupSnapshots ¶
func ListVolumeGroupSnapshots( ctx context.Context, k8sClient client.Client, listOptions ...client.ListOption, ) ([]client.Object, error)
ListVolumeGroupSnapshots lists VolumeGroupSnapshots using the appropriate API. Requires a prior successful EnsureLocalVGSAPI (or ForcePrivateVGSAPIForTesting).
func ManifestWorkName ¶
func MapCopy ¶
func MapCopy[M ~map[K]V, K, V comparable](src M, dst *M) bool
Copies src's key-value pairs into dst. Or, if dst is nil, assigns src to dst. Returns whether dst changes.
func MapCopyF ¶
func MapCopyF[M ~map[K]V, K, V comparable](src M, dstGet func() M, dstSet func(M)) bool
func MapDelete ¶
func MapDelete[M ~map[K]V, K, V comparable](src M, dst *M) bool
Deletes any key-value pairs from dst that are in src. Returns whether dst changes.
func MapDeleteF ¶
func MapDeleteF[M ~map[K]V, K, V comparable](src M, dstGet func() M, dstSet func(M)) bool
func MapDoF ¶
func MapDoF[M ~map[K]V, K, V comparable, R any](src M, dstGet func() M, dstSet func(M), mapDo func(M, *M) R) R
func MergeConditions ¶
func MergeConditions( conditionSet func(*[]metav1.Condition, metav1.Condition) metav1.Condition, conditions *[]metav1.Condition, ignoreReasons []string, subConditions ...*metav1.Condition, ) metav1.Condition
MergeConditions merges VRG conditions of the same type to generate a single condition for the Type
func NewVolumeGroupSnapshot ¶
NewVolumeGroupSnapshot returns an empty VolumeGroupSnapshot of the appropriate API type. Requires a prior successful EnsureLocalVGSAPI (or ForcePrivateVGSAPIForTesting).
func ObjectLabelsDelete ¶
func ObjectLabelsDo ¶
func ObjectMetaEmbedded ¶
func ObjectMetaEmbedded(objectMeta *metav1.ObjectMeta) metav1.ObjectMeta
func ObjectOwnerSet ¶
func ObjectOwnerUnsetIfSet ¶
func ObjectsMap ¶
func OptionalEqual ¶
OptionalEqual returns True if optional field values are equal, or one of them is unset.
func OwnerNamespacedName ¶
func OwnerNamespacedName(owner metav1.Object) types.NamespacedName
func OwnsAcrossNamespaces ¶
func OwnsVolumeGroupSnapshot ¶
OwnsVolumeGroupSnapshot registers Owns for the active VolumeGroupSnapshot API. Call EnsureLocalVGSAPI before this. Returns true if a VGS API was selected and Owns was registered.
func ParseVMInterfaceAddresses ¶
ParseVMInterfaceAddresses parses the network.kubevirt.io/addresses annotation. Value format: '{"primary-udn": ["192.168.0.100"]' Returns the full interface→IPs mapping, or nil on parse failure. Callers that only need interface names can iterate the map keys.
func ProtectedPVCNamespacedName ¶
func ProtectedPVCNamespacedName(pvc ramen.ProtectedPVC) types.NamespacedName
func RemoveOwnerReference ¶
func ReportIfNotPresent ¶
func ReportIfNotPresent(recorder *EventReporter, instance runtime.Object, eventType, eventReason, msg string, )
ReportIfNotPresent will report event if lastReportedEvent is not the same in last 10 minutes TODO: The duration 10 minutes can be changed to some other value if necessary
func ResourceIsDeleted ¶
Return true if resource was marked for deletion.
func SecretFinalizer ¶
func SecretFinalizer(format TargetSecretFormat) string
func SelectVGSGroupVersion ¶
func SelectVGSGroupVersion(ctx context.Context, apiReader client.Reader) (schema.GroupVersion, error)
SelectVGSGroupVersion picks the VGS API GroupVersion using the same precedence as UsePublicVGSAPI / UsePrivateVGSAPI: public if its CRD is installed and serves the public client's version, otherwise private under the same rule.
func SetStatusCondition ¶
func SetVolumeGroupSnapshotClassName ¶
SetVolumeGroupSnapshotClassName sets the VolumeGroupSnapshotClassName on a VolumeGroupSnapshot.
func SetVolumeGroupSnapshotSourceSelector ¶
func SetVolumeGroupSnapshotSourceSelector(vgs client.Object, selector *metav1.LabelSelector)
SetVolumeGroupSnapshotSourceSelector sets the source selector on a VolumeGroupSnapshot.
func SyncPVCAnnotations ¶
func SyncPVCAnnotations(pvc *corev1.PersistentVolumeClaim, protectedAnnotations map[string]string)
SyncPVCAnnotations synchronizes annotations from ProtectedPVC to PVC, removing annotations that were previously synced but are no longer in ProtectedPVC, while preserving PVC-specific annotations.
func SyncPVCLabels ¶
func SyncPVCLabels(pvc *corev1.PersistentVolumeClaim, protectedLabels map[string]string)
SyncPVCLabels synchronizes labels from ProtectedPVC to PVC. It simply adds/updates labels without removing ones that are deleted from ProtectedPVC. Note: Kubernetes handles labels differently from annotations. Label values are limited to 63 characters, so using the same pattern as in the SyncPVCAnnotations will eventually cause it to break.
func UpdateStringMap ¶
UpdateStringMap copies all key/value pairs in src adding them to map referenced by the dst pointer. When a key in src is already present in dst, the value in dst will be overwritten by the value associated with the key in src. The dst map is created if needed.
func UsePrivateVGSAPI ¶
func UsePrivateVGSAPI() bool
UsePrivateVGSAPI reports whether Ramen should use the private VolumeGroupSnapshot API. Requires a prior successful EnsureLocalVGSAPI (or ForcePrivateVGSAPIForTesting). Public API takes precedence when both CRDs are installed.
func UsePublicVGSAPI ¶
func UsePublicVGSAPI() bool
UsePublicVGSAPI reports whether Ramen should use the public VolumeGroupSnapshot API. Requires a prior successful EnsureLocalVGSAPI (or ForcePrivateVGSAPIForTesting).
func VSInRGD ¶
func VSInRGD(vs vsv1.VolumeSnapshot, rgd *ramendrv1alpha1.ReplicationGroupDestination) bool
func VolumeGroupSnapshotClassMatchStorageProviders ¶
func VolumeGroupSnapshotClassMatchStorageProviders( volumeGroupSnapshotClass VolumeGroupSnapshotClassWrapper, storageClassProviders []string, ) bool
VolumeGroupSnapshotClassMatchStorageProviders checks if a VGS class matches any storage provider.
func VolumeGroupSnapshotIsReady ¶
VolumeGroupSnapshotIsReady reports whether the VolumeGroupSnapshot is ready to use.
func WatchesVolumeGroupSnapshotClass ¶
func WatchesVolumeGroupSnapshotClass( b *builder.Builder, log logr.Logger, eventHandler handler.EventHandler, opts ...builder.WatchesOption, ) *builder.Builder
WatchesVolumeGroupSnapshotClass registers Watches for the active VolumeGroupSnapshotClass API. Call EnsureLocalVGSAPI before this. Returns the builder unchanged if no VGS API is selected.
Types ¶
type Comparison ¶
type Comparison int
const ( Different Comparison = iota Same Absent )
func MapInsertOnlyAll ¶
func MapInsertOnlyAll[M ~map[K]V, K, V comparable](src M, dst *M) Comparison
Copies src's key-value pairs into dst only if src's keys are all absent from dst. Or, if dst is nil, assigns src to dst. Returns state of src's key-value pairs in dst before any changes.
func MapInsertOnlyAllF ¶
func MapInsertOnlyAllF[M ~map[K]V, K, V comparable](src M, dstGet func() M, dstSet func(M)) Comparison
func ObjectLabelInsertOnlyAll ¶
func ObjectLabelInsertOnlyAll(object metav1.Object, labels map[string]string) Comparison
func ObjectOwnerSetIfNotAlready ¶
func ObjectOwnerSetIfNotAlready(object, owner metav1.Object) Comparison
type CreateOrDeleteOrResourceVersionUpdatePredicate ¶
type CreateOrDeleteOrResourceVersionUpdatePredicate struct{}
func (CreateOrDeleteOrResourceVersionUpdatePredicate) Create ¶
func (CreateOrDeleteOrResourceVersionUpdatePredicate) Create(e event.CreateEvent) bool
func (CreateOrDeleteOrResourceVersionUpdatePredicate) Delete ¶
func (CreateOrDeleteOrResourceVersionUpdatePredicate) Delete(e event.DeleteEvent) bool
func (CreateOrDeleteOrResourceVersionUpdatePredicate) Generic ¶
func (CreateOrDeleteOrResourceVersionUpdatePredicate) Generic(e event.GenericEvent) bool
func (CreateOrDeleteOrResourceVersionUpdatePredicate) Update ¶
func (CreateOrDeleteOrResourceVersionUpdatePredicate) Update(e event.UpdateEvent) bool
type CreateOrResourceVersionUpdatePredicate ¶
type CreateOrResourceVersionUpdatePredicate struct{}
func (CreateOrResourceVersionUpdatePredicate) Create ¶
func (CreateOrResourceVersionUpdatePredicate) Create(event.CreateEvent) bool
func (CreateOrResourceVersionUpdatePredicate) Delete ¶
func (CreateOrResourceVersionUpdatePredicate) Delete(event.DeleteEvent) bool
func (CreateOrResourceVersionUpdatePredicate) Generic ¶
func (CreateOrResourceVersionUpdatePredicate) Generic(event.GenericEvent) bool
func (CreateOrResourceVersionUpdatePredicate) Update ¶
func (CreateOrResourceVersionUpdatePredicate) Update(e event.UpdateEvent) bool
type EventReporter ¶
type EventReporter struct {
// contains filtered or unexported fields
}
EventReporter is custom events reporter type which allows user to limit the events
func NewEventReporter ¶
func NewEventReporter(recorder record.EventRecorder) *EventReporter
NewEventReporter returns EventReporter object
type Labels ¶
func OwnerLabels ¶
type MWUtil ¶
type MWUtil struct {
client.Client
APIReader client.Reader
Ctx context.Context
Log logr.Logger
InstName string
TargetNamespace string
}
func (*MWUtil) BuildManifestWorkName ¶
func (*MWUtil) CreateOrUpdateDRCConfigManifestWork ¶
func (mwu *MWUtil) CreateOrUpdateDRCConfigManifestWork(cluster string, cConfig rmn.DRClusterConfig) error
DRClusterConfig ManifestWork creation
func (*MWUtil) CreateOrUpdateDrClusterManifestWork ¶
func (*MWUtil) CreateOrUpdateMModeManifestWork ¶
func (mwu *MWUtil) CreateOrUpdateMModeManifestWork( name, cluster string, mMode rmn.MaintenanceMode, annotations map[string]string, ) error
MaintenanceMode ManifestWork creation
func (*MWUtil) CreateOrUpdateNFManifestWork ¶
func (mwu *MWUtil) CreateOrUpdateNFManifestWork( name, homeCluster string, nf csiaddonsv1alpha1.NetworkFence, annotations map[string]string, ) error
NetworkFence MW creation
func (*MWUtil) CreateOrUpdateNamespaceManifestWork ¶
func (mwu *MWUtil) CreateOrUpdateNamespaceManifestWork( name string, namespaceName string, managedClusterNamespace string, annotations map[string]string, labels map[string]string, ) error
Namespace MW creation
func (*MWUtil) CreateOrUpdateRecipeManifestWork ¶
func (mwu *MWUtil) CreateOrUpdateRecipeManifestWork( recipe *recipev1.Recipe, managedClusterNamespace string, ) error
Recipe MW creation
func (*MWUtil) CreateOrUpdateVRGManifestWork ¶
func (mwu *MWUtil) CreateOrUpdateVRGManifestWork( name, namespace, homeCluster string, vrg rmn.VolumeReplicationGroup, annotations map[string]string, ) (ctrlutil.OperationResult, error)
func (*MWUtil) DeleteManifestWork ¶
func (*MWUtil) DeleteNamespaceManifestWork ¶
func (*MWUtil) DeleteRecipeManifestWork ¶
func (*MWUtil) FindManifestWork ¶
func (mwu *MWUtil) FindManifestWork(mwName, managedCluster string) (*ocmworkv1.ManifestWork, error)
func (*MWUtil) FindManifestWorkByType ¶
func (mwu *MWUtil) FindManifestWorkByType(mwType, managedCluster string) (*ocmworkv1.ManifestWork, error)
func (*MWUtil) GenerateManifest ¶
func (*MWUtil) GetDrClusterManifestWork ¶
func (mwu *MWUtil) GetDrClusterManifestWork(clusterName string) (*ocmworkv1.ManifestWork, error)
func (*MWUtil) IsManifestApplied ¶
func (*MWUtil) ListMModeManifests ¶
func (mwu *MWUtil) ListMModeManifests(cluster string) (*ocmworkv1.ManifestWorkList, error)
func (*MWUtil) UpdateVRGManifestWork ¶
func (mwu *MWUtil) UpdateVRGManifestWork(vrg *rmn.VolumeReplicationGroup, mw *ocmworkv1.ManifestWork) error
type ManagedClusterInstance ¶
type ManagedClusterInstance struct {
// contains filtered or unexported fields
}
func NewManagedClusterInstance ¶
func NewManagedClusterInstance( ctx context.Context, client client.Client, cluster string, ) (*ManagedClusterInstance, error)
NewManagedClusterInstance creates an ManagedClusterInstance instance, reading the ManagedCluster resource for cluster
func (*ManagedClusterInstance) ClusterID ¶
func (mci *ManagedClusterInstance) ClusterID() (string, error)
ClusterID returns the clusterID claimed by the ManagedCluster, or error if it is empty or not found
func (*ManagedClusterInstance) StorageClassClaims ¶
func (mci *ManagedClusterInstance) StorageClassClaims() []string
func (*ManagedClusterInstance) VolumeReplicationClassClaims ¶
func (mci *ManagedClusterInstance) VolumeReplicationClassClaims() []string
func (*ManagedClusterInstance) VolumeSnapshotClassClaims ¶
func (mci *ManagedClusterInstance) VolumeSnapshotClassClaims() []string
type ManagedClusterViewGetter ¶
type ManagedClusterViewGetter interface {
GetVRGFromManagedCluster(
resourceName, resourceNamespace, managedCluster string,
annotations map[string]string) (*rmn.VolumeReplicationGroup, error)
GetNFFromManagedCluster(
resourceName, networkFenceClassName, resourceNamespace, managedCluster string,
annotations map[string]string) (*csiaddonsv1alpha1.NetworkFence, error)
GetMModeFromManagedCluster(
resourceName, managedCluster string,
annotations map[string]string) (*rmn.MaintenanceMode, error)
ListMModesMCVs(managedCluster string) (*viewv1beta1.ManagedClusterViewList, error)
GetDRClusterConfigFromManagedCluster(
resourceName string,
annotations map[string]string) (*rmn.DRClusterConfig, error)
DeleteDRClusterConfigManagedClusterView(clusterName string) error
GetSClassFromManagedCluster(
resourceName, managedCluster string,
annotations map[string]string) (*storagev1.StorageClass, error)
ListSClassMCVs(managedCluster string) (*viewv1beta1.ManagedClusterViewList, error)
GetNFClassFromManagedCluster(
resourceName, managedCluster string,
annotations map[string]string) (*csiaddonsv1alpha1.NetworkFenceClass, error)
ListNFClassMCVs(managedCluster string) (*viewv1beta1.ManagedClusterViewList, error)
GetVSClassFromManagedCluster(
resourceName, managedCluster string,
annotations map[string]string) (*snapv1.VolumeSnapshotClass, error)
ListVSClassMCVs(managedCluster string) (*viewv1beta1.ManagedClusterViewList, error)
GetVRClassFromManagedCluster(
resourceName, managedCluster string,
annotations map[string]string) (*volrep.VolumeReplicationClass, error)
ListVRClassMCVs(managedCluster string) (*viewv1beta1.ManagedClusterViewList, error)
GetVGSClassFromManagedCluster(
resourceName, managedCluster string,
annotations map[string]string) (VolumeGroupSnapshotClassWrapper, error)
ListVGSClassMCVs(managedCluster string) (*viewv1beta1.ManagedClusterViewList, error)
GetVGRClassFromManagedCluster(
resourceName, managedCluster string,
annotations map[string]string) (*volrep.VolumeGroupReplicationClass, error)
GetNSFromManagedCluster(
managedCluster, resourceName string) (*corev1.Namespace, error)
GetRecipeFromManagedCluster(
managedCluster, resourceName, resourceNamespace string) (*recipev1.Recipe, error)
ListVGRClassMCVs(managedCluster string) (*viewv1beta1.ManagedClusterViewList, error)
GetResource(mcv *viewv1beta1.ManagedClusterView, resource interface{}) error
DeleteManagedClusterView(clusterName, mcvName string, logger logr.Logger) error
DeleteVRGManagedClusterView(resourceName, resourceNamespace, clusterName, resourceType string) error
DeleteNamespaceManagedClusterView(resourceName, resourceNamespace, clusterName, resourceType string) error
DeleteNFManagedClusterView(resourceName, resourceNamespace, clusterName, resourceType string) error
DeleteRecipeManagedClusterView(resourceName, resourceNamespace, clusterName string) error
}
type ManagedClusterViewGetterImpl ¶
func (ManagedClusterViewGetterImpl) DeleteDRClusterConfigManagedClusterView ¶
func (m ManagedClusterViewGetterImpl) DeleteDRClusterConfigManagedClusterView(clusterName string) error
func (ManagedClusterViewGetterImpl) DeleteManagedClusterView ¶
func (m ManagedClusterViewGetterImpl) DeleteManagedClusterView(clusterName, mcvName string, logger logr.Logger) error
func (ManagedClusterViewGetterImpl) DeleteNFManagedClusterView ¶
func (m ManagedClusterViewGetterImpl) DeleteNFManagedClusterView( resourceName, resourceNamespace, clusterName, resourceType string, ) error
func (ManagedClusterViewGetterImpl) DeleteNamespaceManagedClusterView ¶
func (m ManagedClusterViewGetterImpl) DeleteNamespaceManagedClusterView( resourceName, resourceNamespace, clusterName, resourceType string, ) error
func (ManagedClusterViewGetterImpl) DeleteRecipeManagedClusterView ¶
func (m ManagedClusterViewGetterImpl) DeleteRecipeManagedClusterView( resourceName, resourceNamespace, clusterName string, ) error
func (ManagedClusterViewGetterImpl) DeleteVRGManagedClusterView ¶
func (m ManagedClusterViewGetterImpl) DeleteVRGManagedClusterView( resourceName, resourceNamespace, clusterName, resourceType string, ) error
func (ManagedClusterViewGetterImpl) GetDRClusterConfigFromManagedCluster ¶
func (m ManagedClusterViewGetterImpl) GetDRClusterConfigFromManagedCluster( clusterName string, annotations map[string]string, ) (*rmn.DRClusterConfig, error)
func (ManagedClusterViewGetterImpl) GetMModeFromManagedCluster ¶
func (m ManagedClusterViewGetterImpl) GetMModeFromManagedCluster(resourceName, managedCluster string, annotations map[string]string, ) (*rmn.MaintenanceMode, error)
func (ManagedClusterViewGetterImpl) GetNFClassFromManagedCluster ¶
func (m ManagedClusterViewGetterImpl) GetNFClassFromManagedCluster(resourceName, managedCluster string, annotations map[string]string, ) (*csiaddonsv1alpha1.NetworkFenceClass, error)
func (ManagedClusterViewGetterImpl) GetNFFromManagedCluster ¶
func (m ManagedClusterViewGetterImpl) GetNFFromManagedCluster(targetCluster, networkFenceClassName, resourceNamespace, managedCluster string, annotations map[string]string, ) (*csiaddonsv1alpha1.NetworkFence, error)
func (ManagedClusterViewGetterImpl) GetNSFromManagedCluster ¶
func (m ManagedClusterViewGetterImpl) GetNSFromManagedCluster(cluster, resourceName string) (*corev1.Namespace, error)
func (ManagedClusterViewGetterImpl) GetRecipeFromManagedCluster ¶
func (m ManagedClusterViewGetterImpl) GetRecipeFromManagedCluster(cluster, resourceName, resourceNamespace string, ) (*recipev1.Recipe, error)
func (ManagedClusterViewGetterImpl) GetResource ¶
func (m ManagedClusterViewGetterImpl) GetResource(mcv *viewv1beta1.ManagedClusterView, resource interface{}) error
func (ManagedClusterViewGetterImpl) GetSClassFromManagedCluster ¶
func (m ManagedClusterViewGetterImpl) GetSClassFromManagedCluster(resourceName, managedCluster string, annotations map[string]string, ) (*storagev1.StorageClass, error)
func (ManagedClusterViewGetterImpl) GetVGRClassFromManagedCluster ¶
func (m ManagedClusterViewGetterImpl) GetVGRClassFromManagedCluster(resourceName, managedCluster string, annotations map[string]string, ) (*volrep.VolumeGroupReplicationClass, error)
func (ManagedClusterViewGetterImpl) GetVGSClassFromManagedCluster ¶
func (m ManagedClusterViewGetterImpl) GetVGSClassFromManagedCluster(resourceName, managedCluster string, annotations map[string]string, ) (VolumeGroupSnapshotClassWrapper, error)
func (ManagedClusterViewGetterImpl) GetVRClassFromManagedCluster ¶
func (m ManagedClusterViewGetterImpl) GetVRClassFromManagedCluster(resourceName, managedCluster string, annotations map[string]string, ) (*volrep.VolumeReplicationClass, error)
func (ManagedClusterViewGetterImpl) GetVRGFromManagedCluster ¶
func (m ManagedClusterViewGetterImpl) GetVRGFromManagedCluster(resourceName, resourceNamespace, managedCluster string, annotations map[string]string, ) (*rmn.VolumeReplicationGroup, error)
func (ManagedClusterViewGetterImpl) GetVSClassFromManagedCluster ¶
func (m ManagedClusterViewGetterImpl) GetVSClassFromManagedCluster(resourceName, managedCluster string, annotations map[string]string, ) (*snapv1.VolumeSnapshotClass, error)
func (ManagedClusterViewGetterImpl) ListMModesMCVs ¶
func (m ManagedClusterViewGetterImpl) ListMModesMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
func (ManagedClusterViewGetterImpl) ListNFClassMCVs ¶
func (m ManagedClusterViewGetterImpl) ListNFClassMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
func (ManagedClusterViewGetterImpl) ListSClassMCVs ¶
func (m ManagedClusterViewGetterImpl) ListSClassMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
func (ManagedClusterViewGetterImpl) ListVGRClassMCVs ¶
func (m ManagedClusterViewGetterImpl) ListVGRClassMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
func (ManagedClusterViewGetterImpl) ListVGSClassMCVs ¶
func (m ManagedClusterViewGetterImpl) ListVGSClassMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
func (ManagedClusterViewGetterImpl) ListVRClassMCVs ¶
func (m ManagedClusterViewGetterImpl) ListVRClassMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
func (ManagedClusterViewGetterImpl) ListVSClassMCVs ¶
func (m ManagedClusterViewGetterImpl) ListVSClassMCVs(cluster string) (*viewv1beta1.ManagedClusterViewList, error)
type PvcSelector ¶
type PvcSelector struct {
LabelSelector metav1.LabelSelector
NamespaceNames []string
}
type RecipeElements ¶
type RecipeElements struct {
PvcSelector PvcSelector
CaptureWorkflow []kubeobjects.CaptureSpec
RecoverWorkflow []kubeobjects.RecoverSpec
CaptureFailOn string
RestoreFailOn string
RecipeWithParams *recipev1.Recipe
StopRecipeReconcile bool
}
type ResourceUpdater ¶
type ResourceUpdater struct {
// contains filtered or unexported fields
}
func NewResourceUpdater ¶
func NewResourceUpdater(obj client.Object) *ResourceUpdater
func (*ResourceUpdater) AddAnnotation ¶
func (u *ResourceUpdater) AddAnnotation(key, value string) *ResourceUpdater
func (*ResourceUpdater) AddFinalizer ¶
func (u *ResourceUpdater) AddFinalizer(finalizerName string) *ResourceUpdater
func (*ResourceUpdater) AddLabel ¶
func (u *ResourceUpdater) AddLabel(key, value string) *ResourceUpdater
func (*ResourceUpdater) AddOwner ¶
func (u *ResourceUpdater) AddOwner(owner metav1.Object, scheme *runtime.Scheme) *ResourceUpdater
func (*ResourceUpdater) DeleteAnnotation ¶
func (u *ResourceUpdater) DeleteAnnotation(key string) *ResourceUpdater
func (*ResourceUpdater) DeleteLabel ¶
func (u *ResourceUpdater) DeleteLabel(key string) *ResourceUpdater
func (*ResourceUpdater) RemoveFinalizer ¶
func (u *ResourceUpdater) RemoveFinalizer(finalizerName string) *ResourceUpdater
func (*ResourceUpdater) RemoveOwner ¶
func (u *ResourceUpdater) RemoveOwner(owner metav1.Object, scheme *runtime.Scheme) *ResourceUpdater
type ResourceVersionUpdatePredicate ¶
type ResourceVersionUpdatePredicate struct{}
func (ResourceVersionUpdatePredicate) Create ¶
func (ResourceVersionUpdatePredicate) Create(event.CreateEvent) bool
func (ResourceVersionUpdatePredicate) Delete ¶
func (ResourceVersionUpdatePredicate) Delete(event.DeleteEvent) bool
func (ResourceVersionUpdatePredicate) Generic ¶
func (ResourceVersionUpdatePredicate) Generic(event.GenericEvent) bool
func (ResourceVersionUpdatePredicate) Update ¶
func (ResourceVersionUpdatePredicate) Update(e event.UpdateEvent) bool
type SecretsUtil ¶
type SecretsUtil struct {
client.Client
APIReader client.Reader
Ctx context.Context
Log logr.Logger
}
func (*SecretsUtil) AddSecretToCluster ¶
func (sutil *SecretsUtil) AddSecretToCluster( secretName, clusterName, namespace, targetNS string, format TargetSecretFormat, veleroNS string, ) error
AddSecretToCluster takes in a secret (secretName) in the Ramen S3 secret format in a namespace and uses OCM Policy to deliver it to the desired cluster (clusterName), in the desired namespace (targetNS). It accepts a format that can help convert the secret in the hub cluster to a desired format on the target cluster. The format SecretFormatVelero needs an additional argument veleroNS which is the namespace for the velero formatted secret, to be delivered from the targetNS (which requires that the secret first be delivered to the targetNS)
func (*SecretsUtil) RemoveSecretFromCluster ¶
func (sutil *SecretsUtil) RemoveSecretFromCluster( secretName, clusterName, namespace string, format TargetSecretFormat, ) error
RemoveSecretFromCluster removes the secret (secretName) in namespace, from clusterName in the format requested. If this was the last cluster that required the secret to be delivered in the requested format, then the related policy resources are also deleted as part of the removal.
type TargetSecretFormat ¶
type TargetSecretFormat string
TargetSecretFormat defines the secret format to deliver to the cluster
const ( SecretFormatRamen TargetSecretFormat = "ramen" SecretFormatVelero TargetSecretFormat = "velero" )
type VMStaticIPInfo ¶
type VMStaticIPInfo struct {
VMName string
Namespace string
// HasStaticIP is true when the VM carries the VMStaticIPAnnotation on
// spec.template.metadata, indicating a UDN/CUDN static IP reservation.
HasStaticIP bool
// PrimaryAddresses holds the parsed interface→[]IP mapping from the
// annotation on the primary cluster. This is the source for translation.
PrimaryAddresses map[string][]string
}
VMStaticIPInfo holds per-VM static IP detection results. HasStaticIP=false is not an error — it means the VM uses DHCP or pod network and requires no IP translation during DR.
type VolumeGroupSnapshotClassWrapper ¶
type VolumeGroupSnapshotClassWrapper interface {
GetName() string
GetDriver() string
GetLabels() map[string]string
GetAnnotations() map[string]string
GetDeletionPolicy() string
}
VolumeGroupSnapshotClassWrapper provides a unified view of both public and private VGS class APIs.
func GetVolumeGroupSnapshotClasses ¶
func GetVolumeGroupSnapshotClasses( ctx context.Context, k8sClient client.Client, volumeGroupSnapshotClassSelector metav1.LabelSelector, ) ([]VolumeGroupSnapshotClassWrapper, error)
GetVolumeGroupSnapshotClasses returns VGS classes using the appropriate API. Requires a prior successful EnsureLocalVGSAPI (or ForcePrivateVGSAPIForTesting).
func NewPrivateVGSCWrapper ¶
func NewPrivateVGSCWrapper(vgsc *groupsnapv1beta1.VolumeGroupSnapshotClass) VolumeGroupSnapshotClassWrapper
NewPrivateVGSCWrapper creates a wrapper for a private VolumeGroupSnapshotClass (tests).
func NewPrivateVGSCWrappers ¶
func NewPrivateVGSCWrappers( vgscs ...*groupsnapv1beta1.VolumeGroupSnapshotClass, ) []VolumeGroupSnapshotClassWrapper
NewPrivateVGSCWrappers wraps private VolumeGroupSnapshotClasses for tests.
func NewVolumeGroupSnapshotClassForGV ¶
func NewVolumeGroupSnapshotClassForGV(gv schema.GroupVersion) (interface{}, VolumeGroupSnapshotClassWrapper, error)
NewVolumeGroupSnapshotClassForGV returns an empty VGSC object and a wrapper over the same instance. Callers that populate the object (e.g. via ManagedClusterView) can then read fields through the wrapper without a second wrap step.