From f6902ec848ee74ead29037cbf11adf61abfeff5a Mon Sep 17 00:00:00 2001 From: Steve Hawkins Date: Tue, 29 Nov 2022 16:09:32 -0500 Subject: [PATCH] fix #4136: logging at warning only if warning was requested --- .../kubernetes/client/dsl/internal/OperationSupport.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/OperationSupport.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/OperationSupport.java index f317e4d60a2..55dfa177356 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/OperationSupport.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/OperationSupport.java @@ -30,6 +30,7 @@ import io.fabric8.kubernetes.client.Client; import io.fabric8.kubernetes.client.Config; import io.fabric8.kubernetes.client.KubernetesClientException; +import io.fabric8.kubernetes.client.dsl.FieldValidateable.Validation; import io.fabric8.kubernetes.client.dsl.base.PatchContext; import io.fabric8.kubernetes.client.dsl.base.PatchType; import io.fabric8.kubernetes.client.http.HttpClient; @@ -646,7 +647,11 @@ protected void retryWithExponentialBackoff(CompletableFuture response) { List warnings = response.headers("Warning"); if (warnings != null && !warnings.isEmpty()) { - LOG.warn("Recieved warning(s) from request at {}: {}", request.uri(), warnings); + if (context.fieldValidation == Validation.WARN) { + LOG.warn("Recieved warning(s) from request {}: {}", request.uri(), warnings); + } else { + LOG.debug("Recieved warning(s) from request {}: {}", request.uri(), warnings); + } } if (response.isSuccessful()) { return;