Documentation ¶
Index ¶
- Constants
- func GKENodeNameFromConfigMap(cm *corev1.ConfigMap) (string, error)
- func GenerateConfigMapKey(...) string
- func ParseConfigMapKey(key string) (string, string, string, string, string, string, error)
- func RegisterLockReleaseProcedure() error
- func ReleaseLock(hostIP, clientIP string) error
- type LockReleaseController
- func (c *LockReleaseController) CreateConfigMapWithData(ctx context.Context, cmName, cmNamespace string, data map[string]string) (*corev1.ConfigMap, error)
- func (c *LockReleaseController) GetConfigMap(ctx context.Context, cmName, cmNamespace string) (*corev1.ConfigMap, error)
- func (c *LockReleaseController) RecordKubeAPIMetrics(opErr error, resourceType, opType, opSource string, opDuration time.Duration)
- func (c *LockReleaseController) RecordLockReleaseMetrics(opErr error)
- func (c *LockReleaseController) RemoveKeyFromConfigMap(ctx context.Context, cm *corev1.ConfigMap, key string) error
- func (c *LockReleaseController) RemoveKeyFromConfigMapWithRetry(ctx context.Context, cm *corev1.ConfigMap, key string) error
- func (c *LockReleaseController) Run(ctx context.Context)
- func (c *LockReleaseController) UpdateConfigMapWithKeyValue(ctx context.Context, cm *corev1.ConfigMap, key, value string) error
- type LockReleaseControllerConfig
Constants ¶
const ( ConfigMapNamePrefix = "fscsi-" // ConfigMapFinalzer is the finalizer which will be added during configmap creation. ConfigMapFinalzer = "filestore.csi.storage.gke.io/lock-release" )
Variables ¶
This section is empty.
Functions ¶
func GKENodeNameFromConfigMap ¶ added in v1.5.2
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
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.
func ReleaseLock ¶
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.
Types ¶
type LockReleaseController ¶ added in v1.4.1
type LockReleaseController struct {
// contains filtered or unexported fields
}
func NewFakeLockReleaseController ¶ added in v1.5.2
func NewFakeLockReleaseController() *LockReleaseController
func NewFakeLockReleaseControllerWithClient ¶ added in v1.5.2
func NewFakeLockReleaseControllerWithClient(client kubernetes.Interface) *LockReleaseController
func NewLockReleaseController ¶ added in v1.4.1
func NewLockReleaseController(client kubernetes.Interface, config *LockReleaseControllerConfig) (*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) 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) 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
func (c *LockReleaseController) Run(ctx context.Context)
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
// Reconcile loop frequency.
SyncPeriod time.Duration
// HTTP endpoint and path to emit NFS lock release metrics.
MetricEndpoint, MetricPath string
}