Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skaffold render with Kustomize and --set fails with error "failed to apply setter to file: missing Resource metadata" #9239

Closed
carlosafonso opened this issue Jan 6, 2024 · 0 comments · Fixed by #9240
Assignees
Labels
area/render priority/p1 High impact feature/bug.

Comments

@carlosafonso
Copy link

Expected behavior

When rendering a manifest using Kustomize and the --set option, I would expect Skaffold to apply the Kustomize customizations and replace any # from-param: directive with whatever I specify in --set.

Actual behavior

The operation fails with the following error:

failed to apply setter to file /home/user/test/k8s/overlays/prod/patch.yaml, err: missing Resource metadata

Information

  • Skaffold version: v2.9.0
  • Operating system: Ubuntu 20.04.6 LTS
  • Installed via: Google Cloud SDK
  • Contents of skaffold.yaml:
apiVersion: skaffold/v4beta8
kind: Config
metadata:
  name: skaffold-set-bug
profiles:
  - name: raw
    manifests:
      rawYaml:
        - k8s/base/resources.yaml
  - name: kustomize
    manifests:
      kustomize:
        paths:
          - k8s/overlays/prod

Steps to reproduce the behavior

  1. Clone this: https://github.com/carlosafonso/skaffold-set-bug
  2. skaffold -p raw render -> This works correctly, using raw manifests
  3. skaffold -p raw render --set="foo=bar" -> This also works correctly, using raw manifests and replacing the placeholder
  4. skaffold -p kustomize render -> This works correctly, using Kustomize (the patch is applied)
  5. skaffold -p kustomize render --set="foo=foo" -> This fails

-vdebug logs

DEBU[0000] skaffold API not starting as it's not requested  subtask=-1 task=DevLoop
INFO[0000] Skaffold &{Version:v2.9.0 ConfigVersion:skaffold/v4beta8 GitVersion: GitCommit:6071a3f7574702c8666a243d89254e9b0d8ff4d7 BuildDate:2023-11-07T13:13:24Z GoVersion:go1.21.0 Compiler:gc Platform:linux/amd64 User:}  subtask=-1 task=DevLoop
INFO[0000] Loaded Skaffold defaults from "/home/user/.skaffold/config"  subtask=-1 task=DevLoop
DEBU[0000] parsed 1 configs from configuration file /home/user/tests/skaffold.yaml  subtask=-1 task=DevLoop
INFO[0000] applying profile: kustomize                   subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field Build  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field hooks  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field before  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field after  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field artifacts  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field insecureRegistries  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field tagPolicy  subtask=-1 task=DevLoop
INFO[0000] no values found in profile for field TagPolicy, using original config values  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field platforms  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field BuildType  subtask=-1 task=DevLoop
INFO[0000] no values found in profile for field BuildType, using original config values  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field Test   subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field Render  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field Generate  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field rawYaml  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field remoteManifests  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field kustomize  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field helm   subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field kpt    subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field hooks  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field before  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field after  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field transform  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field validate  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field output  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field Deploy  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field DeployType  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field docker  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field helm   subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field kpt    subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field kubectl  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field cloudrun  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field statusCheck  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field statusCheckDeadlineSeconds  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field tolerateFailuresUntilDeadline  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field kubeContext  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field logs   subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field prefix  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field jsonParse  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field fields  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field -      subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field PortForward  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field ResourceSelector  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field allow  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field deny   subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field Verify  subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field CustomActions  subtask=-1 task=DevLoop
DEBU[0000] Defaulting build type to local build          subtask=-1 task=DevLoop
DEBU[0000] Defaulting deploy type to kubectl             subtask=-1 task=DevLoop
INFO[0000] Using kubectl context: minikube               subtask=-1 task=DevLoop
DEBU[0000] getting client config for kubeContext: `minikube`  subtask=-1 task=DevLoop
DEBU[0000] getting client config for kubeContext: `minikube`  subtask=-1 task=DevLoop
DEBU[0000] Running command: [minikube version --output=json]  subtask=-1 task=DevLoop
DEBU[0000] Command output: [{"commit":"fd7ecd9c4599bef9f04c0986c4a0187f98a4396e","minikubeVersion":"v1.31.2"}
]  subtask=-1 task=DevLoop
DEBU[0000] Running command: [/usr/bin/minikube docker-env --shell none -p minikube --user=skaffold]  subtask=-1 task=DevLoop
DEBU[0000] Command output: [DOCKER_TLS_VERIFY=1
DOCKER_HOST=tcp://192.168.49.2:2376
DOCKER_CERT_PATH=/home/user/.minikube/certs
MINIKUBE_ACTIVE_DOCKERD=minikube
SSH_AUTH_SOCK=
SSH_AGENT_PID=
]  subtask=-1 task=DevLoop
DEBU[0000] setting Docker user agent to skaffold-v2.9.0  subtask=-1 task=DevLoop
INFO[0000] Using minikube docker daemon at tcp://192.168.49.2:2376  subtask=-1 task=DevLoop
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: ['default']                   subtask=-1 task=DevLoop
DEBU[0000] CLI platforms provided: ""                    subtask=-1 task=DevLoop
DEBU[0000] platform detection from active kubernetes cluster is not enabled  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
INFO[0000] Tags generated in 8.306µs                     subtask=-1 task=Build
INFO[0000] Starting render...                            subtask=-1 task=DevLoop
DEBU[0000] Running command: [kubectl version --client -ojson]  subtask=-1 task=DevLoop
DEBU[0000] Command output: [{
  "clientVersion": {
    "major": "1",
    "minor": "28",
    "gitVersion": "v1.28.2",
    "gitCommit": "89a4ea3e1e4ddd7f7572286090359983e0387b2f",
    "gitTreeState": "clean",
    "buildDate": "2023-09-13T09:35:49Z",
    "goVersion": "go1.20.8",
    "compiler": "gc",
    "platform": "linux/amd64"
  },
  "kustomizeVersion": "v5.0.4-0.20230601165947-6ce0bf390ce3"
}
]  subtask=-1 task=DevLoop
DEBU[0000] Executing template &{envTemplate 0xc000a5f9e0 0xc0008d29b0  } with environment ***REDACTED***  subtask=-1 task=DevLoop
DEBU[0000] Running command: [tput colors]                subtask=-1 task=DevLoop
DEBU[0000] Command output: [256
]                        subtask=-1 task=DevLoop
failed to apply setter to file /home/user/tests/k8s/overlays/prod/patch.yaml, err: missing Resource metadata
DEBU[0000] exporting metrics                             subtask=-1 task=DevLoop
DEBU[0001] metrics uploading complete in 445.332566ms    subtask=-1 task=DevLoop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/render priority/p1 High impact feature/bug.
Projects
None yet
2 participants