Skip to content

Conversation

@stefanprodan
Copy link
Member

Use the APIReader client to bypass the controller runtime cache when checking for dependencies. This allows a Kustomization to depend on other Kustomizations managed by different controller shards.

Fix: #1175

@stefanprodan stefanprodan added the area/kstatus Health checking related issues and pull requests label Sep 25, 2024
Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

Manually tested, inspected and verified that before this change, the client failed to get the object from the cache, and doing a live lookup using the API reader fixes that.

In brief, the controller-runtime client determines that Kustomization is configured to be in the cached and must be present in the cache, refer https://github.com/kubernetes-sigs/controller-runtime/blob/v0.19.0/pkg/client/client.go#L335-L342. But due to the sharding configuration, the cache doesn't contain any of the Kustomizations that don't match with the sharding label selector. This results in an object not found error. As is evident from the code, live lookup is only performed for resources that are configured to not be cached.

LGTM! Thanks for the fix.

@stefanprodan stefanprodan merged commit 0d28f0f into main Sep 26, 2024
7 checks passed
@stefanprodan stefanprodan deleted the deps-api-reader branch September 26, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/kstatus Health checking related issues and pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A sharded kustomization with a dependsOn pointing to a Kustomization in another shard fails to find it

3 participants