storageclass

package
v1.2.16 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 7 Imported by: 0

README

PVC StorageClass Annotation Mutator

The PVC StorageClass Annotation Mutator tries to detect the StorageClass of the PVC being created and sets the StorageClass' UID in the storageos.com/storageclass annotation on the PVC.

This allows StorageOS to detect whether the StorageClass parameters used to create the volume may have been changed later. Since StorageClasses are immutable, deleting and recreating the StorageClass is the only way to change parameters.

The PVC Label Sync Controller compares the UID set in the annotation with the UID of the current StorageClass, and only syncs labels if they match.

Trigger

Only PVCs that will be provisioned by StorageOS are candidates for mutation.

Failure Policy

Failure to set the StorageClass annotation should not cause the PVC creation to fail.

Tunables

There are currently no tunable flags for the PVC StorageClass Annotation Mutator.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnotationSetter

type AnnotationSetter struct {
	client.Client
	// contains filtered or unexported fields
}

AnnotationSetter is responsible to add an annotation to link the StorageClass with the PVC.

func NewAnnotationSetter

func NewAnnotationSetter(k8s client.Client) *AnnotationSetter

NewAnnotationSetter returns a new PVC annotation mutating admission controller.

func (*AnnotationSetter) MutatePVC

func (s *AnnotationSetter) MutatePVC(ctx context.Context, pvc *corev1.PersistentVolumeClaim, namespace string) error

MutatePVC mutates a given pvc with a new annotation, by attached StorageClass.

Errors returned here may block creation of the PVC, depending on the FailurePolicy set in the webhook configuration.

Jump to

Keyboard shortcuts

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