Documentation ¶
Index ¶
- Constants
- Variables
- func GetResizeCondition() apis.CStorVolumeCondition
- func IsScaleDownInProgress(cvObj *apis.CStorVolume) bool
- type Builder
- func (b *Builder) Build() (*apis.CStorVolume, error)
- func (b *Builder) WithAnnotations(annotations map[string]string) *Builder
- func (b *Builder) WithAnnotationsNew(annotations map[string]string) *Builder
- func (b *Builder) WithCStorIQN(name string) *Builder
- func (b *Builder) WithCapacity(capacity string) *Builder
- func (b *Builder) WithConsistencyFactor(consistencyfactor int) *Builder
- func (b *Builder) WithDependentsUpgraded() *Builder
- func (b *Builder) WithDesiredReplicationFactor(desiredRF int) *Builder
- func (b *Builder) WithGenerateName(name string) *Builder
- func (b *Builder) WithIQN(iqn string) *Builder
- func (b *Builder) WithLabels(labels map[string]string) *Builder
- func (b *Builder) WithLabelsNew(labels map[string]string) *Builder
- func (b *Builder) WithName(name string) *Builder
- func (b *Builder) WithNamespace(namespace string) *Builder
- func (b *Builder) WithNewVersion(version string) *Builder
- func (b *Builder) WithNodeBase(nodebase string) *Builder
- func (b *Builder) WithOwnerRefernceNew(ownerRefernce []metav1.OwnerReference) *Builder
- func (b *Builder) WithReplicationFactor(replicationfactor int) *Builder
- func (b *Builder) WithTargetIP(targetip string) *Builder
- func (b *Builder) WithTargetPort(targetport string) *Builder
- func (b *Builder) WithTargetPortal(targetportal string) *Builder
- type CStorVolume
- func (c *CStorVolume) AreSpecReplicasHealthy(volStatus *apis.CVStatus) bool
- func (c *CStorVolume) BuildScaleDownConfigData(repID string) map[string]string
- func (c *CStorVolume) GetCVCondition(condType apis.CStorVolumeConditionType) apis.CStorVolumeCondition
- func (c *CStorVolume) GetRemovingReplicaID() string
- func (c *CStorVolume) IsConditionPresent(condType apis.CStorVolumeConditionType) bool
- func (c *CStorVolume) IsDRFPending() bool
- func (c *CStorVolume) IsHealthy() bool
- func (c *CStorVolume) IsResizePending() bool
- type CStorVolumeConfig
- type CStorVolumeList
- type CVReplicationDetails
- type Conditions
- type Kubeclient
- func (k *Kubeclient) Create(vol *apis.CStorVolume) (*apis.CStorVolume, error)
- func (k *Kubeclient) Delete(name string) error
- func (k *Kubeclient) Get(name string, opts metav1.GetOptions) (*apis.CStorVolume, error)
- func (k *Kubeclient) GetRaw(name string, opts metav1.GetOptions) ([]byte, error)
- func (k *Kubeclient) List(opts metav1.ListOptions) (*apis.CStorVolumeList, error)
- func (k *Kubeclient) Patch(name, namespace string, pt types.PatchType, data []byte) (*apis.CStorVolume, error)
- func (k *Kubeclient) Update(vol *apis.CStorVolume) (*apis.CStorVolume, error)
- func (k *Kubeclient) WithNamespace(namespace string) *Kubeclient
- type KubeclientBuildOption
- type ListBuilder
- type Predicate
- type PredicateList
Constants ¶
const ( //CStorNodeBase nodeBase for cstor volume CStorNodeBase string = "iqn.2016-09.com.openebs.cstor" // TargetPort is port for cstor volume TargetPort string = "3260" )
const ( //IoWaitTime is the time interval for which the IO has to be stopped before doing snapshot operation IoWaitTime = 10 //TotalWaitTime is the max time duration to wait for doing snapshot operation on all the replicas TotalWaitTime = 60 )
Variables ¶
var ( // ConfFileMutex is to hold the lock while updating istgt.conf file ConfFileMutex = &sync.Mutex{} // IstgtConfPath will locate path for istgt configurations IstgtConfPath = "/usr/local/etc/istgt/istgt.conf" //DesiredReplicationFactorKey is plain text in istgt configuration file informs //about desired replication factor used by target DesiredReplicationFactorKey = " DesiredReplicationFactor" //TargetNamespace is namespace where target pod and cstorvolume is present //and this is updated by addEventHandler function TargetNamespace = "" )
Functions ¶
func GetResizeCondition ¶
func GetResizeCondition() apis.CStorVolumeCondition
GetResizeCondition will return resize condtion related to cstorvolume condtions
func IsScaleDownInProgress ¶
func IsScaleDownInProgress(cvObj *apis.CStorVolume) bool
IsScaleDownInProgress return true if length of status replica details is greater than length of spec replica details
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is the builder object for CStorVolume
func BuilderFromAPI ¶
func BuilderFromAPI(cStorVolume *apis.CStorVolume) *Builder
BuilderFromAPI returns builder instance from core API
func (*Builder) Build ¶
func (b *Builder) Build() (*apis.CStorVolume, error)
Build returns the CStorVolume API instance
func (*Builder) WithAnnotations ¶
WithAnnotations merges existing annotations if any with the ones that are provided here
func (*Builder) WithAnnotationsNew ¶
WithAnnotationsNew resets existing annotations if any with ones that are provided here
func (*Builder) WithCStorIQN ¶
WithCStorIQN sets the iqn field of CStorVolume with provided arguments
func (*Builder) WithCapacity ¶
WithCapacity sets the Capacity field of CStorVolume with provided arguments
func (*Builder) WithConsistencyFactor ¶
WithConsistencyFactor sets the ConsistencyFactor field of CStorVolume with provided arguments
func (*Builder) WithDependentsUpgraded ¶
WithDependentsUpgraded sets the field to true for new volume
func (*Builder) WithDesiredReplicationFactor ¶
WithDesiredReplicationFactor sets the DesiredReplicationFactor field of CStorVolume with provided arguments
func (*Builder) WithGenerateName ¶
WithGenerateName sets the GenerateName field of CStorVolume with provided value
func (*Builder) WithLabels ¶
WithLabels merges existing labels if any with the ones that are provided here
func (*Builder) WithLabelsNew ¶
WithLabelsNew resets existing labels if any with ones that are provided here
func (*Builder) WithNamespace ¶
WithNamespace sets the Namespace field of CStorVolume provided arguments
func (*Builder) WithNewVersion ¶
WithNewVersion sets the current and desired version field of CStorVolume with provided arguments
func (*Builder) WithNodeBase ¶
WithNodeBase sets the NodeBase field of CStorVolume with provided arguments
func (*Builder) WithOwnerRefernceNew ¶
func (b *Builder) WithOwnerRefernceNew(ownerRefernce []metav1.OwnerReference) *Builder
WithOwnerRefernceNew sets ownerrefernce if any with ones that are provided here
func (*Builder) WithReplicationFactor ¶
WithReplicationFactor sets the ReplicationFactor field of CStorVolume with provided arguments
func (*Builder) WithTargetIP ¶
WithTargetIP sets the target IP address field of CStorVolume with provided arguments
func (*Builder) WithTargetPort ¶
WithTargetPort sets the TargetPort field of CStorVolume with provided arguments
func (*Builder) WithTargetPortal ¶
WithTargetPortal sets the TargetPortal field of CStorVolume with provided arguments
type CStorVolume ¶
type CStorVolume struct {
// contains filtered or unexported fields
}
CStorVolume a wrapper for CStorVolume object
func NewForAPIObject ¶
func NewForAPIObject(obj *apis.CStorVolume) *CStorVolume
NewForAPIObject returns a new instance of cstorvolume
func (*CStorVolume) AreSpecReplicasHealthy ¶
func (c *CStorVolume) AreSpecReplicasHealthy(volStatus *apis.CVStatus) bool
AreSpecReplicasHealthy return true if all the spec replicas are in Healthy state else return false
func (*CStorVolume) BuildScaleDownConfigData ¶
func (c *CStorVolume) BuildScaleDownConfigData(repID string) map[string]string
BuildScaleDownConfigData build data based on replica that needs to remove
func (*CStorVolume) GetCVCondition ¶
func (c *CStorVolume) GetCVCondition( condType apis.CStorVolumeConditionType) apis.CStorVolumeCondition
GetCVCondition returns corresponding cstorvolume condition based argument passed
func (*CStorVolume) GetRemovingReplicaID ¶
func (c *CStorVolume) GetRemovingReplicaID() string
GetRemovingReplicaID return replicaID that present in status but not in spec
func (*CStorVolume) IsConditionPresent ¶
func (c *CStorVolume) IsConditionPresent(condType apis.CStorVolumeConditionType) bool
IsConditionPresent returns true if condition is available
func (*CStorVolume) IsDRFPending ¶
func (c *CStorVolume) IsDRFPending() bool
IsDRFPending return true if drf update is required else false Steps to verify whether drf is required 1. Read DesiredReplicationFactor configurations from istgt conf file 2. Compare the value with spec.DesiredReplicationFactor and return result
func (*CStorVolume) IsHealthy ¶
func (c *CStorVolume) IsHealthy() bool
IsHealthy returns true if the CVR is in healthy state
func (*CStorVolume) IsResizePending ¶
func (c *CStorVolume) IsResizePending() bool
IsResizePending return true if resize is in progress
type CStorVolumeConfig ¶
type CStorVolumeConfig struct { *CVReplicationDetails *Kubeclient }
CStorVolumeConfig embed CVReplicationDetails and Kubeclient of corresponding namespace
type CStorVolumeList ¶
type CStorVolumeList struct {
// contains filtered or unexported fields
}
CStorVolumeList is a list of cstorvolume objects
func (*CStorVolumeList) Len ¶
func (l *CStorVolumeList) Len() int
Len returns the number of items present in the CStorVolumeList
type CVReplicationDetails ¶
type CVReplicationDetails struct { VolumeName string `json:"volumeName"` ReplicationFactor int `json:"replicationFactor"` ConsistencyFactor int `json:"consistencyFactor"` ReplicaID string `json:"replicaId"` ReplicaGUID string `json:"replicaZvolGuid"` }
CVReplicationDetails enables to update RF,CF and known replicas into etcd
func (*CVReplicationDetails) BuildConfigData ¶
func (csr *CVReplicationDetails) BuildConfigData() map[string]string
BuildConfigData builds data based on the CVReplicationDetails
func (*CVReplicationDetails) UpdateCVWithReplicationDetails ¶
func (csr *CVReplicationDetails) UpdateCVWithReplicationDetails(kubeclient *Kubeclient) error
UpdateCVWithReplicationDetails updates the cstorvolume with known replicas and updated replication details
func (*CVReplicationDetails) UpdateConfig ¶
func (csr *CVReplicationDetails) UpdateConfig() error
UpdateConfig updates target configuration file by building data
func (*CVReplicationDetails) Validate ¶
func (csr *CVReplicationDetails) Validate() error
Validate verifies whether CStorReplication data read on wire is valid or not
type Conditions ¶
type Conditions []apis.CStorVolumeCondition
Conditions enables building CRUD operations on cstorvolume conditions
func (Conditions) AddCondition ¶
func (c Conditions) AddCondition(cond apis.CStorVolumeCondition) []apis.CStorVolumeCondition
AddCondition appends the new condition to existing conditions
func (Conditions) DeleteCondition ¶
func (c Conditions) DeleteCondition(cond apis.CStorVolumeCondition) []apis.CStorVolumeCondition
DeleteCondition deletes the condition from conditions
func (Conditions) UpdateCondition ¶
func (c Conditions) UpdateCondition(cond apis.CStorVolumeCondition) []apis.CStorVolumeCondition
UpdateCondition updates the condition if it is present in Conditions
type Kubeclient ¶
type Kubeclient struct {
// contains filtered or unexported fields
}
Kubeclient enables kubernetes API operations on cstor volume replica 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(vol *apis.CStorVolume) (*apis.CStorVolume, error)
Create creates the cstorvolume resource
func (*Kubeclient) Delete ¶
func (k *Kubeclient) Delete(name string) error
Delete deletes the cstorvolume resource
func (*Kubeclient) Get ¶
func (k *Kubeclient) Get( name string, opts metav1.GetOptions, ) (*apis.CStorVolume, error)
Get returns deployment object for given name
func (*Kubeclient) GetRaw ¶
func (k *Kubeclient) GetRaw( name string, opts metav1.GetOptions, ) ([]byte, error)
GetRaw returns a raw CStor volume instance
func (*Kubeclient) List ¶
func (k *Kubeclient) List( opts metav1.ListOptions, ) (*apis.CStorVolumeList, error)
List returns a list of cstor volume replica instances present in kubernetes cluster
func (*Kubeclient) Patch ¶
func (k *Kubeclient) Patch( name, namespace string, pt types.PatchType, data []byte, ) (*apis.CStorVolume, error)
Patch patches the cstorvolume resource
func (*Kubeclient) Update ¶
func (k *Kubeclient) Update(vol *apis.CStorVolume) (*apis.CStorVolume, error)
Update updates the cstorvolume resource
func (*Kubeclient) WithNamespace ¶
func (k *Kubeclient) WithNamespace(namespace string) *Kubeclient
WithNamespace sets the kubernetes client against the provided namespace
type KubeclientBuildOption ¶
type KubeclientBuildOption func(*Kubeclient)
KubeclientBuildOption defines the abstraction to build a kubeclient instance
func WithClientSet ¶
func WithClientSet(c *clientset.Clientset) KubeclientBuildOption
WithClientSet sets the kubernetes client against the kubeclient instance
func WithKubeConfigPath ¶
func WithKubeConfigPath(path string) KubeclientBuildOption
WithKubeConfigPath sets the kubernetes client against the provided path
func WithNamespace ¶
func WithNamespace(namespace string) KubeclientBuildOption
WithNamespace sets the kubernetes client against the provided namespace
type ListBuilder ¶
type ListBuilder struct {
// contains filtered or unexported fields
}
ListBuilder enables building an instance of CstorVolumeList
func NewListBuilder ¶
func NewListBuilder() *ListBuilder
NewListBuilder returns a new instance of listBuilder
func (*ListBuilder) List ¶
func (b *ListBuilder) List() *CStorVolumeList
List returns the list of cstorvolume (cv) instances that was built by this builder
func (*ListBuilder) WithAPIList ¶
func (b *ListBuilder) WithAPIList(list *apis.CStorVolumeList) *ListBuilder
WithAPIList builds the list of cstorvolume instances based on the provided cstorvolume api instances
func (*ListBuilder) WithFilter ¶
func (b *ListBuilder) WithFilter(pred ...Predicate) *ListBuilder
WithFilter adds filters on which the cstorvolume has to be filtered
type Predicate ¶
type Predicate func(*CStorVolume) bool
Predicate defines an abstraction to determine conditional checks against the provided cstorvolume instance
type PredicateList ¶
type PredicateList []Predicate
PredicateList holds a list of cstor volume based predicates