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

kpt fn sink not writing output to specified directory #981

Closed
wpwoodjr opened this issue Aug 27, 2020 · 3 comments
Closed

kpt fn sink not writing output to specified directory #981

wpwoodjr opened this issue Aug 27, 2020 · 3 comments
Assignees
Labels
p1 size/M 2 day triaged Issue has been triaged by adding an `area/` label

Comments

@wpwoodjr
Copy link

In this example I try to write kpt fn sink output to ../tmp but instead it overwrites the current working directory files.

$ mkdir test
$ kpt pkg init test/
writing test/Kptfile
writing test/README.md
$ cd test
$ cp ../helloworld/namespace.yaml .
$ cat namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
  name: helloworld
  labels:
    color: orange
$ mkdir ../tmp
$ kpt fn source . | kpt fn run .  --image gcr.io/kpt-functions/label-namespace -- label_name=color label_value=blue | kpt fn sink ../tmp
$ cat namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
  name: helloworld
  labels:
    color: blue
$ ls ../tmp
@phanimarupaka phanimarupaka self-assigned this Aug 29, 2020
@phanimarupaka phanimarupaka added area/cfg p1 size/M 2 day triaged Issue has been triaged by adding an `area/` label labels Aug 29, 2020
@mikebz
Copy link
Contributor

mikebz commented Dec 11, 2020

@natasha41575 @runewake2 interesting issue for either one of you to explore, repro and potentially fix. Seems to be a very nicely documented bug report. Thank you @wpwoodjr

@runewake2
Copy link
Contributor

Hi,

I believe what is happening is being caused by kpt fn run being passed a directory argument. This prevents kpt fn run from outputting and being consumed by your kpt fn sink command and instead has it perform an in-place operation. Removing the . directory argument in kpt fn run should allow your kpt fn source | kpt fn run | kpt fn sink pipeline to complete as you expect.

For example:

- kpt fn source . | kpt fn run .  --image gcr.io/kpt-functions/label-namespace -- label_name=color label_value=blue | kpt fn sink ../tmp
+ kpt fn source . | kpt fn run --image gcr.io/kpt-functions/label-namespace -- label_name=color label_value=blue | kpt fn sink ../tmp

I've opened PR #1361 that hopefully helps clarify this behavior in kpt's documentation.

If your still encountering this issue after making this change let us know.

@runewake2
Copy link
Contributor

I'm going to close this issue. If the changes I suggested above don't fix the issue you are encountering please reopen this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1 size/M 2 day triaged Issue has been triaged by adding an `area/` label
Projects
None yet
Development

No branches or pull requests

4 participants