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

fix: dynamic client for ambigious Kind #1088

Merged
merged 1 commit into from
Oct 17, 2024
Merged

Conversation

adityathebe
Copy link
Member

@adityathebe adityathebe commented Oct 17, 2024

we were getting resource not found errors when fetching resources with the dynamic client.

The issue was that the "Kind" alone wasn't specific enough to get the correct dynamic client. Example: I had two HelmChart kinds

helmcharts                                         helm.cattle.io/v1                        true         HelmChart
helmcharts                         hc              source.toolkit.fluxcd.io/v1              true         HelmChart

Changed that to create the dynamic client for <Group, Version, Kind> instead.

we were getting resource not found errors when fetching resources with
the dynamic client.

The issue was that the "Kind" alone wasn't specific enough to get the
correct dynamic client. Example: I had two HelmChart kinds

helmcharts                                         helm.cattle.io/v1                        true         HelmChart
helmcharts                         hc              source.toolkit.fluxcd.io/v1              true         HelmChart

Changed that to create the dynamic client for <Group, Version, Kind>
instead.
Comment on lines +113 to +114
gv, _ := schema.ParseGroupVersion(resource.APIVersion)
kclient, err = ctx.KubernetesDynamicClient().GetClientByGroupVersionKind(gv.Group, gv.Version, resource.Kind)
Copy link
Member Author

Choose a reason for hiding this comment

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

change of concern.

Rest of the change is reformatting by golines

@adityathebe adityathebe merged commit 717814f into main Oct 17, 2024
8 checks passed
@adityathebe adityathebe deleted the fix/dynamic-client branch October 17, 2024 16:30
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.

1 participant