diff --git a/controllers/nodeupgrade_controller.go b/controllers/nodeupgrade_controller.go index 61f9de70ec2d..8019c504c571 100644 --- a/controllers/nodeupgrade_controller.go +++ b/controllers/nodeupgrade_controller.go @@ -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) @@ -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, @@ -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 diff --git a/pkg/nodeupgrader/upgrader.go b/pkg/nodeupgrader/upgrader.go index 6f8943a0a72f..f5507fbfd66f 100644 --- a/pkg/nodeupgrader/upgrader.go +++ b/pkg/nodeupgrader/upgrader.go @@ -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 diff --git a/pkg/nodeupgrader/upgrader_test.go b/pkg/nodeupgrader/upgrader_test.go index 5ecdee054088..e35834d3d363 100644 --- a/pkg/nodeupgrader/upgrader_test.go +++ b/pkg/nodeupgrader/upgrader_test.go @@ -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)