Skip to content

Commit

Permalink
Merge pull request #8856 from rifelpet/machine-types-2
Browse files Browse the repository at this point in the history
Use ec2.DescribeInstanceTypes for machine type info
  • Loading branch information
k8s-ci-robot authored Jun 9, 2020
2 parents 7a5dd52 + d923354 commit d5b8e6c
Show file tree
Hide file tree
Showing 29 changed files with 234 additions and 2,956 deletions.
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -829,13 +829,6 @@ build-docs-netlify:
pip install -r ${KOPS_ROOT}/images/mkdocs/requirements.txt
mkdocs build

# Update machine_types.go
.PHONY: update-machine-types
update-machine-types:
go build -o hack/machine_types/machine_types ${KOPS_ROOT}/hack/machine_types/
hack/machine_types/machine_types --out upup/pkg/fi/cloudup/awsup/machine_types.go
go fmt upup/pkg/fi/cloudup/awsup/machine_types.go

#-----------------------------------------------------------
# development targets

Expand Down
5 changes: 5 additions & 0 deletions cloudmock/aws/mockec2/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@ func (m *MockEC2) DescribeInstancesPages(request *ec2.DescribeInstancesInput, ca
func (m *MockEC2) DescribeInstancesPagesWithContext(aws.Context, *ec2.DescribeInstancesInput, func(*ec2.DescribeInstancesOutput, bool) bool, ...request.Option) error {
panic("Not implemented")
}

func (m *MockEC2) DescribeInstanceTypes(*ec2.DescribeInstanceTypesInput) (*ec2.DescribeInstanceTypesOutput, error) {
klog.Warningf("MockEc2::DescribeInstanceTypes is stub-implemented")
return &ec2.DescribeInstanceTypesOutput{}, nil
}
4 changes: 2 additions & 2 deletions cmd/kops/create_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ func RunCreateCluster(ctx context.Context, f *util.Factory, out io.Writer, c *Cr
}

strict := false
err = validation.DeepValidate(cluster, instanceGroups, strict)
err = validation.DeepValidate(cluster, instanceGroups, strict, nil)
if err != nil {
return err
}
Expand All @@ -1255,7 +1255,7 @@ func RunCreateCluster(ctx context.Context, f *util.Factory, out io.Writer, c *Cr
fullInstanceGroups = append(fullInstanceGroups, fullGroup)
}

err = validation.DeepValidate(fullCluster, fullInstanceGroups, true)
err = validation.DeepValidate(fullCluster, fullInstanceGroups, true, nil)
if err != nil {
return err
}
Expand Down
7 changes: 6 additions & 1 deletion cmd/kops/create_ig.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,12 @@ func RunCreateInstanceGroup(ctx context.Context, f *util.Factory, cmd *cobra.Com
return fmt.Errorf("unexpected object type: %T", obj)
}

err = validation.CrossValidateInstanceGroup(group, cluster).ToAggregate()
cloud, err := cloudup.BuildCloud(cluster)
if err != nil {
return err
}

err = validation.CrossValidateInstanceGroup(group, cluster, cloud).ToAggregate()
if err != nil {
return err
}
Expand Down
7 changes: 6 additions & 1 deletion cmd/kops/edit_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,12 @@ func RunEditCluster(ctx context.Context, f *util.Factory, cmd *cobra.Command, ar
continue
}

err = validation.DeepValidate(fullCluster, instanceGroups, true)
cloud, err := cloudup.BuildCloud(fullCluster)
if err != nil {
return err
}

err = validation.DeepValidate(fullCluster, instanceGroups, true, cloud)
if err != nil {
results = editResults{
file: file,
Expand Down
7 changes: 6 additions & 1 deletion cmd/kops/edit_instancegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@ func RunEditInstanceGroup(ctx context.Context, f *util.Factory, cmd *cobra.Comma
return err
}

err = validation.CrossValidateInstanceGroup(fullGroup, fullCluster).ToAggregate()
cloud, err := cloudup.BuildCloud(fullCluster)
if err != nil {
return err
}

err = validation.CrossValidateInstanceGroup(fullGroup, fullCluster, cloud).ToAggregate()
if err != nil {
return err
}
Expand Down
2 changes: 2 additions & 0 deletions docs/releases/1.19-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

# Significant changes

* Clusters using the Amazon VPC CNI provider now perform an `ec2.DescribeInstanceTypes` call at instance launch time. In large clusters or AWS accounts this may lead to API throttling which could delay node readiness. If this becomes a problem please open a GitHub issue.

# Breaking changes

* Support for Kubernetes 1.9 and 1.10 has been removed.
Expand Down
1 change: 0 additions & 1 deletion hack/.packages
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ k8s.io/kops/dnsprovider/pkg/dnsprovider/providers/openstack/designate
k8s.io/kops/dnsprovider/pkg/dnsprovider/rrstype
k8s.io/kops/dnsprovider/pkg/dnsprovider/tests
k8s.io/kops/examples/kops-api-example
k8s.io/kops/hack/machine_types
k8s.io/kops/kube-discovery/cmd/kube-discovery
k8s.io/kops/node-authorizer/cmd/node-authorizer
k8s.io/kops/node-authorizer/pkg/authorizers/alwaysallow
Expand Down
1 change: 0 additions & 1 deletion hack/machine_types/.gitignore

This file was deleted.

21 changes: 0 additions & 21 deletions hack/machine_types/BUILD.bazel

This file was deleted.

19 changes: 0 additions & 19 deletions hack/machine_types/README.md

This file was deleted.

Loading

0 comments on commit d5b8e6c

Please sign in to comment.