CloudHealth / helm

Apache License 2.0
8 stars 15 forks source link

fix values json schema for apiToken #110

Closed smcavallo closed 8 months ago

smcavallo commented 9 months ago

Unfortunately https://github.com/CloudHealth/helm/pull/108 did not fix the issue. String is not a required field but the json schema requires that there is a type of apiToken and that it must be a string and must match the given pattern. The intention is to only match the given pattern if the apiToken is provided.

This PR fixes that. Output of testing which was performed is below.

null value succeeds

helm template --values=values.yaml . > /dev/null

string less than 6 characters fails

helm template --values=values.yaml --set cloudhealth-collector.apiToken=asf . > /dev/null
Error: values don't meet the specifications of the schema(s) in the following chart(s):
cloudhealth-collector:
- apiToken: Must validate at least one schema (anyOf)
- apiToken: Does not match pattern '^(.{6,48}|)$'

string longer than 6 characters succeeds

helm template --values=values.yaml --set cloudhealth-collector.apiToken=12345s . > /dev/null

string which is 48 characters succeeds

helm template --values=values.yaml --set cloudhealth-collector.apiToken=123456789012345678901234567890123456789012345678 . > /dev/null

string which is longer than 48 characters fails

helm template --values=values.yaml --set cloudhealth-collector.apiToken=1234567890123456789012345678901234567890123456789 . > /dev/null
Error: values don't meet the specifications of the schema(s) in the following chart(s):
cloudhealth-collector:
- apiToken: Must validate at least one schema (anyOf)
- apiToken: Does not match pattern '^(.{6,48}|)$'