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

Make Extra Resources convertable to json and yaml #148

Open
Avarei opened this issue Jun 29, 2024 · 1 comment
Open

Make Extra Resources convertable to json and yaml #148

Avarei opened this issue Jun 29, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Avarei
Copy link

Avarei commented Jun 29, 2024

What problem are you facing?

Currently extra resources have a few problems that make them more difficult to work with for composition functions which convert the RunFunctionRequest into Yaml.

I ran into this issue in function-pkl and I also saw that function-go-templating had to implement a workaround.
In both Projects we re-implement the struct to be able to convert it to and from yaml.

function-go-templating's workaround

function-pkl's workaround

How could Crossplane help solve your problem?

I currently see two potential ways this could be solved

Option 1 (Breaking)

  1. add camelCased json tags to Requirements and sub structs
  2. allow for both match_name and match_labels to be ANDed similar to K8s LabelSelector.

This would make them possible to be represented in yaml.

It would be breaking though.
However I think currently most composition functions have not yet implemented this. So this would hopefully not affect most users.

Option 2 (Non breaking (i think))

implement custom methods for Marshalling und Unmarshalling

  • MarshalJSON
  • UnmarshalJSON
  • MarshalYAML
  • UnmarshalYAML

A non-breaking option could be to provide a Another option could be to provide

@Avarei Avarei added the enhancement New feature or request label Jun 29, 2024
@negz
Copy link
Member

negz commented Sep 16, 2024

@Avarei Could you elaborate a little bit more on what the problems are? It's not immediately obvious to me from skimming the linked workarounds.

Is it just that the protobufs are producing snake_case rather than camelCase field names when converted to YAML?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants