From f711b2af32c3fe2c221b493db379d38a3f0a09f3 Mon Sep 17 00:00:00 2001 From: googs1025 Date: Sat, 3 Aug 2024 08:15:06 +0800 Subject: [PATCH] fix error output --- pkg/webhooks/pod_admission_webhook.go | 2 +- pkg/webhooks/pod_mutating_webhook.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/webhooks/pod_admission_webhook.go b/pkg/webhooks/pod_admission_webhook.go index f04bca400..746916d7c 100644 --- a/pkg/webhooks/pod_admission_webhook.go +++ b/pkg/webhooks/pod_admission_webhook.go @@ -54,7 +54,7 @@ func (p *podWebhook) ValidateCreate(ctx context.Context, obj runtime.Object) (ad return nil, fmt.Errorf("follower pod node selector not set") } if _, exists := pod.Spec.NodeSelector[topologyKey]; !exists { - return nil, fmt.Errorf("follower pod node selector not set") + return nil, fmt.Errorf("follower pod node selector for topology domain not found. missing selector: %s", topologyKey) } // For follower pods, validate leader pod exists and is scheduled. leaderScheduled, err := p.leaderPodScheduled(ctx, pod) diff --git a/pkg/webhooks/pod_mutating_webhook.go b/pkg/webhooks/pod_mutating_webhook.go index e6bbb95f3..f6c73f4af 100644 --- a/pkg/webhooks/pod_mutating_webhook.go +++ b/pkg/webhooks/pod_mutating_webhook.go @@ -188,7 +188,7 @@ func (p *podWebhook) topologyFromPod(ctx context.Context, pod *corev1.Pod, topol // Get topology (e.g. node pool name) from node labels. topology, exists := node.Labels[topologyKey] if !exists { - return "", fmt.Errorf("node does not have topology label: %s", topology) + return "", fmt.Errorf("node does not have topology label: %s", topologyKey) } return topology, nil }