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

fix: Fix authtoken ticker #114

Merged
merged 1 commit into from
Jun 24, 2022
Merged

fix: Fix authtoken ticker #114

merged 1 commit into from
Jun 24, 2022

Conversation

helayoty
Copy link
Contributor

Description of your changes

  • Duration shouldn't be 0.

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Special notes for your reviewer

@@ -66,10 +66,7 @@ func main() {
// Stat returns file info. It will return
// an error if there is no file.
_, err := os.Stat(tokenFilePath)
if err != nil {
klog.Error(err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

no more logging?

Copy link
Contributor

Choose a reason for hiding this comment

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

why retry here at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why retry here at all?

The refresh token will take time until the file got to appear. This way will keep the member-agent trying for a couple of time until the file is ready.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no more logging?

already handled in like 71-74

Copy link
Contributor

Choose a reason for hiding this comment

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

why retry here at all?

The refresh token will take time until the file got to appear. This way will keep the member-agent trying for a couple of time until the file is ready.

There is no guarantee that this retry will succeed, right? We can just exit and let the k8s handle the retry too.

Copy link
Contributor Author

@helayoty helayoty Jun 24, 2022

Choose a reason for hiding this comment

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

We can, but since the token is written to pod(ephemeral) storage, every time we deploy the member-agent container will initially fail to boot, potentially trigging alerts on deployment. How about increasing backoff?

cmd/memberagent/main.go Outdated Show resolved Hide resolved
@@ -66,10 +66,7 @@ func main() {
// Stat returns file info. It will return
// an error if there is no file.
_, err := os.Stat(tokenFilePath)
if err != nil {
klog.Error(err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

why retry here at all?

The refresh token will take time until the file got to appear. This way will keep the member-agent trying for a couple of time until the file is ready.

There is no guarantee that this retry will succeed, right? We can just exit and let the k8s handle the retry too.

cmd/memberagent/main.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 24, 2022

Codecov Report

Merging #114 (55803e0) into main (36181c5) will increase coverage by 0.10%.
The diff coverage is 100.00%.

❗ Current head 55803e0 differs from pull request most recent head 3f2e7fd. Consider uploading reports for the commit 3f2e7fd to get more accurate results

@@            Coverage Diff             @@
##             main     #114      +/-   ##
==========================================
+ Coverage   76.45%   76.55%   +0.10%     
==========================================
  Files           5        5              
  Lines         671      674       +3     
==========================================
+ Hits          513      516       +3     
  Misses        148      148              
  Partials       10       10              
Impacted Files Coverage Δ
pkg/authtoken/token_refresher.go 79.31% <100.00%> (+1.53%) ⬆️
pkg/authtoken/token_writer.go 39.28% <100.00%> (+2.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 36181c5...3f2e7fd. Read the comment docs.

@helayoty helayoty merged commit 43255bd into Azure:main Jun 24, 2022
@helayoty helayoty deleted the update-authtoken branch June 24, 2022 20:45
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

Successfully merging this pull request may close these issues.

4 participants