Skip to content

Commit

Permalink
Create the autopilot client before applying the plan
Browse files Browse the repository at this point in the history
If it's done the other way round, it might happen that the k0s binary is
being replaced by the autopilot update process, and cannot be executed.

Signed-off-by: Tom Wieczorek <twieczorek@mirantis.com>
  • Loading branch information
twz123 committed Sep 20, 2024
1 parent 5f5b6bf commit d60a190
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions inttest/ap-single/single_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ spec:
manifestFile := "/tmp/happy.yaml"
s.PutFileTemplate(s.ControllerNode(0), manifestFile, planTemplate, nil)

out, err := s.RunCommandController(0, fmt.Sprintf("/usr/local/bin/k0s kubectl apply -f %s", manifestFile))
s.T().Logf("kubectl apply output: '%s'", out)
s.Require().NoError(err)

client, err := s.AutopilotClient(s.ControllerNode(0))
s.Require().NoError(err)
s.NotEmpty(client)

out, err := s.RunCommandController(0, fmt.Sprintf("/usr/local/bin/k0s kubectl apply -f %s", manifestFile))
s.T().Logf("kubectl apply output: '%s'", out)
s.Require().NoError(err)

// The plan has enough information to perform a successful update of k0s, so wait for it.
plan, err := aptest.WaitForPlanState(s.Context(), client, apconst.AutopilotName, appc.PlanCompleted)
s.Require().NoError(err, "While waiting for plan to complete")
Expand Down

0 comments on commit d60a190

Please sign in to comment.