Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cross-shard dependency check #1248

Merged
merged 1 commit into from
Sep 26, 2024
Merged

Allow cross-shard dependency check #1248

merged 1 commit into from
Sep 26, 2024

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

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@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
2 participants