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

NETOBSERV-857 After some time, it fails to retrieve flows #310

Merged
merged 1 commit into from
Mar 24, 2023

Conversation

jpinsonneau
Copy link
Contributor

Reload HOST token from file on every query

@jpinsonneau
Copy link
Contributor Author

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 21, 2023
@codecov
Copy link

codecov bot commented Mar 21, 2023

Codecov Report

Merging #310 (e35befb) into main (b00b682) will increase coverage by 0.02%.
The diff coverage is 57.14%.

@@            Coverage Diff             @@
##             main     #310      +/-   ##
==========================================
+ Coverage   58.49%   58.51%   +0.02%     
==========================================
  Files         148      148              
  Lines        6536     6532       -4     
  Branches      783      783              
==========================================
- Hits         3823     3822       -1     
+ Misses       2497     2494       -3     
  Partials      216      216              
Flag Coverage Δ
uitests 59.06% <ø> (ø)
unittests 56.92% <57.14%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/handler/loki.go 42.13% <50.00%> (-0.73%) ⬇️
pkg/loki/config.go 100.00% <100.00%> (+26.08%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link

New image: ["quay.io/netobserv/network-observability-console-plugin:5cf517e"]. It will expire after two weeks.

@jpinsonneau jpinsonneau marked this pull request as ready for review March 21, 2023 15:33
@jpinsonneau jpinsonneau requested a review from jotak March 21, 2023 15:34
@memodi
Copy link
Contributor

memodi commented Mar 21, 2023

/ok-to-test

} else if cfg.Authorization != "" {
headers[auth.AuthHeader] = []string{cfg.Authorization}
} else if cfg.TokenPath != "" {
bytes, err := os.ReadFile(cfg.TokenPath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a bit less straightforward, but we could keep the token in memory for something like 5 minutes and then make it expire? Like it's suggested there: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#launch-a-pod-using-service-account-token-projection
That would avoid reading files at every request.

Currently we use the default expiration time which is 1 hour if I'm correct, so reloading every 5min is a comfortable margin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about fsnotify ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm more for keeping it simple ... don't think we need something that sophisticated here? There's more complexity by having a watcher, error handling might be different and more tricky (e.g. if an error makes you "miss" a change event, should you just report the error? reload the file anyway? I think the answer isn't obvious)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and also not introducing a new dependency just for that)

@jotak
Copy link
Member

jotak commented Mar 21, 2023

/lgtm
up to you to do what I suggested above or not .. this isn't super critical

@memodi
Copy link
Contributor

memodi commented Mar 23, 2023

/label qe-approved

Verified no longer running into the cert issue with this change when authToken: HOST is set.

@openshift-ci openshift-ci bot added the qe-approved QE has approved this pull request label Mar 23, 2023
@jotak
Copy link
Member

jotak commented Mar 24, 2023

@jpinsonneau are we good to merge?

@jpinsonneau
Copy link
Contributor Author

/approve

@openshift-ci
Copy link

openshift-ci bot commented Mar 24, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jpinsonneau

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit be861fb into netobserv:main Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. qe-approved QE has approved this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants