Documentation
¶
Index ¶
- Constants
- func ContainsString(slice []string, s string) bool
- func RemoveString(slice []string, s string) []string
- type ClusterSharedVolumeReconciler
- type ControllerSetupConfig
- type OneTimeRecoveryRunnable
- type PodCleanupReconciler
- type SharedVolumeReconciler
- type SharedVolumeRef
- type SyncController
- func (s *SyncController) RecoverSyncOperations(ctx context.Context) error
- func (s *SyncController) StartSyncForClusterSharedVolume(ctx context.Context, csv *svv1alpha1.ClusterSharedVolume) error
- func (s *SyncController) StartSyncForSharedVolume(ctx context.Context, sv *svv1alpha1.SharedVolume) error
- func (s *SyncController) StopSyncForClusterSharedVolume(csv *svv1alpha1.ClusterSharedVolume)
- func (s *SyncController) StopSyncForSharedVolume(sv *svv1alpha1.SharedVolume)
- type SyncRequest
- type SyncSource
- type SyncSourceGit
- type SyncSourceHTTP
- type SyncSourceS3
- type SyncSourceSSH
- type SyncTarget
- type VolumeControllerBase
- func (r *VolumeControllerBase) CheckAndUpdateNfsServerStatus(ctx context.Context, volumeObj VolumeObject, namespace string) (ctrl.Result, error)
- func (r *VolumeControllerBase) CheckNfsServerStatus(ctx context.Context, volumeObj VolumeObject, namespace string) (bool, string, string, error)
- func (r *VolumeControllerBase) CheckResourceReadiness(ctx context.Context, volumeObj VolumeObject, namespace string, ...) error
- func (b *VolumeControllerBase) CleanupAllPVCs(ctx context.Context, volume VolumeObject, referenceValue string)
- func (b *VolumeControllerBase) CleanupAllPVCsInNamespace(ctx context.Context, volume VolumeObject, referenceValue string, ...)
- func (b *VolumeControllerBase) CleanupAllPVs(ctx context.Context, volume VolumeObject, referenceValue string)
- func (b *VolumeControllerBase) CleanupAllPVsWithWait(ctx context.Context, volume VolumeObject, referenceValue string)
- func (b *VolumeControllerBase) CleanupAllPodsUsingVolume(ctx context.Context, volume VolumeObject)
- func (b *VolumeControllerBase) CleanupAllPodsUsingVolumeInNamespace(ctx context.Context, volume VolumeObject, operationalNamespace string)
- func (b *VolumeControllerBase) CleanupNFSServer(ctx context.Context, volume VolumeObject)
- func (b *VolumeControllerBase) CleanupNFSServerInNamespace(ctx context.Context, volume VolumeObject, operationalNamespace string)
- func (b *VolumeControllerBase) CleanupReplicaSet(ctx context.Context, volume VolumeObject, referenceValue string)
- func (b *VolumeControllerBase) CleanupReplicaSetInNamespace(ctx context.Context, volume VolumeObject, referenceValue string, ...)
- func (b *VolumeControllerBase) CleanupResources(ctx context.Context, volume VolumeObject) error
- func (b *VolumeControllerBase) CleanupResourcesInNamespace(ctx context.Context, volume VolumeObject, operationalNamespace string) error
- func (b *VolumeControllerBase) CleanupService(ctx context.Context, volume VolumeObject, referenceValue string)
- func (b *VolumeControllerBase) CleanupServiceInNamespace(ctx context.Context, volume VolumeObject, referenceValue string, ...)
- func (r *VolumeControllerBase) CreateAndOwnNfsServer(ctx context.Context, volumeObj VolumeObject, namespace string) error
- func (r *VolumeControllerBase) CreateNoOpNotReadyCallback() func(context.Context, VolumeObject) error
- func (r *VolumeControllerBase) CreateNoOpReadyCallback() func(context.Context, VolumeObject) error
- func (r *VolumeControllerBase) CreateSyncControllerSetupHook(createSyncController func(client.Client, *runtime.Scheme) *SyncController, ...) func(ctrl.Manager, *VolumeControllerBase) error
- func (r *VolumeControllerBase) CreateSyncNotReadyCallback() func(context.Context, VolumeObject) error
- func (r *VolumeControllerBase) CreateSyncReadyCallback() func(context.Context, VolumeObject) error
- func (r *VolumeControllerBase) DeterminePhase(nfsReady, replicaSetReady bool) string
- func (r *VolumeControllerBase) EnsureAPIVersionAndKind(obj client.Object, apiVersion, kind string)
- func (r *VolumeControllerBase) EnsureControllerNamespace(ctx context.Context) error
- func (r *VolumeControllerBase) FillAndValidateSpec(volumeObj VolumeObject, generateNfsServer bool, namespace string) error
- func (b *VolumeControllerBase) ForceCleanupAllResources(ctx context.Context, volume VolumeObject, referenceValue string)
- func (b *VolumeControllerBase) ForceCleanupAllResourcesInNamespace(ctx context.Context, volume VolumeObject, referenceValue string, ...)
- func (b *VolumeControllerBase) ForceDeletePV(ctx context.Context, pv *corev1.PersistentVolume) error
- func (b *VolumeControllerBase) ForceDeletePVC(ctx context.Context, pvc *corev1.PersistentVolumeClaim) error
- func (b *VolumeControllerBase) ForceDeletePod(ctx context.Context, pod *corev1.Pod) error
- func (r *VolumeControllerBase) GenerateAndCreateNfsServer(ctx context.Context, volumeObj VolumeObject, resourcePrefix string, ...) (ctrl.Result, error)
- func (r *VolumeControllerBase) GetManagedNfsServerAddress(volumeObj VolumeObject, nfsServerSpec *svv1alpha1.NfsServerSpec) string
- func (r *VolumeControllerBase) HandleFinalizerLogic(ctx context.Context, obj client.Object, finalizerName string) (bool, error)
- func (r *VolumeControllerBase) IsExternalNfsServer(nfsServerSpec *svv1alpha1.NfsServerSpec) bool
- func (r *VolumeControllerBase) IsPVCReady(ctx context.Context, volumeObj VolumeObject, namespace string) (bool, error)
- func (r *VolumeControllerBase) IsReplicaSetReady(ctx context.Context, volumeObj VolumeObject, namespace string) (bool, error)
- func (r *VolumeControllerBase) RandString(n int) string
- func (r *VolumeControllerBase) ReconcileGeneric(ctx context.Context, req ctrl.Request, config VolumeReconcileConfig) (ctrl.Result, error)
- func (r *VolumeControllerBase) ReconcileNfsServer(ctx context.Context, volumeObj VolumeObject, generateNfsServer bool, ...) (ctrl.Result, error)
- func (r *VolumeControllerBase) ReconcileNfsServerComplete(ctx context.Context, volumeObj VolumeObject, namespace string, ...) (ctrl.Result, error)
- func (r *VolumeControllerBase) ReconcilePersistentVolume(ctx context.Context, volumeObj VolumeObject, namespace string) error
- func (r *VolumeControllerBase) ReconcilePersistentVolumeClaim(ctx context.Context, volumeObj VolumeObject, namespace string) error
- func (r *VolumeControllerBase) ReconcileReplicaSet(ctx context.Context, volumeObj VolumeObject, namespace string) error
- func (r *VolumeControllerBase) ReconcileRequiredResources(ctx context.Context, volumeObj VolumeObject, namespace string) error
- func (r *VolumeControllerBase) ReconcileService(ctx context.Context, volumeObj VolumeObject, namespace string) error
- func (r *VolumeControllerBase) ReconcileVolume(ctx context.Context, req ctrl.Request, volumeObj VolumeObject, ...) (ctrl.Result, error)
- func (r *VolumeControllerBase) RemoveFinalizerWithRetry(ctx context.Context, obj client.Object, finalizerName string) error
- func (b *VolumeControllerBase) RemovePVCFinalizersWithRetry(ctx context.Context, pvc *corev1.PersistentVolumeClaim) error
- func (b *VolumeControllerBase) RemovePVFinalizersWithRetry(ctx context.Context, pv *corev1.PersistentVolume) error
- func (r *VolumeControllerBase) SetupGenericController(mgr ctrl.Manager, config ControllerSetupConfig, reconciler interface{}) error
- func (r *VolumeControllerBase) ShouldUpdateReadinessStatus(volumeObj VolumeObject, nfsReady, replicaSetReady bool) bool
- func (r *VolumeControllerBase) UpdateReadinessStatus(ctx context.Context, volumeObj VolumeObject, nfsReady, replicaSetReady bool, ...) error
- func (r *VolumeControllerBase) UpdateStatusWithRetry(ctx context.Context, obj client.Object, updateFn func(client.Object)) error
- func (r *VolumeControllerBase) UpdateVolumeStatus(volumeObj VolumeObject, nfsReady bool, phase string, message string) bool
- func (r *VolumeControllerBase) UpdateVolumeStatusSimple(volumeObj VolumeObject, phase string, message string) bool
- func (b *VolumeControllerBase) WaitForPodsToTerminate(ctx context.Context, volume VolumeObject, referenceValue string)
- type VolumeObject
- type VolumeReconcileConfig
- type VolumeRef
Constants ¶
const ()
const (
ClusterSharedVolumeOperationNamespace = "shared-volume-controller"
)const (
// NfsServerGeneratingAnnotation marks when NfsServer generation is in progress
NfsServerGeneratingAnnotation = "shared-volume.io/nfsserver-generating"
)
const (
SyncControllerName = "sync-controller"
)
Variables ¶
This section is empty.
Functions ¶
func ContainsString ¶
ContainsString checks if a slice contains a specific string
func RemoveString ¶
RemoveString removes a specific string from a slice
Types ¶
type ClusterSharedVolumeReconciler ¶
type ClusterSharedVolumeReconciler struct {
}ClusterSharedVolumeReconciler reconciles a ClusterSharedVolume object
func (*ClusterSharedVolumeReconciler) Reconcile ¶
func (r *ClusterSharedVolumeReconciler) 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.
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.21.0/pkg/reconcile
func (*ClusterSharedVolumeReconciler) SetupWithManager ¶
func (r *ClusterSharedVolumeReconciler) SetupWithManager(mgr ctrl.Manager, controllerNamespace string) error
SetupWithManager sets up the controller with the Manager.
type ControllerSetupConfig ¶
type ControllerSetupConfig struct { VolumeType client.Object ControllerName string ControllerNamespace string PreSetupHook func(ctrl.Manager, *VolumeControllerBase) error Runnables []manager.Runnable // Use controller-runtime manager.Runnable interface }
ControllerSetupConfig holds configuration for generic controller setup
type OneTimeRecoveryRunnable ¶
type OneTimeRecoveryRunnable struct {
// contains filtered or unexported fields
}
OneTimeRecoveryRunnable is a generic runnable that executes a recovery operation once
func NewOneTimeRecoveryRunnable ¶
func NewOneTimeRecoveryRunnable(name string, recoveryFunc func(context.Context) error, needsLeader bool) *OneTimeRecoveryRunnable
NewOneTimeRecoveryRunnable creates a new one-time recovery runnable
func (*OneTimeRecoveryRunnable) NeedLeaderElection ¶
func (r *OneTimeRecoveryRunnable) NeedLeaderElection() bool
NeedLeaderElection returns whether this runnable needs leader election
type PodCleanupReconciler ¶
PodCleanupReconciler reconciles Pod deletions for SharedVolume cleanup
func (*PodCleanupReconciler) Reconcile ¶
func (r *PodCleanupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile handles pod deletion cleanup
func (*PodCleanupReconciler) SetupWithManager ¶
func (r *PodCleanupReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager
type SharedVolumeReconciler ¶
type SharedVolumeReconciler struct {
}SharedVolumeReconciler reconciles a SharedVolume object
func (*SharedVolumeReconciler) Reconcile ¶
func (r *SharedVolumeReconciler) 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.
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.21.0/pkg/reconcile
func (*SharedVolumeReconciler) SetupWithManager ¶
func (r *SharedVolumeReconciler) SetupWithManager(mgr ctrl.Manager, controllerNamespace string) error
SetupWithManager sets up the controller with the Manager.
type SharedVolumeRef ¶
type SharedVolumeRef struct {}
SharedVolumeRef represents a reference to a SharedVolume (legacy, for backward compatibility)
type SyncController ¶
type SyncController struct { client.Client Scheme *runtime.Scheme // contains filtered or unexported fields }
SyncController manages sync operations for SharedVolumes
func NewSyncController ¶
func NewSyncController(client client.Client, scheme *runtime.Scheme) *SyncController
NewSyncController creates a new SyncController
func (*SyncController) RecoverSyncOperations ¶
func (s *SyncController) RecoverSyncOperations(ctx context.Context) error
RecoverSyncOperations starts sync operations for all existing ready SharedVolumes and ClusterSharedVolumes This should be called when the controller starts to resume sync operations after pod restart
func (*SyncController) StartSyncForClusterSharedVolume ¶
func (s *SyncController) StartSyncForClusterSharedVolume(ctx context.Context, csv *svv1alpha1.ClusterSharedVolume) error
StartSyncForClusterSharedVolume starts sync operations for a ClusterSharedVolume
func (*SyncController) StartSyncForSharedVolume ¶
func (s *SyncController) StartSyncForSharedVolume(ctx context.Context, sv *svv1alpha1.SharedVolume) error
StartSyncForSharedVolume starts sync operations for a SharedVolume
func (*SyncController) StopSyncForClusterSharedVolume ¶
func (s *SyncController) StopSyncForClusterSharedVolume(csv *svv1alpha1.ClusterSharedVolume)
StopSyncForClusterSharedVolume stops sync operations for a ClusterSharedVolume
func (*SyncController) StopSyncForSharedVolume ¶
func (s *SyncController) StopSyncForSharedVolume(sv *svv1alpha1.SharedVolume)
StopSyncForSharedVolume stops sync operations for a SharedVolume
type SyncRequest ¶
type SyncRequest struct { Source SyncSource `json:"source"` Target SyncTarget `json:"target"` Timeout string `json:"timeout"` }
SyncRequest represents the payload for sync API calls
type SyncSource ¶
type SyncSource struct { Type string `json:"type"` Details interface{} `json:"details"` }
type SyncSourceGit ¶
type SyncSourceHTTP ¶
type SyncSourceHTTP struct {
URL string `json:"url"`
}
type SyncSourceS3 ¶
type SyncSourceSSH ¶
type SyncTarget ¶
type SyncTarget struct {
Path string `json:"path"`
}
type VolumeControllerBase ¶
type VolumeControllerBase struct { client.Client Scheme *runtime.Scheme // ControllerNamespace is the namespace where controller resources will be created ControllerNamespace string // SyncController handles sync operations SyncController *SyncController }
VolumeControllerBase contains the shared implementation for volume controllers
func NewVolumeControllerBase ¶
func NewVolumeControllerBase(client client.Client, scheme *runtime.Scheme, controllerNamespace string, syncController *SyncController) *VolumeControllerBase
NewVolumeControllerBase creates a new VolumeControllerBase instance
func (*VolumeControllerBase) CheckAndUpdateNfsServerStatus ¶
func (r *VolumeControllerBase) CheckAndUpdateNfsServerStatus(ctx context.Context, volumeObj VolumeObject, namespace string) (ctrl.Result, error)
CheckAndUpdateNfsServerStatus checks NfsServer status and updates volume status accordingly
func (*VolumeControllerBase) CheckNfsServerStatus ¶
func (r *VolumeControllerBase) CheckNfsServerStatus(ctx context.Context, volumeObj VolumeObject, namespace string) (bool, string, string, error)
CheckNfsServerStatus checks if the NfsServer exists and is ready
func (*VolumeControllerBase) CheckResourceReadiness ¶
func (r *VolumeControllerBase) CheckResourceReadiness(ctx context.Context, volumeObj VolumeObject, namespace string, onReady func(ctx context.Context, volumeObj VolumeObject) error, onNotReady func(ctx context.Context, volumeObj VolumeObject) error) error
CheckResourceReadiness checks the readiness of all resources associated with a volume
func (*VolumeControllerBase) CleanupAllPVCs ¶
func (b *VolumeControllerBase) CleanupAllPVCs(ctx context.Context, volume VolumeObject, referenceValue string)
CleanupAllPVCs deletes all PVCs related to this volume
func (*VolumeControllerBase) CleanupAllPVCsInNamespace ¶
func (b *VolumeControllerBase) CleanupAllPVCsInNamespace(ctx context.Context, volume VolumeObject, referenceValue string, operationalNamespace string)
CleanupAllPVCsInNamespace deletes all PVCs related to this volume in the specified namespace
func (*VolumeControllerBase) CleanupAllPVs ¶
func (b *VolumeControllerBase) CleanupAllPVs(ctx context.Context, volume VolumeObject, referenceValue string)
CleanupAllPVs deletes all PVs related to this volume
func (*VolumeControllerBase) CleanupAllPVsWithWait ¶
func (b *VolumeControllerBase) CleanupAllPVsWithWait(ctx context.Context, volume VolumeObject, referenceValue string)
CleanupAllPVsWithWait deletes all PVs related to this volume and waits for them to be completely gone
func (*VolumeControllerBase) CleanupAllPodsUsingVolume ¶
func (b *VolumeControllerBase) CleanupAllPodsUsingVolume(ctx context.Context, volume VolumeObject)
CleanupAllPodsUsingVolume finds and force deletes all pods that use this volume
func (*VolumeControllerBase) CleanupAllPodsUsingVolumeInNamespace ¶
func (b *VolumeControllerBase) CleanupAllPodsUsingVolumeInNamespace(ctx context.Context, volume VolumeObject, operationalNamespace string)
CleanupAllPodsUsingVolumeInNamespace finds and force deletes all pods that use this volume in the specified namespace
func (*VolumeControllerBase) CleanupNFSServer ¶
func (b *VolumeControllerBase) CleanupNFSServer(ctx context.Context, volume VolumeObject)
CleanupNFSServer deletes the NFS server if it was generated
func (*VolumeControllerBase) CleanupNFSServerInNamespace ¶
func (b *VolumeControllerBase) CleanupNFSServerInNamespace(ctx context.Context, volume VolumeObject, operationalNamespace string)
CleanupNFSServerInNamespace deletes the NFS server if it was generated in the specified namespace
func (*VolumeControllerBase) CleanupReplicaSet ¶
func (b *VolumeControllerBase) CleanupReplicaSet(ctx context.Context, volume VolumeObject, referenceValue string)
CleanupReplicaSet deletes the ReplicaSet and any remaining pods
func (*VolumeControllerBase) CleanupReplicaSetInNamespace ¶
func (b *VolumeControllerBase) CleanupReplicaSetInNamespace(ctx context.Context, volume VolumeObject, referenceValue string, operationalNamespace string)
CleanupReplicaSetInNamespace deletes the ReplicaSet and any remaining pods in the specified namespace
func (*VolumeControllerBase) CleanupResources ¶
func (b *VolumeControllerBase) CleanupResources(ctx context.Context, volume VolumeObject) error
CleanupResources removes all resources associated with a volume
func (*VolumeControllerBase) CleanupResourcesInNamespace ¶
func (b *VolumeControllerBase) CleanupResourcesInNamespace(ctx context.Context, volume VolumeObject, operationalNamespace string) error
CleanupResourcesInNamespace removes all resources associated with a volume in the specified namespace
func (*VolumeControllerBase) CleanupService ¶
func (b *VolumeControllerBase) CleanupService(ctx context.Context, volume VolumeObject, referenceValue string)
CleanupService deletes the service
func (*VolumeControllerBase) CleanupServiceInNamespace ¶
func (b *VolumeControllerBase) CleanupServiceInNamespace(ctx context.Context, volume VolumeObject, referenceValue string, operationalNamespace string)
CleanupServiceInNamespace deletes the service in the specified namespace
func (*VolumeControllerBase) CreateAndOwnNfsServer ¶
func (r *VolumeControllerBase) CreateAndOwnNfsServer(ctx context.Context, volumeObj VolumeObject, namespace string) error
CreateAndOwnNfsServer creates an NfsServer resource and sets ownership
func (*VolumeControllerBase) CreateNoOpNotReadyCallback ¶
func (r *VolumeControllerBase) CreateNoOpNotReadyCallback() func(context.Context, VolumeObject) error
CreateNoOpNotReadyCallback creates a callback that does nothing when volume is not ready
func (*VolumeControllerBase) CreateNoOpReadyCallback ¶
func (r *VolumeControllerBase) CreateNoOpReadyCallback() func(context.Context, VolumeObject) error
CreateNoOpReadyCallback creates a callback that does nothing when volume is ready
func (*VolumeControllerBase) CreateSyncControllerSetupHook ¶
func (r *VolumeControllerBase) CreateSyncControllerSetupHook(createSyncController func(client.Client, *runtime.Scheme) *SyncController, recoveryFunc func(context.Context) error) func(ctrl.Manager, *VolumeControllerBase) error
CreateSyncControllerSetupHook creates a pre-setup hook for controllers that need sync operations
func (*VolumeControllerBase) CreateSyncNotReadyCallback ¶
func (r *VolumeControllerBase) CreateSyncNotReadyCallback() func(context.Context, VolumeObject) error
CreateSyncNotReadyCallback creates a generic callback for when volume is not ready that handles sync operations
func (*VolumeControllerBase) CreateSyncReadyCallback ¶
func (r *VolumeControllerBase) CreateSyncReadyCallback() func(context.Context, VolumeObject) error
CreateSyncReadyCallback creates a generic callback for when volume is ready that handles sync operations
func (*VolumeControllerBase) DeterminePhase ¶
func (r *VolumeControllerBase) DeterminePhase(nfsReady, replicaSetReady bool) string
DeterminePhase determines the correct phase based on NFS and ReplicaSet readiness
func (*VolumeControllerBase) EnsureAPIVersionAndKind ¶
func (r *VolumeControllerBase) EnsureAPIVersionAndKind(obj client.Object, apiVersion, kind string)
EnsureAPIVersionAndKind ensures that APIVersion and Kind are set for owner references
func (*VolumeControllerBase) EnsureControllerNamespace ¶
func (r *VolumeControllerBase) EnsureControllerNamespace(ctx context.Context) error
EnsureControllerNamespace ensures that the controller namespace exists
func (*VolumeControllerBase) FillAndValidateSpec ¶
func (r *VolumeControllerBase) FillAndValidateSpec(volumeObj VolumeObject, generateNfsServer bool, namespace string) error
FillAndValidateSpec fills defaults and validates the volume spec.
func (*VolumeControllerBase) ForceCleanupAllResources ¶
func (b *VolumeControllerBase) ForceCleanupAllResources(ctx context.Context, volume VolumeObject, referenceValue string)
ForceCleanupAllResources immediately force deletes all remaining pods without waiting
func (*VolumeControllerBase) ForceCleanupAllResourcesInNamespace ¶
func (b *VolumeControllerBase) ForceCleanupAllResourcesInNamespace(ctx context.Context, volume VolumeObject, referenceValue string, operationalNamespace string)
ForceCleanupAllResourcesInNamespace immediately force deletes all remaining pods without waiting in the specified namespace
func (*VolumeControllerBase) ForceDeletePV ¶
func (b *VolumeControllerBase) ForceDeletePV(ctx context.Context, pv *corev1.PersistentVolume) error
ForceDeletePV attempts to delete a PV and removes finalizers if deletion is stuck
func (*VolumeControllerBase) ForceDeletePVC ¶
func (b *VolumeControllerBase) ForceDeletePVC(ctx context.Context, pvc *corev1.PersistentVolumeClaim) error
ForceDeletePVC attempts to delete a PVC and removes finalizers if deletion is stuck
func (*VolumeControllerBase) ForceDeletePod ¶
ForceDeletePod attempts to delete a pod and removes all finalizers if deletion is stuck
func (*VolumeControllerBase) GenerateAndCreateNfsServer ¶
func (r *VolumeControllerBase) GenerateAndCreateNfsServer(ctx context.Context, volumeObj VolumeObject, resourcePrefix string, namespace string) (ctrl.Result, error)
GenerateAndCreateNfsServer creates an NFS server for the VolumeObject with default configuration
func (*VolumeControllerBase) GetManagedNfsServerAddress ¶
func (r *VolumeControllerBase) GetManagedNfsServerAddress(volumeObj VolumeObject, nfsServerSpec *svv1alpha1.NfsServerSpec) string
GetManagedNfsServerAddress retrieves the address from a managed NfsServer resource
func (*VolumeControllerBase) HandleFinalizerLogic ¶
func (r *VolumeControllerBase) HandleFinalizerLogic(ctx context.Context, obj client.Object, finalizerName string) (bool, error)
HandleFinalizerLogic handles the common finalizer pattern for volume objects. Returns true if reconciliation should continue, false if it should exit early.
func (*VolumeControllerBase) IsExternalNfsServer ¶
func (r *VolumeControllerBase) IsExternalNfsServer(nfsServerSpec *svv1alpha1.NfsServerSpec) bool
IsExternalNfsServer determines if the NFS server spec refers to an external server rather than a managed NfsServer resource
func (*VolumeControllerBase) IsPVCReady ¶
func (r *VolumeControllerBase) IsPVCReady(ctx context.Context, volumeObj VolumeObject, namespace string) (bool, error)
IsPVCReady checks if the PVC associated with the volume is bound
func (*VolumeControllerBase) IsReplicaSetReady ¶
func (r *VolumeControllerBase) IsReplicaSetReady(ctx context.Context, volumeObj VolumeObject, namespace string) (bool, error)
IsReplicaSetReady checks if the ReplicaSet associated with the volume is ready
func (*VolumeControllerBase) RandString ¶
func (r *VolumeControllerBase) RandString(n int) string
RandString generates a random alphanumeric string of given length.
func (*VolumeControllerBase) ReconcileGeneric ¶
func (r *VolumeControllerBase) ReconcileGeneric( ctx context.Context, req ctrl.Request, config VolumeReconcileConfig, ) (ctrl.Result, error)
ReconcileGeneric provides a complete generic reconciliation pattern for volume objects
func (*VolumeControllerBase) ReconcileNfsServer ¶
func (r *VolumeControllerBase) ReconcileNfsServer(ctx context.Context, volumeObj VolumeObject, generateNfsServer bool, namespace string) (ctrl.Result, error)
ReconcileNfsServer handles the NfsServer lifecycle management
func (*VolumeControllerBase) ReconcileNfsServerComplete ¶
func (r *VolumeControllerBase) ReconcileNfsServerComplete(ctx context.Context, volumeObj VolumeObject, namespace string, generateNfsServer bool, resourcePrefix string, onReady func(ctx context.Context, volumeObj VolumeObject) error, onNotReady func(ctx context.Context, volumeObj VolumeObject) error) (ctrl.Result, error)
ReconcileNfsServerComplete handles the complete NfsServer lifecycle management including generation, resource reconciliation, and readiness checking
func (*VolumeControllerBase) ReconcilePersistentVolume ¶
func (r *VolumeControllerBase) ReconcilePersistentVolume(ctx context.Context, volumeObj VolumeObject, namespace string) error
ReconcilePersistentVolume creates or updates the PersistentVolume
func (*VolumeControllerBase) ReconcilePersistentVolumeClaim ¶
func (r *VolumeControllerBase) ReconcilePersistentVolumeClaim(ctx context.Context, volumeObj VolumeObject, namespace string) error
ReconcilePersistentVolumeClaim creates or updates the PersistentVolumeClaim
func (*VolumeControllerBase) ReconcileReplicaSet ¶
func (r *VolumeControllerBase) ReconcileReplicaSet(ctx context.Context, volumeObj VolumeObject, namespace string) error
ReconcileReplicaSet creates or updates the ReplicaSet
func (*VolumeControllerBase) ReconcileRequiredResources ¶
func (r *VolumeControllerBase) ReconcileRequiredResources(ctx context.Context, volumeObj VolumeObject, namespace string) error
ReconcileRequiredResources creates or updates the PV, PVC, ReplicaSet, and Service resources
func (*VolumeControllerBase) ReconcileService ¶
func (r *VolumeControllerBase) ReconcileService(ctx context.Context, volumeObj VolumeObject, namespace string) error
ReconcileService creates or updates the Service
func (*VolumeControllerBase) ReconcileVolume ¶
func (r *VolumeControllerBase) ReconcileVolume(ctx context.Context, req ctrl.Request, volumeObj VolumeObject, finalizerName string, namespace string, onReady func(context.Context, VolumeObject) error, onNotReady func(context.Context, VolumeObject) error) (ctrl.Result, error)
ReconcileVolume provides a generic reconciliation pattern for volume objects
func (*VolumeControllerBase) RemoveFinalizerWithRetry ¶
func (r *VolumeControllerBase) RemoveFinalizerWithRetry(ctx context.Context, obj client.Object, finalizerName string) error
RemoveFinalizerWithRetry removes a finalizer from any client.Object with retry and conflict handling
func (*VolumeControllerBase) RemovePVCFinalizersWithRetry ¶
func (b *VolumeControllerBase) RemovePVCFinalizersWithRetry(ctx context.Context, pvc *corev1.PersistentVolumeClaim) error
RemovePVCFinalizersWithRetry removes finalizers from a PVC with retry logic to handle conflicts
func (*VolumeControllerBase) RemovePVFinalizersWithRetry ¶
func (b *VolumeControllerBase) RemovePVFinalizersWithRetry(ctx context.Context, pv *corev1.PersistentVolume) error
RemovePVFinalizersWithRetry removes finalizers from a PV with retry logic to handle conflicts
func (*VolumeControllerBase) SetupGenericController ¶
func (r *VolumeControllerBase) SetupGenericController(mgr ctrl.Manager, config ControllerSetupConfig, reconciler interface{}) error
SetupGenericController provides a fully generic controller setup pattern
func (*VolumeControllerBase) ShouldUpdateReadinessStatus ¶
func (r *VolumeControllerBase) ShouldUpdateReadinessStatus(volumeObj VolumeObject, nfsReady, replicaSetReady bool) bool
ShouldUpdateReadinessStatus determines if a status update is needed based on the current status
func (*VolumeControllerBase) UpdateReadinessStatus ¶
func (r *VolumeControllerBase) UpdateReadinessStatus(ctx context.Context, volumeObj VolumeObject, nfsReady, replicaSetReady bool, onReady func(ctx context.Context, volumeObj VolumeObject) error, onNotReady func(ctx context.Context, volumeObj VolumeObject) error) error
UpdateReadinessStatus updates the volume status based on NFS and ReplicaSet readiness
func (*VolumeControllerBase) UpdateStatusWithRetry ¶
func (r *VolumeControllerBase) UpdateStatusWithRetry(ctx context.Context, obj client.Object, updateFn func(client.Object)) error
UpdateStatusWithRetry updates the status of any client.Object with retry and conflict handling
func (*VolumeControllerBase) UpdateVolumeStatus ¶
func (r *VolumeControllerBase) UpdateVolumeStatus(volumeObj VolumeObject, nfsReady bool, phase string, message string) bool
UpdateVolumeStatus updates the status fields and returns true if any field was changed
func (*VolumeControllerBase) UpdateVolumeStatusSimple ¶
func (r *VolumeControllerBase) UpdateVolumeStatusSimple(volumeObj VolumeObject, phase string, message string) bool
UpdateVolumeStatusSimple updates basic status fields (phase and message) and returns true if any field was changed
func (*VolumeControllerBase) WaitForPodsToTerminate ¶
func (b *VolumeControllerBase) WaitForPodsToTerminate(ctx context.Context, volume VolumeObject, referenceValue string)
WaitForPodsToTerminate waits for all pods related to a volume to fully terminate before proceeding with PVC deletion to avoid stuck pod termination
type VolumeObject ¶
type VolumeObject interface { client.Object // GetVolumeSpec returns the common volume specification GetVolumeSpec() *svv1alpha1.VolumeSpecBase // GetPhase returns the current phase GetPhase() string // SetPhase sets the current phase SetPhase(phase string) // GetMessage returns the current message GetMessage() string // SetMessage sets the current message SetMessage(message string) // GetNfsServerAddress returns the NFS server address GetNfsServerAddress() string // SetNfsServerAddress sets the NFS server address SetNfsServerAddress(address string) // GetPersistentVolumeClaimName returns the PVC name GetPersistentVolumeClaimName() string // SetPersistentVolumeClaimName sets the PVC name SetPersistentVolumeClaimName(name string) // GetPersistentVolumeName returns the PV name GetPersistentVolumeName() string // SetPersistentVolumeName sets the PV name SetPersistentVolumeName(name string) // GetServiceName returns the service name GetServiceName() string // SetServiceName sets the service name SetServiceName(name string) }
VolumeObject represents a common interface for volume-like objects
type VolumeReconcileConfig ¶
type VolumeReconcileConfig struct { VolumeObjFactory func() VolumeObject APIVersion string Kind string FinalizerName string Namespace string // The namespace to use for resource creation CreateReadyCallback func() func(context.Context, VolumeObject) error CreateNotReadyCallback func() func(context.Context, VolumeObject) error }
VolumeReconcileConfig holds the configuration for generic volume reconciliation