Disable the client cache for Workspace lookups #253
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of your changes
Fixes #243 (sort of)
This disables the cache used when getting Workspace resources at the start of each reconciliation to avoid a potential concurrent map iteration/write, caused by the client-go workqueue not being fully deduplicated. That's an upstream bug, for which this PR is a mitigation to prevent the provider crashing.
I'm not totally convinced that this is the right thing to do. If we are actually seeing concurrent reconciliations of the same workspace, maybe it is better to crash; the problem is that crashing has the potential to leave workspaces in an inconsistent state (i.e. half-applied, with the state lock left around), and causes all workspaces to be reconciled at once when the provider starts back up.
If we do see concurrent reconciles, we should still be protected by the terraform state lock, although we might see strange errors/status on the resource.
I have:
make reviewable
to ensure this PR is ready for review.How has this code been tested
Unit tests passed; I intend to rely on the Github Action integration test to assert that the provider still works as intended, but the actual bug happens very rarely (With 100+ Workspaces we saw provider-terraform go 10 days without crashing) so it's hard to prove that this fixes the issue.