@@ -116,6 +116,8 @@ public class KUBE_PING extends Discovery {
116116
117117 protected int tp_bind_port ;
118118
119+ private boolean failedJsonErrorReported = false ;
120+
119121 public boolean isDynamic () {
120122 return false ; // bind_port in the transport needs to be fixed (cannot be 0)
121123 }
@@ -301,11 +303,16 @@ public String fetchFromKube() {
301303 protected List <Pod > readAll () {
302304 if (isClusteringEnabled () && client != null ) {
303305 try {
304- return client .getPods (namespace , labels , dump_requests );
306+ List <Pod > pods = client .getPods (namespace , labels , dump_requests );
307+ failedJsonErrorReported = false ;
308+ return pods ;
305309 }
306310 catch (Exception e ) {
307- log .warn ("failed getting JSON response from Kubernetes %s for cluster [%s], namespace [%s], labels [%s]; encountered [%s: %s]" ,
308- client .info (), cluster_name , namespace , labels , e .getClass ().getName (), e .getMessage ());
311+ if (!failedJsonErrorReported ) {
312+ failedJsonErrorReported = true ;
313+ log .warn ("failed getting JSON response from Kubernetes %s for cluster [%s], namespace [%s], labels [%s]; encountered [%s: %s]" ,
314+ client .info (), cluster_name , namespace , labels , e .getClass ().getName (), e .getMessage ());
315+ }
309316 }
310317 }
311318 return Collections .emptyList ();
0 commit comments