Documentation ¶
Index ¶
- Constants
- type Builder
- func (b *Builder) Build() (*corev1.PersistentVolume, error)
- func (b *Builder) WithAccessModes(accessMode []corev1.PersistentVolumeAccessMode) *Builder
- func (b *Builder) WithAnnotations(annotations map[string]string) *Builder
- func (b *Builder) WithCapacity(capacity string) *Builder
- func (b *Builder) WithCapacityQty(resCapacity resource.Quantity) *Builder
- func (b *Builder) WithLabels(labels map[string]string) *Builder
- func (b *Builder) WithLocalHostDirectory(path string) *Builder
- func (b *Builder) WithLocalHostPathFormat(path, fstype string) *Builder
- func (b *Builder) WithName(name string) *Builder
- func (b *Builder) WithNodeAffinity(nodeName string) *Builder
- func (b *Builder) WithReclaimPolicy(reclaimPolicy corev1.PersistentVolumeReclaimPolicy) *Builder
- func (b *Builder) WithVolumeMode(volumeMode corev1.PersistentVolumeMode) *Builder
- type Kubeclient
- func (k *Kubeclient) Create(pv *corev1.PersistentVolume) (*corev1.PersistentVolume, error)
- func (k *Kubeclient) Delete(name string, deleteOpts *metav1.DeleteOptions) error
- func (k *Kubeclient) DeleteCollection(listOpts metav1.ListOptions, deleteOpts *metav1.DeleteOptions) error
- func (k *Kubeclient) Get(name string, opts metav1.GetOptions) (*corev1.PersistentVolume, error)
- func (k *Kubeclient) List(opts metav1.ListOptions) (*corev1.PersistentVolumeList, error)
- type KubeclientBuildOption
- type ListBuilder
- type PV
- type PVList
- type Predicate
- type PredicateList
Constants ¶
const ( //KeyNode represents the key values used for specifying the Node Affinity // based on the hostname KeyNode = "kubernetes.io/hostname" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is the builder object for PV
func (*Builder) Build ¶
func (b *Builder) Build() (*corev1.PersistentVolume, error)
Build returns the PV API instance
func (*Builder) WithAccessModes ¶
func (b *Builder) WithAccessModes(accessMode []corev1.PersistentVolumeAccessMode) *Builder
WithAccessModes sets the AccessMode field in PV with provided arguments
func (*Builder) WithAnnotations ¶
WithAnnotations sets the Annotations field of PV with provided arguments
func (*Builder) WithCapacity ¶
WithCapacity sets the Capacity field in PV by converting string capacity into Quantity
func (*Builder) WithCapacityQty ¶
WithCapacityQty sets the Capacity field in PV with provided arguments
func (*Builder) WithLabels ¶
WithLabels sets the Labels field of PV with provided arguments
func (*Builder) WithLocalHostDirectory ¶
WithLocalHostDirectory sets the LocalVolumeSource field of PV with provided hostpath
func (*Builder) WithLocalHostPathFormat ¶
WithLocalHostPathFormat sets the LocalVolumeSource field of PV with provided hostpath and request to format it with fstype - if not already formatted. A "" value for fstype indicates that the Local PV can determine the type of FS.
func (*Builder) WithNodeAffinity ¶
WithNodeAffinity sets the NodeAffinity field of PV with provided node name
func (*Builder) WithReclaimPolicy ¶
func (b *Builder) WithReclaimPolicy(reclaimPolicy corev1.PersistentVolumeReclaimPolicy) *Builder
WithReclaimPolicy sets the PV ReclaimPolicy field with provided argument
func (*Builder) WithVolumeMode ¶
func (b *Builder) WithVolumeMode(volumeMode corev1.PersistentVolumeMode) *Builder
WithVolumeMode sets the VolumeMode field in PV with provided arguments
type Kubeclient ¶
type Kubeclient struct {
// contains filtered or unexported fields
}
Kubeclient enables kubernetes API operations on pv instance
func NewKubeClient ¶
func NewKubeClient(opts ...KubeclientBuildOption) *Kubeclient
NewKubeClient returns a new instance of kubeclient meant for cstor volume replica operations
func (*Kubeclient) Create ¶
func (k *Kubeclient) Create(pv *corev1.PersistentVolume) (*corev1.PersistentVolume, error)
Create creates a pv in kubernetes cluster
func (*Kubeclient) Delete ¶
func (k *Kubeclient) Delete(name string, deleteOpts *metav1.DeleteOptions) error
Delete deletes a pv instance from the kubecrnetes cluster
func (*Kubeclient) DeleteCollection ¶
func (k *Kubeclient) DeleteCollection(listOpts metav1.ListOptions, deleteOpts *metav1.DeleteOptions) error
DeleteCollection deletes a collection of pv objects.
func (*Kubeclient) Get ¶
func (k *Kubeclient) Get(name string, opts metav1.GetOptions) (*corev1.PersistentVolume, error)
Get returns a pv resource instances present in kubernetes cluster
func (*Kubeclient) List ¶
func (k *Kubeclient) List(opts metav1.ListOptions) (*corev1.PersistentVolumeList, error)
List returns a list of pv instances present in kubernetes cluster
type KubeclientBuildOption ¶
type KubeclientBuildOption func(*Kubeclient)
KubeclientBuildOption abstracts creating an instance of kubeclient
func WithClientSet ¶
func WithClientSet(c *kubernetes.Clientset) KubeclientBuildOption
WithClientSet sets the kubernetes client against the kubeclient instance
func WithKubeConfigPath ¶
func WithKubeConfigPath(path string) KubeclientBuildOption
WithKubeConfigPath sets the kubeConfig path against client instance
type ListBuilder ¶
type ListBuilder struct {
// contains filtered or unexported fields
}
ListBuilder enables building an instance of PVlist
func ListBuilderForAPIObjects ¶
func ListBuilderForAPIObjects(pvs *corev1.PersistentVolumeList) *ListBuilder
ListBuilderForAPIObjects builds the ListBuilder object based on PV api list
func ListBuilderForObjects ¶
func ListBuilderForObjects(pvs *PVList) *ListBuilder
ListBuilderForObjects builds the ListBuilder object based on PVList
func NewListBuilder ¶
func NewListBuilder() *ListBuilder
NewListBuilder returns an instance of ListBuilder
func (*ListBuilder) APIList ¶
func (b *ListBuilder) APIList() (*corev1.PersistentVolumeList, error)
APIList builds core API PV list using listbuilder
func (*ListBuilder) Len ¶
func (b *ListBuilder) Len() (int, error)
Len returns the number of items present in the PVCList of a builder
func (*ListBuilder) List ¶
func (b *ListBuilder) List() (*PVList, error)
List returns the list of pv instances that was built by this builder
func (*ListBuilder) WithFilter ¶
func (b *ListBuilder) WithFilter(pred ...Predicate) *ListBuilder
WithFilter adds filters on which the pv's has to be filtered
type PV ¶
type PV struct {
// contains filtered or unexported fields
}
PV is a wrapper over persistentvolume api object. It provides build, validations and other common logic to be used by various feature specific callers.
func NewForAPIObject ¶
func NewForAPIObject(obj *corev1.PersistentVolume, opts ...pvBuildOption) *PV
NewForAPIObject returns a new instance of PV
func (*PV) GetAffinitedNodeHostname ¶
GetAffinitedNodeHostname returns hostname configured using the NodeAffinity This method expects only a single hostname to be set.
The PV object will have the node's hostname specified as follows:
nodeAffinity: required: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/hostname operator: In values: - hostname
type PVList ¶
type PVList struct {
// contains filtered or unexported fields
}
PVList is a wrapper over persistentvolume api object. It provides build, validations and other common logic to be used by various feature specific callers.
func (*PVList) ToAPIList ¶
func (p *PVList) ToAPIList() *corev1.PersistentVolumeList
ToAPIList converts PVList to API PVList
type Predicate ¶
Predicate defines an abstraction to determine conditional checks against the provided pvc instance
func ContainsName ¶
ContainsName is filter function to filter pv's based on the name