csistorageclasscontroller

package
v0.0.0-...-e59cd12 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 17 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCSIStorageClassController

func NewCSIStorageClassController(
	name string,
	assetFunc resourceapply.AssetFunc,
	files []string,
	kubeClient kubernetes.Interface,
	informerFactory informers.SharedInformerFactory,
	operatorClient v1helpers.OperatorClient,
	operatorInformer opinformers.SharedInformerFactory,
	eventRecorder events.Recorder,
	optionalStorageClassHooks ...StorageClassHookFunc) factory.Controller

func SetDefaultStorageClass

func SetDefaultStorageClass(storageClassLister v1.StorageClassLister, storageClass *storagev1.StorageClass) error

Types

type CSIStorageClassController

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

This Controller deploys a StorageClass provided by CSI driver operator and decides if this StorageClass should be applied as default - if requested. If operator wants to request it's StorageClass to be created as default, the asset file provided to this controller must have defaultScAnnotationKey set to "true". Based on the current StorageClasses in the cluster the controller can decide not to deploy given StorageClass as default if there already is any existing default. When the controller detects there already is a StorageClass with a same name it just copies the default StorageClass annotation from the existing one to prevent overwriting value that user might have manually changed. If the asset file does not have defaultScAnnotationKey set at all, controller just skips any checks and modifications and applies the StorageClass as it is. It produces following Conditions: StorageClassControllerDegraded - failed to apply StorageClass provided

func (*CSIStorageClassController) Sync

type StorageClassHookFunc

type StorageClassHookFunc func(*operatorapi.OperatorSpec, *storagev1.StorageClass) error

StorageClassHookFunc is a hook function to modify a StorageClass.

type StorageClassStateEvaluator

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

StorageClassStateEvaluator evaluates the StorageClassState in the corresponding ClusterCSIDriver and reconciles the StorageClass according to that policy.

func NewStorageClassStateEvaluator

func NewStorageClassStateEvaluator(
	kubeClient kubernetes.Interface,
	clusterCSIDriverLister oplisters.ClusterCSIDriverLister,
	eventRecorder events.Recorder) *StorageClassStateEvaluator

func (*StorageClassStateEvaluator) ApplyStorageClass

func (e *StorageClassStateEvaluator) ApplyStorageClass(ctx context.Context, expectedSC *storagev1.StorageClass, scState operatorapi.StorageClassStateName) (err error)

ApplyStorageClass applies the provided SC according to the StorageClassState. If Managed, apply the SC. If Unmanaged, do nothing. If Removed, delete the SC.

func (*StorageClassStateEvaluator) EvalAndApplyStorageClass

func (e *StorageClassStateEvaluator) EvalAndApplyStorageClass(ctx context.Context, expectedSC *storagev1.StorageClass) error

func (*StorageClassStateEvaluator) GetStorageClassState

func (e *StorageClassStateEvaluator) GetStorageClassState(ccdName string) operatorapi.StorageClassStateName

GetStorageClassState accepts the name of a ClusterCSIDriver and returns the StorageClassState associated with that object. If the ClusterCSIDriver is not found, this function returns the default state (Managed).

func (*StorageClassStateEvaluator) IsManaged

Jump to

Keyboard shortcuts

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