Open jack1902 opened 10 months ago
One thing that we have been doing is to patch the logic for every custom CRD that we create. It's not great, but we also don't have a lot of custom CRDs.
When a resource doesn't yet have a status field does kstatus report unknown ?
If I am reading the code right (https://github.com/kubernetes-sigs/cli-utils/blob/0b156cb0425fdb29a436d13f840a39039558c10e/pkg/kstatus/status/status.go#L102), it actually falls all the way through to Current
if there is no status field.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
/remove-lifecycle stale
When a resource doesn't yet have a status field does kstatus report unknown ?
If I am reading the code right (
), it actually falls all the way through to
Current
if there is no status field.
This is correct. Objects without status are assumed to be Current. This is how many of the base k8s types are handled, like Role & RoleBinding, which don't have status.
If you want your CRD to not immediately be seen as Current, add status.observedGeneration
to the schema with a default of 0
. This will cause the API Server to create a default status when the object is created, which kstatus will interpret as InProgress until your controller sets status.observedGeneration
= meta.generation
.
TL;DR - When a resource doesn't yet have a
status
field does kstatus reportunknown
?When creating a resource which is defined by a CRD which has no
status
by default, i believe the behaviour of kstatus is to state "unknown". I believe this then enables developers usingunknown
as a condition to determine if that should be seen as "lets carry on" or "stop here and wait".If the "unknown" status is indeed what happens when no
status
field exists on a resource (because it has been freshly applied and the backing controller hasn't had a chance to update the CR' status field yet, i'll close this issue and raise another with the project using this one to add configuration.