k8s

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProtocolNfs Protocol NFS in lower case
	ProtocolNfs = "nfs"
	// CsiDriverNamePowerScale CSI PowerScale Name
	CsiDriverNamePowerScale = "isilon"
	// CsiDriverNamePowerMax CSI PowerMax Name
	CsiDriverNamePowerMax = "powermax"
)

Variables

View Source
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

View Source
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

View Source
var NewConfigFn = func(config *rest.Config) (*kubernetes.Clientset, error) {
	return kubernetes.NewForConfig(config)
}

NewConfigFn will return a valid kubernetes.Clientset

Functions

func Contains

func Contains(slice []string, value string) bool

Contains will return true if the slice contains the given value

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 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

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"`
	StorageSystemVolumeName string `json:"storage_system_volume_name"`
	StoragePoolName         string `json:"storage_pool_name"`
	StorageSystem           string `json:"storage_system"`
	Protocol                string `json:"protocol"`
	CreatedTime             string `json:"created_time"`
}

VolumeInfo contains information about mapping a Persistent Volume to the volume created on a storage system

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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