feat: disable write back informer by default#15079
Conversation
Signed-off-by: Eduardo Rodrigues <eduardodbr@hotmail.com>
Signed-off-by: Eduardo Rodrigues <eduardodbr@hotmail.com>
Signed-off-by: Eduardo Rodrigues <eduardodbr@hotmail.com>
|
/retest |
There was a problem hiding this comment.
Pull request overview
This PR changes the default behavior of the INFORMER_WRITE_BACK environment variable from true to false to address unexpected controller behavior. The change aligns with Kubernetes best practices that recommend avoiding writes to the informer store, though it may result in more 409 Conflict errors.
Key Changes:
- Modified the switch statement logic in
operator.goto make the empty string case default to "false" behavior instead of "true" - Updated documentation to reflect the new default value of
false - Added feature documentation explaining the rationale for this change
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| workflow/controller/operator.go | Swapped the case statements to make empty string default to the "false" behavior (no write-back to informer cache) instead of "true" |
| docs/environment-variables.md | Updated the default value for INFORMER_WRITE_BACK from true to false in the environment variables table |
| .features/pending/disable-write-back-informer.md | Added feature documentation explaining the motivation for disabling write-back informer by default |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| // this does not reduce errors, but does reduce | ||
| // conflicts and therefore we log fewer warning messages. |
There was a problem hiding this comment.
The comment is now grammatically incomplete after the partial removal. It starts with lowercase "this does not reduce errors" which makes it unclear what "this" refers to. Consider revising to: "Writing back to the informer does not reduce errors, but does reduce conflicts and therefore we log fewer warning messages."
| // this does not reduce errors, but does reduce | |
| // conflicts and therefore we log fewer warning messages. | |
| // Writing back to the informer does not reduce errors, but does reduce conflicts and therefore we log fewer warning messages. |
| return | ||
| } | ||
| case "false": | ||
| // no longer write back to informer cache as default (as per v4.0) |
There was a problem hiding this comment.
The comment on line 808 starts with lowercase and lacks proper sentence structure. Consider revising to: "No longer write back to informer cache as default (as per v4.0)."
| // no longer write back to informer cache as default (as per v4.0) | |
| // No longer write back to informer cache as default (as per v4.0). |
| | `EVENT_AGGREGATION_WITH_ANNOTATIONS` | `bool` | `false` | Whether event annotations will be used when aggregating events. | | ||
| | `GZIP_IMPLEMENTATION` | `string` | `PGZip` | The implementation of compression/decompression. Currently only "`PGZip`" and "`GZip`" are supported. | | ||
| | `INFORMER_WRITE_BACK` | `bool` | `true` | Whether to write back to informer instead of catching up. | | ||
| | `INFORMER_WRITE_BACK` | `bool` | `false` | Whether to write back to informer instead of catching up. | |
There was a problem hiding this comment.
There's an extra trailing space after false in the default value column. This should be removed for consistency with other entries in the table.
| | `INFORMER_WRITE_BACK` | `bool` | `false` | Whether to write back to informer instead of catching up. | | |
| | `INFORMER_WRITE_BACK` | `bool` | `false` | Whether to write back to informer instead of catching up. | |
Signed-off-by: Eduardo Rodrigues <eduardodbr@hotmail.com>
Motivation
We’ve seen several cases of unexpected behavior that appear to be caused by the write-back mechanism, and Kubernetes docs (and maintainers kubernetes-sigs/controller-runtime#1622) recommend avoiding writes to the informer store. Although turning it off may increase the frequency of 409 Conflict errors, it should help reduce unpredictable controller behavior.
Modifications
Verification
Documentation