Skip to content

Commit 9202175

Browse files
improve comments for aviunding misunderstanding from object graph nodes and Kubernetes nodes
1 parent 6154455 commit 9202175

File tree

1 file changed

+8
-8
lines changed
  • cmd/clusterctl/pkg/client/cluster

1 file changed

+8
-8
lines changed

cmd/clusterctl/pkg/client/cluster/mover.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ func (o *objectMover) move(graph *objectGraph, toProxy Proxy) error {
120120
return err
121121
}
122122

123-
// Define the move sequence by processing the ownerReference chain, so we ensure that a node is moved only after its owners.
124-
// Additionally nodes are grouped, so bulk of nodes can be moved in parallel. e.g.
123+
// Define the move sequence by processing the ownerReference chain, so we ensure that a Kubernetes object is moved only after its owners.
124+
// The sequence is bases on object graph nodes, each one representing a Kubernetes object; nodes are grouped, so bulk of nodes can be moved in parallel. e.g.
125125
// - All the Clusters should be moved first (group 1, processed in parallel)
126126
// - All the MachineDeployments should be moved second (group 1, processed in parallel)
127127
// - then all the MachineSets, then all the Machines, etc.
@@ -155,7 +155,7 @@ type moveSequence struct {
155155
nodesMap map[*node]empty
156156
}
157157

158-
// moveGroup defines is a list of nodes that can be moved in parallel.
158+
// moveGroup defines is a list of nodes read from the object graph that can be moved in parallel.
159159
type moveGroup []*node
160160

161161
func (s *moveSequence) addGroup(group moveGroup) {
@@ -260,10 +260,10 @@ const (
260260
retryIntervalCreateTargetObject = 1 * time.Second
261261
)
262262

263-
// createGroup creates all the nodes in a moveGroup into the target management cluster.
263+
// createGroup creates all the Kubernetes objects into the target management cluster corresponding to the object graph nodes in a moveGroup.
264264
func (o *objectMover) createGroup(group moveGroup, toProxy Proxy) error {
265265

266-
// Creates - in parallel - the all the nodes in the group.
266+
// Creates - in parallel - all the nodes in the group.
267267
var wg sync.WaitGroup
268268
errList := []error{}
269269
errCh := make(chan error)
@@ -299,7 +299,7 @@ func (o *objectMover) createGroup(group moveGroup, toProxy Proxy) error {
299299
return nil
300300
}
301301

302-
// createTargetObject creates the Kubernetes object corresponding to the node in the target Management cluster, taking care of restoring the OwnerReference with the owner node, if any.
302+
// createTargetObject creates the Kubernetes object in the target Management cluster corresponding to the object graph node, taking care of restoring the OwnerReference with the owner nodes, if any.
303303
func (o *objectMover) createTargetObject(nodeToCreate *node, toProxy Proxy) error {
304304
o.log.V(1).Info("Creating", nodeToCreate.identity.Kind, nodeToCreate.identity.Name, "Namespace", nodeToCreate.identity.Namespace)
305305

@@ -395,7 +395,7 @@ const (
395395
retryIntervalDeleteSourceObject = 1 * time.Second
396396
)
397397

398-
// deleteGroup deletes all the nodes in a moveGroup from the source management cluster.
398+
// deleteGroup deletes all the Kubernetes objects from the source management cluster corresponding to the object graph nodes in a moveGroup.
399399
func (o *objectMover) deleteGroup(group moveGroup) error {
400400
// Deletes - in parallel - the dependents nodes and the softDependents nodes (with the respective object tree).
401401
var wg sync.WaitGroup
@@ -435,7 +435,7 @@ var (
435435
removeFinalizersPatch = client.ConstantPatch(types.MergePatchType, []byte("{\"metadata\":{\"finalizers\":[]}}"))
436436
)
437437

438-
// deleteSourceObject deletes the object corresponding to the node from the source management cluster, taking care of removing all the finalizers so
438+
// deleteSourceObject deletes the Kubernetes object corresponding to the node from the source management cluster, taking care of removing all the finalizers so
439439
// the objects gets immediately deleted (force delete).
440440
func (o *objectMover) deleteSourceObject(nodeToDelete *node) error {
441441
o.log.V(1).Info("Deleting", nodeToDelete.identity.Kind, nodeToDelete.identity.Name, "Namespace", nodeToDelete.identity.Namespace)

0 commit comments

Comments
 (0)