Skip to content

Commit

Permalink
provide reasoning for why the condition.observedGeneration is optiona…
Browse files Browse the repository at this point in the history
…l and not a pointer
  • Loading branch information
deads2k committed May 1, 2020
1 parent 45f87a4 commit 55bd1d8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions keps/sig-api-machinery/1623-standardize-conditions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ However, it encapsulates the best of what we've learned and will allow new APIs
3. `lastHeartbeatTime` is removed.
This field caused excessive write loads as we scaled.
If an API needs this concept, it should codify it separately and possibly using a different resource.
4. `observedGeneration` does not follow the standard requirement of "all optional fields are pointers".
This rule originated from the need to distinguish intent of zero value versus unset.
The `.metadata.generation` is never set to zero.
See the [CR strategy](https://github.com/kubernetes/apiextensions-apiserver/blob/release-1.18/pkg/registry/customresource/strategy.go#L88)
and [deployment strategy](https://github.com/kubernetes/kubernetes/blob/release-1.18/pkg/registry/apps/deployment/strategy.go)
as examples.
Because zero isn't a valid `.metadata.generation`, that intent doesn't make sense.
In the case of a controller make a PUT for `.status.condition` that is missing an `observedGeneration` the zero value of
zero makes sense because the controller is expressing "I don't know" that what's what `0` means in that context.
This also provides parity the `.metadata.generation` field [Generation int64 \`json:"generation,omitempty" protobuf:"varint,7,opt,name=generation"\`](https://github.com/kubernetes/apimachinery/blob/release-1.18/pkg/apis/meta/v1/types.go#L182-L185).

### Graduation Criteria

Expand Down

0 comments on commit 55bd1d8

Please sign in to comment.