在值中的一个值上出现错误.yaml文件



我试图将我的configMap yaml中的值替换为该值的值。yaml文件。

我的价值观。Yaml文件包括从我的部署中引用的字段。

我试图替换现在硬编码的值在我的configMap。使用从值中获取的值。yaml文件。

当我运行"helm template"命令时,一切正常,没有错误显示。
但是,当我运行"升级命令"时,它失败了,显示如下错误:

Error: UPGRADE FAILED: cannot patch "oct-2-files" with kind ConfigMap:    
"" is invalid: patch: Invalid value: "{"apiVersion":"v1","data":{"keys":"\n\n##server.http.port=4442\n\n\nbase.request.host=https://localhost\n\nbase.request.port=8060\n\nlte.device.provisioning.simulate.mode=false\n\n\npostgres.cluster=${POSTGRES_CLUSTER}\n\npostgres.host=${POSTGRES_HOST}\n\npostgres.port=${POSTGRES_PORT}\n\npostgres.dbname=${POSTGRES_DB}\n\n\n\njdbc.user=${POSTGRES_USER}\n\njdbc.pass=${POSTGRES_PASS}\n\n\n\n#spring.data.mongodb.host=${MONGO_HOST}\n\nspring.data.mongodb.uri=${MONGO_URI}\n\n\nspring.redis.password=${REDIS_PASS}\n\n\nspring.redis.host=${REDIS_HOST}\n\nspring.redis.port=${REDIS_PORT}\n\n\n\n\nactivemq.cluster=${AMQ_CLUSTER}\n\nactivemq.server.address=${AMQ_HOST}\n\nactivemq.server.port=${AMQ_PORT}\n\n\n\nlocation.mapitem.image_path=/usr/src/octopus/storage/\n\n\n\n## OCR\n\n\nocr.tesseract.data.path=/usr/src/octopus/backend/tesseract\n\n\n\n# define if image saving is enabled\n\nocr.image.saving.enabled=true\n\n\n# the path for the image storing folder\n\nocr.image.path=/usr/src/octopus/storage/\n\n\n# cron pattern for image clean process\n\nocr.image.clean.cron.expression=0 0/10 * * * *\n\n\nocr.image.engine=fe\n\n\n\n## Debugging\n\n# To enable debugging activate the desired properties below and restart the\nbackend container, e.g.:\n\n# docker restart octopus-be-dev-1\n\n\n# logging.level.org.springframework.web=DEBUG\n\nlogging.level.org.springframework.web=INFO\n\n\n# logging.level.com.mot.nsa=DEBUG\n\nlogging.level.com.mot.nsa=INFO\n\n\n# logging.level.root=DEBUG\n\nlogging.level.root=INFO\n\n\n# logging.level.org.apache.camel=on\n\nlogging.level.org.apache.camel=off\n\n\n# log4j.logger.org.springframework=DEBUG\n\nlog4j.logger.org.springframework=INFO\n\n\n# logging.level.org.hibernate=DEBUG\n\nlogging.level.org.hibernate=INFO\n\n\n# hibernate.show_sql=true\n\nhibernate.show_sql=false\n","server.http.port":4442},"kind":"ConfigMap","metadata":{"annotations":{"meta.helm.sh/release-name":"helmoct","meta.helm.sh/release-namespace":"default"},"creationTimestamp":"2022-06-23T07:05:20Z","labels":{"app.kubernetes.io/managed-by":"Helm"},"managedFields":[{"manager":"kubectl-create","operation":"Update","apiVersion":"v1","time":"2022-03-14T15:50:44Z","fieldsType":"FieldsV1","fieldsV1":{"f:data":{}}},{"manager":"helm","operation":"Update","apiVersion":"v1","time":"2022-06-27T04:35:27Z","fieldsType":"FieldsV1","fieldsV1":{"f:data":{"f:keys":{}}}}],"name":"octopus-2-files","namespace":"default","resourceVersion":"738993","uid":"e43715b4-cdb9-4c13-94a4-2877ec975597"}}":    
**json: cannot unmarshal number into Go struct field ConfigMap.data of type string**

这是我的值。yaml文件:

version: 164   
dummyhostval: 1.13.19.196   
mainfeport: 9090   
proxyhost: 1.13.19.73   
httpport: 4442    #this is the only value from the configMap yaml

这是我的configMap yaml:

kind: ConfigMap
apiVersion: v1
metadata:
name: octopus-2-files
data:
server.http.port: {{ .Values."httpport" }}
keys: |

##server.http.port=4442

base.request.host=https://localhost
base.request.port=8060
lte.device.provisioning.simulate.mode=false

postgres.cluster=${POSTGRES_CLUSTER}
postgres.host=${POSTGRES_HOST}
postgres.port=${POSTGRES_PORT}
postgres.dbname=${POSTGRES_DB}

为什么helm认为它是一个数字,我该如何克服它?

错误告诉您不能在configmap中使用数字。你需要让它都是字符串

不能将number解封为Go结构域ConfigMap。字符串类型的数据

所以引用服务器端口:

server.http.port: {{ .Values.httpport | quote }}

最新更新