Skip to content

Commit 45f87a4

Browse files
committed
add conditions.observedgeneration and clarify usage
1 parent 567b090 commit 45f87a4

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

keps/sig-api-machinery/1623-standardize-conditions/README.md

+18-10
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,32 @@ The pattern is well-established and we have a good sense of the schema we now wa
7777
Introduce a type into k8s.io/apimachinery/pkg/apis/meta/v1 for `Condition` that looks like
7878
```go
7979
type Condition struct {
80-
// Type of condition in CamelCase.
80+
// Type of condition in CamelCase or in foo.example.com/CamelCase.
81+
// Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
82+
// useful (see .node.status.conditions), the ability to deconflict is important.
8183
// +required
8284
Type string `json:"type" protobuf:"bytes,1,opt,name=type"`
8385
// Status of the condition, one of True, False, Unknown.
8486
// +required
8587
Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status"`
88+
// If set, this represents the .metadata.generation that the condition was set based upon.
89+
// For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date
90+
// with respect to the current state of the instance.
91+
// +optional
92+
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
8693
// Last time the condition transitioned from one status to another.
87-
// This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
94+
// This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
8895
// +required
89-
LastTransitionTime metav1.Time `json:"lastTransitionTime" protobuf:"bytes,3,opt,name=lastTransitionTime"`
96+
LastTransitionTime metav1.Time `json:"lastTransitionTime" protobuf:"bytes,4,opt,name=lastTransitionTime"`
9097
// The reason for the condition's last transition in CamelCase.
91-
// The specific API may choose whether or not this field is considered a guaranteed API.
98+
// The specific API may choose whether or not this field is considered a guaranteed API.
99+
// This field may not be empty.
92100
// +required
93-
Reason string `json:"reason" protobuf:"bytes,4,opt,name=reason"`
101+
Reason string `json:"reason" protobuf:"bytes,5,opt,name=reason"`
94102
// A human readable message indicating details about the transition.
95-
// This field is never considered a guaranteed API and may be empty/missing.
96-
// +optional
97-
Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
103+
// This field may be empty.
104+
// +required
105+
Message string `json:"message" protobuf:"bytes,6,opt,name=message"`
98106
}
99107
```
100108

@@ -106,8 +114,8 @@ However, it encapsulates the best of what we've learned and will allow new APIs
106114
1. `lastTransitionTime` is required.
107115
Some current implementations allow this to be missing, but this makes it difficult for consumers.
108116
By requiring it, the actor setting the field can set it to the best possible value instead of having clients try to guess.
109-
2. `reason` is required.
110-
The actor setting the value should always describe why the condition is the way it is, even if that value is, unknown unknowns.
117+
2. `reason` is required and must not be empty.
118+
The actor setting the value should always describe why the condition is the way it is, even if that value is "unknown unknowns".
111119
No other actor has the information to make a better choice.
112120
3. `lastHeartbeatTime` is removed.
113121
This field caused excessive write loads as we scaled.

keps/sig-api-machinery/1623-standardize-conditions/kep.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ title: KEP Template
22
kep-number: 1623
33
authors:
44
- "@deads2k"
5-
owning-sig: sig-apimachinery
5+
owning-sig: sig-api-machinery
66
participating-sigs:
7-
- sig-apimachinery
7+
- sig-api-machinery
88
- sig-apps
99
- sig-architecture
1010
status: implementable

0 commit comments

Comments
 (0)