Documentation ¶
Overview ¶
Package secret implements the secret lister. It is responsible for retrieving the list of secrets containing MapR tickets and enriching them with additional information.
The lister is implemented as a chain of filters and collectors. The filters are used to filter out secrets, ie. to only keep those that contain a MapR ticket. The collectors are used to collect additional information about the secrets, ie. to collect the number of persistent volumes using each secret. This data is then used to print the secrets in a human-readable tabular format.
Index ¶
- Variables
- func Print(cmd *cobra.Command, secrets []types.MaprSecret) error
- type Lister
- type ListerOption
- func WithFilterByGID(gid uint32) ListerOption
- func WithFilterByInUse() ListerOption
- func WithFilterByMaprCluster(cluster string) ListerOption
- func WithFilterByMaprUser(user string) ListerOption
- func WithFilterByUID(uid uint32) ListerOption
- func WithFilterExpiresBefore(expiresBefore time.Duration) ListerOption
- func WithFilterOnlyExpired() ListerOption
- func WithFilterOnlyUnexpired() ListerOption
- func WithShowInUse() ListerOption
- func WithSortBy(sortBy []SortOption) ListerOption
- func WithVolumeLister(volumeLister volumeLister) ListerOption
- type SortOption
Constants ¶
This section is empty.
Variables ¶
var ( // SortOptionsList is the list of valid sort options SortOptionsList = []string{ SortByName.String(), SortByNamespace.String(), SortByMaprCluster.String(), SortByMaprUser.String(), SortByAge.String(), SortByExpiration.String(), SortByNumPVCs.String(), } // DefaultSortBy is the default sort order DefaultSortBy = []SortOption{ SortByNamespace, SortByName, } )
Functions ¶
Types ¶
type Lister ¶
type Lister struct {
// contains filtered or unexported fields
}
Lister is the struct that is used to list secrets containing MapR tickets in the cluster.
func NewLister ¶
func NewLister(client kubernetes.Interface, namespace string, opts ...ListerOption) *Lister
NewLister creates a new secret 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.
type ListerOption ¶
type ListerOption func(*Lister)
ListerOption is a function that can be used to configure the secret lister.
func WithFilterByGID ¶
func WithFilterByGID(gid uint32) ListerOption
WithFilterByGID configures the secret lister to only list tickets that include a group with the given GID.
func WithFilterByInUse ¶
func WithFilterByInUse() ListerOption
WithFilterByInUse configures the secret lister to only list tickets that are in use by a persistent volume.
func WithFilterByMaprCluster ¶
func WithFilterByMaprCluster(cluster string) ListerOption
WithFilterByMaprCluster configures the secret lister to only list tickets that are backed by a MapR cluster with the given name.
func WithFilterByMaprUser ¶
func WithFilterByMaprUser(user string) ListerOption
WithFilterByMaprUser configures the secret lister to only list tickets that are for a MapR user with the given name.
func WithFilterByUID ¶
func WithFilterByUID(uid uint32) ListerOption
WithFilterByUID configures the secret lister to only list tickets that are for a user with the given UID.
func WithFilterExpiresBefore ¶
func WithFilterExpiresBefore(expiresBefore time.Duration) ListerOption
WithFilterExpiresAfter configures the secret lister to only list tickets that expire during the given duration or have already expired.
func WithFilterOnlyExpired ¶
func WithFilterOnlyExpired() ListerOption
WithFilterOnlyExpired configures the secret lister to only list tickets that have expired.
func WithFilterOnlyUnexpired ¶
func WithFilterOnlyUnexpired() ListerOption
WithFilterOnlyUnexpired configures the secret lister to only list tickets that have not expired.
func WithShowInUse ¶
func WithShowInUse() ListerOption
WithShowInUse configures the secret lister to show by how many persistent volumes a ticket is in use.
func WithSortBy ¶
func WithSortBy(sortBy []SortOption) ListerOption
WithSortBy configures the secret lister to sort the tickets by the given sort options.
func WithVolumeLister ¶
func WithVolumeLister(volumeLister volumeLister) ListerOption
WithShowVolumes configures the secret lister to make use of the given volume lister to collect information about the persistent volumes that are using tickets.
type SortOption ¶
type SortOption string
SortOption is the type of a sort option, basically a wrapper around a string to provide type safety.
const ( SortByName SortOption = "name" SortByNamespace SortOption = "namespace" SortByMaprCluster SortOption = "mapr.cluster" SortByMaprUser SortOption = "mapr.user" SortByAge SortOption = "age" SortByExpiration SortOption = "expiration" SortByNumPVCs SortOption = "npvcs" )
All valid sort options are defined here
func (SortOption) String ¶
func (s SortOption) String() string
String returns the string representation of the sort option.