-
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 multiple SSH keys support for Hetzner #14058
Conversation
@@ -33,6 +34,24 @@ type ServerGroupModelBuilder struct { | |||
var _ fi.ModelBuilder = &ServerGroupModelBuilder{} | |||
|
|||
func (b *ServerGroupModelBuilder) Build(c *fi.ModelBuilderContext) error { | |||
var sshkeyTasks []*hetznertasks.SSHKey | |||
for _, sshkey := range b.SSHPublicKeys { |
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.
Nit: If you have two ServerGroupModelBuilders, with overlapping SSHPublicKeys, this may result in duplicate tasks. So you might want to consider keeping the dedicated SSHPublicKeyBuilder task, or using EnsureTask (which allows for duplicate creation if they are identical, but is a bit more hacky). But not a blocker!
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.
The ServerGroupModelBuilder creates servers for all instance groups, so there is no need for using EnsureTask at the moment.
@@ -33,7 +33,7 @@ import ( | |||
type ServerGroup struct { | |||
Name *string | |||
Lifecycle fi.Lifecycle | |||
SSHKey *SSHKey | |||
SSHKeys []*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.
Do we set this anywhere? I didn't see if in the diff, which is surprising (?)
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.
We don't set this anywhere, except for model. They are used only when creating a new server and otherwise ignored.
Hetzner Cloud API doesn't return the keys for a running server.
/approve Looks good to me, but you might want to keep the SSH-specific builder to avoid duplicate tasks. So I'll add a hold but feel free to cancel the hold if the potentially duplicate tasks aren't a problem in practice! /hold |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justinsb 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 |
I need an easy way to access the SSHKey tasks. As they are only used for creating servers, seems the best approach for now. /hold cancel |
Rebasing to get over merge conflict with #14034. |
/lgtm |
No description provided.