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

Unable to install with tanka by following instructions #1301

Closed
ghost opened this issue Nov 21, 2019 · 10 comments · Fixed by #1538
Closed

Unable to install with tanka by following instructions #1301

ghost opened this issue Nov 21, 2019 · 10 comments · Fixed by #1538
Labels
component/packaging lifecycle/upstream A change must be done to an upstream project first

Comments

@ghost
Copy link

ghost commented Nov 21, 2019

Hi I'am doing all required steps from Installing Loki with Tanka guide and get:

# tk show environments/loki
Evaluating jsonnet: RUNTIME ERROR: couldn't open import "k.libsonnet": no match locally or in the Jsonnet library paths
	/data/foo/vendor/ksonnet-util/kausal.libsonnet:2:11-31	thunk <k> from <$>
	/data/foo/vendor/ksonnet-util/kausal.libsonnet:4:1-2	$
	/data/foo/vendor/loki/loki.libsonnet:1:2-40	$
	main.jsonnet:2:14-42	thunk <loki> from <$>
	main.jsonnet:5:1-5	$
	During evaluation

Maybe some steps missing in the guide?

@sandeepsukhani
Copy link
Contributor

Have you followed all the steps from https://github.com/grafana/loki/blob/master/production/ksonnet/README.md#prerequisites

There is a step to get k.libsonnet and k8s.libsonnet

@ghost
Copy link
Author

ghost commented Nov 21, 2019

@sandlis Yes! There are steps I did:

# tk init
Directory structure set up! Remember to configure the API endpoint:
`tk env set environments/default --server=127.0.0.1:6443`

# tk env add environments/loki --namespace=loki

# tk env set environments/loki --server=https://localhost:6443
updated spec.apiServer (` -> `https://localhost:6443`)

# jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k.libsonnet
GET https://github.com/ksonnet/ksonnet-lib/archive/0d2f82676817bbf9e4acf6495b2090205f323b9f.tar.gz 200

# jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3/k8s.libsonnet
GET https://github.com/ksonnet/ksonnet-lib/archive/0d2f82676817bbf9e4acf6495b2090205f323b9f.tar.gz 200

# jb install github.com/grafana/loki/production/ksonnet/loki
GET https://github.com/grafana/loki/archive/a5765b57bfb19ef65a0cad404545f34111e94c58.tar.gz 200
GET https://github.com/grafana/jsonnet-libs/archive/8f9d72b2e35b5f3cc1b7c2a8af9bbae7658804e2.tar.gz 200
GET https://github.com/grafana/jsonnet-libs/archive/8f9d72b2e35b5f3cc1b7c2a8af9bbae7658804e2.tar.gz 200
GET https://github.com/grafana/jsonnet-libs/archive/8f9d72b2e35b5f3cc1b7c2a8af9bbae7658804e2.tar.gz 200

# vim environments/loki/main.jsonnet

# tk show environments/loki
Evaluating jsonnet: RUNTIME ERROR: couldn't open import "k.libsonnet": no match locally or in the Jsonnet library paths
	/data/foo/vendor/ksonnet-util/kausal.libsonnet:2:11-31	thunk <k> from <$>
	/data/foo/vendor/ksonnet-util/kausal.libsonnet:4:1-2	$
	/data/foo/vendor/loki/loki.libsonnet:1:2-40	$
	main.jsonnet:2:14-42	thunk <loki> from <$>
	main.jsonnet:5:1-5	$
	During evaluation

# cat jsonnetfile.json
{
  "dependencies": [
    {
      "name": "k.libsonnet",
      "source": {
        "git": {
          "remote": "https://github.com/ksonnet/ksonnet-lib",
          "subdir": "ksonnet.beta.3/k.libsonnet"
        }
      },
      "version": "master"
    },
    {
      "name": "k8s.libsonnet",
      "source": {
        "git": {
          "remote": "https://github.com/ksonnet/ksonnet-lib",
          "subdir": "ksonnet.beta.3/k8s.libsonnet"
        }
      },
      "version": "master"
    },
    {
      "name": "loki",
      "source": {
        "git": {
          "remote": "https://github.com/grafana/loki",
          "subdir": "production/ksonnet/loki"
        }
      },
      "version": "master"
    }
  ]
}


@sandeepsukhani
Copy link
Contributor

sandeepsukhani commented Nov 21, 2019

can you please try changing k.libsonnet import to ksonnet.beta.3/k.libsonnet in vendor/ksonnet-util/kausal.libsonnet and see if error goes away?
Please do the same for k8s.libsonnet if you see a similar error for that and let me know whether it works.

@sh0rez
Copy link
Member

sh0rez commented Nov 23, 2019

(Tanka maintainer here)

Unfortunately, the the above won't work at the moment. jsonnet-bundler removed support for installing single files (which is by design and won't change), so you have no chance to get jb install this library at the top level (k.libsonnet).

Instead, it will prefix it with the package name (e.g. ksonnet.beta.3/k.libsonnet).

But the other libraries you are importing here won't allow this scheme, as they have k.libsonnet hard-coded.

The only fix at the moment before we work this out is to link those files in place manually:

# install the package
$ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3

# link them to the old name
$ ln -s vendor/ksonnet.beta.3/k.libsonnet lib/k.libsonnet
$ ln -s vendor/ksonnet.beta.3/k8s.libsonnet lib/k8s.libsonnet

Make sure to link into lib/ and NOT into vendor/ because jb will clean all files from vendor/ it does not manage.

@sh0rez sh0rez added component/docs component/packaging lifecycle/upstream A change must be done to an upstream project first labels Nov 23, 2019
@vinodkottem
Copy link

can you please try changing k.libsonnet import to ksonnet.beta.3/k.libsonnet in vendor/ksonnet-util/kausal.libsonnet and see if error goes away?
Please do the same for k8s.libsonnet if you see a similar error for that and let me know whether it works.

It works

@sh0rez
Copy link
Member

sh0rez commented Dec 3, 2019

can you please try changing k.libsonnet import to ksonnet.beta.3/k.libsonnet in vendor/ksonnet-util/kausal.libsonnet and see if error goes away?
Please do the same for k8s.libsonnet if you see a similar error for that and let me know whether it works.

It works

That is NOT a solution you should even consider to use. On the next run the bundles will revert that change and you are back to zero.

Instead, create a file called k.libsonnet in the lib folder with the following line in it:

import "ksonnet.beta.3/k.libsonnet"

@vinodkottem
Copy link

can you please try changing k.libsonnet import to ksonnet.beta.3/k.libsonnet in vendor/ksonnet-util/kausal.libsonnet and see if error goes away?
Please do the same for k8s.libsonnet if you see a similar error for that and let me know whether it works.

It works

That is NOT a solution you should even consider to use. On the next run the bundles will revert that change and you are back to zero.

Instead, create a file called k.libsonnet in the lib folder with the following line in it:

import "ksonnet.beta.3/k.libsonnet"

You are right @sh0rez . This is simple.
My bad, I missed to install jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.3 this when I tried your solution and then went on with other solution.

@sh0rez
Copy link
Member

sh0rez commented Dec 4, 2019

Cool! The docs on https://tanka.dev are in the process of being updated, this will be included as well.

I will add a link here then as well, so that hopefully access to this info becomes better!

@sh0rez sh0rez closed this as completed Dec 4, 2019
@chancez
Copy link
Contributor

chancez commented Jan 16, 2020

@sh0rez Why is this closed? This still seems to be an issue when following the instructions at https://github.com/grafana/loki/tree/master/production/ksonnet

@sh0rez
Copy link
Member

sh0rez commented Jan 16, 2020

You are right, the docs still include invalid information. tk init takes care of installing k.libsonnet now (needs Tanka master for now, release expected for tomorrow).

I'll add a PR to resolve this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/packaging lifecycle/upstream A change must be done to an upstream project first
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants