From 4f8147906943f9673040e22ef1c3605d32a84996 Mon Sep 17 00:00:00 2001 From: Tobias Trabelsi Date: Tue, 7 Oct 2025 11:18:39 +0200 Subject: [PATCH] fix(): also drop api server response to debug in case there are no errors --- internal/k8s.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/k8s.go b/internal/k8s.go index f56480e..a62f3c8 100644 --- a/internal/k8s.go +++ b/internal/k8s.go @@ -91,13 +91,18 @@ func RecreateIPPoolCrd(cfg *Config, name string, ips []string) error { var status int res.StatusCode(&status) + raw, rawErr := res.Raw() + if status < 200 || status >= 400 { + log.WithFields(log.Fields{ + "Caller": "RecreateIPPoolCrd", + }).Warnf("Response from k8s api server: %s", string(raw)) return fmt.Errorf("failed to post CRD to kube api: %v", res.Error()) } - raw, rawErr := res.Raw() + log.WithFields(log.Fields{ "Caller": "RecreateIPPoolCrd", - }).Infof("Response from k8s api server: %s", string(raw)) + }).Debugf("Response from k8s api server: %s", string(raw)) if rawErr != nil { log.WithFields(log.Fields{