Is this a BUG REPORT or FEATURE REQUEST? (choose one):
Bug Report
Version of Helm and Kubernetes:
Helm 2.11.0
Kubernetes v1.12.1
Which chart:
nginx-ingress version 0.31.0
What happened:
Scenario:
I'm trying to set a configmap value for use-geoip2: true, as the default value in nginx-ingress is 'false' with standard geoip being enabled instead (for the time being). For the same reason, I'm trying to set use-geoip: false. Note: I'm using the 0.21.0 image that supports geoip2, but the rendering/parsing issue seems to be general in nature not specific to this feature.
Approach 1:
helm install stable/nginx-ingress --name myingress \
--set controller.image.tag=0.21.0 \
--set controller.config.use-geoip=false \
--set controller.config.use-geoip2=true
Running with --dry-run --debug, I can see the following configmap data being set which _should_ be valid YAML:
data:
enable-vts-status: "false"
use-geoip: false
use-geoip2: true
However, on the actual run this results in k8s (or is it helm?) throwing an error on parsing the configmap:
Error: release myingress failed: ConfigMap in version "v1" cannot be handled as a ConfigMap: v1.ConfigMap.Data: ReadString: expects " or n, but found f, error found in #10 byte of ...|e-geoip":false,"use-|..., bigger context ...|,"data":{"enable-vts-status":"false","use-geoip":false,"use-geoip2":true},"kind":"ConfigMap","metada|...
Approach 2:
helm install stable/nginx-ingress --name myingress \
--set controller.image.tag=0.21.0 \
--set controller.config.use-geoip=\"false\" \
--set controller.config.use-geoip2=\"true\"
Running with --dry-run --debug, I can see the following configmap data being set:
data:
enable-vts-status: "false"
use-geoip: '"false"' <= note the nested single/double quotes
use-geoip2: '"true"'
This is technically a valid configmap, and helm installs just fine. But due to the nested quotes, nginx-ingress gives up trying to parse out a boolean value from this mess:
configmap.go:227] unexpected error merging defaults: 2 error(s) decoding:
* cannot parse 'use-geoip' as bool: strconv.ParseBool: parsing "\"false\"": invalid syntax
* cannot parse 'use-geoip2' as bool: strconv.ParseBool: parsing "\"true\"": invalid syntax
Is there any way to enforce the output of toYaml to quote the values? There should be a simple solution, but I can't find one. If not, this would mean that boolean configmap values are unsettable without modifying the template files.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.
Any thoughts on this? Has nobody else experienced this problem?
I'm also experiencing this problem
I've also just faced this issue
~same here :(~ I was able to make it work (fix) by using --set-string. For example:
--set-string controller.config.ssl-redirect=false
Thanks @dawidmalina! I consider this a workaround, since booleans should be supported without calling them strings. But great to know there is an interim solution!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.
This issue is being automatically closed due to inactivity.
I'm running into this issue too
Actually was able to put quotes around the booleans and it worked!
values.yaml
controller:
config:
hsts: "true"
hsts-include-subdomains: "true"
hsts-preload: "true"
hsts-max-age: "63072000"
resulting ConfigMap:
apiVersion: v1
data:
enable-vts-status: "false"
hsts: "true"
hsts-include-subdomains: "true"
hsts-max-age: "63072000"
hsts-preload: "true"
kind: ConfigMap
hey I m too getting this same issue
Error: release eg-typeahead failed: ConfigMap in version "v1" cannot be handled as a ConfigMap: v1.ConfigMap.Data: ReadString: expects " or n, but found [, error found in #10 byte of ...|,"rules":[{"metricsQ|..., bigger context ...|piVersion":"v1","data":{"config.yaml":"","rules":[{"metricsQuery":"rate(tomcat_threads_current_threa|...
below is my file
```apiVersion: v1
kind: ConfigMap
metadata:
name: "eg-typeahead"
namespace: "default"
data:
config.yaml: |
rules:
I think that is the issue with your YAML file format. The rules: block must be intented. I had similar issue and I found that all integers must be quoted as well.
if value type is integer or boolean, add quote makes effect.
Error: ConfigMap in version "v1" cannot be handled as a ConfigMap: v1.ConfigMap.Data: ReadString: expects " or n, but found 1, error found in #10 byte of ...|ASSWORD":123,"POSTGR|..., bigger context ...|"data":{"POSTGRES_DB":"test","POSTGRES_PASSWORD":123,"POSTGRES_USER":"postgres"},"kind":"ConfigMap",|...
yes I also resolved above error by putting quotes for values of type integer/boolean and it worked for me while working with helm charts. here's my sample config.yaml file and values.yaml
config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.postgres.config.name }}
labels:
group: {{ .Values.postgres.group }}
data:
{{- range .Values.postgres.config.data }}
{{ .key }}: {{ .value | quote}}
{{- end}}
values.yaml
replicaCount: 1
postgres:
name: postgres
group: db
container:
image: postgres:10.2
port: 5432
service:
type: ClusterIP
port: 5432
volume:
name: postgres-storage
kind: PersistentVolumeClaim
mountPath: /var/lib/postgresql/data
pvc:
name: postgres-persistent-volume-claim
accessMode: ReadWriteOnce
storage: 4Gi
config:
name: postgres-config
data:
- key: POSTGRES_DB
value: test
- key: POSTGRES_USER
value: postgres
- key: POSTGRES_PASSWORD
value: 123
Most helpful comment
~same here :(~ I was able to make it work (fix) by using
--set-string. For example: