FairwindsOps / reckoner

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

Validation Errors for Unused Variables #667

Closed transient1 closed 1 year ago

transient1 commented 1 year ago

What happened?

Running reckoner plot -o cert-manager course.yml to only install cert-manager, and this error is emitted:

ERROR: environment variable ${SOME_VAR} is not set
Course file has schema validation errors - error opening course file course.yml: Course file has schema validation errors

The variable in question belongs to another addon in the course.yml file.

What did you expect to happen?

To successfully install a chart, provided that its schema was correct, not have it fail due to an error with another, unrelated chart.

How can we reproduce this?

Requires a course.yml with at least 2 charts, where one of the charts uses environment variables, like the datadog apm chart. Try to plot the chart that has no variables, and it should fail because the variables used in the datadog chart are not defined.

Version

reckoner 6.0.0

Search

Code of Conduct

Additional context

No response

sudermanjr commented 1 year ago

I'm on the fence as to whether we should support this or not. In the current scenario, we are able to parse other fields as environment variables, such as namespace, or even chart names, which opens up a lot of functionality. This however requires us to parse the entire course file for env vars every time your run reckoner.

It would be exceptionally tricky to only parse env vars in part of the file based on the -o flag, and it would probably remove the ability to use environment variables in the header of the file.

transient1 commented 1 year ago

Would it be feasible to have a flag to ignore variables? I'm imagining that in the scenario I encountered I would see that the vars it's erroring on are not part of my plot, so not important to me, and could therefore pass a flag saying ignore that error. Although maybe my case was an edge one since I was testing something else, and one could reasonably expect that if you have a chart included in your course file you're using it and have defined the variables.

Okay, I think I just convinced myself that it's not necessary.