Skip to content

Commit

Permalink
Merge pull request kubernetes#7334 from omerap12/wrapper_nil_pointer
Browse files Browse the repository at this point in the history
Fix nil handling in NodeGroupForNode wrapper
  • Loading branch information
k8s-ci-robot authored Oct 3, 2024
2 parents edd416a + de16a92 commit 813140e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package wrapper
import (
"context"
"fmt"
"reflect"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down Expand Up @@ -99,7 +100,8 @@ func (w *Wrapper) NodeGroupForNode(_ context.Context, req *protos.NodeGroupForNo
if err != nil {
return nil, err
}
if ng == nil {
// Checks if ng is nil interface or contains nil value
if ng == nil || reflect.ValueOf(ng).IsNil() {
return &protos.NodeGroupForNodeResponse{
NodeGroup: &protos.NodeGroup{}, //NodeGroup with id = "", meaning the node should not be processed by cluster autoscaler
}, nil
Expand Down

0 comments on commit 813140e

Please sign in to comment.