lockrelease

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigMapNamePrefix = "fscsi-"

	// ConfigMapFinalzer is the finalizer which will be added during configmap creation.
	ConfigMapFinalzer = "filestore.csi.storage.gke.io/lock-release"
)
View Source
const (
	LeaseName = "filestore-csi-storage-gke-io-node"
)

Variables

This section is empty.

Functions

func GKENodeNameFromConfigMap added in v1.5.2

func GKENodeNameFromConfigMap(cm *corev1.ConfigMap) (string, error)

GKENodeNameFromConfigMap extracts the GKE node name from configmap. The name of a configmap which stores lock info should start with "fscsi-", and will be in format "fscsi-{GKE_node_name}".

func GenerateConfigMapKey added in v1.5.2

func GenerateConfigMapKey(projectID, location, filestoreName, shareName, gkeNodeID, gkeNodeInternalIP string) string

GenerateConfigMapKey generates a configmap key for the given filestore and GKE node info strings. The generated key will be in format {projectID}.{location}.{filestoreName}.{shareName}.{nodeID}.{nodeInternalIP} The input gkeNodeInternalIP has to a valid IPV4 address. The output nodeInternalIP will be in underscore concatenation.

func ParseConfigMapKey added in v1.5.2

func ParseConfigMapKey(key string) (string, string, string, string, string, string, error)

ParseConfigMapKey converts the a configmap key into projectID, location, filestoreName, shareName, nodeID, and nodeInternalIP. Throws an error if the input key is not in the format of {projectID}.{location}.{filestoreName}.{shareName}.{nodeID}.{nodeInternalIP}

func RegisterLockReleaseProcedure

func RegisterLockReleaseProcedure() error

Register rpc procedure for lock release. This function will be called during lock release controller initialization.

Types

type DefaultEventProcessor added in v1.5.20

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

func (*DefaultEventProcessor) SetController added in v1.5.20

func (p *DefaultEventProcessor) SetController(ctrl *LockReleaseController)

type EventProcessor added in v1.5.20

type EventProcessor interface {
	SetController(ctrl *LockReleaseController)
	// contains filtered or unexported methods
}

type FakeLockReleaseControllerBuilder added in v1.5.20

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

func NewControllerBuilder added in v1.5.20

func NewControllerBuilder() *FakeLockReleaseControllerBuilder

func (*FakeLockReleaseControllerBuilder) Build added in v1.5.20

func (*FakeLockReleaseControllerBuilder) WithClient added in v1.5.20

func (*FakeLockReleaseControllerBuilder) WithLockService added in v1.5.20

func (*FakeLockReleaseControllerBuilder) WithProcessor added in v1.5.20

type FileStoreRPCClient added in v1.5.20

type FileStoreRPCClient struct{}

func (*FileStoreRPCClient) ReleaseLock added in v1.5.20

func (c *FileStoreRPCClient) ReleaseLock(hostIP, clientIP string) error

ReleaseLock calls the Filestore server to remove all advisory locks for a given GKE node IP. hostIP is the internal IP address of the Filestore instance. clientIP is the internal IP address of the GKE node.

type LockReleaseController added in v1.4.1

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

func NewLockReleaseController added in v1.4.1

func NewLockReleaseController(
	client kubernetes.Interface,
	config *LockReleaseControllerConfig,
	nodeInformer *cache.SharedIndexInformer) (*LockReleaseController, error)

func (*LockReleaseController) CreateConfigMapWithData added in v1.5.2

func (c *LockReleaseController) CreateConfigMapWithData(ctx context.Context, cmName, cmNamespace string, data map[string]string) (*corev1.ConfigMap, error)

CreateConfigMapWithData creates a configmap in the api server. Returns the api server's representation of the configmap, and an error, if there is any.

func (*LockReleaseController) EnqueueCreateEventObject added in v1.5.20

func (c *LockReleaseController) EnqueueCreateEventObject(obj interface{})

EnqueueCreateEvent adds an object to the createEventQueue of the LockReleaseController.

func (*LockReleaseController) EnqueueUpdateEventObject added in v1.5.20

func (c *LockReleaseController) EnqueueUpdateEventObject(oldObj, newObj interface{})

EnqueueUpdateEvent adds a NodeUpdatePair to the updateEventQueue.

func (*LockReleaseController) GetClient added in v1.5.20

GetClient returns the kubernetes client of the LockReleaseController.

func (*LockReleaseController) GetConfigMap added in v1.5.2

func (c *LockReleaseController) GetConfigMap(ctx context.Context, cmName, cmNamespace string) (*corev1.ConfigMap, error)

GetConfigMap gets the configmap from the api server. Returns nil if the expected configmap is not found.

func (*LockReleaseController) GetHost added in v1.5.20

func (c *LockReleaseController) GetHost() string

GetHost returns the hostname where the lock release controller is running on.

func (*LockReleaseController) GetId added in v1.5.20

func (c *LockReleaseController) GetId() string

GetId returns the ID of the LockReleaseController.

func (*LockReleaseController) RecordKubeAPIMetrics added in v1.5.2

func (c *LockReleaseController) RecordKubeAPIMetrics(opErr error, resourceType, opType, opSource string, opDuration time.Duration)

func (*LockReleaseController) RecordLockReleaseMetrics added in v1.5.2

func (c *LockReleaseController) RecordLockReleaseMetrics(opErr error)

func (*LockReleaseController) RemoveKeyFromConfigMap added in v1.5.2

func (c *LockReleaseController) RemoveKeyFromConfigMap(ctx context.Context, cm *corev1.ConfigMap, key string) error

RemoveKeyFromConfigMap deletes the key from configmap.data, then updates the configmap. No-op if the key does not exist. RemoveKeyFromConfigMap is only called in NodeUnstageVolume.

func (*LockReleaseController) RemoveKeyFromConfigMapWithRetry added in v1.5.2

func (c *LockReleaseController) RemoveKeyFromConfigMapWithRetry(ctx context.Context, cm *corev1.ConfigMap, key string) error

RemoveKeyFromConfigMapWithRetry gets the latest configmap from the api server, removes the key from configmap.data, and update the configmap. Keeps retrying until configmap successfully update or timeout. No-op if the key does not exist. RemoveKeyFromConfigMapWithRetry is only called in lock release reconciler.

func (*LockReleaseController) Run added in v1.4.1

TODO(b/377771989): Deperacte Run once lock release controller V2 is rolled out.

func (*LockReleaseController) RunEventWorkers added in v1.8.0

func (c *LockReleaseController) RunEventWorkers(ctx context.Context) error

func (*LockReleaseController) UpdateConfigMapWithKeyValue added in v1.5.2

func (c *LockReleaseController) UpdateConfigMapWithKeyValue(ctx context.Context, cm *corev1.ConfigMap, key, value string) error

UpdateConfigMapWithKeyValue adds a key value pair into configmap.data, and updates the configmap in the api server. No-op if the key already exists in configmap.data. Returns the server's representation of the configMap, and an error, if there is any. UpdateConfigMapWithKeyValue is only called in NodeStageVolume.

type LockReleaseControllerConfig added in v1.4.1

type LockReleaseControllerConfig struct {
	// Parameters of leaderelection.LeaderElectionConfig.
	LeaseDuration, RenewDeadline, RetryPeriod time.Duration
	// Parameters of workQueue rate limiters.
	WorkQueueRateLimiterBaseDelay, WorkQueueRateLimiterMaxDelay time.Duration
	// Reconcile loop frequency.
	SyncPeriod time.Duration
	// HTTP endpoint and path to emit NFS lock release metrics.
	MetricEndpoint, MetricPath string
}

type LockService added in v1.5.20

type LockService interface {
	ReleaseLock(hostIP, clientIP string) error
}

type NodeUpdatePair added in v1.5.20

type NodeUpdatePair struct {
	OldObj *corev1.Node
	NewObj *corev1.Node
}

Jump to

Keyboard shortcuts

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