Skip to content

Commit 86603d9

Browse files
authored
docs: best practices for state management (#2945)
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 4901d00 commit 86603d9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/content/en/docs/getting-started/patterns-best-practices.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,15 @@ Thanks to Kubernetes resources' declarative nature, operators dealing only with
7777

7878
### When State Management Becomes Necessary
7979

80-
This stateless approach typically breaks down when dealing with external resources. You might need to track external state for future reconciliations.
80+
This stateless approach typically breaks down when dealing with external resources. You might need to track external state or allocated
81+
values for future reconciliations. There are multiple options:
8182

82-
**Anti-pattern**: Putting state in the primary resource's status sub-resource
83-
- Becomes difficult to manage with large amounts of state
84-
- Violates best practice: status should represent actual resource state, while spec represents desired state
8583

86-
**Recommended approach**: Store state in separate resources designed for this purpose:
84+
1. Putting state in the primary resource's status sub-resource. This is a bit more complex that might seem at the first look.
85+
Refer to the [documentation](../documentation/reconciler.md#making-sure-the-primary-resource-is-up-to-date-for-the-next-reconciliation)
86+
for further details.
87+
88+
2. Store state in separate resources designed for this purpose:
8789
- Kubernetes Secret or ConfigMap
8890
- Dedicated Custom Resource with validated structure
8991

0 commit comments

Comments
 (0)