package
0.0.0-20240919061528-c2b0d1774947
Repository: https://github.com/nvidia/k8s-operator-libs.git
Documentation: pkg.go.dev

# Packages

Copyright 2022 NVIDIA CORPORATION & AFFILIATES Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

# Functions

GetEventReason returns the reason type based on the driver name.
GetUpgradeDriverWaitForSafeLoadAnnotationKey returns the key for annotation used to mark node as waiting for driver safe load.
GetUpgradeInitialStateAnnotationKey returns the key for annotation used to track initial state of the node.
GetUpgradeRequestedAnnotationKey returns the key for annotation used to mark node as driver upgrade is requested externally (orphaned pod).
GetUpgradeSkipNodeLabelKey returns node label used to skip upgrades.
GetUpgradeStateLabelKey returns state label key used for upgrades.
GetValidationStartTimeAnnotationKey returns the key for annotation indicating start time for validation-required state.
GetWaitForPodCompletionStartTimeAnnotationKey returns the key for annotation used to track start time for waiting on pod/job completions.
NewClusterUpgradeState creates an empty ClusterUpgradeState object.
NewClusterUpgradeStateManager creates a new instance of ClusterUpgradeStateManagerImpl.
NewCordonManager returns a CordonManagerImpl.
NewDrainManager creates a DrainManager.
NewNodeUpgradeStateProvider creates a NodeUpgradeStateProviderImpl.
NewPodManager returns an instance of PodManager implementation.
NewSafeDriverLoadManager returns an instance of SafeDriverLoadManager implementation.
NewStringSet creates a StringSet.
NewValidationManager returns an instance of ValidationManager implementation.
SetDriverName sets the name of the driver managed by the upgrade package.

# Constants

PodControllerRevisionHashLabelKey is the label key containing the controller-revision-hash.
UpgradeInitialStateAnnotationKeyFmt is the format of the node annotation indicating node was unschedulable at beginning of upgrade process.
UpgradeRequestedAnnotationKeyFmt is the format of the node label key indicating driver upgrade was requested (used for orphaned pods) Setting this label will trigger setting upgrade state to upgrade-required.
UpgradeSkipNodeLabelKeyFmt is the format of the node label boolean key indicating to skip driver upgrade.
UpgradeStateCordonRequired is set when the node needs to be made unschedulable in preparation for driver upgrade.
UpgradeStateDone is set when driver pod is up to date and running on the node, the node is schedulable.
UpgradeStateDrainRequired is set when the node is required to be scheduled for drain.
UpgradeStateFailed is set when there are any failures during the driver upgrade.
UpgradeStateLabelKeyFmt is the format of the node label key indicating driver upgrade states.
UpgradeStatePodDeletionRequired is set when deletion of pods is required for the driver upgrade to proceed.
UpgradeStatePodRestartRequired is set when the driver pod on the node is scheduled for restart or when unblock of the driver loading is required (safe driver load).
UpgradeStateUncordonRequired is set when driver pod on the node is up-to-date and has "Ready" status.
UpgradeStateUnknown Node has this state when the upgrade flow is disabled or the node hasn't been processed yet.
UpgradeStateUpgradeRequired is set when the driver pod on the node is not up-to-date and required upgrade No actions are performed at this stage.
UpgradeStateValidationRequired is set when validation of the new driver deployed on the node is required before moving to UpgradeStateUncordonRequired.
UpgradeStateWaitForJobsRequired is set on the node when we need to wait on jobs to complete until given timeout.
UpgradeValidationStartTimeAnnotationKeyFmt is the format of the node annotation indicating start time for validation-required state.
UpgradeWaitForPodCompletionStartTimeAnnotationKeyFmt is the format of the node annotation indicating start time for waiting on pod completionsnolint: lll.
UpgradeWaitForSafeDriverLoadAnnotationKeyFmt is the format of the node annotation key indicating that the driver is waiting for safe load.

# Variables

DriverName is the name of the driver to be managed by this package.

# Structs

ClusterUpgradeState contains a snapshot of the driver upgrade state in the cluster It contains driver upgrade policy and mappings between nodes and their upgrade state Nodes are grouped together with the driver POD running on them and the daemon set, controlling this pod This state is then used as an input for the ClusterUpgradeStateManager.
ClusterUpgradeStateManagerImpl serves as a state machine for the ClusterUpgradeState It processes each node and based on its state schedules the required jobs to change their state to the next one.
CordonManagerImpl implements CordonManager interface and can cordon / uncordon k8s nodes.
DrainConfiguration contains the drain specification and the list of nodes to schedule drain on.
DrainManagerImpl implements DrainManager interface and can perform nodes drain based on received DrainConfiguration.
KeyedMutex is a struct that provides a per-key synchronized access.
NodeUpgradeState contains a mapping between a node, the driver POD running on them and the daemon set, controlling this pod.
NodeUpgradeStateProviderImpl implements the NodeUpgradeStateProvider interface.
PodManagerConfig represent the selector for pods and Node names to be considered for managing those pods.
PodManagerImpl implements PodManager interface and checks for pod states.
SafeDriverLoadManagerImpl default implementation of the SafeDriverLoadManager interface Support for safe driver loading is implemented as a part of the upgrade flow.
StringSet implements a thread safe Set of Strings.
ValidationManagerImpl implements the ValidationManager interface and waits on a validation pod, identified via podSelector, to be Ready.

# Interfaces

ClusterUpgradeStateManager is an interface for performing cluster upgrades of driver containers nolint:interfacebloat.
CordonManager provides methods for cordoning / uncordoning nodes.
DrainManager is an interface that allows to schedule nodes drain based on DrainSpec.
NodeUpgradeStateProvider allows for synchronized operations on node objects and ensures that the node, got from the provider, always has the up-to-date upgrade state.
PodManager is an interface that allows to wait on certain pod statuses.
SafeDriverLoadManager interface defines handlers to interact with drivers that are waiting for a safe load.
ValidationManager is an interface for validating driver upgrades.

# Type aliases

PodDeletionFilter takes a pod and returns a boolean indicating whether the pod should be deleted.
UnlockFunc is a function that release a lock.