11

Per this spec on github and these helm instructions I'm trying to upgrade our Helm installation of datadog using the following syntax:

helm upgrade datadog-monitoring --set datadog.confd."kube_scheduler\.yaml".instances[0].prometheus_url="http://localhost:10251/metrics",datadog.confd."kube_scheduler\.yaml".init_config= stable/datadog

However I'm getting the error below regardless of any attempt at altering the syntax of the prometheus_url value (putting the url in quotes, escaping the quotes, etc):

Error: UPGRADE FAILED: failed to create resource: 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 ...|er.yaml":{"instances|..., bigger context ...|{"apiVersion":"v1","data":{"kube_scheduler.yaml":{"instances":[{"prometheus_url":"\"http://localhost|...

If I add the --dry-run --debug flags I get the following yaml output:

REVISION: 7
RELEASED: Mon Mar  2 14:28:52 2020
CHART: datadog-1.39.7
USER-SUPPLIED VALUES:
datadog:
  confd:
    kube_scheduler.yaml:
      init_config: ""
      instances:
      - prometheus_url: http://localhost:10251/metrics

The Yaml output appears to mesh with the integration as specified on this github page.

NealR
  • 10,189
  • 61
  • 159
  • 299
  • sometime you may face problem on APP_PORT: "8080". In this case you need to parse to integer in your code. But using double or single quote will resolve the issue – Roushan Jan 21 '22 at 14:07
  • This has been answered here - [https://stackoverflow.com/questions/59354115/helm-upgrade-fails-with-error-expects-or-n-but-found-t](https://stackoverflow.com/questions/59354115/helm-upgrade-fails-with-error-expects-or-n-but-found-t) – Vijay Patil Dec 05 '22 at 17:15
  • This has been answered here - https://stackoverflow.com/questions/59354115/helm-upgrade-fails-with-error-expects-or-n-but-found-t – Vijay Patil Dec 05 '22 at 18:18

1 Answers1

25

So, the problem, as I can understand, is due to the ConfigMap configuration. I've faced the same with the following config:

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-config
  labels:
    group: mock
data:
  APP_NAME: my-mock
  APP_PORT: 8080
  APP_PATH: /api

And I have solved it only by surrounding all the values with quotes:

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-config
  labels:
    group: mock
data:
  APP_NAME: "my-mock"
  APP_PORT: "8080"
  APP_PATH: "/api"
Danial
  • 362
  • 4
  • 18
Pavel Artanov
  • 469
  • 6
  • 6
  • 1
    sometime you may face problem on APP_PORT: "8080". In this case you need to parse to integer in your code. But using double or single quote will resolve the issue. – Roushan Jan 21 '22 at 14:07