GoogleContainerTools / skaffold

Easy and Repeatable Kubernetes Development

Home Page:https://skaffold.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

skaffold render with Kustomize and --set fails on ConfigMap generation

hjestaedt-flyr opened this issue · comments

Expected behavior

Issue 1

A kustomization.yaml contains a configuration to generate a ConfigMap from a *.env file, just like this:

configMapGenerator:
  - name: foobar-config
    envs:
      - local.env

I would expect the following output when running skaffold render -p issue1 --set="foo=bar":

apiVersion: v1
data:
  NAME: foobar
kind: ConfigMap
metadata:
  name: foobar-config-hbtb84cg8d

Issue 2

Akustomization.yaml contains a configuration to generate a ConfigMap including a file application-local.yaml, but rename the key to application.yaml, just like this:

configMapGenerator:
  - name: foobar-config
    files:
      - application.yaml=application-foobar.yaml

I would expect the following output when running skaffold render -p issue2 --set="foo=bar":

apiVersion: v1
data:
  application.yaml: 'name: foobar'
kind: ConfigMap
metadata:
  name: foobar-config-m896ch6d5m

Actual behavior

Issue 1

If I run skaffold render -p issue1 --set="foo=bar", I get the following error:

running [kustomize build /var/folders/dy/qslwfy7n0jz3wp1gjxs3m32h0000gp/T/4251885249/Users/foobar/src/test/skaffold-set-issue/src/foobar/kustomize/overlays/issue1]
 - stdout: ""
 - stderr: "Error: loading KV pairs: env source files: [local.env]: evalsymlink failure on '/private/var/folders/dy/qslwfy7n0jz3wp1gjxs3m32h0000gp/T/4251885249/Users/foobar/src/test/skaffold-set-issue/src/foobar/kustomize/overlays/issue1/local.env' : lstat /private/var/folders/dy/qslwfy7n0jz3wp1gjxs3m32h0000gp/T/4251885249/Users/foobar/src/test/skaffold-set-issue/src/foobar/kustomize/overlays/issue1/local.env: no such file or directory\n"
 - cause: exit status 1

If I just run skaffold render -p issue1, everything is as expected.

Issue 2

If I run skaffold render -p issue2 --set="foo=bar", I get the following error:

open /Users/foobar/src/test/skaffold-set-issue/src/foobar/kustomize/overlays/issue2/application.yaml=application-foobar.yaml: no such file or directory

If I just run skaffold render -p issue2, everything is as expected.

Information

apiVersion: skaffold/v4beta9
kind: Config

metadata:
  name: foobar

build:
  artifacts:
    - image: examples/foobar
      context: .

profiles:
  - name: issue1
    manifests:
      kustomize:
        paths:
          - kustomize/overlays/issue1/

  - name: issue2
    manifests:
      kustomize:
        paths:
          - kustomize/overlays/issue2/

Steps to reproduce the behavior

Checkout https://github.com/hjestaedt-flyr/skaffold-issue and run:

  • skaffold render -p issue1 --set="foo=bar"
  • skaffold render -p issue2 --set="foo=bar"

Please let me know, if you want me to split this into two issues.