Documentation ¶
Overview ¶
Package topology contains an abstract interface for discovering topology segments for a storage backend and a specific implementation which does that based on the CSINodeDriver.TopologyKeys and the corresponding labels for the nodes.
Index ¶
- type Callback
- type Informer
- type Mock
- type Segment
- func (s Segment) Compare(other Segment) int
- func (s Segment) GetLabelMap() map[string]string
- func (s Segment) GetLabelSelector() *metav1.LabelSelector
- func (s Segment) Len() int
- func (s Segment) Less(i, j int) bool
- func (s *Segment) SimpleString() string
- func (s *Segment) String() string
- func (s Segment) Swap(i, j int)
- type SegmentEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Informer ¶
type Informer interface { // AddCallback ensures that the function is called each time // changes to the list of segments are detected. It also gets // called immediately when adding the callback and there are // already some known segments. AddCallback(cb Callback) // List returns all known segments, in no particular order. List() []*Segment // HasSynced returns true once all segments have been found. HasSynced() bool // RunWorker starts a worker to process queue. RunWorker(ctx context.Context) }
Informer keeps a list of discovered topology segments and can notify one or more clients when it discovers changes. Segments are identified by their address and guaranteed to be unique.
func NewFixedNodeTopology ¶
NewFixedNodeTopology creates topology informer for a driver with a fixed topology segment.
func NewNodeTopology ¶
func NewNodeTopology( driverName string, client kubernetes.Interface, nodeInformer coreinformersv1.NodeInformer, csiNodeInformer storageinformersv1.CSINodeInformer, queue workqueue.RateLimitingInterface, ) Informer
NewNodeTopology returns an informer that synthesizes storage topology segments based on the accessible topology that each CSI driver node instance reports. See https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/1472-storage-capacity-tracking#with-central-controller for details.
type Mock ¶
type Mock struct {
// contains filtered or unexported fields
}
Mock simulates a driver installation on one or more nodes.
func NewMock ¶
NewMock creates a new mocked topology informer with a certain set of pre-defined segments.
func (*Mock) AddCallback ¶
type Segment ¶
type Segment []SegmentEntry
Segment represents a topology segment. Entries are always sorted by key and keys are unique. In contrast to a map, segments therefore can be compared efficiently. A nil segment matches no nodes in a cluster, an empty segment all of them.
func (Segment) Compare ¶
Compare returns -1 if s is considered smaller than the other segment (less keys, keys and/or values smaller), 0 if equal and 1 otherwise.
func (Segment) GetLabelMap ¶
GetLabelMap returns nil if the Segment itself is nil, otherwise a map with all key/value pairs.
func (Segment) GetLabelSelector ¶
func (s Segment) GetLabelSelector() *metav1.LabelSelector
GetLabelSelector returns a LabelSelector with the key/value entries as label match criteria.
func (*Segment) SimpleString ¶
SimpleString only returns the content.
type SegmentEntry ¶
type SegmentEntry struct {
Key, Value string
}
SegmentEntry represents one topology key/value pair.
func (SegmentEntry) Compare ¶
func (se SegmentEntry) Compare(other SegmentEntry) int
Compare returns -1 if se is considered smaller than the other segment entry (key or value smaller), 0 if equal and 1 otherwise.
func (SegmentEntry) String ¶
func (se SegmentEntry) String() string