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

Edge cases while using vendor per environment approach. #207

Closed
olegmayko opened this issue Feb 11, 2020 · 2 comments
Closed

Edge cases while using vendor per environment approach. #207

olegmayko opened this issue Feb 11, 2020 · 2 comments
Labels
component/jsonnet Everything regarding the jsonnet language kind/question Something isn't clear and needs to be answered

Comments

@olegmayko
Copy link
Contributor

olegmayko commented Feb 11, 2020

It's related to #198. Two cases I've noticed when this feature doesn't work/search correctly:

  1. I've added jsonnetfile.json and tkrc.yaml into environments/minikube folder. I excluded from it importing ksonnet/ksonnet.beta.4/k.libsonnet as it's already in global vendor. But it failed
    tk apply -v environments/minikube

evaluating jsonnet: RUNTIME ERROR: couldn't open import "ksonnet/ksonnet.beta.4/k.libsonnet": no match locally or in the Jsonnet library paths
/Users/oleg/git/k8s-services/tanka/environments/minikube/vendor/ksm/kube-state-metrics/kube-state-metrics.libsonnet:1:11-54 thunk from <$>
/Users/oleg/git/k8s-services/tanka/environments/minikube/vendor/ksm/kube-state-metrics/kube-state-metrics.libsonnet:33:25-26
/Users/oleg/git/k8s-services/tanka/environments/minikube/vendor/ksm/kube-state-metrics/kube-state-metrics.libsonnet:142:5-16
During manifestation

I had to add back ksonnet dependency into jsonnetfile.json.

  1. I've added libsonnet to lib folder (which is created by tk init) and I try to call it

local g = import 'generic.libsonnet';
but
tk apply -v environments/minikube
evaluating jsonnet: RUNTIME ERROR: couldn't open import "generic.libsonnet": no match >locally or in the Jsonnet library paths

However, if add dir prefix it works.

local g = import 'lib/generic.libsonnet';

Let me know if you need additional information.

@sh0rez
Copy link
Member

sh0rez commented Feb 11, 2020

tkrc.yaml NEVER belongs into an environment, but into the root of your project (where vendor/, lib/ and jsonnetfile.json are located).

Telling from what you said above, you put it into environments/...?

https://tanka.dev/libraries/overriding#create-tkrcyaml and https://tanka.dev/directory-structure#root-and-base explain why.

@sh0rez sh0rez added component/cli Command Line Interface kind/question Something isn't clear and needs to be answered component/jsonnet Everything regarding the jsonnet language and removed component/cli Command Line Interface labels Feb 12, 2020
@olegmayko
Copy link
Contributor Author

sorry, my bad. it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/jsonnet Everything regarding the jsonnet language kind/question Something isn't clear and needs to be answered
Projects
None yet
Development

No branches or pull requests

2 participants