Skip to content

Commit

Permalink
correct the fmt errors on the controller files.
Browse files Browse the repository at this point in the history
Reference #kubernetes-csi/csi-release-tools#203

Signed-off-by: Humble Chirammal <[email protected]>
  • Loading branch information
humblec committed Sep 6, 2022
1 parent d216fc3 commit 791bc69
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 27 deletions.
4 changes: 3 additions & 1 deletion pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,9 @@ func verifyAndGetSecretNameAndNamespaceTemplate(secret secretParamsMap, storageC
}

// getSecretReference returns a reference to the secret specified in the given nameTemplate
// and namespaceTemplate, or an error if the templates are not specified correctly.
//
// and namespaceTemplate, or an error if the templates are not specified correctly.
//
// no lookup of the referenced secret is performed, and the secret may or may not exist.
//
// supported tokens for name resolution:
Expand Down
58 changes: 32 additions & 26 deletions pkg/controller/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,23 @@ func SupportsTopology(pluginCapabilities rpc.PluginCapabilitySet) bool {
//
// 1) selectedNode is not set (immediate binding):
//
// In this case, we list all CSINode objects to find a Node that
// the driver has registered topology keys with.
// In this case, we list all CSINode objects to find a Node that
// the driver has registered topology keys with.
//
// Once we get the list of CSINode objects, we find one that has
// topology keys registered. If none are found, then we assume
// that the driver has not started on any node yet, and we error
// and retry.
// Once we get the list of CSINode objects, we find one that has
// topology keys registered. If none are found, then we assume
// that the driver has not started on any node yet, and we error
// and retry.
//
// If at least one CSINode object is found with topology keys,
// then we continue and use that for assembling the topology
// requirement. The available topologies will be limited to the
// Nodes that the driver has registered with.
// If at least one CSINode object is found with topology keys,
// then we continue and use that for assembling the topology
// requirement. The available topologies will be limited to the
// Nodes that the driver has registered with.
//
// 2) selectedNode is set (delayed binding):
//
// We will get the topology from the CSINode object for the selectedNode
// and error if we can't (and retry).
//
// We will get the topology from the CSINode object for the selectedNode
// and error if we can't (and retry).
func GenerateAccessibilityRequirements(
kubeClient kubernetes.Interface,
driverName string,
Expand Down Expand Up @@ -380,21 +379,28 @@ func aggregateTopologies(
// This function eliminates the OR of topology values by distributing the OR over the AND a level
// higher.
// For example, given a TopologySelectorTerm of this form:
// {
// "zone": { "zone1", "zone2" },
// "rack": { "rackA", "rackB" },
// }
//
// {
// "zone": { "zone1", "zone2" },
// "rack": { "rackA", "rackB" },
// }
//
// Abstractly it could be viewed as:
// (zone1 OR zone2) AND (rackA OR rackB)
//
// (zone1 OR zone2) AND (rackA OR rackB)
//
// Distributing the OR over the AND, we get:
// (zone1 AND rackA) OR (zone2 AND rackA) OR (zone1 AND rackB) OR (zone2 AND rackB)
//
// (zone1 AND rackA) OR (zone2 AND rackA) OR (zone1 AND rackB) OR (zone2 AND rackB)
//
// which in the intermediate representation returned by this function becomes:
// [
// { "zone": "zone1", "rack": "rackA" },
// { "zone": "zone2", "rack": "rackA" },
// { "zone": "zone1", "rack": "rackB" },
// { "zone": "zone2", "rack": "rackB" },
// ]
//
// [
// { "zone": "zone1", "rack": "rackA" },
// { "zone": "zone2", "rack": "rackA" },
// { "zone": "zone1", "rack": "rackB" },
// { "zone": "zone2", "rack": "rackB" },
// ]
//
// This flattening is then applied to all TopologySelectorTerms in AllowedTopologies, and
// the resulting terms are OR'd together.
Expand Down Expand Up @@ -524,7 +530,7 @@ func (t topologyTerm) clone() topologyTerm {
// - com.example.csi/rack#zz < com.example.csi/zone#zone1
// - com.example.csi/z#z1 < com.example.csi/zone#zone1
// - com.example.csi/rack#rackA,com.example.csi/zone#zone2 < com.example.csi/rackB,com.example.csi/zone#zone1
// Note that both '#' and ',' are less than '/', '-', '_', '.', [A-Z0-9a-z]
// Note that both '#' and ',' are less than '/', '-', '_', '.', [A-Z0-9a-z]
func (t topologyTerm) hash() string {
var segments []string
for k, v := range t {
Expand Down

0 comments on commit 791bc69

Please sign in to comment.