Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavmpandey08 committed Nov 23, 2023
1 parent 874a81e commit b691d5e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions controllers/nodeupgrade_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (r *NodeUpgradeReconciler) reconcile(ctx context.Context, log logr.Logger,
if nodeUpgrade.Spec.FirstNodeToBeUpgraded {
upgraderPod = upgrader.UpgradeFirstControlPlanePod(node.Name, defaultUpgraderImage, nodeUpgrade.Spec.KubernetesVersion, *nodeUpgrade.Spec.EtcdVersion)
} else {
upgraderPod = upgrader.UpgradeRestControlPlanePod(node.Name, defaultUpgraderImage)
upgraderPod = upgrader.UpgradeSecondaryControlPlanePod(node.Name, defaultUpgraderImage)
}
} else {
upgraderPod = upgrader.UpgradeWorkerPod(node.Name, defaultUpgraderImage)
Expand Down Expand Up @@ -251,7 +251,7 @@ func (r *NodeUpgradeReconciler) updateStatus(ctx context.Context, log logr.Logge
}

conditions.MarkTrue(nodeUpgrade, anywherev1.UpgraderPodCreated)
updateContainerConditions(pod, nodeUpgrade)
updateComponentsConditions(pod, nodeUpgrade)

// Always update the readyCondition by summarizing the state of other conditions.
conditions.SetSummary(nodeUpgrade,
Expand All @@ -268,7 +268,7 @@ func (r *NodeUpgradeReconciler) updateStatus(ctx context.Context, log logr.Logge
return nil
}

func updateContainerConditions(pod *corev1.Pod, nodeUpgrade *anywherev1.NodeUpgrade) {
func updateComponentsConditions(pod *corev1.Pod, nodeUpgrade *anywherev1.NodeUpgrade) {
containersMap := []struct {
name string
condition clusterv1.ConditionType
Expand Down
4 changes: 2 additions & 2 deletions pkg/nodeupgrader/upgrader.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func UpgradeFirstControlPlanePod(nodeName, image, kubernetesVersion, etcdVersion
return p
}

// UpgradeRestControlPlanePod returns an upgrader pod that can be deployed on the remaining control plane nodes.
func UpgradeRestControlPlanePod(nodeName, image string) *corev1.Pod {
// UpgradeSecondaryControlPlanePod returns an upgrader pod that can be deployed on the remaining control plane nodes.
func UpgradeSecondaryControlPlanePod(nodeName, image string) *corev1.Pod {
p := upgraderPod(nodeName, image)
p.Spec.InitContainers = containersForUpgrade(image, nodeName, "kubeadm_in_rest_cp")
return p
Expand Down
4 changes: 2 additions & 2 deletions pkg/nodeupgrader/upgrader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ func TestUpgradeFirstControlPlanePod(t *testing.T) {
test.AssertContentToFile(t, string(data), "testdata/expected_first_control_plane_upgrader_pod.yaml")
}

func TestUpgradeRestControlPlanePod(t *testing.T) {
func TestUpgradeSecondaryControlPlanePod(t *testing.T) {
g := NewWithT(t)
pod := nodeupgrader.UpgradeRestControlPlanePod(nodeName, upgraderImage)
pod := nodeupgrader.UpgradeSecondaryControlPlanePod(nodeName, upgraderImage)
g.Expect(pod).ToNot(BeNil())

data, err := yaml.Marshal(pod)
Expand Down

0 comments on commit b691d5e

Please sign in to comment.