-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
UpdateOrCreateToken get secrets err handling optimization #115000
UpdateOrCreateToken get secrets err handling optimization #115000
Conversation
@helen-frank: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Hi @helen-frank. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
/retest |
@@ -43,6 +44,8 @@ func UpdateOrCreateTokens(client clientset.Interface, failIfExists bool, tokens | |||
secret, err := client.CoreV1().Secrets(metav1.NamespaceSystem).Get(context.TODO(), secretName, metav1.GetOptions{}) | |||
if secret != nil && err == nil && failIfExists { | |||
return errors.Errorf("a token with id %q already exists", token.Token.ID) | |||
} else if err != nil && !apierrors.IsNotFound(err) { | |||
return err |
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.
can this be written like this?
if err != nil && !apierrors.IsNotFound(err) {
return err
}
if secret != nil && failIfExists {
return errors.Errorf("a token with id %q already exists", token.Token.ID)
}
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
can you explain in more detail what errors you are seeing and under what conditions? |
…, the error is thrown in time Signed-off-by: helen <haitao.zhang@daocloud.io>
8fb1f8e
to
e6591d2
Compare
This is not a bug, this kind of treatment is to deal with the error in time, not to continue no matter what the error is. |
/retest |
1 similar comment
/retest |
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.
/approve
i think this is safe to change, if we don't retry the API calls (wrap UpdateOrCreateTokens in a retry loop?)
i could not find any cases in the kubeadm code that do the retries.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: helen-frank, neolit123 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 |
Is a good idea, maybe I can add a concurrent processing to it, what do you think |
no i think we should keep it the way it is, right now. |
Got it, I will do it as soon as possible to retry the development of logic. |
i meant we should probably keep it the way it is for now without retry. perhaps for a separate PR. |
/cc @pacoxu |
/lgtm |
LGTM label has been added. Git tree hash: 179d3f3697ea90bba76b24fb2f8af4bda93f72aa
|
Signed-off-by: helen haitao.zhang@daocloud.io
What type of PR is this?
/kind feature
What this PR does / why we need it:
when UpdateOrCreateToken get secrets, if the error is not a NotFound, the error is thrown in time
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: