-
Notifications
You must be signed in to change notification settings - Fork 20
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
instancepool: add min available support and Migrate to egoscale v3 #629
instancepool: add min available support and Migrate to egoscale v3 #629
Conversation
1b025df
to
1a06458
Compare
cmd/instance_pool_update.go
Outdated
Name string `cli-short:"n" cli-usage:"Instance Pool name"` | ||
PrivateNetworks []string `cli-flag:"private-network" cli-usage:"managed Compute instances Private Network NAME|ID (can be specified multiple times)"` | ||
SSHKey string `cli-flag:"ssh-key" cli-usage:"SSH key to deploy on managed Compute instances"` | ||
SSHKey string `cli-flag:"ssh-key" cli-usage:"SSH key to deploy on managed Compute instances (can be specified multiple times)"` |
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.
missing an s after SSHKey
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 one I kept, becuase, I was not sure if to make it more than ssh key or only one, usually user update more than ssk keys?
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.
Similar to how it was done in #620, it should be SSHKeys
and type is []string]
. Then instead of setting updateReq.SSHKey
(which accepts one SSH key), you set updateReq.SSHKeys
.
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.
Actually ignore my previous comment. This kind of change is out of scope of this PR, let's keep it focused instead. So just remove (can be specified multiple times)
suffix in the flag usage as it is incorrect (you can only specify a single SSH key with this implementation).
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.
ack!
cmd/instance_pool_create.go
Outdated
PrivateNetworks []string `cli-flag:"private-network" cli-usage:"managed Compute instances Private Network NAME|ID (can be specified multiple times)"` | ||
SSHKey string `cli-flag:"ssh-key" cli-usage:"SSH key to deploy on managed Compute instances"` | ||
SSHKeys []string `cli-flag:"ssh-key" cli-usage:"SSH key to deploy on managed Compute instances (can be specified multiple times)"` |
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.
Can you explain how this change is relevant to this PR?
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 made it based on similar migration to v3 made by @pierre-emmanuelJ this was my reference: cc09480#:~:text=SSHKeys%20%20%20%20%20%20%20%20%20%20%20%20%5B%5Dstring%20%20%20%20%20%20%20%20%20%20%60cli%2Dflag%3A%22ssh%2Dkey%22%20cli%2Dusage%3A%22SSH%20key%20to%20deploy%20on%20the%20instance%20(can%20be%20specified%20multiple%20times)%22%60
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.
See #629 (comment)
12c8dc2
to
20be0f7
Compare
Thanks, @elkezza, for your effort on this change. I fixed Elastic IP and Instance Type. |
return fmt.Errorf("error listing instance type: %w", err) | ||
} | ||
|
||
// c.InstanceType is never empty |
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.
To be checked if It's the case like Instance
@pierre-emmanuelJ big thanks for the new improvement in the code, below are the test regarding these changes : ) ❯ go run . compute instance-pool update my-pool --elastic-ip 85.217.175.225 --elastic-ip 85.217.174.116
✔ Updating Instance Pool "my-pool"... 0s
┼──────────────────────┼──────────────────────────────────────┼
│ INSTANCE POOL │ │
┼──────────────────────┼──────────────────────────────────────┼
│ ID │ 8fa38a23-4891-4868-b39b-f55a7fe567fb │
│ Name │ my-pool │
│ Description │ │
│ Instance Type │ standard.medium │
│ Template │ Linux Ubuntu 22.04 LTS 64-bit │
│ Zone │ at-vie-1 │
│ Anti-Affinity Groups │ n/a │
│ Security Groups │ n/a │
│ Private Networks │ n/a │
│ Elastic IPs │ 85.217.175.225 │
│ │ 85.217.174.116 │
│ IPv6 │ false │
│ SSH Key │ - │
│ Size │ 4 │
│ Disk Size │ 50 GiB │
│ Instance Prefix │ pool │
│ State │ updating │
│ Labels │ n/a │
│ Instances │ pool-8fa38-geuxj │
│ │ pool-8fa38-czrfn │
│ │ pool-8fa38-iglia │
│ │ pool-8fa38-hjapn │
┼──────────────────────┼──────────────────────────────────────┼
❯ go run . compute instance-pool update my-pool --elastic-ip 85.217.175.225 --elastic-ip 85.217.232.33
warning: Elastic IP 85.217.232.33 not found.
✔ Updating Instance Pool "my-pool"... 0s
┼──────────────────────┼──────────────────────────────────────┼
│ INSTANCE POOL │ │
┼──────────────────────┼──────────────────────────────────────┼
│ ID │ 8fa38a23-4891-4868-b39b-f55a7fe567fb │
│ Name │ my-pool │
│ Description │ │
│ Instance Type │ standard.medium │
│ Template │ Linux Ubuntu 22.04 LTS 64-bit │
│ Zone │ at-vie-1 │
│ Anti-Affinity Groups │ n/a │
│ Security Groups │ n/a │
│ Private Networks │ n/a │
│ Elastic IPs │ 85.217.175.225 │
│ IPv6 │ false │
│ SSH Key │ - │
│ Size │ 4 │
│ Disk Size │ 50 GiB │
│ Instance Prefix │ pool │
│ State │ updating │
│ Labels │ n/a │
│ Instances │ pool-8fa38-geuxj │
│ │ pool-8fa38-czrfn │
│ │ pool-8fa38-iglia │
│ │ pool-8fa38-hjapn │
┼──────────────────────┼──────────────────────────────────────┼
❯ go run . compute instance-pool update my-pool --instance-type standard.micro
✔ Updating Instance Pool "my-pool"... 0s
┼──────────────────────┼──────────────────────────────────────┼
│ INSTANCE POOL │ │
┼──────────────────────┼──────────────────────────────────────┼
│ ID │ 8fa38a23-4891-4868-b39b-f55a7fe567fb │
│ Name │ my-pool │
│ Description │ │
│ Instance Type │ standard.micro │
│ Template │ Linux Ubuntu 22.04 LTS 64-bit │
│ Zone │ at-vie-1 │
│ Anti-Affinity Groups │ n/a │
│ Security Groups │ n/a │
│ Private Networks │ n/a │
│ Elastic IPs │ n/a │
│ IPv6 │ false │
│ SSH Key │ - │
│ Size │ 4 │
│ Disk Size │ 50 GiB │
│ Instance Prefix │ pool │
│ State │ updating │
│ Labels │ n/a │
│ Instances │ pool-8fa38-geuxj │
│ │ pool-8fa38-czrfn │
│ │ pool-8fa38-iglia │
│ │ pool-8fa38-hjapn │
┼──────────────────────┼──────────────────────────────────────┼
|
Signed-off-by: Pierre-Emmanuel Jacquier <[email protected]>
Signed-off-by: Pierre-Emmanuel Jacquier <[email protected]>
Signed-off-by: Pierre-Emmanuel Jacquier <[email protected]>
Signed-off-by: Pierre-Emmanuel Jacquier <[email protected]>
a08634c
to
e37b482
Compare
) # Description Added min available to both instance_pool_create.go and instance_pool_update.go and Migrate to egoscale v3k, however, there are some parts need to be reviewed like InstanceType in instance_pool_update.go which I was not sure how to be correctly implemented in egoscale v3. ## Checklist (For exoscale contributors) * [ ] Changelog updated (under *Unreleased* block) * [ ] Testing ## Testing I test to create new instance pool with min available 3 then I updated see the bellow output of the tests: ```bash go run . compute instance-pool create my-pool --size 4 --min-available 3 ✔ Creating Instance Pool "my-pool"... 24s ┼──────────────────────┼──────────────────────────────────────┼ │ INSTANCE POOL │ │ ┼──────────────────────┼──────────────────────────────────────┼ │ ID │ 9c52ad25-9898-48c1-be9a-f90ce13575c2 │ │ Name │ my-pool │ │ Description │ │ │ Instance Type │ standard.medium │ │ Template │ Linux Ubuntu 22.04 LTS 64-bit │ │ Zone │ at-vie-1 │ │ Anti-Affinity Groups │ n/a │ │ Security Groups │ n/a │ │ Private Networks │ n/a │ │ Elastic IPs │ n/a │ │ IPv6 │ false │ │ SSH Key │ - │ │ Size │ 4 │ │ Disk Size │ 50 GiB │ │ Instance Prefix │ pool │ │ State │ scaling-up │ │ Labels │ n/a │ │ Instances │ pool-9c52a-dqhmy │ │ │ pool-9c52a-pkwqs │ │ │ pool-9c52a-iepbx │ │ │ pool-9c52a-staqe │ ┼──────────────────────┼──────────────────────────────────────┼ go run . compute instance-pool update my-pool --min-available 4 ✔ Updating Instance Pool "my-pool"... 0s ┼──────────────────────┼──────────────────────────────────────┼ │ INSTANCE POOL │ │ ┼──────────────────────┼──────────────────────────────────────┼ │ ID │ 9c52ad25-9898-48c1-be9a-f90ce13575c2 │ │ Name │ my-pool │ │ Description │ │ │ Instance Type │ standard.medium │ │ Template │ Linux Ubuntu 22.04 LTS 64-bit │ │ Zone │ at-vie-1 │ │ Anti-Affinity Groups │ n/a │ │ Security Groups │ n/a │ │ Private Networks │ n/a │ │ Elastic IPs │ n/a │ │ IPv6 │ false │ │ SSH Key │ - │ │ Size │ 4 │ │ Disk Size │ 50 GiB │ │ Instance Prefix │ pool │ │ State │ updating │ │ Labels │ n/a │ │ Instances │ pool-9c52a-dqhmy │ │ │ pool-9c52a-pkwqs │ │ │ pool-9c52a-iepbx │ │ │ pool-9c52a-staqe │ ┼──────────────────────┼──────────────────────────────────────┼ ``` --------- Signed-off-by: Pierre-Emmanuel Jacquier <[email protected]> Co-authored-by: Pierre-Emmanuel Jacquier <[email protected]>
Description
Added min available to both instance_pool_create.go and instance_pool_update.go and Migrate to egoscale v3k, however, there are some parts need to be reviewed like InstanceType in instance_pool_update.go which I was not sure how to be correctly implemented in egoscale v3.
Checklist
(For exoscale contributors)
Testing
I test to create new instance pool with min available 3 then I updated see the bellow output of the tests: