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

yaml: unmarshal errors when having multiple deployments configs in the same file #330

Open
assapir opened this issue May 2, 2024 · 2 comments
Labels

Comments

@assapir
Copy link

assapir commented May 2, 2024

we have a template with the following:

{{- if ... }} # this is always true by default
apiVersion: apps/v1
kind: Deployment
...
---
apiVersion: apps/v1
kind: Deployment
...

When trying to write a simple test, we get the following error:

                Error: yaml: unmarshal errors:
  line 63: mapping key "kind" already defined at line 2
  line 64: mapping key "metadata" already defined at line 3
  line 71: mapping key "spec" already defined at line 10

If I comment out the first deployment, everything is working as expected.

@quintush
Copy link
Contributor

Hello @assapir,

I would need some more details on your scenario.
Using multiple deployment configs should not be a problem.
See the deployment.yaml in the base chart which contains multiple deployment configurations and have succeeding tests.

Would it be possible to add the complete file?

Greetings,
@quintush

@asweet-confluent
Copy link

This happened when I accidentally chomped the whitespace before my document separator:

        controlledResources: ["cpu", "memory"]
        controlledValues: RequestsOnly--- # <--
apiVersion: apps/v1
kind: Deployment

Fixing that resolved the problem.

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

No branches or pull requests

3 participants