GoogleContainerTools / GoogleContainerTools/skaffold

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

Open
#9,338 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

### Expected behavior

#### Issue 1

A `kustomization.yaml` contains a configuration to generate a ConfigMap from a `*.env` file, just like this:
```yaml
configMapGenerator:
- name: foobar-config
envs:
- local.env
```

I would expect the following output when running `skaffold render -p issue1 --set="foo=bar"`:
```yaml
apiVersion: v1
data:
NAME: foobar
kind: ConfigMap
metadata:
name: foobar-config-hbtb84cg8d
```

#### Issue 2

A`kustomization.yaml` contains a configuration to generate a ConfigMap including a file `application-local.yaml`, but rename the key to `application.yaml`, just like this:
```yaml
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"`:
```yaml
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:
```bash
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:
```bash
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

- Skaffold version: v2.10.1
- Operating system: macOS 14.3 (Build 23D56)
- Installed via: homebrew
- Contents of skaffold.yaml: https://raw.githubusercontent.com/hjestaedt-flyr/skaffold-issue/main/src/foobar/skaffold.yaml

```yaml
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.