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

kubectl diff exits with code 0 when files don't exist #1087

Closed
jmcarp opened this issue Jul 26, 2021 · 8 comments
Closed

kubectl diff exits with code 0 when files don't exist #1087

jmcarp opened this issue Jul 26, 2021 · 8 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@jmcarp
Copy link

jmcarp commented Jul 26, 2021

What happened:

Run kubectl diff using a kustomization.yaml that refers to files that don't exist.

What you expected to happen:

A non-zero exit code is returned.

How to reproduce it (as minimally and precisely as possible):

cat <<EOF > kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patchesStrategicMerge:
  - generated/system-service-account-annotations.yaml
EOF

kubectl diff --kustomize .

Anything else we need to know?:

Environment:

  • Kubernetes client and server versions (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:52:14Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"19+", GitVersion:"v1.19.9-gke.1900", GitCommit:"008fd38bf3dc201bebdd4fe26edf9bf87478309a", GitTreeState:"clean", BuildDate:"2021-04-14T09:22:08Z", GoVersion:"go1.15.8b5", Compiler:"gc", Platform:"linux/amd64"}
  • OS (e.g: cat /etc/os-release):
    macos

Happy to submit a patch to change the behavior if it's a bug or to document it if it's expected.

@jmcarp jmcarp added the kind/bug Categorizes issue or PR as related to a bug. label Jul 26, 2021
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jul 26, 2021
@eddiezane
Copy link
Member

cc @rikatz

@soltysh
Copy link
Contributor

soltysh commented Aug 18, 2021

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 18, 2021
@RinkiyaKeDad
Copy link
Member

/assign

@RinkiyaKeDad
Copy link
Member

Hey @jmcarp, I tried but wasn't able to reproduce this issue. Could you please confirm if I followed the correct steps?

  1. kustomization.yaml:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patchesStrategicMerge:
  - generated/system-service-account-annotations.yaml
  1. k diff --kustomize .

This gives me the following error as expected:

error: trouble configuring builtin PatchStrategicMergeTransformer with config: `
paths:
- generated/system-service-account-annotations.yaml
`: evalsymlink failure on '/Users/arsh/Projects/Temp/yamls/generated/system-service-account-annotations.yaml' : lstat /Users/arsh/Projects/Temp/yamls/generated: no such file or directory

It even shows a non-zero exit code of 2 when I run echo $?.

@MadhavJivrajani
Copy link
Contributor

+1
I'm unable to reproduce it as well. My current config is:

Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.0", GitCommit:"c2b5237ccd9c0f1d600d3072634ca66cefdf272f", GitTreeState:"clean", BuildDate:"2021-08-04T18:03:20Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-21T23:01:33Z", GoVersion:"go1.16.4", Compiler:"gc", Platform:"linux/amd64"}

@jmcarp any more information that you can provide that can help reproduce this?

@RinkiyaKeDad RinkiyaKeDad removed their assignment Oct 19, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 17, 2022
@eddiezane
Copy link
Member

We'll track this here kubernetes/enhancements#2574

/close

@k8s-ci-robot
Copy link
Contributor

@eddiezane: Closing this issue.

In response to this:

We'll track this here kubernetes/enhancements#2574

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

7 participants