[cherry-pick release-1.18] Fast-fail backup when built-in data mover has no running node-agent (#10360)
Run the E2E test on kind / setup-test-matrix (push) Successful in 2s
e2e-test-kind.yaml / extract (push) Successful in 16s
Run the E2E test on kind / get-go-version (push) Successful in 18s
push.yml / extract (push) Successful in 12s
Main CI / get-go-version (push) Successful in 13s
Run the E2E test on kind / build (push) Failing after 25s
Run the E2E test on kind / run-e2e-test (push) Skipped
Main CI / Build (push) Failing after 34s

* Fast-fail backup when built-in data mover has no running node-agent

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Joseph <jvaikath@redhat.com>
Signed-off-by: Chai Bot <ship-help-github@redhat.com>

* Run make update to fix import ordering

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Joseph <jvaikath@redhat.com>
Signed-off-by: Chai Bot <ship-help-github@redhat.com>

* Create new changelog for release 10360

Signed-off-by: Chai Bot <ship-help-github@redhat.com>

---------

Signed-off-by: Joseph <jvaikath@redhat.com>
Signed-off-by: Chai Bot <ship-help-github@redhat.com>
Co-authored-by: Joseph <jvaikath@redhat.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
This commit is contained in:
Chai-bot
2026-08-25 22:52:02 +00:00
committed by GitHub
co-authored by Claude Opus 4.6 Joseph Tiger Kaovilai
parent 882d409195
commit 7770a0884e
5 changed files with 228 additions and 12 deletions
+30
View File
@@ -22,6 +22,8 @@ import (
"fmt"
"github.com/cockroachdb/errors"
"github.com/sirupsen/logrus"
appsv1api "k8s.io/api/apps/v1"
corev1api "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -80,6 +82,34 @@ func KbClientIsRunningInNode(ctx context.Context, namespace string, nodeName str
return isRunningInNode(ctx, namespace, nodeName, nil, kubeClient)
}
// IsReady checks whether the node-agent daemonset has at least one ready pod
// by inspecting the DaemonSet status. It only checks the daemonset for node
// OS types that are present in the cluster, following the same pattern as
// server.checkNodeAgent.
func IsReady(ctx context.Context, namespace string, crClient ctrlclient.Client, log logrus.FieldLogger) error {
if kube.WithLinuxNode(ctx, crClient, log) {
ds := new(appsv1api.DaemonSet)
if err := crClient.Get(ctx, ctrlclient.ObjectKey{Namespace: namespace, Name: daemonSet}, ds); err != nil {
return errors.Wrap(err, "failed to get linux node-agent daemonset")
}
if ds.Status.NumberReady > 0 {
return nil
}
}
if kube.WithWindowsNode(ctx, crClient, log) {
ds := new(appsv1api.DaemonSet)
if err := crClient.Get(ctx, ctrlclient.ObjectKey{Namespace: namespace, Name: daemonsetWindows}, ds); err != nil {
return errors.Wrap(err, "failed to get windows node-agent daemonset")
}
if ds.Status.NumberReady > 0 {
return nil
}
}
return errors.New("node-agent is not ready: no ready pods found")
}
// IsRunningInNode checks if the node agent pod is running properly in a specified node through controller client. If not, return the error found
func IsRunningInNode(ctx context.Context, namespace string, nodeName string, crClient ctrlclient.Client) error {
return isRunningInNode(ctx, namespace, nodeName, crClient, nil)