Skip to content

fix: consistently watch unstructured.Unstructured in real time compositions#6462

Merged
jbw976 merged 1 commit intocrossplane:mainfrom
jbw976:watch-just-one
May 19, 2025
Merged

fix: consistently watch unstructured.Unstructured in real time compositions#6462
jbw976 merged 1 commit intocrossplane:mainfrom
jbw976:watch-just-one

Conversation

@jbw976
Copy link
Copy Markdown
Member

@jbw976 jbw976 commented May 19, 2025

Description of your changes

This PR updates the type we use to start watches on composed resources - we'll now use the Kubernetes unstructured.Unstructured type, like we do for other watches. The current approach of using composed.Unstructured would be fine, except that we already set up watches on XRs using the unstructured.Unstructured type. When an XR is itself a composed resource, we can't try to start another watch using composed.Unstructured, because that is a different type than the watch we already started. When we use different types, the underlying watch runs into an unhandled error for encountering an unexpected type.

The underlying root cause is described in more detail in #5957 (comment).

Fixes #5957
Fixes #6455

Because this issue was hard to reproduce and track down, I prepared a repro and testing project at https://github.com/jbw976/debug-xp-rtc-watch-error. That project consistently reproduces the issue on v1.20.0-rc.1. With this fix in place, the issue no longer occurs, e.g. the logs don't have any Unhandled Error entries, and all resources reach a healthy ready status:

❯ kubectl -n crossplane-system logs --tail=-1 -l app=crossplane -c crossplane | grep -F -i 'Unhandled Error' | wc -l
       0

❯ crossplane beta trace parent.debug.crossplane.io/parent
NAME                                             SYNCED   READY   STATUS
Parent/parent (default)                          True     True    Available
└─ XParent/parent-45z4t                          True     True    Available
   ├─ XChild/xchild-debugging-0                  True     True    Available
   │  ├─ InternetGateway/gateway-debugging-0-0   True     True    Available
   │  ├─ InternetGateway/gateway-debugging-0-1   True     True    Available
   │  ├─ VPC/vpc-debugging-0-0                   True     True    Available
   │  └─ VPC/vpc-debugging-0-1                   True     True    Available
   ├─ XChild/xchild-debugging-1                  True     True    Available
   │  ├─ InternetGateway/gateway-debugging-1-0   True     True    Available
   │  ├─ InternetGateway/gateway-debugging-1-1   True     True    Available
   │  ├─ VPC/vpc-debugging-1-0                   True     True    Available
   │  └─ VPC/vpc-debugging-1-1                   True     True    Available
   └─ XChild/xchild-debugging-2                  True     True    Available
      ├─ InternetGateway/gateway-debugging-2-0   True     True    Available
      ├─ InternetGateway/gateway-debugging-2-1   True     True    Available
      ├─ VPC/vpc-debugging-2-0                   True     True    Available
      └─ VPC/vpc-debugging-2-1                   True     True    Available

I have:

Need help with this checklist? See the cheat sheet.

…itions

If we watch a given XR GVK with both unstructured.Unstructured and also
composed.Unstructured Go types when it itself is a composed resource,
we will run into watch errors about unexpected types because the
underlying watch only expects one Go type per GVK.

Signed-off-by: Jared Watts <jbw976@gmail.com>
Copy link
Copy Markdown
Member

@negz negz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice sleuthing @jbw976!

@jbw976 jbw976 merged commit 698009e into crossplane:main May 19, 2025
27 of 29 checks passed
@github-actions
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unready XR with ready sub resources enabling realtime composition causes watch error

2 participants