Skip to content

Commit

Permalink
fix runRepairer to check nil in order to avoid SEGV (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
YZ775 authored Jan 16, 2025
1 parent 9fe3042 commit f8e9b46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions sabakan/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var (
errNotAvailable = errors.New("no healthy machine is available")
errMissingMachine = errors.New("failed to apply new template due to missing machines")
errTooManyNonExistent = errors.New("too many non-existent control plane nodes")
errClusterNotFound = errors.New("CKE cluster does not exist")

// DefaultWaitRetiredSeconds before removing retired nodes from the cluster.
DefaultWaitRetiredSeconds = 300.0
Expand Down
4 changes: 4 additions & 0 deletions sabakan/integrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ func (ig integrator) runGenerator(ctx context.Context, leaderKey string, cluster
func (ig integrator) runRepairer(ctx context.Context, clusterStatus *cke.ClusterStatus) error {
st := cke.Storage{Client: ig.etcd}

if clusterStatus == nil {
return errClusterNotFound
}

disabled, err := st.IsAutoRepairDisabled(ctx)
if err != nil {
return err
Expand Down

0 comments on commit f8e9b46

Please sign in to comment.