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: respect hyphens in helm chart names #1666

Draft
wants to merge 3 commits into
base: 2.x
Choose a base branch
from

Conversation

rassie
Copy link
Contributor

@rassie rassie commented Nov 21, 2023

From json2jsii 0.4.0 onwards, type name sanitization works correctly with kebab case, i.e. it no longer ignores hyphens, so that names like ingress-nginx, which previously have been previously converted to Ingressnginx, now get converted to IngressNginx, which is the expected behaviour for kebab case to pascal case conversion. However, cdk8s-cli's helm import has been additionally sanitizing hyphens in chart names, even though hyphens are valid characters in chart names, so that the change in json2jsii had no effect. This patch simplifies the helm importer's sanitization routine to not remove hyphens anymore, resulting in more correct class names.

This will be a breaking change for people using Helm charts with a hyphen in the name.

From `json2jsii` 0.4.0 onwards, type name sanitization works correctly with kebab case, i.e. it no longer ignores
hyphens, so that names like `ingress-nginx`, which previously have been previously converted to `Ingressnginx`, now get
converted to `IngressNginx`, which is the expected behaviour for kebab case to pascal case conversion. However,
`cdk8s-cli`'s helm import has been additionally sanitizing hyphens in chart names, even though hyphens are valid
characters in chart names, so that the change in `json2jsii` had no effect. This patch simplifies the helm importer's
sanitization routine to not remove hyphens anymore, resulting in more correct class names.

Signed-off-by: Nikolai Prokoschenko <[email protected]>
@rassie
Copy link
Contributor Author

rassie commented Nov 21, 2023

cc @vinayak-kukreja, since you are the author of the original patch

@vinayak-kukreja
Copy link
Contributor

Hey @rassie, thank you for opening a contribution with us and apologies for the delay.

I am not sure if we can accept a breaking change. Probably would need to be behind some kind of feature flag. Let me consult the team and get back to you.

@shinebayar-g
Copy link
Contributor

shinebayar-g commented Dec 20, 2023

https://github.com/cdk8s-team/cdk8s-cli/pull/1737/files was a breaking change to the same effect.
v2.198.4...v2.198.5

@iliapolo
Copy link
Member

@rassie Since its a breaking change, we need to make this optional...I don't mind introducing a poor mans feature toggle in the form of an environment variable, something like: CDK8S_HELM_IMPORT_RESPECT_HYPHENS.

@shinebayar-g

https://github.com/cdk8s-team/cdk8s-cli/pull/1737/files was a breaking change to the same effect.
v2.198.4...v2.198.5

True, and a good call out. This has surfaced an automation problem with how we bump and approve dependency upgrades for 0.x versions. We need to address this. But I wouldn't want to introduce yet another breaking change because we once let one slip.

@iliapolo iliapolo changed the title fix!: respect hyphens in helm chart names fix: respect hyphens in helm chart names Sep 10, 2024
@iliapolo iliapolo added the response-requested Awaiting response from author label Sep 10, 2024
@rassie
Copy link
Contributor Author

rassie commented Sep 10, 2024

The feature toggle looks quite ugly, if I'm being completely honest. This PR has been open for quite a while, from my POV it'd probably be fine if it just became part of an eventually released major version.

The question is though whether you'd actually want to release a new major version, judging by how 1.x is still a thing three years after initial 2.x release, meaning you'd probably have three major versions around (along with 5-6 cdk8s+ versions). However, if you are open to it, a new major might be a better way.

@rassie
Copy link
Contributor Author

rassie commented Sep 10, 2024

And just as I point it out, v1 seems to be on its way out (#2710). Sorry, haven't seen it while writing the comment.

@github-actions github-actions bot removed the response-requested Awaiting response from author label Sep 10, 2024
@iliapolo
Copy link
Member

@rassie Ok, lets keep it around for a future 3.x version line. If we see more community demand for this we might reconsider the "feature toggle", which I agree is quite ugly. I can tell you that we already have a few other issues in the pipeline that require a major version bump, so this just gives us more incentive to roll it out. But I can't attest to when that will be.

@iliapolo
Copy link
Member

Converting to draft until we decide how and when to include this.

@iliapolo iliapolo marked this pull request as draft September 11, 2024 05:26
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.

4 participants