Merge pull request #7442 from omerap12/logging-fix

Refactor logging statements
This commit is contained in:
Kubernetes Prow Robot 2024-11-04 16:33:30 +00:00 committed by GitHub
commit 238a0c64a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 5 deletions

View File

@ -110,7 +110,7 @@ func (s *AdmissionServer) admit(ctx context.Context, data []byte) (*admissionv1.
patchType := admissionv1.PatchTypeJSONPatch
response.PatchType = &patchType
response.Patch = patch
klog.V(4).Infof("Sending patches: %v", patches)
klog.V(4).InfoS("Sending patches", "patches", patches)
}
var status metrics_admission.AdmissionStatus

View File

@ -88,8 +88,7 @@ var (
func main() {
klog.InitFlags(nil)
kube_flag.InitFlags()
klog.V(1).Infof("Vertical Pod Autoscaler %s Admission Controller", common.VerticalPodAutoscalerVersion)
klog.V(1).InfoS("Starting Vertical Pod Autoscaler Admission Controller", "version", common.VerticalPodAutoscalerVersion)
if len(*vpaObjectNamespace) > 0 && len(*ignoredVpaObjectNamespaces) > 0 {
klog.Fatalf("--vpa-object-namespace and --ignored-vpa-object-namespaces are mutually exclusive and can't be set together.")
}

View File

@ -71,7 +71,7 @@ func (c *metricsClient) GetContainersMetrics() ([]*ContainerMetricsSnapshot, err
if err != nil {
return nil, err
}
klog.V(3).Infof("%v podMetrics retrieved for all namespaces", len(podMetricsList.Items))
klog.V(3).InfoS("podMetrics retrieved for all namespaces", "podMetrics", len(podMetricsList.Items))
for _, podMetrics := range podMetricsList.Items {
metricsSnapshotsForPod := createContainerMetricsSnapshots(podMetrics)
metricsSnapshots = append(metricsSnapshots, metricsSnapshotsForPod...)

View File

@ -96,7 +96,7 @@ func NewVpaTargetSelectorFetcher(config *rest.Config, kubeClient kube_client.Int
if !synced {
klog.Fatalf("Could not sync cache for %s: %v", kind, err)
} else {
klog.Infof("Initial sync of %s completed", kind)
klog.InfoS("Initial sync completed", "kind", kind)
}
}