Skip to content

Commit 388ec1e

Browse files
authored
Remove system pods running check (#802)
Signed-off-by: Kimmo Lehto <[email protected]>
1 parent 0aa7b09 commit 388ec1e

File tree

3 files changed

+0
-73
lines changed

3 files changed

+0
-73
lines changed

phase/reinstall.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,5 @@ func (p *Reinstall) reinstall(h *cluster.Host) error {
111111
return nil
112112
}
113113

114-
log.Infof("%s: waiting for system pods to become ready", h)
115-
if err := retry.Timeout(context.TODO(), retry.DefaultTimeout, node.SystemPodsRunningFunc(h)); err != nil {
116-
if !Force {
117-
return fmt.Errorf("all system pods not running after api start-up, you can ignore this check by using --force: %w", err)
118-
}
119-
log.Warnf("%s: failed to observe system pods running after api start-up: %s", h, err)
120-
}
121-
122114
return nil
123115
}

phase/upgrade_controllers.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,5 @@ func (p *UpgradeControllers) Run() error {
155155
log.Warnf("%s: failed to observe scheduling events after api start-up: %s", leader, err)
156156
}
157157

158-
log.Infof("%s: waiting for system pods to become ready", leader)
159-
if err := retry.Timeout(context.TODO(), retry.DefaultTimeout, node.SystemPodsRunningFunc(leader)); err != nil {
160-
if !Force {
161-
return fmt.Errorf("all system pods not running after api start-up, you can ignore this check by using --force: %w", err)
162-
}
163-
log.Warnf("%s: failed to observe system pods running after api start-up: %s", leader, err)
164-
}
165-
166158
return nil
167159
}

pkg/node/statusfunc.go

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,6 @@ type statusEvents struct {
4242
} `json:"items"`
4343
}
4444

45-
// kubectl get pods -o json
46-
type podStatusList struct {
47-
Items []struct {
48-
Status struct {
49-
ContainerStatuses []struct {
50-
ContainerID string `json:"containerID"`
51-
Name string `json:"name"`
52-
Ready bool `json:"ready"`
53-
} `json:"containerStatuses"`
54-
Phase string `json:"phase"`
55-
} `json:"status"`
56-
} `json:"items"`
57-
}
58-
5945
// KubeNodeReady returns a function that returns an error unless the node is ready according to "kubectl get node"
6046
func KubeNodeReadyFunc(h *cluster.Host) retryFunc {
6147
return func(_ context.Context) error {
@@ -125,49 +111,6 @@ func ScheduledEventsAfterFunc(h *cluster.Host, since time.Time) retryFunc {
125111
}
126112
}
127113

128-
// SystemPodsRunningFunc returns a function that returns an error unless all kube-system pods are running
129-
func SystemPodsRunningFunc(h *cluster.Host) retryFunc {
130-
return func(_ context.Context) error {
131-
output, err := h.ExecOutput(h.Configurer.KubectlCmdf(h, h.K0sDataDir(), "-n kube-system get pods -o json"), exec.HideOutput(), exec.Sudo(h))
132-
if err != nil {
133-
return fmt.Errorf("failed to get kube-system pods: %w", err)
134-
}
135-
pods := &podStatusList{}
136-
if err := json.Unmarshal([]byte(output), &pods); err != nil {
137-
return fmt.Errorf("failed to decode kubectl output for get kube-system pods: %w", err)
138-
}
139-
140-
var running int
141-
var notReady int
142-
143-
for _, p := range pods.Items {
144-
if p.Status.Phase != "Running" {
145-
log.Tracef("%s: pod phase '%s' - container statuses: %+v", h, p.Status.Phase, p.Status.ContainerStatuses)
146-
continue
147-
}
148-
running++
149-
for _, c := range p.Status.ContainerStatuses {
150-
if !c.Ready {
151-
log.Debugf("%s: container %s not ready", h, c.Name)
152-
notReady++
153-
}
154-
}
155-
}
156-
157-
if running == 0 {
158-
return fmt.Errorf("no kube-system pods running")
159-
}
160-
161-
if notReady > 0 {
162-
return fmt.Errorf("%d kube-system containers not ready", notReady)
163-
}
164-
165-
log.Debugf("%s: all (%d) system pods running", h, running)
166-
167-
return nil
168-
}
169-
}
170-
171114
// HTTPStatus returns a function that returns an error unless the expected status code is returned for a HTTP get to the url
172115
func HTTPStatusFunc(h *cluster.Host, url string, expected ...int) retryFunc {
173116
return func(_ context.Context) error {

0 commit comments

Comments
 (0)