kubeadm: check only for RuntimeReady condition

We only check for the `RuntimeReady` condition instead of anything else
like the `NetworkReady` to allow kubeadm to provision the cluster.

Refers to https://github.com/kubernetes/kubernetes/pull/124685#issuecomment-2138655482
Follow-up on: https://github.com/kubernetes/kubernetes/pull/124685

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
This commit is contained in:
Sascha Grunert 2024-05-30 08:33:22 +02:00
parent 957c953867
commit 51a36294a3
No known key found for this signature in database
GPG Key ID: 09D97D153EF94D93
2 changed files with 18 additions and 1 deletions

View File

@ -104,7 +104,8 @@ func (runtime *CRIRuntime) IsRunning() error {
}
for _, condition := range res.GetStatus().GetConditions() {
if !condition.GetStatus() {
if condition.GetType() == runtimeapi.RuntimeReady && // NetworkReady will not be tested on purpose
!condition.GetStatus() {
return errors.Errorf(
"container runtime condition %q is not true. reason: %s, message: %s",
condition.GetType(), condition.GetReason(), condition.GetMessage(),

View File

@ -95,6 +95,7 @@ func TestIsRunning(t *testing.T) {
mock.StatusReturns(&v1.StatusResponse{Status: &v1.RuntimeStatus{
Conditions: []*v1.RuntimeCondition{
{
Type: v1.RuntimeReady,
Status: false,
},
},
@ -103,6 +104,21 @@ func TestIsRunning(t *testing.T) {
},
shouldError: true,
},
{
name: "valid: runtime condition type does not match",
prepare: func(mock *fakeImpl) {
mock.StatusReturns(&v1.StatusResponse{Status: &v1.RuntimeStatus{
Conditions: []*v1.RuntimeCondition{
{
Type: v1.NetworkReady,
Status: false,
},
},
},
}, nil)
},
shouldError: false,
},
} {
t.Run(tc.name, func(t *testing.T) {
containerRuntime := NewContainerRuntime("")