Skip to content

Commit c9685d3

Browse files
authored
Merge pull request #393 from containermom/fix/vpc-primary-attachment-name-length
fix(vpc) primary attachment name length
2 parents a4f3d70 + 965934d commit c9685d3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/providers/vpc/instance/provider.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,14 @@ func (p *VPCInstanceProvider) Create(ctx context.Context, nodeClaim *karpv1.Node
362362
}
363363

364364
// Create primary network attachment with VNI
365+
// VPC resource names have a max length of 63 characters
366+
// The suffix "-primary" is 8 chars, leaving 55 chars for the nodeclaim name
367+
attachmentName := nodeClaim.Name
368+
if len(attachmentName) > 55 {
369+
attachmentName = attachmentName[:55]
370+
}
365371
primaryNetworkAttachment := &vpcv1.InstanceNetworkAttachmentPrototype{
366-
Name: &[]string{fmt.Sprintf("%s-primary-attachment", nodeClaim.Name)}[0],
372+
Name: &[]string{fmt.Sprintf("%s-primary", attachmentName)}[0],
367373
VirtualNetworkInterface: vniPrototype,
368374
}
369375

0 commit comments

Comments
 (0)