-
Notifications
You must be signed in to change notification settings - Fork 141
OCPBUGS-100170: Rebase master to Kubernetes v1.36.3 #2727
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
Changes from all commits
3ddb659
720f13b
746956b
bed40bd
ff173bd
903e7fc
d20c60a
24b3a25
1a4d068
5acf40f
b86d94a
ab57dc0
ccca5a9
9f5059c
f127ce3
5f28948
7e33c3d
115636a
6ddb28b
fc22179
c9ee548
f015292
4434901
fb2467e
2c14a99
5874ee7
9419ebe
dec683b
cc4f7df
8ba6370
0f29094
450e998
9deb725
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 1.26.4 | ||
| 1.26.5 |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| v1.36.0-go1.26.4-bullseye.0 | ||
| v1.36.0-go1.26.5-bullseye.0 |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -584,14 +584,17 @@ func (c *Client) getMemberStatus(memberID uint64) (isLearner bool, started bool, | |||||||||||||||||||||||
| func (c *Client) MemberPromote(learnerID uint64) error { | ||||||||||||||||||||||||
| var ( | ||||||||||||||||||||||||
| lastError error | ||||||||||||||||||||||||
| isLearner bool | ||||||||||||||||||||||||
| isStarted bool | ||||||||||||||||||||||||
| learnerIDUint = strconv.FormatUint(learnerID, 16) | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| klog.V(1).Infof("[etcd] Waiting for a learner to start: %s", learnerIDUint) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| err := wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, kubeadmapi.GetActiveTimeouts().EtcdAPICall.Duration, | ||||||||||||||||||||||||
| true, func(_ context.Context) (bool, error) { | ||||||||||||||||||||||||
| isLearner, started, err := c.getMemberStatus(learnerID) | ||||||||||||||||||||||||
| var err error | ||||||||||||||||||||||||
| isLearner, isStarted, err = c.getMemberStatus(learnerID) | ||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||
| lastError = errors.WithMessagef(err, "failed to get member %s status", learnerIDUint) | ||||||||||||||||||||||||
| return false, nil | ||||||||||||||||||||||||
|
|
@@ -600,7 +603,7 @@ func (c *Client) MemberPromote(learnerID uint64) error { | |||||||||||||||||||||||
| klog.V(1).Infof("[etcd] Member %s was already promoted.", learnerIDUint) | ||||||||||||||||||||||||
| return true, nil | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| if !started { | ||||||||||||||||||||||||
| if !isStarted { | ||||||||||||||||||||||||
| klog.V(1).Infof("[etcd] Member %s is not started yet. Waiting for it to be started.", learnerIDUint) | ||||||||||||||||||||||||
| lastError = errors.Errorf("the etcd member %s is not started", learnerIDUint) | ||||||||||||||||||||||||
| return false, nil | ||||||||||||||||||||||||
|
|
@@ -611,6 +614,10 @@ func (c *Client) MemberPromote(learnerID uint64) error { | |||||||||||||||||||||||
| return lastError | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if !isLearner { | ||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
Comment on lines
+617
to
+619
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Early return skips endpoint registration, unlike the equivalent branch in the promote loop. When the member is already voting on the first status check, 🛠️ Sketch if !isLearner {
- return nil
+ resp, err := c.listMembersOnce()
+ if err != nil {
+ return err
+ }
+ c.addPeerEndpoint(resp.Members, learnerID)
+ return nil
}(factor the Line 679 loop into a small helper reused by both paths) 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| klog.V(1).Infof("[etcd] Promoting a learner as a voting member: %s", learnerIDUint) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| cli, err := c.newEtcdClient(c.Endpoints) | ||||||||||||||||||||||||
|
|
@@ -626,14 +633,39 @@ func (c *Client) MemberPromote(learnerID uint64) error { | |||||||||||||||||||||||
| // 2. context deadline exceeded | ||||||||||||||||||||||||
| // 3. peer URLs already exists | ||||||||||||||||||||||||
| // Once the client provides a way to check if the etcd learner is ready to promote, the retry logic can be revisited. | ||||||||||||||||||||||||
| var promoteResp *clientv3.MemberPromoteResponse | ||||||||||||||||||||||||
| var memberList []*etcdserverpb.Member | ||||||||||||||||||||||||
| err = wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, kubeadmapi.GetActiveTimeouts().EtcdAPICall.Duration, | ||||||||||||||||||||||||
| true, func(_ context.Context) (bool, error) { | ||||||||||||||||||||||||
| // MemberPromote can return a transient client-side error even if the | ||||||||||||||||||||||||
| // promotion already succeeded on the etcd side. Check the current | ||||||||||||||||||||||||
| // member state before attempting another promotion so that retries | ||||||||||||||||||||||||
| // remain idempotent. | ||||||||||||||||||||||||
| resp, statusErr := c.listMembersOnce() | ||||||||||||||||||||||||
| if statusErr != nil { | ||||||||||||||||||||||||
| klog.V(5).Infof("[etcd] Failed to list members before promoting learner %s: %v", learnerIDUint, statusErr) | ||||||||||||||||||||||||
| lastError = statusErr | ||||||||||||||||||||||||
| return false, nil | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| for _, m := range resp.Members { | ||||||||||||||||||||||||
| if m.ID != learnerID { | ||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if !m.IsLearner { | ||||||||||||||||||||||||
| klog.V(1).Infof("[etcd] Member %s is already a voting member, treating promotion as successful", learnerIDUint) | ||||||||||||||||||||||||
| memberList = resp.Members | ||||||||||||||||||||||||
| return true, nil | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| break | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ctx, cancel := context.WithTimeout(context.Background(), etcdTimeout) | ||||||||||||||||||||||||
| defer cancel() | ||||||||||||||||||||||||
| promoteResp, err = cli.MemberPromote(ctx, learnerID) | ||||||||||||||||||||||||
| promoteResp, err := cli.MemberPromote(ctx, learnerID) | ||||||||||||||||||||||||
| if err == nil { | ||||||||||||||||||||||||
| klog.V(1).Infof("[etcd] The learner was promoted as a voting member: %s", learnerIDUint) | ||||||||||||||||||||||||
| memberList = promoteResp.Members | ||||||||||||||||||||||||
| return true, nil | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| klog.V(5).Infof("[etcd] Promoting the learner %s failed: %v", learnerIDUint, err) | ||||||||||||||||||||||||
|
|
@@ -644,7 +676,7 @@ func (c *Client) MemberPromote(learnerID uint64) error { | |||||||||||||||||||||||
| return lastError | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| for _, m := range promoteResp.Members { | ||||||||||||||||||||||||
| for _, m := range memberList { | ||||||||||||||||||||||||
| if m.ID == learnerID { | ||||||||||||||||||||||||
| parsedPeerAddrs, err := url.Parse(m.PeerURLs[0]) | ||||||||||||||||||||||||
| if 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.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Propagate the poll context and guard against a nil
lastErr.The closure discards the poll context and issues the
Getwithcontext.Background(), so individual API calls aren't bounded by theKubernetesAPICalldeadline. Also, ifwaitever returns an error whilelastErris nil,errbecomes nil and execution falls through to line 122 with a nilconfigMap.As per path instructions, "context.Context for cancellation and timeouts".
🛠️ Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
Source: Path instructions