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

RFC: Use container's WorkingDir instead of $KO_DATA_PATH #55

Open
jonjohnsonjr opened this issue Jul 8, 2019 · 9 comments
Open

RFC: Use container's WorkingDir instead of $KO_DATA_PATH #55

jonjohnsonjr opened this issue Jul 8, 2019 · 9 comments
Milestone

Comments

@jonjohnsonjr
Copy link
Collaborator

@dprotaso had an idea that we could use WorkingDir to expose kodata to the built container instead of reading from KO_DATA_PATH. This would be breaking, but it would be nice to have fewer ko-isms.

@xmlking
Copy link
Contributor

xmlking commented Jul 9, 2019

WorkingDir is great as base directory for Destination
we also need flexibility to provide Source directory per image.

I am forced to keep my image's kodata Source in
https://github.com/xmlking/micro-starter-kit/tree/master/srv/account/kodata
I prefer to keep it in
https://github.com/xmlking/micro-starter-kit/tree/master/config

@jonjohnsonjr
Copy link
Collaborator Author

Not a perfect solution, but we've just been symlinking from kodata to other directories, e.g. in https://github.com/knative/serving/tree/master/cmd/controller

@xmlking
Copy link
Contributor

xmlking commented Jul 9, 2019

I could use this trick for my case too and avoid duplicating files . Thanks for sharing.

@xmlking
Copy link
Contributor

xmlking commented Jul 11, 2019

Other problem with /var/run/ko/ is, unable to read when using nonroot images defaultBaseImage: gcr.io/distroless/static:nonroot

@mattmoor
Copy link
Collaborator

@xmlking I suspect the kodata problem is related to the permissions of the directory. I see similar problems, but it seems strangely non-deterministic for me. I have a fix for that here: #68

@github-actions
Copy link

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@dprotaso
Copy link
Contributor

/remove-lifecycle stale

@dprotaso
Copy link
Contributor

Note the original intent was to enable idiomatic loading of kodata similar to golang's testdata

ie.

os.Open("kodata/some-file")

@ktarplee
Copy link

I just added KO support to one of my apps and the only annoying part was that I had to change source code to support static assets in a way that was compatible with KO_DATA_PATH. It seems wrong that it requires that string in my source code. I would much prefer that the contents the kodata directory be in the CWD so that I can reference assets with ./assets from my app and not use the environment variable. Note that there seems to be no other way to do this because you cannot inject a script that does something like export MY_ASSET_DIR=$KO_DATA_PATH/assets where you app uses MY_ASSET_DIR or similar as originally designed. You also cannot change the variable name within the k8s deployment spec either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants