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

Add set instancegroup command #10593

Merged

Conversation

gabrieljackson
Copy link
Contributor

@gabrieljackson gabrieljackson commented Jan 15, 2021

This change adds a new command and functionality for updating
instance group configuration via command line arguments. This
behavior mimics the set cluster command.

This is a follow-up to #8531 and addresses #7976

This implements the original behavior using the new reflect-based
logic. I opted to open a new PR as the original was outdated and
figured this would help with reviews.

This change adds a new command and functionality for updating
instance group configuration via command line arguments. This
behavior mimics the `set cluster` command.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 15, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @gabrieljackson. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 15, 2021
@rifelpet
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 16, 2021
@gabrieljackson
Copy link
Contributor Author

Hey there, just checking in on this to see if anything else is needed from me to begin reviewing. Let me know if that is the case. Thanks!

cmd/kops/set.go Outdated
@@ -33,7 +33,8 @@ var (

setExample = templates.Examples(i18n.T(`
# Set cluster to run kubernetes version 1.17.0
kops set cluster k8s-cluster.example.com spec.kubernetesVersion=1.17.0
kops set cluster k8s-cluster.example.com spec.kubernetesVersion=1.17.0
kops set instancegroup k8s-cluster.example.com spec.maxSize=4
Copy link
Member

Choose a reason for hiding this comment

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

this will require the cli docs to be regenerated:

Suggested change
kops set instancegroup k8s-cluster.example.com spec.maxSize=4
kops set instancegroup --name k8s-cluster.example.com nodes spec.maxSize=4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, thanks. I had this changed locally, but missed including it in the branch. Should be fixed now.

Comment on lines +77 to +86
err = cloudup.PerformAssignments(cluster, cloud)
if err != nil {
return fmt.Errorf("error populating configuration: %v", err)
}

assetBuilder := assets.NewAssetBuilder(cluster, "")
fullCluster, err := cloudup.PopulateClusterSpec(clientset, cluster, cloud, assetBuilder)
if err != nil {
return err
}
Copy link
Member

Choose a reason for hiding this comment

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

I think these can be removed because they're only operating on the Cluster object rather than the InstanceGroup we're modifying.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am pretty sure I need to keep this if I am going to do DeepValidate in the following lines. If this isn't the correct method of checking the resources though I can change it, but I didn't see another similar validation method for just instancegroups.

Copy link
Member

Choose a reason for hiding this comment

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

Ah you're right, I missed that. thanks! I think in this case we can follow what kops edit instancegroup does which is largely the same:

// We need the full cluster spec to perform deep validation
// Note that we don't write it back though
err = cloudup.PerformAssignments(cluster, cloud)
if err != nil {
return fmt.Errorf("error populating configuration: %v", err)
}
assetBuilder := assets.NewAssetBuilder(cluster, "")
fullCluster, err := cloudup.PopulateClusterSpec(clientset, cluster, cloud, assetBuilder)
if err != nil {
return err
}
err = validation.CrossValidateInstanceGroup(fullGroup, fullCluster, cloud).ToAggregate()
if err != nil {
return err
}

but it only validates with CrossValidateInstanceGroup rather than DeepValidate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the pointer. I modified the validation call to use the same one as you referenced.

@rifelpet
Copy link
Member

Looks good, thanks!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 25, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gabrieljackson, rifelpet

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 25, 2021
@k8s-ci-robot k8s-ci-robot merged commit f055dd5 into kubernetes:master Jan 25, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.20 milestone Jan 25, 2021
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. area/documentation 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants