@@ -115,24 +115,23 @@ func SupportsTopology(pluginCapabilities rpc.PluginCapabilitySet) bool {
115
115
//
116
116
// 1) selectedNode is not set (immediate binding):
117
117
//
118
- // In this case, we list all CSINode objects to find a Node that
119
- // the driver has registered topology keys with.
118
+ // In this case, we list all CSINode objects to find a Node that
119
+ // the driver has registered topology keys with.
120
120
//
121
- // Once we get the list of CSINode objects, we find one that has
122
- // topology keys registered. If none are found, then we assume
123
- // that the driver has not started on any node yet, and we error
124
- // and retry.
121
+ // Once we get the list of CSINode objects, we find one that has
122
+ // topology keys registered. If none are found, then we assume
123
+ // that the driver has not started on any node yet, and we error
124
+ // and retry.
125
125
//
126
- // If at least one CSINode object is found with topology keys,
127
- // then we continue and use that for assembling the topology
128
- // requirement. The available topologies will be limited to the
129
- // Nodes that the driver has registered with.
126
+ // If at least one CSINode object is found with topology keys,
127
+ // then we continue and use that for assembling the topology
128
+ // requirement. The available topologies will be limited to the
129
+ // Nodes that the driver has registered with.
130
130
//
131
131
// 2) selectedNode is set (delayed binding):
132
132
//
133
- // We will get the topology from the CSINode object for the selectedNode
134
- // and error if we can't (and retry).
135
- //
133
+ // We will get the topology from the CSINode object for the selectedNode
134
+ // and error if we can't (and retry).
136
135
func GenerateAccessibilityRequirements (
137
136
kubeClient kubernetes.Interface ,
138
137
driverName string ,
@@ -380,21 +379,28 @@ func aggregateTopologies(
380
379
// This function eliminates the OR of topology values by distributing the OR over the AND a level
381
380
// higher.
382
381
// For example, given a TopologySelectorTerm of this form:
383
- // {
384
- // "zone": { "zone1", "zone2" },
385
- // "rack": { "rackA", "rackB" },
386
- // }
382
+ //
383
+ // {
384
+ // "zone": { "zone1", "zone2" },
385
+ // "rack": { "rackA", "rackB" },
386
+ // }
387
+ //
387
388
// Abstractly it could be viewed as:
388
- // (zone1 OR zone2) AND (rackA OR rackB)
389
+ //
390
+ // (zone1 OR zone2) AND (rackA OR rackB)
391
+ //
389
392
// Distributing the OR over the AND, we get:
390
- // (zone1 AND rackA) OR (zone2 AND rackA) OR (zone1 AND rackB) OR (zone2 AND rackB)
393
+ //
394
+ // (zone1 AND rackA) OR (zone2 AND rackA) OR (zone1 AND rackB) OR (zone2 AND rackB)
395
+ //
391
396
// which in the intermediate representation returned by this function becomes:
392
- // [
393
- // { "zone": "zone1", "rack": "rackA" },
394
- // { "zone": "zone2", "rack": "rackA" },
395
- // { "zone": "zone1", "rack": "rackB" },
396
- // { "zone": "zone2", "rack": "rackB" },
397
- // ]
397
+ //
398
+ // [
399
+ // { "zone": "zone1", "rack": "rackA" },
400
+ // { "zone": "zone2", "rack": "rackA" },
401
+ // { "zone": "zone1", "rack": "rackB" },
402
+ // { "zone": "zone2", "rack": "rackB" },
403
+ // ]
398
404
//
399
405
// This flattening is then applied to all TopologySelectorTerms in AllowedTopologies, and
400
406
// the resulting terms are OR'd together.
@@ -524,7 +530,7 @@ func (t topologyTerm) clone() topologyTerm {
524
530
// - com.example.csi/rack#zz < com.example.csi/zone#zone1
525
531
// - com.example.csi/z#z1 < com.example.csi/zone#zone1
526
532
// - com.example.csi/rack#rackA,com.example.csi/zone#zone2 < com.example.csi/rackB,com.example.csi/zone#zone1
527
- // Note that both '#' and ',' are less than '/', '-', '_', '.', [A-Z0-9a-z]
533
+ // Note that both '#' and ',' are less than '/', '-', '_', '.', [A-Z0-9a-z]
528
534
func (t topologyTerm ) hash () string {
529
535
var segments []string
530
536
for k , v := range t {
0 commit comments