controllers

package
v0.0.0-...-6c96132 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 76 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DRClusterConditionReasonInitializing = "Initializing"
	DRClusterConditionReasonFencing      = "Fencing"
	DRClusterConditionReasonUnfencing    = "Unfencing"
	DRClusterConditionReasonCleaning     = "Cleaning"
	DRClusterConditionReasonFenced       = "Fenced"
	DRClusterConditionReasonUnfenced     = "Unfenced"
	DRClusterConditionReasonClean        = "Clean"
	DRClusterConditionReasonValidated    = "Succeeded"

	DRClusterConditionReasonFenceError   = "FenceError"
	DRClusterConditionReasonUnfenceError = "UnfenceError"
	DRClusterConditionReasonCleanError   = "CleanError"

	DRClusterConditionReasonError        = "Error"
	DRClusterConditionReasonErrorUnknown = "UnknownError"
)

DRCluster condition reasons

View Source
const (
	StorageAnnotationSecretName      = "drcluster.ramendr.openshift.io/storage-secret-name"
	StorageAnnotationSecretNamespace = "drcluster.ramendr.openshift.io/storage-secret-namespace"
	StorageAnnotationClusterID       = "drcluster.ramendr.openshift.io/storage-clusterid"
	StorageAnnotationDriver          = "drcluster.ramendr.openshift.io/storage-driver"
)
View Source
const (
	// Annotations for MW and PlacementRule
	DRPCNameAnnotation      = "drplacementcontrol.ramendr.openshift.io/drpc-name"
	DRPCNamespaceAnnotation = "drplacementcontrol.ramendr.openshift.io/drpc-namespace"

	// Annotation that stores the UID of DRPC that created the resource on the managed cluster using a ManifestWork
	DRPCUIDAnnotation = "drplacementcontrol.ramendr.openshift.io/drpc-uid"

	// Annotation for the last cluster on which the application was running
	LastAppDeploymentCluster = "drplacementcontrol.ramendr.openshift.io/last-app-deployment-cluster"

	// Annotation for application namespace on the managed cluster
	DRPCAppNamespace = "drplacementcontrol.ramendr.openshift.io/app-namespace"
)
View Source
const (
	DRTypeSync  = DRType("sync")
	DRTypeAsync = DRType("async")
)
View Source
const (
	// DRPC CR finalizer
	DRPCFinalizer string = "drpc.ramendr.openshift.io/finalizer"

	// Ramen scheduler
	RamenScheduler string = "ramen"

	ClonedPlacementRuleNameFormat string = "drpc-plrule-%s-%s"

	// StatusCheckDelay is used to frequencly update the DRPC status when the reconciler is idle.
	// This is needed in order to sync up the DRPC status and the VRG status.
	StatusCheckDelay = time.Minute * 10

	// PlacementDecisionName format, prefix is the Placement name, and suffix is a PlacementDecision index
	PlacementDecisionName = "%s-decision-%d"

	// Maximum retries to create PlacementDecisionName with an increasing index in case of conflicts
	// with existing PlacementDecision resources
	MaxPlacementDecisionConflictCount = 5

	DestinationClusterAnnotationKey = "drplacementcontrol.ramendr.openshift.io/destination-cluster"

	DoNotDeletePVCAnnotation    = "drplacementcontrol.ramendr.openshift.io/do-not-delete-pvc"
	DoNotDeletePVCAnnotationVal = "true"
)
View Source
const (
	Continue      = 1
	AllowFailover = 2
	Stop          = 3
)
View Source
const (
	LastSyncTimestampSeconds = "last_sync_timestamp_seconds"
	LastSyncDurationSeconds  = "last_sync_duration_seconds"
	LastSyncDataBytes        = "last_sync_data_bytes"
	WorkloadProtectionStatus = "workload_protection_status"
)
View Source
const (
	ObjType            = "obj_type"
	ObjName            = "obj_name"
	ObjNamespace       = "obj_namespace"
	Policyname         = "policyname"
	SchedulingInterval = "scheduling_interval"
)
View Source
const (
	HubOperatorConfigMapName       = hubOperatorNameDefault + configMapNameSuffix
	DrClusterOperatorConfigMapName = drClusterOperatorNameDefault + configMapNameSuffix

	HubLeaderElectionResourceName = hubName + leaderElectionResourceNameSuffix

	ConfigMapRamenConfigKeyName = "ramen_manager_config.yaml"

	DefaultCephFSCSIDriverName = "openshift-storage.cephfs.csi.ceph.com"
	VeleroNamespaceNameDefault = "velero"
	DefaultVolSyncCopyMethod   = "Snapshot"
)
View Source
const (
	// PV data is ready. When failing over or relocating an app to a different
	// cluster, app's PVC will be able to access the storage volume only after
	// this condition is true.
	VRGConditionTypeDataReady = "DataReady"

	// PV data is protected. This means that, the PV data from the storage
	// is in complete sync with its remote peer.
	VRGConditionTypeDataProtected = "DataProtected"

	// PV cluster data is ready.  When failing over or relocating an app to a
	// different cluster, deploying the app prior to ClusterDataReady condition
	// could result in the PVCs binding to newly created PVs instead of binding
	// to their corresponding replicated PVs.  App's PVC should be deployed only
	// after this condition is true.
	VRGConditionTypeClusterDataReady = "ClusterDataReady"

	// PV cluster data is protected.  This condition indicates whether an app,
	// which is active in a cluster, has all its PV related cluster data
	// protected from a disaster by uploading it to the required S3 store(s).
	VRGConditionTypeClusterDataProtected = "ClusterDataProtected"

	// Total number of condition types in VRG as of now. Change this value
	// when a new condition type is added to VRG or an existing condition
	// type is removed from VRG status.
	VRGTotalConditions = 4

	// VolSync related conditions. These conditions are only applicable
	// at individual PVCs and not generic VRG conditions.
	VRGConditionTypeVolSyncRepSourceSetup      = "ReplicationSourceSetup"
	VRGConditionTypeVolSyncFinalSyncInProgress = "FinalSyncInProgress"
	VRGConditionTypeVolSyncRepDestinationSetup = "ReplicationDestinationSetup"
	VRGConditionTypeVolSyncPVsRestored         = "PVsRestored"
)

VRG status condition types. These condition are applicable at the VRG summary level and at the individual PVC level. The ClusterDataReady condition is only applicable at the VRG summary level and is not a condition that applies to individual PVCs.

View Source
const (
	VRGConditionReasonUnused                      = "Unused"
	VRGConditionReasonInitializing                = "Initializing"
	VRGConditionReasonReplicating                 = "Replicating"
	VRGConditionReasonReplicated                  = "Replicated"
	VRGConditionReasonReady                       = "Ready"
	VRGConditionReasonDataProtected               = "DataProtected"
	VRGConditionReasonProgressing                 = "Progressing"
	VRGConditionReasonClusterDataRestored         = "Restored"
	VRGConditionReasonError                       = "Error"
	VRGConditionReasonErrorUnknown                = "UnknownError"
	VRGConditionReasonUploading                   = "Uploading"
	VRGConditionReasonUploaded                    = "Uploaded"
	VRGConditionReasonUploadError                 = "UploadError"
	VRGConditionReasonVolSyncRepSourceInited      = "SourceInitialized"
	VRGConditionReasonVolSyncRepDestInited        = "DestinationInitialized"
	VRGConditionReasonVolSyncPVsRestored          = "Restored"
	VRGConditionReasonVolSyncFinalSyncInProgress  = "Syncing"
	VRGConditionReasonVolSyncFinalSyncComplete    = "Synced"
	VRGConditionReasonClusterDataAnnotationFailed = "AnnotationFailed"
	VRGConditionReasonPeerClassNotFound           = "PeerClassNotFound"
	VRGConditionReasonStorageIDNotFound           = "StorageIDNotFound"
)

VRG condition reasons

View Source
const (
	PvcVRFinalizerProtected = "volumereplicationgroups.ramendr.openshift.io/pvc-vr-protection"

	RestoreAnnotation = "volumereplicationgroups.ramendr.openshift.io/ramen-restore"
	RestoredByRamen   = "True"

	// StorageClass label
	StorageIDLabel = "ramendr.openshift.io/storageid"

	// Consistency group label
	ConsistencyGroupLabel = "ramendr.openshift.io/consistency-group"

	// VolumeReplicationClass label
	VolumeReplicationIDLabel = "ramendr.openshift.io/replicationid"

	// Maintenance mode label
	MModesLabel = "ramendr.openshift.io/maintenancemodes"

	// VolumeReplicationClass schedule parameter key
	VRClassScheduleKey = "schedulingInterval"
)
View Source
const AllDRPolicyAnnotation = "drpolicy.ramendr.openshift.io"

AllDRPolicyAnnotation is added to related resources that can be watched to reconcile all related DRPolicy resources

View Source
const (
	DRClusterNameAnnotation = "drcluster.ramendr.openshift.io/drcluster-name"
)
View Source
const (
	DRPolicySyncIntervalSeconds = "policy_schedule_interval_seconds"
)
View Source
const NoS3StoreAvailable = "NoS3"

FIXME

View Source
const ReasonDRClusterNotFound = "DRClusterNotFound"

ReasonDRClusterNotFound is set when the DRPolicy could not find the referenced DRCluster(s)

View Source
const ReasonDRClustersUnavailable = "DRClustersUnavailable"

ReasonDRClustersUnavailable is set when the DRPolicy has none of the referenced DRCluster(s) are in a validated state

View Source
const ReasonValidationFailed = "ValidationFailed"

ReasonValidationFailed is set when the DRPolicy could not be validated or is not valid

Variables

View Source
var (
	WaitForAppResourceRestoreToComplete error = errorswrapper.New("Waiting for App resources to be restored...")
	WaitForVolSyncDestRepToComplete     error = errorswrapper.New("Waiting for VolSync RD to complete...")
	WaitForSourceCluster                error = errorswrapper.New("Waiting for primary to provide Protected PVCs...")
	WaitForVolSyncManifestWorkCreation  error = errorswrapper.New("Waiting for VolSync ManifestWork to be created...")
	WaitForVolSyncRDInfoAvailibility    error = errorswrapper.New("Waiting for VolSync RDInfo...")
)
View Source
var (
	VolumeUnprotectionEnabledForAsyncVolRep  = false
	VolumeUnprotectionEnabledForAsyncVolSync = false
)
View Source
var ErrWorkflowNotFound = fmt.Errorf("backup or restore workflow not found")
View Source
var InitialWaitTimeForDRPCPlacementRule = errorswrapper.New("Waiting for DRPC Placement to produces placement decision")

Functions

func AvailableS3Profiles

func AvailableS3Profiles(drClusters []rmn.DRCluster) []string

func ConfigMapGet

func ConfigMapGet(
	ctx context.Context,
	apiReader client.Reader,
) (configMap *corev1.ConfigMap, ramenConfig *ramendrv1alpha1.RamenConfig, err error)

func ConfigMapNew

func ConfigMapNew(
	namespaceName string,
	name string,
	ramenConfig *ramendrv1alpha1.RamenConfig,
) (*corev1.ConfigMap, error)

func ConvertToPlacement

func ConvertToPlacement(placementObj interface{}) *clrapiv1beta1.Placement

func ConvertToPlacementRule

func ConvertToPlacementRule(placementObj interface{}) *plrv1.PlacementRule

func DRClusterPredicateFunc

func DRClusterPredicateFunc() predicate.Funcs

func DRClusterUpdateOfInterest

func DRClusterUpdateOfInterest(oldDRCluster, newDRCluster *rmn.DRCluster) bool

DRClusterUpdateOfInterest checks if the new DRCluster resource as compared to the older version requires any attention, it checks for the following updates:

  • If any maintenance mode is reported as activated
  • If drcluster was marked for deletion

TODO: Needs some logs for easier troubleshooting

func DRPCUpdateOfInterest

func DRPCUpdateOfInterest(oldDRPC, newDRPC *ramen.DRPlacementControl) bool

DRPCUpdateOfInterest returns a bool, which is true if the update to DRPC requires further processing

func DRPCsFailingOverToClusterForPolicy

func DRPCsFailingOverToClusterForPolicy(
	k8sclient client.Client,
	log logr.Logger,
	drpolicy *rmn.DRPolicy,
	drcluster string,
) ([]*rmn.DRPlacementControl, error)

DRPCsFailingOverToClusterForPolicy filters DRPC resources that reference the DRPolicy and are failing over to the target cluster passed in

func DRPCsUsingDRPolicy

func DRPCsUsingDRPolicy(
	k8sclient client.Client,
	log logr.Logger,
	drpolicy *rmn.DRPolicy,
) ([]*rmn.DRPlacementControl, error)

DRPCsUsingDRPolicy finds DRPC resources that reference the DRPolicy.

func DRPolicyPredicateFunc

func DRPolicyPredicateFunc() predicate.Funcs

func DRPolicySyncIntervalMetricLabels

func DRPolicySyncIntervalMetricLabels(drPolicy *rmn.DRPolicy) prometheus.Labels

dRPolicySyncInterval Metrics reports the value from schedulingInterval from DRPolicy

func DeleteDRPolicySyncIntervalMetrics

func DeleteDRPolicySyncIntervalMetrics(labels prometheus.Labels) bool

func DeleteSyncDataBytesMetric

func DeleteSyncDataBytesMetric(labels prometheus.Labels) bool

func DeleteSyncDurationMetric

func DeleteSyncDurationMetric(labels prometheus.Labels) bool

func DeleteSyncTimeMetric

func DeleteSyncTimeMetric(labels prometheus.Labels) bool

func DeleteTypedObject

func DeleteTypedObject(s ObjectStorer, keyPrefix, keySuffix string, object interface{},
) error

func DeleteWorkloadProtectionStatusMetric

func DeleteWorkloadProtectionStatusMetric(labels prometheus.Labels) bool

func DownloadTypedObject

func DownloadTypedObject(s ObjectStorer, keyPrefix, keySuffix string, objectPointer interface{},
) error

func DownloadTypedObjects

func DownloadTypedObjects(s ObjectStorer, keyPrefix string, objectsPointer interface{},
) error

DownloadTypedObjects downloads all objects of the given type that have the given key prefix followed by the given object's type keyInfix.

  • Example key prefix: namespace/vrgName/ Example key infix: v1.PersistentVolumeClaim/ Example new key prefix: namespace/vrgName/v1.PersistentVolumeClaim/
  • Objects being downloaded should meet the decoding expectations of the DownloadObject() method.

func DownloadVRGs

func DownloadVRGs(s ObjectStorer, pvKeyPrefix string) (
	vrgList []ramen.VolumeReplicationGroup, err error,
)

func FindProtectedPVC

func FindProtectedPVC(vrg *ramen.VolumeReplicationGroup, pvcNamespaceName, pvcName string) *ramen.ProtectedPVC

func FindProtectedPvcAndIndex

func FindProtectedPvcAndIndex(
	vrg *ramen.VolumeReplicationGroup, pvcNamespaceName, pvcName string,
) (*ramen.ProtectedPVC, int)

func GetAvailableS3Profiles

func GetAvailableS3Profiles(ctx context.Context, client client.Client,
	drpc *rmn.DRPlacementControl, log logr.Logger,
) []string

func GetDRClusters

func GetDRClusters(ctx context.Context, client client.Client, drPolicy *rmn.DRPolicy) ([]rmn.DRCluster, error)

func GetDRPolicy

func GetDRPolicy(ctx context.Context, client client.Client,
	drpc *rmn.DRPlacementControl, log logr.Logger,
) (*rmn.DRPolicy, error)

func GetLastKnownVRGPrimaryFromS3

func GetLastKnownVRGPrimaryFromS3(
	ctx context.Context,
	apiReader client.Reader,
	s3ProfileNames []string,
	sourceVrgName string,
	sourceVrgNamespace string,
	objectStoreGetter ObjectStoreGetter,
	log logr.Logger,
) *rmn.VolumeReplicationGroup

func GetRamenConfigS3StoreProfile

func GetRamenConfigS3StoreProfile(ctx context.Context, apiReader client.Reader, profileName string) (
	s3StoreProfile ramendrv1alpha1.S3StoreProfile, err error,
)

func GetS3Secret

func GetS3Secret(ctx context.Context, r client.Reader,
	secretRef corev1.SecretReference) (
	s3AccessID, s3SecretAccessKey []byte, err error,
)

func IsPreRelocateProgression

func IsPreRelocateProgression(status rmn.ProgressionStatus) bool

func LoadControllerConfig

func LoadControllerConfig(configFile string,
	log logr.Logger,
) (ramenConfig *ramendrv1alpha1.RamenConfig)

func LoadControllerOptions

func LoadControllerOptions(options *ctrl.Options, ramenConfig *ramendrv1alpha1.RamenConfig)

func MModesFromCSV

func MModesFromCSV(modes string) []ramendrv1alpha1.MMode

func ManagedClusterViewPredicateFunc

func ManagedClusterViewPredicateFunc() predicate.Funcs

func ManifestWorkPredicateFunc

func ManifestWorkPredicateFunc() predicate.Funcs

func ParseDoubleSlash

func ParseDoubleSlash(input string) string

func ParseRemoveSlashes

func ParseRemoveSlashes(input string) string

func ParseSingleSlash

func ParseSingleSlash(input string) string

func PlacementPredicateFunc

func PlacementPredicateFunc() predicate.Funcs

func PlacementRulePredicateFunc

func PlacementRulePredicateFunc() predicate.Funcs

func PruneAnnotations

func PruneAnnotations(annotations map[string]string) map[string]string

pruneAnnotations takes a map of annotations and removes the annotations where the key start with:

  • pv.kubernetes.io
  • replication.storage.openshift.io
  • volumereplicationgroups.ramendr.openshift.io

Parameters:

annotations: the map of annotations to prune

Returns:

a new map containing only the remaining annotations

func RamenConfigS3StoreProfilePointerGet

func RamenConfigS3StoreProfilePointerGet(ramenConfig *ramendrv1alpha1.RamenConfig, profileName string,
) *ramendrv1alpha1.S3StoreProfile

func RamenOperandsNamespace

func RamenOperandsNamespace(config ramendrv1alpha1.RamenConfig) string

func RamenOperatorNamespace

func RamenOperatorNamespace() string

func ReadRamenConfigFile

func ReadRamenConfigFile(log logr.Logger) (ramenConfig *ramendrv1alpha1.RamenConfig, err error)

Read the RamenConfig file mounted in the local file system. This file is expected to be cached in the local file system. If reading of the RamenConfig file for every S3 store profile access turns out to be more expensive, we may need to enhance this logic to load it only when RamenConfig has changed.

func RecipeElementsGet

func RecipeElementsGet(ctx context.Context, reader client.Reader, vrg ramen.VolumeReplicationGroup,
	ramenConfig ramen.RamenConfig, log logr.Logger, recipeElements *RecipeElements,
) error

func RecipeParametersExpand

func RecipeParametersExpand(recipe *recipe.Recipe, parameters map[string][]string,
	log logr.Logger,
) error

func RequiresDRPCReconciliation

func RequiresDRPCReconciliation(oldDRPolicy, newDRPolicy *rmn.DRPolicy) bool

RequiresDRPCReconciliation determines if the updated DRPolicy resource, compared to the previous version, requires reconciliation of the DRPCs. Reconciliation is needed if the DRPolicy has been newly activated. This check helps avoid delays in reconciliation by ensuring timely updates when necessary.

func S3KeyPrefix

func S3KeyPrefix(namespacedName string) string

func SubscriptionFromDrClusterManifestWork

func SubscriptionFromDrClusterManifestWork(
	mwu *util.MWUtil,
	clusterName string,
) (*operatorsv1alpha1.Subscription, error)

func SyncDataBytesMetricLabels

func SyncDataBytesMetricLabels(drPolicy *rmn.DRPolicy, drpc *rmn.DRPlacementControl) prometheus.Labels

lastSyncDataBytes Metric reports value from lastGroupSyncBytes taken from DRPC status

func SyncDurationMetricLabels

func SyncDurationMetricLabels(drPolicy *rmn.DRPolicy, drpc *rmn.DRPlacementControl) prometheus.Labels

lastSyncDuration Metrics reports value from lastGroupSyncDuration from DRPC status

func SyncTimeMetricLabels

func SyncTimeMetricLabels(drPolicy *rmn.DRPolicy, drpc *rmn.DRPlacementControl) prometheus.Labels

lastSyncTime metrics reports value from lastGrpupSyncTime taken from DRPC status

func TypedObjectKey

func TypedObjectKey(prefix, suffix string, object interface{}) string

func UploadPV

func UploadPV(s ObjectStorer, pvKeyPrefix, pvKeySuffix string,
	pv corev1.PersistentVolume,
) error

UploadPV uploads the given PV to the bucket with a key of "<pvKeyPrefix><v1.PersistentVolume/><pvKeySuffix>". - pvKeyPrefix should have any required delimiters like '/' - OK to call UploadPV() concurrently from multiple goroutines safely.

func UploadPVC

func UploadPVC(s ObjectStorer, pvcKeyPrefix, pvcKeySuffix string,
	pvc corev1.PersistentVolumeClaim,
) error

UploadPVC uploads the given PVC to the bucket with a key of "<pvcKeyPrefix><v1.PersistentVolumeClaim/><pvcKeySuffix>". - pvcKeyPrefix should have any required delimiters like '/' - OK to call UploadPVC() concurrently from multiple goroutines safely.

func VrgObjectProtect

func VrgObjectProtect(objectStorer ObjectStorer, vrg ramen.VolumeReplicationGroup) error

func VrgObjectUnprotect

func VrgObjectUnprotect(objectStorer ObjectStorer, vrg ramen.VolumeReplicationGroup) error

func VrgTidyForList

func VrgTidyForList(vrg *ramendrv1alpha1.VolumeReplicationGroup)

func WorkloadProtectionStatusLabels

func WorkloadProtectionStatusLabels(drpc *rmn.DRPlacementControl) prometheus.Labels

workloadProtectionStatus Metric reports information regarding workload protection condition from DRPC

Types

type DRClusterConfigReconciler

type DRClusterConfigReconciler struct {
	client.Client
	Scheme      *runtime.Scheme
	Log         logr.Logger
	RateLimiter *workqueue.TypedRateLimiter[reconcile.Request]
}

DRClusterConfigReconciler reconciles a DRClusterConfig object

func (*DRClusterConfigReconciler) CreateClassClaims

func (r *DRClusterConfigReconciler) CreateClassClaims(ctx context.Context, log logr.Logger) ([]string, error)

CreateClassClaims creates cluster claims for various storage related classes of interest

func (*DRClusterConfigReconciler) GetDRClusterConfig

func (r *DRClusterConfigReconciler) GetDRClusterConfig(ctx context.Context) (*ramen.DRClusterConfig, error)

func (*DRClusterConfigReconciler) Reconcile

func (*DRClusterConfigReconciler) SetupWithManager

func (r *DRClusterConfigReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type DRClusterReconciler

type DRClusterReconciler struct {
	client.Client
	APIReader         client.Reader
	Log               logr.Logger
	Scheme            *runtime.Scheme
	MCVGetter         util.ManagedClusterViewGetter
	ObjectStoreGetter ObjectStoreGetter
	RateLimiter       *workqueue.TypedRateLimiter[reconcile.Request]
}

DRClusterReconciler reconciles a DRCluster object

func (*DRClusterReconciler) Reconcile

func (r *DRClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*DRClusterReconciler) SetupWithManager

func (r *DRClusterReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type DRPCAndPolicy

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

func DRPCsFailingOverToCluster

func DRPCsFailingOverToCluster(k8sclient client.Client, log logr.Logger, drcluster string) ([]DRPCAndPolicy, error)

DRPCsFailingOverToCluster lists DRPC resources that are failing over to the passed in drcluster

func DRPCsUsingDRCluster

func DRPCsUsingDRCluster(k8sclient client.Client, log logr.Logger, drcluster *rmn.DRCluster) ([]DRPCAndPolicy, error)

DRPCsUsingDRCluster finds DRPC resources using the DRcluster.

type DRPCInstance

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

func (*DRPCInstance) EnsureCleanup

func (d *DRPCInstance) EnsureCleanup(clusterToSkip string) error

func (*DRPCInstance) EnsureSecondaryReplicationSetup

func (d *DRPCInstance) EnsureSecondaryReplicationSetup(srcCluster string) error

func (*DRPCInstance) EnsureVolSyncReplicationSetup

func (d *DRPCInstance) EnsureVolSyncReplicationSetup(srcCluster string) error

func (*DRPCInstance) IsVolSyncReplicationRequired

func (d *DRPCInstance) IsVolSyncReplicationRequired(homeCluster string) (bool, error)

func (*DRPCInstance) ResetVolSyncRDOnPrimary

func (d *DRPCInstance) ResetVolSyncRDOnPrimary(clusterName string) error

func (*DRPCInstance) RunFailover

func (d *DRPCInstance) RunFailover() (bool, error)

RunFailover: 0. Check if failoverCluster is a valid target as Secondary (or already is a Primary) 1. If already failed over or in the process (VRG on failoverCluster is Primary), ensure failover is complete and then ensure cleanup 2. Else, if failover is initiated (VRG ManifestWork is create as Primary), then try again till VRG manifests itself on the failover cluster 3. Else, initiate failover to the desired failoverCluster (switchToFailoverCluster)

func (*DRPCInstance) RunInitialDeployment

func (d *DRPCInstance) RunInitialDeployment() (bool, error)

func (*DRPCInstance) RunRelocate

func (d *DRPCInstance) RunRelocate() (bool, error)

runRelocate checks if pre-conditions for relocation are met, and if so performs the relocation Pre-requisites for relocation are checked as follows:

  • The exists at least one VRG across clusters (there is no state where we do not have a VRG as primary or secondary once initial deployment is complete)
  • Ensures that there is only one primary, before further state transitions
  • If there are multiple primaries, wait for one of the primaries to transition to a secondary. This can happen if MCV reports older VRG state as MW is being applied to the cluster.
  • Check if peers are ready
  • If there are secondaries in flight, ensure they report secondary as the observed state before moving forward
  • preferredCluster should not report as Secondary, as it will never transition out of delete state in the future, as there would be no primary. This can happen, if in between relocate the preferred cluster was switched
  • User needs to recover by changing the preferredCluster back to the initial intent
  • Check if we already relocated to the preferredCluster, and ensure cleanup actions
  • Check if current primary (that is not the preferred cluster), is ready to switch over
  • Relocate!

type DRPlacementControlReconciler

type DRPlacementControlReconciler struct {
	client.Client
	APIReader client.Reader
	Log       logr.Logger
	MCVGetter rmnutil.ManagedClusterViewGetter
	Scheme    *runtime.Scheme
	Callback  ProgressCallback

	ObjStoreGetter ObjectStoreGetter
	RateLimiter    *workqueue.TypedRateLimiter[reconcile.Request]
	// contains filtered or unexported fields
}

DRPlacementControlReconciler reconciles a DRPlacementControl object

func (*DRPlacementControlReconciler) FilterDRCluster

func (r *DRPlacementControlReconciler) FilterDRCluster(drcluster *rmn.DRCluster) []ctrl.Request

FilterDRCluster filters for DRPC resources that should be reconciled due to a DRCluster watch event

func (*DRPlacementControlReconciler) FilterDRPCsForDRPolicyUpdate

func (r *DRPlacementControlReconciler) FilterDRPCsForDRPolicyUpdate(drpolicy *rmn.DRPolicy) []ctrl.Request

FilterDRPCsForDRPolicyUpdate filters and returns the DRPC resources that need reconciliation in response to a DRPolicy update event. This ensures that only relevant DRPCs are processed based on the changes in the associated DRPolicy.

func (*DRPlacementControlReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the DRPlacementControl object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.7.0/pkg/reconcile

func (*DRPlacementControlReconciler) SetupWithManager

func (r *DRPlacementControlReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type DRPolicyReconciler

type DRPolicyReconciler struct {
	client.Client
	APIReader         client.Reader
	Log               logr.Logger
	Scheme            *runtime.Scheme
	MCVGetter         util.ManagedClusterViewGetter
	ObjectStoreGetter ObjectStoreGetter
	RateLimiter       *workqueue.TypedRateLimiter[reconcile.Request]
}

DRPolicyReconciler reconciles a DRPolicy object

func (*DRPolicyReconciler) Reconcile

func (r *DRPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the DRPolicy object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.9.2/pkg/reconcile

func (*DRPolicyReconciler) SetupWithManager

func (r *DRPolicyReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type DRPolicySyncMetrics

type DRPolicySyncMetrics struct {
	DRPolicySyncInterval prometheus.Gauge
}

func NewDRPolicySyncIntervalMetrics

func NewDRPolicySyncIntervalMetrics(labels prometheus.Labels) DRPolicySyncMetrics

type DRType

type DRType string

type ObjectStoreGetter

type ObjectStoreGetter interface {
	// ObjectStore returns an object that satisfies ObjectStorer interface
	ObjectStore(ctx context.Context, r client.Reader,
		s3Profile string, callerTag string, log logr.Logger,
	) (ObjectStorer, ramen.S3StoreProfile, error)
}

ObjectStoreGetter interface is exported because test clients use this interface.

func S3ObjectStoreGetter

func S3ObjectStoreGetter() ObjectStoreGetter

S3ObjectStoreGetter returns a concrete type that implements the ObjectStoreGetter interface, allowing the concrete type to be not exported.

type ObjectStorer

type ObjectStorer interface {
	UploadObject(key string, object interface{}) error
	DownloadObject(key string, objectPointer interface{}) error
	ListKeys(keyPrefix string) (keys []string, err error)
	DeleteObject(key string) error
	DeleteObjects(key ...string) error
	DeleteObjectsWithKeyPrefix(keyPrefix string) error
}

type Progress

type Progress int

type ProgressCallback

type ProgressCallback func(string, string)

ProgressCallback of function type

type ProtectedVolumeReplicationGroupListInstance

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

func (*ProtectedVolumeReplicationGroupListInstance) GetItemsInReplicaStoreWithPrefix

func (s *ProtectedVolumeReplicationGroupListInstance) GetItemsInReplicaStoreWithPrefix(s3ProfileName string,
	lookupPrefix string,
) ([]string, error)

func (*ProtectedVolumeReplicationGroupListInstance) ParseResultListFromReplicaStore

func (s *ProtectedVolumeReplicationGroupListInstance) ParseResultListFromReplicaStore(
	s3ProfileName string, prefix string, parseFunc func(string) string,
) ([]string, error)

type ProtectedVolumeReplicationGroupListReconciler

type ProtectedVolumeReplicationGroupListReconciler struct {
	client.Client
	APIReader      client.Reader
	ObjStoreGetter ObjectStoreGetter
	Scheme         *runtime.Scheme
	RateLimiter    *workqueue.TypedRateLimiter[reconcile.Request]
}

ProtectedVolumeReplicationGroupListReconciler reconciles a ProtectedVolumeReplicationGroupList object

func (*ProtectedVolumeReplicationGroupListReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the ProtectedVolumeReplicationGroupList object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.9.2/pkg/reconcile

func (*ProtectedVolumeReplicationGroupListReconciler) SetupWithManager

SetupWithManager sets up the controller with the Manager.

type PvcSelector

type PvcSelector struct {
	LabelSelector  metav1.LabelSelector
	NamespaceNames []string
}

func GetPVCSelector

func GetPVCSelector(ctx context.Context, reader client.Reader, vrg ramen.VolumeReplicationGroup,
	ramenConfig ramen.RamenConfig,
	log logr.Logger,
) (PvcSelector, error)

type RecipeElements

type RecipeElements struct {
	PvcSelector     PvcSelector
	CaptureWorkflow []kubeobjects.CaptureSpec
	RecoverWorkflow []kubeobjects.RecoverSpec
}

type ReplicationGroupDestinationReconciler

type ReplicationGroupDestinationReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

ReplicationGroupDestinationReconciler reconciles a ReplicationGroupDestination object

func (*ReplicationGroupDestinationReconciler) Reconcile

func (*ReplicationGroupDestinationReconciler) SetupWithManager

func (r *ReplicationGroupDestinationReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type ReplicationGroupSourceReconciler

type ReplicationGroupSourceReconciler struct {
	client.Client
	APIReader client.Reader
	Scheme    *runtime.Scheme
	// contains filtered or unexported fields
}

ReplicationGroupSourceReconciler reconciles a ReplicationGroupSource object

func (*ReplicationGroupSourceReconciler) Reconcile

nolint: funlen

func (*ReplicationGroupSourceReconciler) SetupWithManager

func (r *ReplicationGroupSourceReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type SyncDataBytesMetrics

type SyncDataBytesMetrics struct {
	LastSyncDataBytes prometheus.Gauge
}

func NewSyncDataBytesMetric

func NewSyncDataBytesMetric(labels prometheus.Labels) SyncDataBytesMetrics

type SyncDurationMetrics

type SyncDurationMetrics struct {
	LastSyncDuration prometheus.Gauge
}

func NewSyncDurationMetric

func NewSyncDurationMetric(labels prometheus.Labels) SyncDurationMetrics

type SyncTimeMetrics

type SyncTimeMetrics struct {
	LastSyncTime prometheus.Gauge
}

func NewSyncTimeMetric

func NewSyncTimeMetric(labels prometheus.Labels) SyncTimeMetrics

type VRGInstance

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

func (*VRGInstance) UploadPVAndPVCtoS3

func (v *VRGInstance) UploadPVAndPVCtoS3(s3ProfileName string, objectStore ObjectStorer,
	pv *corev1.PersistentVolume, pvc *corev1.PersistentVolumeClaim,
) error

func (*VRGInstance) UploadPVandPVCtoS3Store

func (v *VRGInstance) UploadPVandPVCtoS3Store(s3ProfileName string, pvc *corev1.PersistentVolumeClaim) error

func (*VRGInstance) UploadPVandPVCtoS3Stores

func (v *VRGInstance) UploadPVandPVCtoS3Stores(pvc *corev1.PersistentVolumeClaim,
	log logr.Logger,
) ([]string, error)

type VolumeReplicationGroupReconciler

type VolumeReplicationGroupReconciler struct {
	client.Client
	APIReader      client.Reader
	Log            logr.Logger
	ObjStoreGetter ObjectStoreGetter
	Scheme         *runtime.Scheme

	RateLimiter *workqueue.TypedRateLimiter[reconcile.Request]
	// contains filtered or unexported fields
}

VolumeReplicationGroupReconciler reconciles a VolumeReplicationGroup object

func (*VolumeReplicationGroupReconciler) RDMapFunc

func (*VolumeReplicationGroupReconciler) RSMapFunc

func (*VolumeReplicationGroupReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the VolumeReplicationGroup object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.7.0/pkg/reconcile nolint: funlen

func (*VolumeReplicationGroupReconciler) SetupWithManager

func (r *VolumeReplicationGroupReconciler) SetupWithManager(
	mgr ctrl.Manager, ramenConfig *ramendrv1alpha1.RamenConfig,
) error

SetupWithManager sets up the controller with the Manager.

func (*VolumeReplicationGroupReconciler) VRMapFunc

type WorkloadProtectionMetrics

type WorkloadProtectionMetrics struct {
	WorkloadProtectionStatus prometheus.Gauge
}

func NewWorkloadProtectionStatusMetric

func NewWorkloadProtectionStatusMetric(labels prometheus.Labels) WorkloadProtectionMetrics

Directories

Path Synopsis
NOTE: Added to skip creating shadow manifests for localSecret struct +kubebuilder:skip
NOTE: Added to skip creating shadow manifests for localSecret struct +kubebuilder:skip

Jump to

Keyboard shortcuts

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