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

Single quote dropped. #151

Open
dmolik opened this issue Sep 17, 2024 · 3 comments
Open

Single quote dropped. #151

dmolik opened this issue Sep 17, 2024 · 3 comments

Comments

@dmolik
Copy link

dmolik commented Sep 17, 2024

In one of my operator deployments I'm including a metadata field in the envs like so:

        env:
        - name: APP_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.labels['app.kubernetes.io/name']
        - name: INSTANCE_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.labels['app.kubernetes.io/instance']

when piped through helmify the single quotes are dropped.

@arttor
Copy link
Owner

arttor commented Sep 20, 2024

Hi, this one will be hard to fix.
Helmify removes all single quotes after marshaling template to yaml. Without this step all yaml values containing helm template expressions (anything with {{}}}) will be quotet and will not work with Helm.

Probabaly, we can change strings.ReplaceAll(spec, "'", "") to more intelligent code, which removes single quotes only aroud yaml value, not inside it.

@dmolik
Copy link
Author

dmolik commented Sep 20, 2024

hmmmm, I don't want to generate a load of work, what other strategies can we employ that don't generate a complicated and potentially cumbersome feature to support going forward?

ATM the moment I solved this with some post-processing sed.

@arttor
Copy link
Owner

arttor commented Sep 22, 2024

I think it will be appropriate solution if we find a way to replace current strings.ReplaceAll(spec, "'", "") with a regex. The regex should ignore single quites in the middle of yaml string value.

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

No branches or pull requests

2 participants