File tree Expand file tree Collapse file tree 5 files changed +11
-0
lines changed
cluster-autoscaler/simulator Expand file tree Collapse file tree 5 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -360,6 +360,7 @@ func (snapshot *BasicSnapshotStore) DeviceClasses() fwk.DeviceClassLister {
360360 return snapshot .DraSnapshot ().DeviceClasses ()
361361}
362362
363+ // DeviceClassResolver exposes the snapshot as DeviceClassResolver.
363364func (snapshot * BasicSnapshotStore ) DeviceClassResolver () fwk.DeviceClassResolver {
364365 return snapshot .DraSnapshot ().DeviceClassResolver ()
365366}
Original file line number Diff line number Diff line change @@ -439,10 +439,12 @@ func (snapshot *DeltaSnapshotStore) CsiSnapshot() *csisnapshot.Snapshot {
439439 return snapshot .csiSnapshot
440440}
441441
442+ // CSINodes returns the CSI node lister for this snapshot.
442443func (snapshot * DeltaSnapshotStore ) CSINodes () fwk.CSINodeLister {
443444 return snapshot .csiSnapshot .CSINodes ()
444445}
445446
447+ // DeviceClassResolver exposes the snapshot as DeviceClassResolver.
446448func (snapshot * DeltaSnapshotStore ) DeviceClassResolver () fwk.DeviceClassResolver {
447449 return snapshot .DraSnapshot ().DeviceClassResolver ()
448450}
Original file line number Diff line number Diff line change @@ -8,14 +8,17 @@ import (
88 v1storagelister "k8s.io/client-go/listers/storage/v1"
99)
1010
11+ // Provider provides access to CSI node information for the cluster.
1112type Provider struct {
1213 csINodesLister v1storagelister.CSINodeLister
1314}
1415
16+ // NewCSINodeProvider creates a new Provider with the given CSI node lister.
1517func NewCSINodeProvider (csINodesLister v1storagelister.CSINodeLister ) * Provider {
1618 return & Provider {csINodesLister : csINodesLister }
1719}
1820
21+ // NewCSINodeProviderFromInformers creates a new Provider from an informer factory.
1922func NewCSINodeProviderFromInformers (informerFactory informers.SharedInformerFactory ) * Provider {
2023 return NewCSINodeProvider (informerFactory .Storage ().V1 ().CSINodes ().Lister ())
2124}
Original file line number Diff line number Diff line change @@ -2,14 +2,17 @@ package snapshot
22
33import storagev1 "k8s.io/api/storage/v1"
44
5+ // SnapshotCSINodeLister provides access to CSI nodes within a snapshot.
56type SnapshotCSINodeLister struct {
67 snapshot * Snapshot
78}
89
10+ // List returns all CSI nodes in the snapshot.
911func (s SnapshotCSINodeLister ) List () ([]* storagev1.CSINode , error ) {
1012 return s .snapshot .listCSINodes (), nil
1113}
1214
15+ // Get retrieves a CSI node by name from the snapshot.
1316func (s SnapshotCSINodeLister ) Get (name string ) (* storagev1.CSINode , error ) {
1417 return s .snapshot .Get (name )
1518}
Original file line number Diff line number Diff line change @@ -10,10 +10,12 @@ import (
1010 schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework"
1111)
1212
13+ // Snapshot represents a snapshot of CSI node information for cluster simulation.
1314type Snapshot struct {
1415 csiNodes * common.PatchSet [string , * storagev1.CSINode ]
1516}
1617
18+ // NewSnapshot creates a new Snapshot from a map of CSI nodes.
1719func NewSnapshot (csiNodes map [string ]* storagev1.CSINode ) * Snapshot {
1820 csiNdodePatch := common .NewPatchFromMap (csiNodes )
1921 return & Snapshot {
You can’t perform that action at this time.
0 commit comments