diff --git a/pkg/cloudprovider/cloudprovider.go b/pkg/cloudprovider/cloudprovider.go index 4684ccdf6c30..aa62f17b54aa 100644 --- a/pkg/cloudprovider/cloudprovider.go +++ b/pkg/cloudprovider/cloudprovider.go @@ -87,6 +87,7 @@ func (c *CloudProvider) Create(ctx context.Context, nodeClaim *corev1beta1.NodeC return nil, cloudprovider.NewInsufficientCapacityError(fmt.Errorf("resolving node class, %w", err)) } instanceTypes, err := c.resolveInstanceTypes(ctx, nodeClaim, nodeClass) + logging.FromContext(ctx).With("instanceTypes", utils.PrettySlice(utils.GetInstanceNameFromInstanceType(instanceTypes), 5)).Debugf("resolved instance types from nodeclass") if err != nil { return nil, fmt.Errorf("resolving instance types, %w", err) } diff --git a/pkg/providers/instance/instance.go b/pkg/providers/instance/instance.go index 46b0d57a570e..405c7af529ae 100644 --- a/pkg/providers/instance/instance.go +++ b/pkg/providers/instance/instance.go @@ -86,6 +86,7 @@ func (p *Provider) Create(ctx context.Context, nodeClass *v1beta1.EC2NodeClass, // Only filter the instances if there are no minValues in the requirement. if !schedulingRequirements.HasMinValues() { instanceTypes = p.filterInstanceTypes(nodeClaim, instanceTypes) + logging.FromContext(ctx).With("instanceTypes", utils.PrettySlice(utils.GetInstanceNameFromInstanceType(instanceTypes), 5)).Debugf("filtered instance types after removing exotic types and spot instance types costlier than cheapest on-demand") } tags := getTags(ctx, nodeClass, nodeClaim) fleetInstance, err := p.launchInstance(ctx, nodeClass, nodeClaim, instanceTypes, tags) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 2dc741e87e3d..b4e3100c21f9 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -19,6 +19,8 @@ import ( "regexp" "strings" + "sigs.k8s.io/karpenter/pkg/cloudprovider" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" "github.com/samber/lo" @@ -66,3 +68,11 @@ func PrettySlice[T any](s []T, maxItems int) string { } return sb.String() } + +func GetInstanceNameFromInstanceType(instanceTypes []*cloudprovider.InstanceType) []string { + var names []string + for _, val := range instanceTypes { + names = append(names, val.Name) + } + return names +}