controller: set Status.ObservedGeneration on every status patch - #62
Merged
Merged
Conversation
The CRD declares Status.ObservedGeneration but the controller never wrote it. Consumers (kubectl wait, dashboards, owner controllers) had no way to tell whether the operator had seen the latest spec. Both helpers that patch the ExternalDNS status now set ObservedGeneration to the Generation captured at the start of the reconcile. This is the standard pattern: ObservedGeneration advances on both success and failure, since either way the controller has observed and acted on that Generation. Signed-off-by: Tamal Saha <tamal@appscode.com>
Superm4n97
previously approved these changes
Jun 5, 2026
Signed-off-by: Tamal Saha <tamal@appscode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apis/external/v1alpha1/externaldns_types.godeclaresStatus.ObservedGeneration, but no code path ever writes it. So consumers (kubectl wait, dashboards, owner controllers) had no way to tell whether the operator had seen the latest spec.Both helpers that patch the
ExternalDNSstatus —updateEdnsStatusandpatchDNSRecords— now setObservedGenerationto theGenerationcaptured at the start of the reconcile. This is the standard controller pattern:ObservedGenerationadvances on both success and failure, since either way the controller has observed and acted on thatGeneration. The conditions array continues to carry per-conditionGenerationso callers can still distinguish stale conditions.Test plan
go build ./...go vet ./...ExternalDNS, thenkubectl get externaldns -o jsonpath='{.status.observedGeneration}'and confirm it matches.metadata.generationafter the reconcile settles.ObservedGenerationadvances on the next reconcile.