Skip to content

Commit

Permalink
Fix nil handling in NodeGroupForNode wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Omer Aplatony <[email protected]>
  • Loading branch information
omerap12 committed Oct 3, 2024
1 parent f79e8d4 commit de16a92
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 de16a92

Please sign in to comment.