Skip to content

Commit a1556c0

Browse files
Set Ready=Unknown when reconciliation is paused
Per Kubernetes API conventions, Unknown signals that the operator is no longer actively verifying the resource — a more honest status than preserving a stale Ready=True while reconciliation is stopped. - internal/paused/paused.go: set Ready=Unknown alongside Paused=True in EnsureCondition; both conditions land in the same status patch - docs/concepts/pausing.md: new "Effect on the Ready Condition" section with YAML example, kubectl output, and rationale callout; update the Paused Condition kubectl example to show Ready=Unknown
1 parent 0404228 commit a1556c0

2 files changed

Lines changed: 44 additions & 4 deletions

File tree

docs/concepts/pausing.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ condition. The `Paused` column is visible with `-o wide`:
5555

5656
```
5757
$ kubectl get vrfs -o wide
58-
NAME VRF DEVICE READY PAUSED AGE
59-
vrf-prod prod leaf-01 True True 5m
58+
NAME VRF DEVICE READY PAUSED AGE
59+
vrf-prod prod leaf-01 Unknown True 5m
6060
```
6161

6262
The condition message indicates the reason:
@@ -69,6 +69,35 @@ conditions:
6969
message: "Device spec.paused is set to true"
7070
```
7171

72-
::: warning
73-
The `Paused` condition does not affect the `Ready` condition.
72+
## Effect on the Ready Condition
73+
74+
When a resource is paused, the `Ready` condition is set to `Unknown` with reason `Paused`.
75+
76+
```yaml
77+
conditions:
78+
- type: Ready
79+
status: "Unknown"
80+
reason: Paused
81+
message: "Reconciliation is paused"
82+
- type: Paused
83+
status: "True"
84+
reason: Paused
85+
message: "Device spec.paused is set to true"
86+
```
87+
88+
The `kubectl get` output reflects this:
89+
90+
```
91+
$ kubectl get vrfs -o wide
92+
NAME VRF DEVICE READY PAUSED AGE
93+
vrf-prod prod leaf-01 Unknown True 5m
94+
```
95+
96+
Once the resource is unpaused, the controller runs a full reconcile and
97+
immediately sets `Ready` back to `True` or `False` based on the observed state.
98+
99+
::: info Why Unknown and not False?
100+
`False` would imply the resource is broken. `Unknown` is the honest signal:
101+
the operator has stopped actively verifying the resource, so its current
102+
state is simply not known.
74103
:::

internal/paused/paused.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ func EnsureCondition(ctx context.Context, c client.Client, device *v1alpha1.Devi
4343
log.V(4).Info("Reconciliation is paused for this object", "reason", newCondition.Message)
4444
}
4545

46+
// Set Ready=Unknown while paused: the operator is no longer actively
47+
// verifying the resource, so its state cannot be determined.
48+
if isPaused {
49+
conditions.Set(obj, metav1.Condition{
50+
Type: v1alpha1.ReadyCondition,
51+
Status: metav1.ConditionUnknown,
52+
Reason: v1alpha1.PausedReason,
53+
Message: "Reconciliation is paused",
54+
})
55+
}
56+
4657
// Only do a standalone status patch when pausing. When not paused,
4758
// the condition is set in-memory and will be persisted by the normal
4859
// reconciliation status update, avoiding an unnecessary extra reconcile.

0 commit comments

Comments
 (0)