Skaffold 不接受 yaml 中的“命令”参数

问题描述

这是我正在使用的 Skaffold yaml:

apiVersion: skaffold/v1
kind: Config
Metadata:
  name: myapp-api
build:
  artifacts:
  - image: elodie/myapp-api
    context: .
    docker:
      dockerfile: Dockerfile
deploy:
  helm:
    releases:
    - name: elodie-api
      chartPath: bitnami/node
      remote: true
      setValues:
        command: ['/bin/bash','-ec','npm start']
        image.repository: elodie/myapp-api
        service.type: LoadBalancer
        getAppFromExternalRepository: false
        applicationPort: 6666
      setValueTemplates:
        image.tag: "{{ .DIGEST_HEX }}"

添加命令配置时出现 parsing skaffold config: error parsing skaffold configuration file: unable to parse config: yaml: unmarshal errors: line 16: cannot unmarshal !!seq into string 错误,但该值直接从 bitnami 提供的 values.yaml 中取出。

为什么我会收到这个错误,有什么想法吗?

解决方法

setValues 变成了 --set 参数的序列 helm。所以`setValues:只支持字符串值。

Helm 确实支持 represent other structures with --set 的方法。看起来您应该可以使用:

setValues:
  command: "{/bin/bash,-ec,npm start}"