diff --git a/pkg/kubelet/cm/topologymanager/fake_topology_manager.go b/pkg/kubelet/cm/topologymanager/fake_topology_manager.go index 921b47dab3b..19b07a719ca 100644 --- a/pkg/kubelet/cm/topologymanager/fake_topology_manager.go +++ b/pkg/kubelet/cm/topologymanager/fake_topology_manager.go @@ -45,7 +45,7 @@ func NewFakeManagerWithHint(hint *TopologyHint) Manager { // NewFakeManagerWithPolicy returns an instance of fake topology manager with specified policy func NewFakeManagerWithPolicy(policy Policy) Manager { - klog.InfoS("NewFakeManagerWithPolicy") + klog.InfoS("NewFakeManagerWithPolicy", "policy", policy.Name()) return &fakeManager{ policy: policy, } diff --git a/pkg/kubelet/cm/topologymanager/policy_options.go b/pkg/kubelet/cm/topologymanager/policy_options.go index 43eb9d886eb..5490aba112e 100644 --- a/pkg/kubelet/cm/topologymanager/policy_options.go +++ b/pkg/kubelet/cm/topologymanager/policy_options.go @@ -47,11 +47,11 @@ func CheckPolicyOptionAvailable(option string) error { } if alphaOptions.Has(option) && !utilfeature.DefaultFeatureGate.Enabled(kubefeatures.TopologyManagerPolicyAlphaOptions) { - return fmt.Errorf("Topology Manager Policy Alpha-level Options not enabled, but option %q provided", option) + return fmt.Errorf("topology manager policy alpha-level options not enabled, but option %q provided", option) } if betaOptions.Has(option) && !utilfeature.DefaultFeatureGate.Enabled(kubefeatures.TopologyManagerPolicyBetaOptions) { - return fmt.Errorf("Topology Manager Policy Beta-level Options not enabled, but option %q provided", option) + return fmt.Errorf("topology manager policy beta-level options not enabled, but option %q provided", option) } return nil diff --git a/pkg/kubelet/cm/topologymanager/policy_options_test.go b/pkg/kubelet/cm/topologymanager/policy_options_test.go index 840f4e8a4ce..833609db228 100644 --- a/pkg/kubelet/cm/topologymanager/policy_options_test.go +++ b/pkg/kubelet/cm/topologymanager/policy_options_test.go @@ -74,7 +74,7 @@ func TestNewTopologyManagerOptions(t *testing.T) { policyOptions: map[string]string{ MaxAllowableNUMANodes: "8", }, - expectedErr: fmt.Errorf("Topology Manager Policy Beta-level Options not enabled,"), + expectedErr: fmt.Errorf("topology manager policy beta-level options not enabled,"), }, { description: "return empty TopologyManagerOptions", @@ -117,7 +117,7 @@ func TestNewTopologyManagerOptions(t *testing.T) { policyOptions: map[string]string{ fancyBetaOption: "true", }, - expectedErr: fmt.Errorf("Topology Manager Policy Beta-level Options not enabled,"), + expectedErr: fmt.Errorf("topology manager policy beta-level options not enabled,"), }, { description: "test alpha options success", @@ -136,7 +136,7 @@ func TestNewTopologyManagerOptions(t *testing.T) { policyOptions: map[string]string{ fancyAlphaOption: "true", }, - expectedErr: fmt.Errorf("Topology Manager Policy Alpha-level Options not enabled,"), + expectedErr: fmt.Errorf("topology manager policy alpha-level options not enabled,"), }, } diff --git a/pkg/kubelet/cm/topologymanager/scope_container.go b/pkg/kubelet/cm/topologymanager/scope_container.go index 61cef19df58..7bdbba68dc2 100644 --- a/pkg/kubelet/cm/topologymanager/scope_container.go +++ b/pkg/kubelet/cm/topologymanager/scope_container.go @@ -63,6 +63,7 @@ func (s *containerScope) Admit(pod *v1.Pod) lifecycle.PodAdmitResult { } if IsAlignmentGuaranteed(s.policy) { + klog.V(4).InfoS("Resource alignment at container scope guaranteed", "pod", klog.KObj(pod)) metrics.ContainerAlignedComputeResources.WithLabelValues(metrics.AlignScopeContainer, metrics.AlignedNUMANode).Inc() } } @@ -84,6 +85,6 @@ func (s *containerScope) accumulateProvidersHints(pod *v1.Pod, container *v1.Con func (s *containerScope) calculateAffinity(pod *v1.Pod, container *v1.Container) (TopologyHint, bool) { providersHints := s.accumulateProvidersHints(pod, container) bestHint, admit := s.policy.Merge(providersHints) - klog.InfoS("ContainerTopologyHint", "bestHint", bestHint) + klog.InfoS("ContainerTopologyHint", "bestHint", bestHint, "pod", klog.KObj(pod), "containerName", container.Name) return bestHint, admit } diff --git a/pkg/kubelet/cm/topologymanager/scope_pod.go b/pkg/kubelet/cm/topologymanager/scope_pod.go index 61d599ebc08..d06d9578256 100644 --- a/pkg/kubelet/cm/topologymanager/scope_pod.go +++ b/pkg/kubelet/cm/topologymanager/scope_pod.go @@ -64,6 +64,7 @@ func (s *podScope) Admit(pod *v1.Pod) lifecycle.PodAdmitResult { } if IsAlignmentGuaranteed(s.policy) { // increment only if we know we allocate aligned resources. + klog.V(4).InfoS("Resource alignment at pod scope guaranteed", "pod", klog.KObj(pod)) metrics.ContainerAlignedComputeResources.WithLabelValues(metrics.AlignScopePod, metrics.AlignedNUMANode).Inc() } return admission.GetPodAdmitResult(nil) @@ -84,6 +85,6 @@ func (s *podScope) accumulateProvidersHints(pod *v1.Pod) []map[string][]Topology func (s *podScope) calculateAffinity(pod *v1.Pod) (TopologyHint, bool) { providersHints := s.accumulateProvidersHints(pod) bestHint, admit := s.policy.Merge(providersHints) - klog.InfoS("PodTopologyHint", "bestHint", bestHint) + klog.InfoS("PodTopologyHint", "bestHint", bestHint, "pod", klog.KObj(pod)) return bestHint, admit } diff --git a/pkg/kubelet/cm/topologymanager/topology_manager.go b/pkg/kubelet/cm/topologymanager/topology_manager.go index 7c5e9d3d8cc..d9e244952ec 100644 --- a/pkg/kubelet/cm/topologymanager/topology_manager.go +++ b/pkg/kubelet/cm/topologymanager/topology_manager.go @@ -212,11 +212,13 @@ func (m *manager) RemoveContainer(containerID string) error { } func (m *manager) Admit(attrs *lifecycle.PodAdmitAttributes) lifecycle.PodAdmitResult { + klog.V(4).InfoS("Topology manager admission check", "pod", klog.KObj(attrs.Pod)) metrics.TopologyManagerAdmissionRequestsTotal.Inc() startTime := time.Now() podAdmitResult := m.scope.Admit(attrs.Pod) metrics.TopologyManagerAdmissionDuration.Observe(float64(time.Since(startTime).Milliseconds())) + klog.V(4).InfoS("Pod Admit Result", "Message", podAdmitResult.Message, "pod", klog.KObj(attrs.Pod)) return podAdmitResult }