devspace-sh / devspace

DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
https://devspace.sh
Apache License 2.0
4.37k stars 361 forks source link

inlineManifest: cannot unmarshal an object into string #2544

Closed Orgil closed 1 year ago

Orgil commented 1 year ago

What happened?

deployments:
  test:
    inlineManifest:
        apiVersion: v1
        kind: Secret
        metadata:
          name: test
        type: Opaque
        data:
          SECRET: $(echo '${SECRET}' | base64)

cannot unmarshal an object into string error given. if i add |- at the end of inlineManifest i can not use expression in the value.

Local Environment:

89luca89 commented 1 year ago

Hi @Orgil I'll take a look at this :+1:

89luca89 commented 1 year ago

so @Orgil

using |- is mandatory, inlineManifest is meant to be a block of text, containing the manifests so:

deployments:
  test:
    inlineManifest: |-
        apiVersion: v1
        kind: Secret
        metadata:
          name: test
        type: Opaque
        data:
          SECRET: $(echo '${SECRET}' | base64)

this is the correct way to use it, I'll need to investigate why the inline shell is not working

Orgil commented 1 year ago

Thanks for taking time for it. BTW, there is no |- in the doc i dug through PR and found it. Also ${VARIABLE} works fine but inline expression.

89luca89 commented 1 year ago

Thanks for taking time for it. BTW, there is no |- in the doc i dug through PR and found it.

Thanks a lot for noticing this! Fixing the docs also :smile:

Also ${VARIABLE} works fine but inline expression.

Yes I can reproduce, investigating


EDIT:

Also as a workaround (for now) you can use the shell in the variables then use them in the inlineManifest:

vars:
    PLAIN: $(echo '${SECRET}' | base64)

deployments:
  test:
    inlineManifest: |-
        apiVersion: v1
        kind: Secret
        metadata:
          name: test
        type: Opaque
        data: ${PLAIN}
Orgil commented 1 year ago

@89luca89 This is exactly what i did currently. you can close this issue, If this is intended. Thank you