kyverno / chainsaw

Declarative K8s e2e testing
https://kyverno.github.io/chainsaw/
Apache License 2.0
267 stars 40 forks source link

[Question] String interpolation for testing ConfigMap data #1866

Closed aaronborden-rivian closed 2 weeks ago

aaronborden-rivian commented 3 weeks ago

Describe your question

I have ConfigMap data that I want to verify is correct. The content might include interpolated values, like the namespace. (join('-', [$values.myvar, 'hardcoded-suffix'])) works fine for small strings, but if you have a multi-line string, this becomes very cumbersome.

What is the recommended approach for validating string data like this?

apiVersion: v1
kind: ConfigMap
metadata:
  name: config
 data:
   config.ini: |
    [main]
    host=storage.service.($namespace):1234

    [logging]
    level=($logLevel)

chainsaw version Version

v0.2.8

Additional context

No response

eddycharly commented 3 weeks ago

String interpolation is not supported yet. The best way i can think about is probably to use placeholders and replace/replace_all.

I would love to support interpolation but didn't start working on it yet.

eddycharly commented 2 weeks ago

Closing, please reopen if necessary.