integrations/operator: propagate revision + fix tests#34265
integrations/operator: propagate revision + fix tests#34265
Conversation
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
94d04e3 to
f837efe
Compare
There was a problem hiding this comment.
Shouldn't we use Upsert instead of create/update?
Upsert doesn't care about the revision which is more or less what we need here
There was a problem hiding this comment.
I asked @rosstimothy, and we likely want to propagate revision even when Upserting. IIRC Update and Upsert have different behaviours for User, and both endpoints are not implemented for all resources. We might want to support both endpoints with the same generic controller.
I don't see an issue with propagating the revision. Worst case scenario, it is not used. In the best case scenario, this prevents a conflict. For some resources we are propagating information from the existing resource, the whole process is not 100% stateless. This happens in the optional Mutate() function. For example, the "CreatedBy" field of the user spec. In this case, opportunistic locking makes sense.
There was a problem hiding this comment.
Using Upsert directly could lead to the operator overwriting any manual changes made to a resource, I'm not sure how likely that scenario is. It is generally preferred to use Create/Update where possible.
There was a problem hiding this comment.
I think we must improve documentation.
When using IaC tools, it's not clear if users can change using other tools (web, tctl).
If they can't change, then the upsert is, imo, a better approach.
Even if they change the resource just to test something out, they can always go back to IaC flow.
If they can change the resource, the update will fail and they need to manually change the resource to merge any potential diff.
Have we decided on this?
There was a problem hiding this comment.
If they can change the resource, the update will fail and they need to manually change the resource to merge any potential diff.
With the current implementation, if a conflict happens, the operator update/upsert will fail and the resource reconciliation will be requeued. The operator will perform the update in the next reconciliation cycle, a few milliseconds later. The second reconciliation should succeed.
When using IaC tools, it's not clear if users can change using other tools (web, tctl).
We do have an origin label we are not using enough. The UI/tctl could display a warning if you are attempting to edit a resource whose origin is IaC. Things become even more confusing with resources like AccessLists where some of the information can and should be edited by users in the UI even if some parts of the resource are managed via IaC.
If they can't change, then the upsert is, imo, a better approach.
Even if they change the resource just to test something out, they can always go back to IaC flow.
AFAIK, if you do a change, TF/operator will erase it the next time, which is the intended behaviour.
My biggest issue today is not caused by users editing resources managed by IaC but caused by Teleport updating fields in the spec (which should not happen according to Kube's design, the status is here for computed values). Regardless if we use update or upsert, we need to propagate those dynamic fields that appear in the spec, or else we lose information.
Have we decided on this?
I don't think and can create an issue for this. AFAIK this PR doesn't change the current state of things, it only propagates the revision.
69d626c to
bb54a43
Compare
|
@hugoShaka See the table below for backport results.
|
Depends on #34263
This PR does two things:
Eventually)