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

cdk8s synth pulls namespace from current context #2303

Open
burner1024 opened this issue Dec 18, 2024 · 7 comments
Open

cdk8s synth pulls namespace from current context #2303

burner1024 opened this issue Dec 18, 2024 · 7 comments
Labels
bug Something isn't working effort/medium 1 week tops priority/p2 Dependent on community feedback. PR's are welcome :)

Comments

@burner1024
Copy link

Description of the bug:

When using a Helm chart, namespace for resources would be taken from current context in ~/.kube/config.
That is unexpected.

Reproduction Steps:

        new Helm(this, 'karpenter', {
            chart: 'oci://public.ecr.aws/karpenter/karpenter',
            values: {
                serviceAccount: {
                    annotations:
                        { 'eks.amazonaws.com/role-arn': values.controllerRoleArn }
                },
                settings: {
                    clusterName: values.clusterName,
                    interruptionQueue: values.interruptionQueue,
                },
                webhook: { enabled: false },
            },
            version: values.version,
        });

Easily worked around by explicitly setting namespace = this.namespace.

But this is surprising behaviour, which will lead to generating different manifest from the same code on different machines.

Error Log:

Environment:

  • Framework Version: 2.198.283
  • OS:

Other:


This is 🐛 Bug Report

@burner1024 burner1024 added bug Something isn't working needs-triage Priority and effort undetermined yet labels Dec 18, 2024
@shinebayar-g
Copy link

I believe this is how helm template works. It should be easily reproducible by running the equivalent helm template command.

@burner1024
Copy link
Author

Maybe. But the very reason to use cdk8s is to forget the nightmare that Helm is.

@shinebayar-g
Copy link

Not maybe, it is. You're not escaping anything. You're literally calling helm template.

@burner1024
Copy link
Author

Whatever, doesn't really matter, the ask stands.

@iliapolo
Copy link
Member

I don't see this as an issue to be honest. We aren't trying to go against helm behavior by using the Helm construct, we're just trying to bring in helm alongside with cdk8s. Changing this would be a breaking change and may also be unexpected to some users.

Specifying the namespace property seems like a reasonable way to customize the helm behavior to whatever the user wants.

@iliapolo iliapolo added the response-requested Awaiting response from author label Feb 24, 2025
@burner1024
Copy link
Author

Whether an issue is breaking or not should only influence when it's handled, not whether it's handled at all.

I don't know in which situation would the same code generating different result be expected and desirable.
I'm fairly sure this will come up again, though.
So, whatever you think is best.

@github-actions github-actions bot removed the response-requested Awaiting response from author label Feb 25, 2025
@iliapolo
Copy link
Member

Whether an issue is breaking or not should only influence when it's handled, not whether it's handled at all.

True.

I'm going to keep this open as a p2 to see what folks have to say.

For contributors though: Please do not submit a PR for this before checking in with the team, since this is technically a breaking change

@iliapolo iliapolo added effort/medium 1 week tops priority/p2 Dependent on community feedback. PR's are welcome :) and removed needs-triage Priority and effort undetermined yet labels Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working effort/medium 1 week tops priority/p2 Dependent on community feedback. PR's are welcome :)
Projects
None yet
Development

No branches or pull requests

3 participants