apollographql / apollographql/router
templatizeExtraLabels doesn't stringify typically non-string values
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 978
- Forks
- 346
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 133
Description
Describe the bug
apollographql.templatizeExtraLabels does not properly translate string values to strings when creating labels if they would otherwise be another scalar type.
For example, adding:
router:
extraLabels:
somelabel: "true"
would end up attempting to create this label:
somelabel: true
which would cause an error.
To Reproduce
Steps to reproduce the behavior:
- Create an
extraLabelslabel that has a string value that would otherwise be a non-string value (like"true") - Observe manifest creation failing with an error around labels saying something like
contains non-string key in the map: true is of the type bool, expected string
Expected behavior
Manifest generation would work just fine.
Additional context
Overriding apollographql.templatizeExtraLabels with the following that uses toJson to stringify the label value solved the issue, but it could introduce breaking changes:
{{- define "apollographql.templatizeExtraLabels" -}}
{{- range $key, $value := .Values.extraLabels }}
{{ printf "%s: %s" $key (toJson (include "apollographql.tplvalues.render" ( dict "value" $value "context" $)))}}
{{- end -}}
{{- end -}}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the apollographql.templatizeExtraLabels template and reproduce the failure with an extraLabels value such as somelabel: "true". The work is done when manifest generation succeeds and the resulting label value remains a string; the issue does not name a specific file or test to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- helm
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100