GoogleContainerTools / GoogleContainerTools/skaffold

"requires" field does not take affect on the order of module deployment

Open
#9,515 0 comments 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

Minimum reproduction config: https://github.com/aiotter/skaffold-issue-requires

In this repo, `main` module will deploy `ConfigMap` on namespace `test`, which is to be created by `cfg1` module.
`main` is dependent on `cfg1`, so `cfg1` is supposed to deploy `Namespace` resource before `main`, but it does not happens.

### Expected behavior
When the module `main` depends on the module `cfg1` and you run `skaffold run`, `cfg1` must be deployed first and then `main`.

### Actual behavior
Under some conditions, `cfg1` is deployed first.

### Information

- Skaffold version: v2.13.2
- Operating system: macOS 14.0
- Installed via: Homebrew
- Contents of skaffold.yaml:
```yaml
# ./skaffold.yaml
apiVersion: skaffold/v4beta11
kind: Config
metadata:
name: main
requires:
- configs: [cfg1]
deploy:
helm:
releases:
- name: test
chartPath: chart
---
apiVersion: skaffold/v4beta11
kind: Config
metadata:
name: cfg1
manifests:
rawYaml:
- namespace.yaml
deploy:
kubectl:
```

```yaml
# ./chart/templates/test.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: test
namespace: cfg1
data:
hello: world
```

### Steps to reproduce the behavior

1. `git clone https://github.com/aiotter/skaffold-issue-requires`
2. `skaffold run`

```
$ skaffold run -vdebug
DEBU[0000] skaffold API not starting as it's not requested subtask=-1 task=DevLoop
INFO[0000] Skaffold &{Version:v2.13.2 ConfigVersion:skaffold/v4beta11 GitVersion: GitCommit:64621312014d9d749790bfee13cb459895a0cd5f BuildDate:2024-08-21T15:54:07Z GoVersion:go1.23.0 Compiler:gc Platform:darwin/arm64 User:} subtask=-1 task=DevLoop
INFO[0000] Loaded Skaffold defaults from "/Users/aiotter/.skaffold/config" subtask=-1 task=DevLoop
DEBU[0000] found config for context "orbstack" subtask=-1 task=DevLoop
DEBU[0000] parsed 2 configs from configuration file /Users/aiotter/work/skaffold-issue-requires/skaffold.yaml subtask=-1 task=DevLoop
DEBU[0000] Defaulting build type to local build subtask=-1 task=DevLoop
DEBU[0000] parsed 2 configs from configuration file /Users/aiotter/work/skaffold-issue-requires/skaffold.yaml subtask=-1 task=DevLoop
DEBU[0000] Defaulting build type to local build subtask=-1 task=DevLoop
DEBU[0000] Defaulting build type to local build subtask=-1 task=DevLoop
INFO[0000] Using kubectl context: orbstack subtask=-1 task=DevLoop
DEBU[0000] getting client config for kubeContext: `orbstack` subtask=-1 task=DevLoop
INFO[0000] Using local-cluster=true from config subtask=-1 task=DevLoop
DEBU[0000] getting client config for kubeContext: `orbstack` subtask=-1 task=DevLoop
DEBU[0000] Running command: [minikube version --output=json] subtask=-1 task=DevLoop
DEBU[0000] Command output: [{"commit":"8220a6eb95f0a4d75f7f2d7b14cef975f050512d","minikubeVersion":"v1.32.0"}
] subtask=-1 task=DevLoop
DEBU[0000] Running command: [/opt/homebrew/bin/minikube profile list -o json --user=skaffold] subtask=-1 task=DevLoop
DEBU[0000] Command output: ...
INFO[0000] no kpt renderer or deployer found, skipping hydrated-dir creation subtask=-1 task=DevLoop
DEBU[0000] Running command: [kubectl config view --minify -o jsonpath='{..namespace}'] subtask=-1 task=DevLoop
DEBU[0000] Command output: [''] subtask=-1 task=DevLoop
DEBU[0000] Running command: [helm version --client] subtask=-1 task=DevLoop
DEBU[0000] Command output: [version.BuildInfo{Version:"v3.14.0", GitCommit:"3fc9f4b2638e76f26739cd77c7017139be81d0ea", GitTreeState:"clean", GoVersion:"go1.21.6"}
] subtask=-1 task=DevLoop
DEBU[0000] CLI platforms provided: "" subtask=-1 task=DevLoop
DEBU[0000] getting client config for kubeContext: `orbstack` subtask=-1 task=DevLoop
DEBU[0000] platforms detected from active kubernetes cluster nodes: "linux/arm64" subtask=-1 task=DevLoop
DEBU[0000] Using builder: local subtask=-1 task=DevLoop
DEBU[0000] push value not present in NewBuilder, defaulting to false because cluster.PushImages is false subtask=-1 task=DevLoop
DEBU[0000] Using builder: local subtask=-1 task=DevLoop
DEBU[0000] push value not present in NewBuilder, defaulting to false because cluster.PushImages is false subtask=-1 task=DevLoop
INFO[0000] build concurrency set to default value of -1 subtask=-1 task=DevLoop
No tags generated
INFO[0000] Tags generated in 15.208µs subtask=-1 task=Build
INFO[0000] Cache check completed in 412.083µs subtask=-1 task=Build
Starting test...
INFO[0000] Test completed in 8.292µs subtask=-1 task=Test
INFO[0000] Starting render... subtask=-1 task=DevLoop
INFO[0000] starting render process subtask=0 task=Render
DEBU[0000] Executing template &{envTemplate 0x1400070d0e0 0x1400063a320 } with environment ...
DEBU[0000] manifests with tagged images:apiVersion: v1
kind: Namespace
metadata:
labels:
name: cfg1
name: cfg1 subtask=0 task=Render
DEBU[0000] manifests with labels apiVersion: v1
kind: Namespace
metadata:
labels:
name: cfg1
name: cfg1 subtask=-1 task=DevLoop
INFO[0000] Render completed in 1.06925ms subtask=-1 task=DevLoop
Starting deploy...
DEBU[0000] getting client config for kubeContext: `orbstack` subtask=-1 task=DevLoop
INFO[0000] Deploying with helm v3.14.0 ... subtask=0 task=Deploy
DEBU[0000] Executing template &{envTemplate 0x140009a6fc0 0x1400063a550 } with environment ...
DEBU[0000] Executing template &{envTemplate 0x14000774240 0x1400063a5a0 } with environment ...
DEBU[0000] Executing template &{envTemplate 0x14000774fc0 0x1400063a5f0 } with environment ...
DEBU[0000] Executing template &{envTemplate 0x14000775b00 0x1400063a640 } with environment ...
DEBU[0000] Running command: [helm --kube-context orbstack get all test] subtask=0 task=Deploy
INFO[0000] Building helm dependencies... subtask=0 task=Deploy
DEBU[0000] Running command: [helm --kube-context orbstack dep build chart] subtask=0 task=Deploy
DEBU[0001] EnvVarMap: map[] subtask=-1 task=DevLoop
DEBU[0001] Running command: [helm --kube-context orbstack upgrade test chart --post-renderer /opt/homebrew/bin/skaffold] subtask=0 task=Deploy
Error: UPGRADE FAILED: failed to create resource: namespaces "cfg1" not found
DEBU[0001] Running command: [tput colors] subtask=-1 task=DevLoop
DEBU[0001] Command output: [256
] subtask=-1 task=DevLoop
deploying "test": install: exit status 1
DEBU[0001] exporting metrics subtask=-1 task=DevLoop
DEBU[0001] failed to create firelog exporter due to error: open assets/firelog_generated/key.txt: file does not exist subtask=-1 task=DevLoop
DEBU[0001] did not create any log exporter subtask=-1 task=DevLoop
```

btw I don't understand why skaffold is referring to minikube in the log above.
I don't use minikube but OrbStack in the current kubectl config.

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.