Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate AWS machine type on cluster ig update #3257

Merged

Conversation

KashifSaadat
Copy link
Contributor

Fixes #3252

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 23, 2017
@KashifSaadat
Copy link
Contributor Author

/assign @chrislovecnm

Copy link
Contributor

@chrislovecnm chrislovecnm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question about GCE

func awsValidateMachineType(fieldPath *field.Path, machineType string) field.ErrorList {
allErrs := field.ErrorList{}

if machineType != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! But can we only run this when the cluster is on aws? I think this will bust GCE and vsphere ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh and should machine type ever == ""?

@KashifSaadat
Copy link
Contributor Author

Hey @chrislovecnm, cheers for the feedback!

The machineType != "" was included due to a few test failures (aws_test unit tests and create_cluster_integration_test). The unit test files are easy to correct (just include machine type in the instance group spec that's passed to the validation function).
The integration tests all pass valid Cluster Spec config files (including machine type), but the failures appear to be on the options.yaml which I don't think is right?

--- FAIL: TestCreateClusterMinimal (1.29s)
	create_cluster_integration_test.go:121: error running create cluster (../../tests/integration/create_cluster/minimal/options.yaml): master-us-test-1a.spec.machineType: Invalid value: "": machine type specified is invalid

The awsValidateMachineType function is called by awsValidateInstanceGroup, which is only called when the cloud provider is aws: https://github.com/kubernetes/kops/blob/master/pkg/apis/kops/validation/legacy.go#L524-L530
There's currently no validation steps implemented for other cloud providers but would be good to support that in the future.

@justinsb
Copy link
Member

I think we can add additional validation for an empty machineType later.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 24, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: KashifSaadat, justinsb

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 24, 2017
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 74bad14 into kubernetes:master Aug 24, 2017
@KashifSaadat KashifSaadat deleted the validate-aws-machine-type branch August 25, 2017 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants