Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ConnectFn = func(api *API) error { config, err := getConfig() if err != nil { return err } api.Client, err = NewConfigFn(config) if err != nil { return err } return nil }
ConnectFn will connect the client to the k8s API
var InClusterConfigFn = func() (*rest.Config, error) { return rest.InClusterConfig() }
InClusterConfigFn will return a valid configuration if we are running in a Pod on a kubernetes cluster
var NewConfigFn = func(config *rest.Config) (*kubernetes.Clientset, error) { return kubernetes.NewForConfig(config) }
NewConfigFn will return a valid kubernetes.Clientset
var NewForConfigFn = func(k8sconfig *rest.Config) (*kubernetes.Clientset, error) { return kubernetes.NewForConfig(k8sconfig) }
NewForConfigFn creates a new Clientset for the given config. If config's RateLimiter is not set and QPS and Burst are acceptable, NewForConfigFn will generate a rate-limiter in configShallowCopy
var NewLeaderElectorFn = func(lec leaderelection.LeaderElectionConfig) (*leaderelection.LeaderElector, error) { return leaderelection.NewLeaderElector(lec) }
NewLeaderElectorFn creates a LeaderElector from a LeaderElectionConfig
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Client kubernetes.Interface Lock sync.Mutex }
API holds data used to access the K8S API
func (*API) GetPersistentVolumes ¶
func (api *API) GetPersistentVolumes() (*corev1.PersistentVolumeList, error)
GetPersistentVolumes will return a list of persistent volumes in the kubernetes cluster
type LeaderElector ¶
type LeaderElector struct { API LeaderElectorGetter Elector *leaderelection.LeaderElector }
LeaderElector holds LeaderElector struct for the client
func (*LeaderElector) InitLeaderElection ¶
func (elect *LeaderElector) InitLeaderElection(endpoint string, namespace string) error
InitLeaderElection will run algorithm for leader election, call during service initialzation process
func (*LeaderElector) IsLeader ¶
func (elect *LeaderElector) IsLeader() bool
IsLeader return true if the given client is leader at the moment
type LeaderElectorGetter ¶
LeaderElectorGetter is an interface for initialize and check elected leader
type VolumeFinder ¶
type VolumeFinder struct { API VolumeGetter DriverNames []string Logger *logrus.Logger }
VolumeFinder is a volume finder that will query the Kubernetes API for Persistent Volumes created by a matching DriverName and StorageSystemID
func (VolumeFinder) GetPersistentVolumes ¶
func (f VolumeFinder) GetPersistentVolumes(ctx context.Context) ([]VolumeInfo, error)
GetPersistentVolumes will return a list of persistent volume information
type VolumeGetter ¶
type VolumeGetter interface {
GetPersistentVolumes() (*corev1.PersistentVolumeList, error)
}
VolumeGetter is an interface for getting a list of persistent volume information
type VolumeInfo ¶
type VolumeInfo struct { Namespace string `json:"namespace"` PersistentVolumeClaim string `json:"persistent_volume_claim"` PersistentVolumeStatus string `json:"volume_status"` VolumeClaimName string `json:"volume_claim_name"` PersistentVolume string `json:"persistent_volume"` StorageClass string `json:"storage_class"` Driver string `json:"driver"` ProvisionedSize string `json:"provisioned_size"` CreatedTime string `json:"created_time"` VolumeHandle string `json:"volume_handle"` }
VolumeInfo contains information about mapping a Persistent Volume to the volume created on a storage system