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

conditionally render status line #211

Merged
merged 1 commit into from
Mar 16, 2024
Merged

Conversation

sebhoss
Copy link
Contributor

@sebhoss sebhoss commented Mar 16, 2024

I was trying to get the Istio resources working which do not specify their status fields but rather use x-kubernetes-preserve-unknown-fields. Currently kopium does not generate a XyzStatus struct for that but still adds a #[kube(status = "XyzStatus")] line to the spec struct which causes compile errors. This PR changes that so that the status line is only added if we have an actual status container and that container has members. In every other case, kopium does not generate a status struct and uses a BTreeMap instead which cannot be used in the #[kube(status = ...)] line.

I'm not entirely sure if this breaks anything else down the line, however I was able to generate & cargo check every custom resource in metio/kube-custom-resources-rs#222 with this change.

Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

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

Makes perfect sense to me. minor nit.

src/main.rs Outdated Show resolved Hide resolved
@sebhoss sebhoss force-pushed the istio-status-support branch 2 times, most recently from c777f10 to c961145 Compare March 16, 2024 16:33
Signed-off-by: Sebastian Hoß <seb@xn--ho-hia.de>
@clux clux merged commit 358958e into kube-rs:main Mar 16, 2024
5 checks passed
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.

None yet

2 participants