Skip to content

Commit

Permalink
Merge pull request #7785 from justinsb/automated-cherry-pick-of-#7539…
Browse files Browse the repository at this point in the history
…-origin-release-1.15

Automated cherry pick of #7539: fix(nodeup): miscalculated `max-pods` when using
  • Loading branch information
k8s-ci-robot authored Oct 14, 2019
2 parents d60f665 + 49c016d commit 2d09f53
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion nodeup/pkg/model/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,18 @@ func (b *KubeletBuilder) buildKubeletConfigSpec() (*kops.KubeletConfigSpec, erro
}

if b.Cluster.Spec.Networking != nil && b.Cluster.Spec.Networking.AmazonVPC != nil {
instanceType, err := awsup.GetMachineTypeInfo(strings.Split(b.InstanceGroup.Spec.MachineType, ",")[0])
sess := session.Must(session.NewSession())
metadata := ec2metadata.New(sess)

// Get the actual instance type by querying the EC2 instance metadata service.
instanceTypeName, err := metadata.GetMetadata("instance-type")
if err != nil {
// Otherwise, fall back to the Instance Group spec.
instanceTypeName = strings.Split(b.InstanceGroup.Spec.MachineType, ",")[0]
}

// Get the instance type's detailed information.
instanceType, err := awsup.GetMachineTypeInfo(instanceTypeName)
if err != nil {
return c, err
}
Expand Down

0 comments on commit 2d09f53

Please sign in to comment.