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

/home/runner/work/gnmic/gnmic/pkg/loaders/file_loader/file_loader.go:201: [file_loader] failed to read targets file #301

Open
pree04 opened this issue Nov 23, 2023 · 13 comments

Comments

@pree04
Copy link

pree04 commented Nov 23, 2023

Hi , I am using gnmi file loader to load remote file and i get the error
/home/runner/work/gnmic/gnmic/pkg/loaders/file_loader/file_loader.go:201: [file_loader] failed to read targets file: Get "https://l/raw?private_token=generated token value": context deadline exceeded

hwever i am able to get the content of the file using curl
@karimra Please help.

@karimra
Copy link
Collaborator

karimra commented Nov 23, 2023

That error means the request timed out. There could be many reasons for that.

  • Check that the http server is reachable from gnmic server/container/pod.
  • Check if the http server you run has tls enabled or not and configure the loader accordingly.

@pree04
Copy link
Author

pree04 commented Nov 23, 2023

@karimra

  1. Check that the http server is reachable from gnmic server/container/pod. ->for this i added http_proxy in gnmi env variable,

but how will i check from the gnmic server/container/pod ? curl is not available and even i am unable to do apk add curl there
2. Check if the http server you run has tls enabled or not and configure the loader accordingly. -> since from test pods i am able to curl and i get the file content without passing tls and without using -k .
I feel the way I am passing the token is not correct. Internally gnmi is doing url.Parse(path) . When i do the parse seperately i get the error panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
main.main()
/tmp/sandbox2191370610/prog.go:31 +0x4a5

It seems we can not pass ?token=token value in the url

@karimra
Copy link
Collaborator

karimra commented Nov 23, 2023

If your http server does not have TLS enabled try with a url with scheme http:// not https://

@pree04
Copy link
Author

pree04 commented Nov 23, 2023

No , we need to use https only, but i already set the skip-verify: true
@karimra how to troubleshoot this?
when i try to install curl in pod(using apk add curl) to test the connecitivity to the file i get
ERROR: Unable to lock database: Permission denied
ERROR: Failed to open apk database: Permission denied

@karimra
Copy link
Collaborator

karimra commented Nov 23, 2023

can you share your loader config here, so we are on the same page?

@pree04
Copy link
Author

pree04 commented Nov 23, 2023

insecure: true    
loader:
  type: file
  path: https://<gitlab.com>/api/v4/projects/222/repository/files/test%2ftargets.yaml/raw?private_token=23122432424
  interval: 30s

@karimra
Copy link
Collaborator

karimra commented Nov 23, 2023

maybe replace that %2f with /, the url parsing will do that for you.

@pree04
Copy link
Author

pree04 commented Nov 24, 2023

@karimra url parsing works fine for the url https://<gitlab.com>/api/v4/projects/222/repository/files/test%2ftargets.yaml/raw?private_token=23122432424
but how can i test from gnmi this url is accessible?

@karimra
Copy link
Collaborator

karimra commented Nov 24, 2023

That depends on your setup, that's out of scope of gnmic.

@pree04
Copy link
Author

pree04 commented Nov 24, 2023

@karimra I am able to do the curl from the test pod and as well as from kubernetes nodes . it seems gnmic pods dont allow to install curl to test it from there.

@peejaychilds
Copy link
Contributor

On the node that you are running your gnmic pod you can run curl on the node but in network namespace of the gnmic pod which should tell you if you have some type of issue due to name resolution and/or pod network policy etc.

https://www.redhat.com/sysadmin/container-namespaces-nsenter

Also if the URL works with gnmic outside the pod then the issue is not with gnmic but with your environment ...

@pree04
Copy link
Author

pree04 commented Nov 24, 2023

@peejaychilds @karimra Can gnmi file loader is able to fetch the file from gilab?

@pree04
Copy link
Author

pree04 commented Nov 28, 2023

From the node where gnmi pods are runing, able to curl and get the result from the same gnmi namespace i created a test pod and tried curl that is also working

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

No branches or pull requests

3 participants