claim

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package claim implements the persistent volume claim lister. It is responsible for listing all persistent volume claims in the cluster that are refering to MapR-backed persistent volumes.

The lister is implemented as a chain of filters and collectors. The filters are used to filter out volume claims, ie. to only keep those that are bound and backed by a MapR CSI provisioner. The collectors are used to collect additional information about the volume claims, ie. to collect the PV for each PVC and the MapR ticket for each PV. This data is then used to print the volume claims in a human-readable tabular format.

Index

Constants

This section is empty.

Variables

View Source
var (
	// SortOptionsList is the list of valid sort options
	SortOptionsList = []string{
		SortByNamespace.String(),
		SortByName.String(),
		SortBySecretNamespace.String(),
		SortBySecretName.String(),
		SortByVolumeName.String(),
		SortByVolumePath.String(),
		SortByVolumeHandle.String(),
		SortByExpiration.String(),
		SortByAge.String(),
	}

	// DefaultSortBy is the default sort order
	DefaultSortBy = []SortOption{
		SortByNamespace,
		SortByName,
	}
)

Functions

func Print

func Print(cmd *cobra.Command, volumeClaims []types.MaprVolumeClaim) error

Print prints the volume claims to the given output stream in a tabular format known by kubectl.

Types

type Lister

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

Lister is the struct that is used to list volume claims refering to MapR-backed persistent volumes in the cluster.

func NewLister

func NewLister(client kubernetes.Interface, namespace string, opts ...ListerOption) *Lister

NewLister creates a new volume claim lister. It requires a Kubernetes client and a namespace to operate on. It also accepts a list of options that can be used to configure the lister.

func (*Lister) List

func (l *Lister) List() ([]types.MaprVolumeClaim, error)

List returns a list of volume claims that are provisioned by one of the MapR CSI provisioners.

type ListerOption

type ListerOption func(*Lister)

ListerOption is a function that can be used to configure the volume claim lister.

func WithSecretLister

func WithSecretLister(secretLister secretLister) ListerOption

WithSecretLister configures the volume claim lister to use the given secret lister.

func WithSortBy

func WithSortBy(sortBy []SortOption) ListerOption

WithSortBy configures the volume claim lister to sort the volume claims by the given sort options.

type SortOption

type SortOption string

SortOption is the type of a sort option, basically a wrapper around a string to provide type safety.

const (
	SortByNamespace       SortOption = "namespace"
	SortByName            SortOption = "name"
	SortBySecretNamespace SortOption = "secret.namespace"
	SortBySecretName      SortOption = "secret.name"
	SortByVolumeName      SortOption = "volume.name"
	SortByVolumePath      SortOption = "volume.path"
	SortByVolumeHandle    SortOption = "volume.handle"
	SortByExpiration      SortOption = "expiration"
	SortByAge             SortOption = "age"
)

All valid sort options are defined here

func (SortOption) String

func (s SortOption) String() string

String returns the string representation of the sort option.

Jump to

Keyboard shortcuts

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