Skip to content

Commit 092e36b

Browse files
authored
feat: disable write back informer by default (#15079)
Signed-off-by: Eduardo Rodrigues <[email protected]>
1 parent cfdfea7 commit 092e36b

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Description: Disable write back informer by default
2+
Author: [Eduardo Rodrigues](https://github.com/eduardodbr)
3+
Component: General
4+
Issues: 12352
5+
6+
Update the controller’s default behavior to disable the write-back informer. We’ve seen several cases of unexpected behavior that appear to be caused by the write-back mechanism, and Kubernetes docs 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.
7+

docs/environment-variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This document outlines environment variables that can be used to customize behav
3232
| `EXPRESSION_TEMPLATES` | `bool` | `true` | Escape hatch to disable expression templates. |
3333
| `EVENT_AGGREGATION_WITH_ANNOTATIONS` | `bool` | `false` | Whether event annotations will be used when aggregating events. |
3434
| `GZIP_IMPLEMENTATION` | `string` | `PGZip` | The implementation of compression/decompression. Currently only "`PGZip`" and "`GZip`" are supported. |
35-
| `INFORMER_WRITE_BACK` | `bool` | `true` | Whether to write back to informer instead of catching up. |
35+
| `INFORMER_WRITE_BACK` | `bool` | `false` | Whether to write back to informer instead of catching up. |
3636
| `HEALTHZ_AGE` | `time.Duration` | `5m` | How old a un-reconciled workflow is to report unhealthy. |
3737
| `INDEX_WORKFLOW_SEMAPHORE_KEYS` | `bool` | `true` | Whether or not to index semaphores. |
3838
| `LEADER_ELECTION_IDENTITY` | `string` | Controller's `metadata.name` | The ID used for workflow controllers to elect a leader. |

workflow/controller/operator.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,14 +798,15 @@ func (woc *wfOperationCtx) persistUpdates(ctx context.Context) {
798798
woc.log.WithFields(logging.Fields{"resourceVersion": woc.wf.ResourceVersion, "phase": woc.wf.Status.Phase}).Info(ctx, "Workflow update successful")
799799

800800
switch os.Getenv("INFORMER_WRITE_BACK") {
801-
// By default we write back (as per v2.11), this does not reduce errors, but does reduce
801+
// this does not reduce errors, but does reduce
802802
// conflicts and therefore we log fewer warning messages.
803-
case "", "true":
803+
case "true":
804804
if err := woc.writeBackToInformer(); err != nil {
805805
woc.markWorkflowError(ctx, err)
806806
return
807807
}
808-
case "false":
808+
// no longer write back to informer cache as default (as per v4.0)
809+
case "", "false":
809810
time.Sleep(1 * time.Second)
810811
}
811812

0 commit comments

Comments
 (0)