Skip to content

Commit

Permalink
Merge pull request #1357 from dusk125/master
Browse files Browse the repository at this point in the history
OCPBUGS-17199:  Revert pull request #1350
  • Loading branch information
openshift-merge-bot[bot] authored Oct 16, 2024
2 parents df38d11 + e86d267 commit 26e5aee
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/operator/ceohelpers/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,20 @@ func IsBootstrapComplete(configmapLister corev1listers.ConfigMapLister, staticPo
return isBootstrapComplete, err
}

// now run check to stability of revisions
_, status, _, err := staticPodClient.GetStaticPodOperatorState()
if err != nil {
return false, fmt.Errorf("failed to get static pod operator state: %w", err)
}
if status.LatestAvailableRevision == 0 {
return false, nil
}
for _, curr := range status.NodeStatuses {
if curr.CurrentRevision != status.LatestAvailableRevision {
klog.V(4).Infof("bootstrap considered incomplete because revision %d is still in progress", status.LatestAvailableRevision)
return false, nil
}
}

// check if etcd-bootstrap member is still present within the etcd cluster membership
membersList, err := etcdClient.MemberList(context.Background())
Expand Down
7 changes: 7 additions & 0 deletions pkg/operator/ceohelpers/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ func Test_IsBootstrapComplete(t *testing.T) {
expectComplete: true,
expectError: nil,
},
"bootstrap complete, node progressing": {
bootstrapConfigMap: bootstrapComplete,
nodes: twoNodesProgressingTowardsCurrentRevision,
etcdMembers: u.DefaultEtcdMembers(),
expectComplete: false,
expectError: nil,
},
"bootstrap complete, etcd-bootstrap removed": {
bootstrapConfigMap: bootstrapComplete,
nodes: twoNodesAtCurrentRevision,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,37 @@ func TestBootstrapAnnotationRemoval(t *testing.T) {
}
},
},
{
// The configmap should remain intact because although bootstrapping
// reports complete, the nodes are still progressing towards a revision.
name: "NewClusterBootstrapNodesProgressing",
objects: []runtime.Object{
u.BootstrapConfigMap(u.WithBootstrapStatus("complete")),
u.EndpointsConfigMap(
u.WithBootstrapIP("192.0.2.1"),
u.WithEndpoint(etcdMembers[0].ID, etcdMembers[0].PeerURLs[0]),
u.WithEndpoint(etcdMembers[1].ID, etcdMembers[1].PeerURLs[0]),
u.WithEndpoint(etcdMembers[2].ID, etcdMembers[2].PeerURLs[0]),
),
},
staticPodStatus: u.StaticPodOperatorStatus(
u.WithLatestRevision(3),
u.WithNodeStatusAtCurrentRevision(3),
u.WithNodeStatusAtCurrentRevision(2),
u.WithNodeStatusAtCurrentRevision(3),
),
expectBootstrap: true,
etcdMembers: etcdMembers,
validateFunc: func(ts *testing.T, endpoints []func(*corev1.ConfigMap), actions []clientgotesting.Action) {
for _, action := range actions {
if action.Matches("update", "configmaps") {
updateAction := action.(clientgotesting.UpdateAction)
actual := updateAction.GetObject().(*corev1.ConfigMap)
ts.Errorf("unexpected configmap update: %#v", actual)
}
}
},
},
{
// The configmap should remain intact because although nodes appear
// to have converged on a revision, bootstrap reports incomplete.
Expand Down

0 comments on commit 26e5aee

Please sign in to comment.