-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add set instancegroup
command
#10593
Conversation
This change adds a new command and functionality for updating instance group configuration via command line arguments. This behavior mimics the `set cluster` command.
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 Once the patch is verified, the new status will be reflected by the 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. |
/ok-to-test |
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 |
There was a problem hiding this comment.
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:
kops set instancegroup k8s-cluster.example.com spec.maxSize=4 | |
kops set instancegroup --name k8s-cluster.example.com nodes spec.maxSize=4 |
There was a problem hiding this comment.
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.
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 | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
kops/cmd/kops/edit_instancegroup.go
Lines 167 to 183 in 97c40a3
// 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
There was a problem hiding this comment.
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.
Looks good, thanks! /lgtm |
[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 |
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.