GoogleContainerTools / GoogleContainerTools/skaffold
Deploy section in profile does not fully replace deployment configuration
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
### Expected behavior
According to https://skaffold.dev/docs/environment/profiles/, "the specified build, test and deploy configuration in [the profile] will replace the build, test and deploy sections declared in the main section of skaffold.yaml". I expect that if I specify a deploy section in a profile, it should just use that and not retain any information form the main section.
### Actual behavior
Skaffold runs the `kubectl` command defined in the main section even though I only specified `kustomize` in my profile. I can suppress this if I explicitly set `kubectl: {}` in my profile.
### Information
- Skaffold version: v1.23.0
- Operating system: Linux
- Installed via: skaffold.dev
- Contents of skaffold.yaml:
```yaml
apiVersion: skaffold/v2beta14
kind: Config
metadata:
name: environments
build:
tagPolicy:
sha256: {}
artifacts:
- image: gcr.io/devops-environments/manager
docker:
dockerfile: cmd/manager/Dockerfile
deploy:
kubectl:
remoteManifests:
- environments-system:deployment/manager
profiles:
- name: release
activation:
- command: render
test:
- image: gcr.io/devops-environments/manager
custom:
- command: make test
deploy:
# kubectl: {} # Uncomment to fix
kustomize:
paths:
- config/release
```
### Steps to reproduce the behavior
1. Run `skaffold render` using the above configuration
2. Observe that Skaffold tries to read a remote manifest from the context
### Log output
```
time="2021-05-19T23:51:02Z" level=info msg="Skaffold &{Version:v1.23.0 ConfigVersion:skaffold/v2beta15 GitVersion: GitCommit:e8f3c652112c338e75e03497bc8ab09b9081142d BuildDate:2021-04-28T00:53:10Z GoVersion:go1.14.14 Compiler:gc Platform:linux/amd64}"
time="2021-05-19T23:51:02Z" level=info msg="Loaded Skaffold defaults from \"/usr/local/google/home/ekuefler/.skaffold/config\""
time="2021-05-19T23:51:02Z" level=debug msg="config version out of date: upgrading to latest \"skaffold/v2beta15\""
time="2021-05-19T23:51:02Z" level=debug msg="parsed 1 configs from configuration file /usr/local/google/home/ekuefler/environments/skaffold.yaml"
time="2021-05-19T23:51:02Z" level=info msg="applying profile: release"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field Build"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field artifacts"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field insecureRegistries"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field tagPolicy"
time="2021-05-19T23:51:02Z" level=info msg="no values found in profile for field TagPolicy, using original config values"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field BuildType"
time="2021-05-19T23:51:02Z" level=info msg="no values found in profile for field BuildType, using original config values"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field Test"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field Deploy"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field DeployType"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field helm"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field kpt"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field kubectl"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field kustomize"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field statusCheckDeadlineSeconds"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field kubeContext"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field logs"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field prefix"
time="2021-05-19T23:51:02Z" level=debug msg="overlaying profile on config for field PortForward"
time="2021-05-19T23:51:02Z" level=debug msg="Defaulting build type to local build"
time="2021-05-19T23:51:02Z" level=info msg="Using kubectl context: gke_z752110b7bf8cdc07-tp_us-west1_ekuefler-8414cc74"
time="2021-05-19T23:51:02Z" level=debug msg="Running command: [minikube version --output=json]"
time="2021-05-19T23:51:02Z" level=debug msg="setting Docker user agent to skaffold-v1.23.0"
time="2021-05-19T23:51:02Z" level=debug msg="Using builder: local"
time="2021-05-19T23:51:02Z" level=debug msg="push value not present, defaulting to true because cluster.PushImages is true"
time="2021-05-19T23:51:02Z" level=info msg="build concurrency first set to 1 parsed from *local.Builder[0]"
time="2021-05-19T23:51:02Z" level=info msg="final build concurrency value is 1"
time="2021-05-19T23:51:02Z" level=debug msg="push value not present, defaulting to true because cluster.PushImages is true"
time="2021-05-19T23:51:02Z" level=debug msg="Running command: [kubectl version --client -ojson]"
time="2021-05-19T23:51:02Z" level=debug msg="could not parse date \"\""
time="2021-05-19T23:51:03Z" level=debug msg="Command output: [{\n \"clientVersion\": {\n \"major\": \"1\",\n \"minor\": \"21\",\n \"gitVersion\": \"v1.21.1\",\n \"gitCommit\": \"5e58841cce77d4bc13713ad2b91fa0d961e69192\",\n \"gitTreeState\": \"clean\",\n \"buildDate\": \"2021-05-12T14:18:45Z\",\n \"goVersion\": \"go1.16.4\",\n \"compiler\": \"gc\",\n \"platform\": \"linux/amd64\"\n }\n}\n]"
time="2021-05-19T23:51:03Z" level=info msg="Using default-repo=gcr.io/devops-environments-playground from config"
time="2021-05-19T23:51:03Z" level=info msg="Tags generated in 199.419µs"
time="2021-05-19T23:51:03Z" level=debug msg="Found dependencies for dockerfile: [{go.mod /workspace true} {go.sum /workspace true} {. /workspace true}]"
time="2021-05-19T23:51:03Z" level=debug msg="Could not import artifact from Docker, building instead (import of missing images disabled)"
time="2021-05-19T23:51:03Z" level=info msg="Cache check completed in 406.206663ms"
time="2021-05-19T23:51:03Z" level=debug msg="Running docker build: context: ., dockerfile: cmd/manager/Dockerfile"
time="2021-05-19T23:51:52Z" level=info msg="Build completed in 48.686 seconds"
time="2021-05-19T23:51:52Z" level=debug msg="push value not present, defaulting to true because cluster.PushImages is true"
time="2021-05-19T23:51:52Z" level=debug msg="Running command: [kubectl version --client -ojson]"
time="2021-05-19T23:51:52Z" level=debug msg="Command output: [{\n \"clientVersion\": {\n \"major\": \"1\",\n \"minor\": \"21\",\n \"gitVersion\": \"v1.21.1\",\n \"gitCommit\": \"5e58841cce77d4bc13713ad2b91fa0d961e69192\",\n \"gitTreeState\": \"clean\",\n \"buildDate\": \"2021-05-12T14:18:45Z\",\n \"goVersion\": \"go1.16.4\",\n \"compiler\": \"gc\",\n \"platform\": \"linux/amd64\"\n }\n}\n]"
time="2021-05-19T23:51:52Z" level=warning msg="k8s/*.yaml did not match any file"
time="2021-05-19T23:51:52Z" level=debug msg="Running command: [kubectl --context gke_z752110b7bf8cdc07-tp_us-west1_ekuefler-8414cc74 --namespace environments-system get deployment/manager -o yaml]"
getting remote manifests: exit status 1
time="2021-05-19T23:52:53Z" level=debug msg="exporting metrics"
time="2021-05-19T23:52:53Z" level=debug msg="metrics uploading complete in 227.061635ms"
```
Contributor guide
Assessment
This issue has not been assessed yet.