-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 static host user proto defs #44610
Conversation
@@ -0,0 +1,44 @@ | |||
syntax = "proto3"; | |||
|
|||
package teleport.statichostuser.v1; |
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.
What do you think about generalizing the package a bit to encompass all of auto user provisioning?
package teleport.statichostuser.v1; | |
package teleport.userprovisioning.v1; |
rpc CreateStaticHostUser(CreateStaticHostUserRequest) returns (CreateStaticHostUserResponse); | ||
// UpdateStaticHostUser updates an existing static host user. | ||
rpc UpdateStaticHostUser(UpdateStaticHostUserRequest) returns (UpdateStaticHostUserResponse); | ||
// UpsertStaticHostUser creates a new static host user or forcefully updates an existing static host user. | ||
rpc UpsertStaticHostUser(UpsertStaticHostUserRequest) returns (UpsertStaticHostUserResponse); |
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.
https://github.com/gravitational/teleport/blob/master/rfd/0153-resource-guidelines.md#create
https://github.com/gravitational/teleport/blob/master/rfd/0153-resource-guidelines.md#update
https://github.com/gravitational/teleport/blob/master/rfd/0153-resource-guidelines.md#upsert
rpc CreateStaticHostUser(CreateStaticHostUserRequest) returns (CreateStaticHostUserResponse); | |
// UpdateStaticHostUser updates an existing static host user. | |
rpc UpdateStaticHostUser(UpdateStaticHostUserRequest) returns (UpdateStaticHostUserResponse); | |
// UpsertStaticHostUser creates a new static host user or forcefully updates an existing static host user. | |
rpc UpsertStaticHostUser(UpsertStaticHostUserRequest) returns (UpsertStaticHostUserResponse); | |
rpc CreateStaticHostUser(CreateStaticHostUserRequest) returns (StaticHostUser); | |
// UpdateStaticHostUser updates an existing static host user. | |
rpc UpdateStaticHostUser(UpdateStaticHostUserRequest) returns (StaticHostUser); | |
// UpsertStaticHostUser creates a new static host user or forcefully updates an existing static host user. | |
rpc UpsertStaticHostUser(UpsertStaticHostUserRequest) returns (StaticHostUser); |
if u.Spec.NodeLabels != nil { | ||
for key, value := range u.Spec.NodeLabels.Values { | ||
if key == types.Wildcard && !(len(value.Values) == 1 && value.Values[0] == types.Wildcard) { | ||
return trace.BadParameter("selector *:<val> is not supported") | ||
} | ||
} | ||
} |
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 validation appears to be much more lax than the validation of equivalent fields of a role.
https://github.com/gravitational/teleport/blob/master/lib/services/role.go#L251
https://github.com/gravitational/teleport/blob/master/lib/services/role.go#L334-L348
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.
Trait templating doesn't apply here because when we create a host user, there won't be a user to pull traits from. I tried adding the expression validation, but it would require moving a LOT of stuff from lib/utils
to api/utils
and I think it would be much simpler to just do that in lib/services
like we do for roles.
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 it might make more sense for validation logic to be moved out of api and into a place that can make use of lib/utils in that case. If you want to omit it here and move it to lib/services or similar in a future PR that's fine with me.
// node_labels is a map of node labels (used to dynamically grant access to | ||
// nodes). |
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.
Here and below, update the comment since the labels here are used to select nodes, not to grant access to nodes.
// node_labels is a map of node labels (used to dynamically grant access to | |
// nodes). | |
// node_labels is a map of node labels that will create a user | |
// for this resource |
This change adds the proto definition for the static host user resource and its gRPC service.
fa529da
to
a134b2d
Compare
This change adds the proto definition for the static host user resource and its gRPC service.
This change adds the proto definition for the static host user resource (RFD 175) and its gRPC service.
Part of #42712.