-
Notifications
You must be signed in to change notification settings - Fork 20
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
Don't fail requests if we can't update clusterAuthToken.lastUsedAt #32
Conversation
c3a4bc3
to
a6e3a79
Compare
a6e3a79
to
7ea87ac
Compare
@@ -135,31 +133,31 @@ func (h *KubeAPIHandlers) v1getAndVerifyUser(accessKey, secretKey string) (*type | |||
|
|||
if refresh.Add(refreshPeriod).Before(now) { | |||
clusterUserAttribute.NeedsRefresh = true | |||
shouldUpdate = true | |||
if _, err := h.clusterUserAttribute.Update(clusterUserAttribute); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously we weren't updating the clusterUserAttribute
. Why are we adding this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We accidentally stopped updating it in #28 and now we do again as we should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it thanks for the context!
_, err = h.clusterAuthTokens.Update(clusterAuthToken) | ||
if err != nil { | ||
return nil, fmt.Errorf("error updating clusterAuthToken %s: %w", clusterAuthToken.Name, err) | ||
if _, err = h.clusterAuthTokens.Update(clusterAuthToken); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future we may want to migrate to wrangler and use patch
here instead as we do for the local cluster.
@@ -135,31 +133,31 @@ func (h *KubeAPIHandlers) v1getAndVerifyUser(accessKey, secretKey string) (*type | |||
|
|||
if refresh.Add(refreshPeriod).Before(now) { | |||
clusterUserAttribute.NeedsRefresh = true | |||
shouldUpdate = true | |||
if _, err := h.clusterUserAttribute.Update(clusterUserAttribute); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it thanks for the context!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, seems to do what it says it does
Ref: rancher/rancher#48986
clusterAuthToken.lastUsedAt
(don't fail or retry).Ideally we want to migrate
cluster.cattle.io
to wrangler and usepatch
forlastUsedAt
updates instead as we do for the counterpart tokens in the local cluster.