FairwindsOps / reckoner

Declaratively install and manage multiple Helm chart releases
https://fairwinds.com
Apache License 2.0
338 stars 32 forks source link

Can't use $ in strings as expected in reckoner 6 #678

Closed Azahorscak closed 1 year ago

Azahorscak commented 1 year ago

What happened?

When passing in a string with $'s in them i'm unable to escape the $ as expected. This fails with the following message.

Course file has schema validation errors - error opening course file course.yml: Course file has schema validation errors

What did you expect to happen?

The string to be treated the same as in reckoner 5 and the diff command to succeed.

How can we reproduce this?

You can include a string in the course file that has a $ in the value.

Version

6.0.0

Search

Code of Conduct

Additional context

No response

sudermanjr commented 1 year ago

~In your example to reproduce the issue, you only have a single $. Have you tried example$$var ?~

Edit: Misunderstood the problem

sudermanjr commented 1 year ago

I still cannot reproduce the error. Can you please try with the latest RC of 6.1.0? I did this on Version:6.1.0-rc.3 Commit:069b95f3dfbcb496cb9f890970c8545546e2cf63

 SECRET_TEST='foo$foo' reckoner template /tmp/course.yaml -a
---
_references: {}
namespace: infra
repository: stable
context: DONOTUSE
helm_args:
- --skip-tests
- --include-crds
repositories:
  fairwinds-stable:
    url: https://charts.fairwinds.com/stable
  fairwinds-incubator:
    url: https://charts.fairwinds.com/incubator
charts:
  vpa:
    chart: vpa
    namespace: vpa
    version: 1.2.2
    repository: fairwinds-stable
    values:
      env:
        - name: FOO
          value: "$SECRET_TEST"
      recommender:
        extraArgs:
          pod-recommendation-min-cpu-millicores: 15
          pod-recommendation-min-memory-mb: 50
          farlge: "$SECRET_TEST"
          v: 1
          prometheus-address: |
            http://prometheus-operator-prometheus.prometheus-operator.svc.cluster.local:9090
          storage: prometheus
      admissionController:
        enabled: true
        cleanupOnDelete:
          enabled: false
        resources:
          limits:
            cpu: 50m
            memory: 64Mi
          requests:
            cpu: 50m
            memory: 64Mi
Startouf commented 1 year ago

Hello I believe I might be running into the same problem.

How are you supposed to escape $ in string ? I believe it was using $$ but I'm running into the following error

In one of my chart values I need to escape a PHP symbol

nextcloud:
  host: cloud.rockit.dance
  containerport: 8082
  configs:
    domains.config.php: |-
      <?php
      $$CONFIG = array (
        'trusted_domains' =>
          array (
            0 => '192.168.2.*',
            1 => 'cloud.example.com',
          )
      );

and I have the following error

ERROR: environment variable CONFIG is not set
Course file has schema validation errors - error opening course file core.yaml: Course file has schema validation errors

I'll try updating reckoner to see it it works

EDIT : moving the values to a file seems to work as variable seem not to work in files

releases:
  - name: nextcloud
    ...
    files:
      - ./values/nextcloud.yml
sudermanjr commented 1 year ago

@Startouf and @Azahorscak Can you please indicate which exact version of reckoner you are using?