Skip to content

controller: set Status.ObservedGeneration on every status patch - #62

Merged
tamalsaha merged 2 commits into
masterfrom
fix/observed-generation
Jun 5, 2026
Merged

tamalsaha merged 2 commits into
masterfrom
fix/observed-generation

Conversation

@tamalsaha

Copy link
Copy Markdown
Contributor

Summary

apis/external/v1alpha1/externaldns_types.go declares Status.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 ExternalDNS status — updateEdnsStatus and patchDNSRecords — now set ObservedGeneration to the Generation captured at the start of the reconcile. This is the standard controller pattern: ObservedGeneration advances on both success and failure, since either way the controller has observed and acted on that Generation. The conditions array continues to carry per-condition Generation so callers can still distinguish stale conditions.

Test plan

  • go build ./...
  • go vet ./...
  • Apply an ExternalDNS, then kubectl get externaldns -o jsonpath='{.status.observedGeneration}' and confirm it matches .metadata.generation after the reconcile settles.
  • Edit the spec; confirm ObservedGeneration advances on the next reconcile.

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>
kodiakhq[bot]
kodiakhq Bot previously approved these changes Jun 5, 2026
Superm4n97
Superm4n97 previously approved these changes Jun 5, 2026
Signed-off-by: Tamal Saha <tamal@appscode.com>
@tamalsaha
tamalsaha dismissed stale reviews from Superm4n97 and kodiakhq[bot] via 2326cee June 5, 2026 18:28
@tamalsaha
tamalsaha merged commit d410b2b into master Jun 5, 2026
4 checks passed
@tamalsaha
tamalsaha deleted the fix/observed-generation branch June 5, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants