Search code examples
kubernetesyamlkubernetes-helm

How can I escape $ sign with a string (Ex $log) in Helm yaml file


First of all, I know that if it is a single $ sign that I can escape with $$ sign. My scenario is something like $log. I want that to print as it is.

Things I have tried so far:

  • If I give $log, it will set an empty string
  • If I give $$log, then it will set only $
  • Tried with setting as a env in the same values.yaml file but same results as above

How can I resolve this issue?

Update:

My values file is like below:

fluent-bit:
    env:
      - name: LOGSERVICE_FLB_RULE_DEFAULT_KEY
        value: $log
    image:
    .
    .
    .
        [FILTER]
            Name          rewrite_tag
            Match         kube.*
            Rule          $kubernetes['container_image'] ^.+solr:.+$ format.logging.solr false
            Rule          $kubernetes['container_image'] ^.+zookeeper:.+$ format.logging.zookeeper false
            Rule          ${LOGSERVICE_FLB_RULE_DEFAULT_KEY} ^.*$ format.logging false
            Emitter_Name  re_emitted_with_tag

What my expectation is:

    Rule          $kubernetes['container_image'] ^.+solr:.+$ format.logging.solr false
    Rule          $kubernetes['container_image'] ^.+zookeeper:.+$ format.logging.zookeeper false
    Rule          $log ^.*$ format.logging false

But what I'm getting at is:

    Rule          ['container_image'] ^.+solr:.+$ format.logging.solr false
    Rule          ['container_image'] ^.+zookeeper:.+$ format.logging.zookeeper false
    Rule           ^.*$ format.logging false

Solution

  • Posting the answer out of comments.


    After attempt to reproduce the issue, it worked as expected result.

    The only visible difference is helm version which was used: in question it's 3.5.4 while I used 3.7.0.

    Updating to last stable version resolved the issue.