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

Allow output path relative to function config file #12

Open
howardjohn opened this issue Mar 2, 2021 · 2 comments
Open

Allow output path relative to function config file #12

howardjohn opened this issue Mar 2, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@howardjohn
Copy link

Say I have a folder setup like

.
|_ my-pkg
    |_ khelm-function.yaml

I want to emit run the function to end up like

.
|_ my-pkg
    |_ khelm-function.yaml
    |_ rendered.yaml

If I run kpt fn run --network . from . or my-pkg, I get different results. It would be great to be able to output to the same folder as khelm-function.yaml - whether by default or some option/special file format/whatever. This way, as I accumulate many functions, I can just run them at the top level.

Alternatively, I can set outputPath: my-pkg/rendered.yaml, but then I cannot run the fn in my-pkg folder and it leaks folder structure details a bit.

@mgoltzsche
Copy link
Owner

mgoltzsche commented Mar 3, 2021

@howardjohn I am afraid that this is a kpt issue: khelm runs within a container and just prints the templated manifests to stdout with paths annotated on resources (see here). kpt uses these paths to derive the full file name on the host and write it to disk. I don't think I can access the function file path within the function.
While the function resource itself is within the function input that is provided via stdin and has the path annotated I wouldn't know how to reliably identify the function resource/declaration from the input that lead to the execution of the currently running function.

Do you know kpt functions that print resource paths relative to their function.yaml location?
Please let me know if you have an idea how it could be done or create a kpt issue.

(While it is about the input I was also thinking about making kpt more project and working directory agnostic in another issue.)

For now you can manage your kpt function declarations within a (repo's) root directory and refer to sources within and write manifests into sub directories.

@mgoltzsche
Copy link
Owner

@howardjohn I created a kpt feature request for this: kptdev/kpt#1531

@mgoltzsche mgoltzsche added the enhancement New feature or request label Mar 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants