Skip to content

Commit f8e9b46

Browse files
authored
fix runRepairer to check nil in order to avoid SEGV (#788)
1 parent 9fe3042 commit f8e9b46

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

sabakan/generator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var (
1818
errNotAvailable = errors.New("no healthy machine is available")
1919
errMissingMachine = errors.New("failed to apply new template due to missing machines")
2020
errTooManyNonExistent = errors.New("too many non-existent control plane nodes")
21+
errClusterNotFound = errors.New("CKE cluster does not exist")
2122

2223
// DefaultWaitRetiredSeconds before removing retired nodes from the cluster.
2324
DefaultWaitRetiredSeconds = 300.0

sabakan/integrate.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ func (ig integrator) runGenerator(ctx context.Context, leaderKey string, cluster
156156
func (ig integrator) runRepairer(ctx context.Context, clusterStatus *cke.ClusterStatus) error {
157157
st := cke.Storage{Client: ig.etcd}
158158

159+
if clusterStatus == nil {
160+
return errClusterNotFound
161+
}
162+
159163
disabled, err := st.IsAutoRepairDisabled(ctx)
160164
if err != nil {
161165
return err

0 commit comments

Comments
 (0)