Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kale-amruta committed Feb 13, 2025
1 parent 1e21ada commit 48e8243
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 9 additions & 0 deletions pkg/controllers/resources/nodes/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,15 @@ func (s *nodeSyncer) Sync(ctx *synccontext.SyncContext, event *synccontext.SyncE
}

s.translateUpdateBackwards(event.Host, event.Virtual)

// Set the marker of managed-by vcluster so that
// we skip deleting the nodes which are not managed
// by vcluster in `SyncToHost` function
if len(event.Virtual.Labels) == 0 {
event.Virtual.Labels = map[string]string{}
}
event.Virtual.Labels[translate.MarkerLabel] = translate.VClusterName

return ctrl.Result{}, nil
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/controllers/resources/nodes/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,6 @@ func (s *nodeSyncer) translateUpdateBackwards(pNode *corev1.Node, vNode *corev1.
annotations["cluster-autoscaler.kubernetes.io/scale-down-disabled"] = "true"
}

// Set the marker of managed-by vcluster so that
// we skip deleting the nodes which are not managed
// by vcluster in `SyncToHost` function
labels[translate.MarkerLabel] = translate.VClusterName

// set annotations, spec & labels
vNode.Spec = *translatedSpec
vNode.Annotations = annotations
Expand Down

0 comments on commit 48e8243

Please sign in to comment.