DiscoveryConfig: init service and add resource to tctl#32399
DiscoveryConfig: init service and add resource to tctl#32399marcoandredinis merged 4 commits intomasterfrom
tctl#32399Conversation
4bd0512 to
09ada06
Compare
tctltctl
a7e849e to
b3afbec
Compare
09ada06 to
aa4b7a9
Compare
6dfa8be to
497c64f
Compare
There was a problem hiding this comment.
This is a terrible approach to upsert, and it's not really justifiable for a brand new resource type IMO. Can we add a real upsert operation, outright drop the implementation of UpdateDiscoveryConfig in v14 and only support it in v15+ as a conditional update operation instead?
There was a problem hiding this comment.
I've just added the upsert method.
outright drop the implementation of UpdateDiscoveryConfig in v14 and only support it in v15+ as a conditional update operation instead?
Sorry, not sure I followed.
Are you suggesting to remove the UpdateDiscoveryConfig in v15/master but keep it in v14?
But then clients using v14 will hit the UpdateDiscoveryConfig and it will fail
Could you please clear this up?
(maybe by v15+ you meant v16 and ownards, not sure if your + was inclusive)
This resource is not yet in use, but we should be careful anyway because it was backported to v14
There was a problem hiding this comment.
Since v14.0.1 doesn't have an implementation for UpdateDiscoveryConfig yet, I propose that we remove UpdateDiscoveryConfig from branch/v14 and leave it as a not implemented RPC, add (and backport) UpsertDiscoveryConfig from this PR and use it in v14 clients, then in master and branch/v15 we can implement it as a conditional update operation.
There was a problem hiding this comment.
remove UpdateDiscoveryConfig from branch/v14 and leave it as a not implemented RPC
It might get released before we are able to merge the backport.
I think, the Update method is the intended one for 99% of the cases.
That also holds true when we implement the condition updates/revisions.
There was a problem hiding this comment.
What is "write-if-any-exists" useful for?
There was a problem hiding this comment.
Well, honestly the only other client (for now) is going to be the WebAPI
I'm not sure we need it there.
This should ease the path for the revision logic we intend to implement later.
I would rather not remove it.
497c64f to
53736e0
Compare
7fad84d to
b809d6d
Compare
|
@fheinecke Can you please take a look? |
2a3c17c to
5af94ee
Compare
There was a problem hiding this comment.
Will this require optimistic locking?
There was a problem hiding this comment.
I think all resources will use it.
This is being used in tctl create -f and cache maintenance.
There was a problem hiding this comment.
Upsert is always unconditional - we considered adding a primitive backend operation for "write if item doesn't exist or if it exists and it matches this revision" but we couldn't really think of uses for it. 🤷
There was a problem hiding this comment.
If you meant in general then yeah, unfortunately we have an implemented and released UpdateDiscoveryConfig that no one should use so the conditionally updating RPC used by tctl edit will probably be UpdateDiscoveryConfigV2 or something like that. 🥲
There was a problem hiding this comment.
I meant the Update endpoint but github doesn't let me add the comment to the correct place
There was a problem hiding this comment.
I'm not sure I'm following here.
tctl edit should use the UpdateDiscoveryConfig which conditionally updates the resource.
It's not doing that right now, but the flow is there:
teleport/tool/tctl/common/edit_command.go
Lines 159 to 172 in 435e7d4
This PR starts the DiscoveryConfig service in gRPC server and allows `tctl` to interact with those records. It also adds access to the `editor` role. Users should be able to RW any DiscoveryConfig. DiscoveryService should be able to watch those resources, so that it can act upon any changes.
5af94ee to
972995d
Compare
|
@marcoandredinis See the table below for backport results.
|
* DiscoveryConfig: init service and add it to `tctl` This PR starts the DiscoveryConfig service in gRPC server and allows `tctl` to interact with those records. It also adds access to the `editor` role. Users should be able to RW any DiscoveryConfig. DiscoveryService should be able to watch those resources, so that it can act upon any changes. * add revision * add upsert method * improve tctl -f command
…3289) * DiscoveryConfig: init service and add it to `tctl` This PR starts the DiscoveryConfig service in gRPC server and allows `tctl` to interact with those records. It also adds access to the `editor` role. Users should be able to RW any DiscoveryConfig. DiscoveryService should be able to watch those resources, so that it can act upon any changes. * add revision * add upsert method * improve tctl -f command
…3289) * DiscoveryConfig: init service and add it to `tctl` This PR starts the DiscoveryConfig service in gRPC server and allows `tctl` to interact with those records. It also adds access to the `editor` role. Users should be able to RW any DiscoveryConfig. DiscoveryService should be able to watch those resources, so that it can act upon any changes. * add revision * add upsert method * improve tctl -f command
Context: #25494
This PR starts the DiscoveryConfig service in gRPC server and allows
tctlto interact with those records.It also adds access to the
editorrole.Users should be able to RW any DiscoveryConfig.
DiscoveryService should be able to watch those resources, so that it can act upon any changes.