-
Notifications
You must be signed in to change notification settings - Fork 23
✨Wait until APIExport virtual workspace URLs are ready #33
Conversation
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to do a GET or LIST first to see the current state (and short-circuit if the live read shows a URL), and use that resource version to start the watch. Also, likely best to have watch resumption on errors and re-list on compaction - which makes me wonder if we should instead start an informer.
main.go
Outdated
} | ||
|
||
if !slices.Contains(apiExport.Spec.LatestResourceSchemas, "today.widgets.data.my.domain") { | ||
// This is not this controller APIExport |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check is likely superfluous and if it were to be true, the controller can do nothing except for panic and process exit, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be useful for the case where the APIExport name is not provided, as a way to pick the expected one. That's true the controller won't be able to to anything if the APIExport specified by name does not pass that check. So maybe add that check only when the name is not provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no name is specified, won't the watch with the metadata.name
field selector return nothing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The metadata.name
field selector is only appended when the name is provided. We could skip the check as well in that case or fail-fast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the apiExportName == ""
condition to the check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should just make it required - why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took it as an invariant that was already there, but making it required, possibly with a sensible default, would make sense and simplify things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the api-export-name
option to default to the controller APIExport name, so it avoids watching for multiple resources.
Ah, I have assumed this is what the controller runtime cached client actually does by default for typed objects. Let me check. |
OK, I realise my assumption was wrong, for the obvious reason the split / caching client that relies on informers is that of the manager, which we aim to create here 🙃! So, as it stands, that is with unset |
I see - in any case, no reason that a closed watch stream while waiting should cause process exit, right? |
I've added a retry logic in case the channel has been closed, so it resumes watching for APIExports if the previous watch stream timed out on idle, or just fails if the connection to the server cannot be re-established. |
@astefanutti: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: astefanutti, stevekuznetsov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR follows up kcp-dev/kcp#2135 so that the manager is started, only after its APIExport virtual workspace URLs are ready.