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

[WIP] v4alpha1 CRDs #5790

Draft
wants to merge 10 commits into
base: dev/v4
Choose a base branch
from
Draft

[WIP] v4alpha1 CRDs #5790

wants to merge 10 commits into from

Conversation

kflynn
Copy link
Member

@kflynn kflynn commented Oct 2, 2024

This has been... ugly.

We're starting from the point of view that the v4alpha1 CRDs should be camelCase internally, but that we'll need to still use snake_case when talking to Python (purely as a practical matter of paranoia). Managing that... wow. The Go ecosystem, you see, does not give you control over the tag used when serializing or deserializing JSON or YAML.

The Right Way to manage this may be a PR into encoding/json and sigs.k8s.io/yaml. The short-term way? I've copied those into Emissary's codebase and hacked them. 😛

The end result is:

  • encoding/json uses the json tag (for camelCase v4alpha1 nativeness)
  • github.com/emissary-ingress/emissary/v3/pkg/json uses the v3 tag but falls back to the json tag (for snake_case v3alpha1 madness)
  • sigs.k8s.io/yaml uses the yaml and json tags (for camelCase v4alpha1 nativeness)
  • github.com/emissary-ingress/emissary/v3/pkg/yaml uses the v3 tag but falls back to the yaml and json tags (for snake_case v3alpha1 madness)

and cmd/migrator has the beginnings of a conversion tool. I say "beginnings" because it currently only does snake_case YAML to camelCase YAML but it's a start... and I used it to convert the testdata manifests for the v4alpha1 CRDs.

Signed-off-by: Flynn [email protected]

…1. Allow make generate-fast to work with it.

Signed-off-by: Flynn <[email protected]>
Turns out that the Go ecosystem doesn't currently offer control over the tag used when serializing or deserializing JSON or YAML. This is pretty appalling. We need control over the tag, and the most sane way I've found to support that is _copying all of encoding/json and sigs.k8s.io/yaml into our tree_ and modifying them. Ugh. Bad ecosystem!

Signed-off-by: Flynn <[email protected]>
…e json tag (and, also, it doesn't rely on internal imports)

Signed-off-by: Flynn <[email protected]>
…t to migrate all the v3alpha1 testdata for emissary-ingress.dev/v4alpha1 over to proper v4 CRDs.

Signed-off-by: Flynn <[email protected]>
Signed-off-by: Flynn <[email protected]>
…ions don't!

Really, standard library authors? Really??

Signed-off-by: Flynn <[email protected]>
…world.

This is the point where we _start_ to have some functionality working. The FakeCollision test passes after this change(!!).

Signed-off-by: Flynn <[email protected]>
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