Skip to content

Commit 914fe09

Browse files
committed
change log level to debug
Change-Id: Icef3545f9fdbd19f1f5807f56a918858b739d100
1 parent c57c844 commit 914fe09

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

internal/kubernetes/kubernetes.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (c *kubernetesCache) getAllJobs(ctx context.Context, client *kubernetes.Cli
7474

7575
// Check cache first (fast path - no locking)
7676
if jobs, found := checkCache(); found {
77-
logger.Infof("Returning cached jobs for namespace: %s (age: %v, count: %d)", namespace, time.Since(getTimestamp(&c.jobs, key)), len(jobs.Items))
77+
logger.Debugf("Returning cached jobs for namespace: %s (age: %v, count: %d)", namespace, time.Since(getTimestamp(&c.jobs, key)), len(jobs.Items))
7878
return jobs, nil
7979
}
8080

@@ -84,12 +84,12 @@ func (c *kubernetesCache) getAllJobs(ctx context.Context, client *kubernetes.Cli
8484

8585
// Double-check cache after acquiring mutex (another goroutine might have updated it)
8686
if jobs, found := checkCache(); found {
87-
logger.Infof("Returning cached jobs for namespace: %s (age: %v, count: %d) [double-check]", namespace, time.Since(getTimestamp(&c.jobs, key)), len(jobs.Items))
87+
logger.Debugf("Returning cached jobs for namespace: %s (age: %v, count: %d) [double-check]", namespace, time.Since(getTimestamp(&c.jobs, key)), len(jobs.Items))
8888
return jobs, nil
8989
}
9090

9191
// Fetch from API if no cache entry exists or cached data is stale
92-
logger.Infof("Making Kubernetes API call to fetch all jobs for namespace: %s", namespace)
92+
logger.Debugf("Making Kubernetes API call to fetch all jobs for namespace: %s", namespace)
9393
jobs, err := client.BatchV1().Jobs(namespace).List(ctx, metav1.ListOptions{})
9494
if err != nil {
9595
logger.Errorf("Failed to fetch jobs from Kubernetes API for namespace %s: %v", namespace, err)
@@ -102,7 +102,7 @@ func (c *kubernetesCache) getAllJobs(ctx context.Context, client *kubernetes.Cli
102102
timestamp: time.Now(),
103103
})
104104

105-
logger.Infof("Successfully fetched and cached %d jobs for namespace: %s", len(jobs.Items), namespace)
105+
logger.Debugf("Successfully fetched and cached %d jobs for namespace: %s", len(jobs.Items), namespace)
106106
return jobs, nil
107107
}
108108

@@ -127,7 +127,7 @@ func (c *kubernetesCache) getAllPods(ctx context.Context, client *kubernetes.Cli
127127

128128
// Check cache first (fast path - no locking)
129129
if pods, found := checkCache(); found {
130-
logger.Infof("Returning cached pods for namespace: %s (age: %v, count: %d)", namespace, time.Since(getTimestamp(&c.pods, key)), len(pods.Items))
130+
logger.Debugf("Returning cached pods for namespace: %s (age: %v, count: %d)", namespace, time.Since(getTimestamp(&c.pods, key)), len(pods.Items))
131131
return pods, nil
132132
}
133133

@@ -137,12 +137,12 @@ func (c *kubernetesCache) getAllPods(ctx context.Context, client *kubernetes.Cli
137137

138138
// Double-check cache after acquiring mutex (another goroutine might have updated it)
139139
if pods, found := checkCache(); found {
140-
logger.Infof("Returning cached pods for namespace: %s (age: %v, count: %d) [double-check]", namespace, time.Since(getTimestamp(&c.pods, key)), len(pods.Items))
140+
logger.Debugf("Returning cached pods for namespace: %s (age: %v, count: %d) [double-check]", namespace, time.Since(getTimestamp(&c.pods, key)), len(pods.Items))
141141
return pods, nil
142142
}
143143

144144
// Fetch from API if no cache entry exists or cached data is stale
145-
logger.Infof("Making Kubernetes API call to fetch all pods for namespace: %s", namespace)
145+
logger.Debugf("Making Kubernetes API call to fetch all pods for namespace: %s", namespace)
146146
pods, err := client.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{})
147147
if err != nil {
148148
logger.Errorf("Failed to fetch pods from Kubernetes API for namespace %s: %v", namespace, err)
@@ -155,7 +155,7 @@ func (c *kubernetesCache) getAllPods(ctx context.Context, client *kubernetes.Cli
155155
timestamp: time.Now(),
156156
})
157157

158-
logger.Infof("Successfully fetched and cached %d pods for namespace: %s", len(pods.Items), namespace)
158+
logger.Debugf("Successfully fetched and cached %d pods for namespace: %s", len(pods.Items), namespace)
159159
return pods, nil
160160
}
161161

@@ -206,15 +206,15 @@ func (k *Kubernetes) clientset() (*kubernetes.Clientset, error) {
206206

207207
// Log rate limiter settings before creating client
208208
if k.config.RateLimiter != nil {
209-
k.logger.Info("Kubernetes client has custom rate limiter configured")
209+
k.logger.Debug("Kubernetes client has custom rate limiter configured")
210210
}
211211

212212
// Log QPS and Burst settings
213213
if k.config.QPS > 0 || k.config.Burst > 0 {
214-
k.logger.Infof("Kubernetes client rate limiter settings - QPS: %.2f, Burst: %d",
214+
k.logger.Debugf("Kubernetes client rate limiter settings - QPS: %.2f, Burst: %d",
215215
k.config.QPS, k.config.Burst)
216216
} else {
217-
k.logger.Info("Kubernetes client using default rate limiter settings")
217+
k.logger.Debug("Kubernetes client using default rate limiter settings")
218218
}
219219

220220
cli, err := kubernetes.NewForConfig(k.config)
@@ -223,7 +223,6 @@ func (k *Kubernetes) clientset() (*kubernetes.Clientset, error) {
223223
return nil, err
224224
}
225225
k.client = cli
226-
k.logger.Info("Kubernetes client created successfully")
227226
return k.client, nil
228227
}
229228

@@ -256,7 +255,7 @@ func (k *Kubernetes) getJobsByIdentifier(ctx context.Context, client *kubernetes
256255
}
257256
}
258257

259-
k.logger.Infof("Filtered %d jobs with identifier '%s' from %d total jobs",
258+
k.logger.Debugf("Filtered %d jobs with identifier '%s' from %d total jobs",
260259
len(filteredJobs.Items), identifier, len(allJobs.Items))
261260

262261
return filteredJobs, nil
@@ -320,7 +319,7 @@ func (k *Kubernetes) LogListenerIP(ctx context.Context, identifier string) (stri
320319
return "", fmt.Errorf("could not find pod for job with id %s", identifier)
321320
}
322321

323-
k.logger.Infof("Found %d pods for job '%s' with identifier '%s'",
322+
k.logger.Debugf("Found %d pods for job '%s' with identifier '%s'",
324323
len(matchingPods), job.Name, identifier)
325324

326325
pod := matchingPods[0]

0 commit comments

Comments
 (0)