Change:
When running the scheduler at or greater, the processed component config may be logged as a single line with newline characters inserted, like so: config should always be readable and formatted to an easily copied/parsed format, like: Not sure how often this happens, need to try reproducing ref and Kubernetes version (use ): Cloud provider or hardware configuration: OS (e.g: ): Kernel (e.g. ): Install tools: Network plugin and version (if this is a network-related bug): Others: /sig scheduling
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
The problem has been reproduced. Here are the steps : Steps to Reproduce: kubeadm a pod network runtime, ( I used calico in my case). to reporter's kube-scheduler config yaml, here is another one. apiVersion: clientConnection: acceptContentTypes: "" burst: 100 contentType: application/vnd.kubernetes.protobuf kubeconfig: qps: 50 enableContentionProfiling: true enableProfiling: true healthzBindAddress: "" kind: KubeSchedulerConfiguration leaderElection: leaderElect: true leaseDuration: 15s renewDeadline: 10s resourceLock: leases resourceName: kube-scheduler resourceNamespace: kube-system retryPeriod: 2s metricsBindAddress: "" parallelism: 16 percentageOfNodesoScore: 0 podInitialBackoffSeconds: 1 podMaxBackoffSeconds: 10 profiles: pluginConfig: args: apiVersion: kind: NodeAffinityArgs name: NodeAffinity args: run the kube-scheduler command with an unassigned ip address that your control-plane can bind to: -scheduler --config scheduler- --bind-address "172.18.56.64" -v 5 Here, v can be anything greater than 3. the config file will have n characters in it, whereas it should have been formatted correctly. W1012 19:21:54. ] No authorization-kubeconfig provided, so SubjectAccessReview of authorization tokens won't work. I1012 19:21:54. ] "Using component config" config="apiVersion: nclientConnection:n acceptContentTypes: ""n burst: 100n contentType: application/vnd.kubernetes.protobufn kubeconfig: n qps: 50nenableContentionProfiling: truenenableProfiling: truenhealthzBindAddress: ""nkind: KubeSchedulerConfigurationnleaderElection:n leaderElect: truen leaseDuration: 15sn renewDeadline: 10sn resourceLock: leasesn resourceName: kube-schedulern resourceNamespace: kube-systemn retryPeriod: 2snmetricsBindAddress: ""nparallelism: 16npercentageOfNodesToScore: 0npodInitialBackoffSeconds: 1npodMaxBackoffSeconds: 10nprofiles:n- pluginConfig:n - args:n apiVersion: n kind: DefaultPreemptionArgsn minCandidateNodesAbsolute: 100n minCandidateNodesPercentage: 10n name: DefaultPreemptionn - args:n apiVersion: n hardPodAffinityWeight: 1n kind: InterPodAffinityArgsn name: InterPodAffinityn - args:n apiVersion: n kind: NodeAffinityArgsn name: NodeAffinityn - args:n apiVersion: n kind: NodeResourcesBalancedAllocationArgsn resources:n - name: cpun weight: 1n - name: memoryn weight: 1n name: NodeResourcesBalancedAllocationn - args:n apiVersion: n kind: NodeResourcesFitArgsn scoringStrategy:n resources:n - name: cpun weight: 1n - name: memoryn weight: 1n type: LeastAllocatedn name: NodeResourcesFitn - args:n apiVersion: n defaultingType: Systemn kind: PodTopologySpreadArgsn name: PodTopologySpreadn - args:n apiVersion: n bindTimeoutSeconds: 600n kind: VolumeBindingArgsn name: VolumeBindingn plugins:n bind:n enabled:n - name: DefaultBindern weight: 0n filter:n enabled:n - name: NodeUnschedulablen weight: 0n - name: NodeNamen weight: 0n - name: TaintTolerationn weight: 0n - name: NodeAffinityn weight: 0n - name: NodePortsn weight: 0n - name: NodeResourcesFitn weight: 0n - name: VolumeRestrictionsn weight: 0n - name: EBSLimitsn weight: 0n - name: GCEPDLimitsn weight: 0n - name: NodeVolumeLimitsn weight: 0n - name: AzureDiskLimitsn weight: 0n - name: VolumeBindingn weight: 0n - name: VolumeZonen weight: 0n - name: PodTopologySpreadn weight: 0n - name: InterPodAffinityn weight: 0n permit: {}n postBind: {}n postFilter:n enabled:n - name: DefaultPreemptionn weight: 0n preBind:n enabled:n - name: VolumeBindingn weight: 0n preFilter:n enabled:n - name: NodeResourcesFitn weight: 0n - name: NodePortsn weight: 0n - name: VolumeRestrictionsn weight: 0n - name: PodTopologySpreadn weight: 0n - name: InterPodAffinityn weight: 0n - name: VolumeBindingn weight: 0n - name: NodeAffinityn weight: 0n preScore:n enabled:n - name: InterPodAffinityn weight: 0n - name: PodTopologySpreadn weight: 0n - name: TaintTolerationn weight: 0n - name: NodeAffinityn weight: 0n queueSort:n enabled:n - name: PrioritySortn weight: 0n reserve:n enabled:n - name: VolumeBindingn weight: 0n score:n enabled:n - name: NodeResourcesBalancedAllocationn weight: 1n - name: ImageLocalityn weight: 1n - name: InterPodAffinityn weight: 1n - name: NodeResourcesFitn weight: 1n - name: NodeAffinityn weight: 1n - name: PodTopologySpreadn weight: 2n - name: TaintTolerationn weight: 1n schedulerName: default-schedulern" Will be trying to write a unit-test for the same.
Awesome, thank you If you want to open a WIP PR to address the changes, we can start reviewing those while you work on the unit test in the same PR.
Hi Sorry for the super late reply! Was working on other stuff. I can open a PR to fix the issue. i have fixed the actual issue and now the logs format correctly. I am just super confused with how to write a test case to verify this. I went through the unit test framework, and couldn't figure out to write a unit test cases using the go libraries that kube provides. I will write now set up the WIP PR.
thanks! a test case might not be totally necessary, since this is just a change to logging, but if you open up your PR we can see how you fixed it and that might help show how we can add a test around your fix
This is the logging output after the fix: be-system, so request-header client certificate authentication won't work. W1108 05:15:16. 8731 ] No authorization-kubeconfig provided, so SubjectAccessReview of authorization tokens won't work. I1108 05:15:16. 8731 ] Using component configconfigapiVersion: clientConnection: acceptContentTypes: "" burst: 100 contentType: application/vnd.kubernetes.protobuf kubeconfig: qps: 50 enableContentionProfiling: true enableProfiling: true healthzBindAddress: "" kind: KubeSchedulerConfiguration leaderElection: leaderElect: true leaseDuration: 15s renewDeadline: 10s resourceLock: leases resourceName: kube-scheduler resourceNamespace: kube-system retryPeriod: 2s metricsBindAddress: "" parallelism: 16 percentageOfNodesToScore: 0 podInitialBackoffSeconds: 1 podMaxBackoffSeconds: 10 profiles: pluginConfig: args: apiVersion: kind: DefaultPreemptionArgs minCandidateNodesAbsolute: 100 minCandidateNodesPercentage: 10 name: DefaultPreemption args: apiVersion: hardPodAffinityWeight: 1 kind: InterPodAffinityArgs name: InterPodAffinity args: apiVersion: kind: NodeAffinityArgs name: NodeAffinity args: apiVersion: kind: NodeResourcesBalancedAllocationArgs resources: name: cpu weight: 1 name: memory weight: 1 name: NodeResourcesBalancedAllocation args: apiVersion: kind: NodeResourcesFitArgs scoringStrategy: resources: name: cpu weight: 1 name: memory weight: 1 type: LeastAllocated name: NodeResourcesFit args: apiVersion: defaultingType: System kind: PodTopologySpreadArgs name: PodTopologySpread args: apiVersion: bindTimeoutSeconds: 600 kind: VolumeBindingArgs name: VolumeBinding plugins: bind: enabled: name: DefaultBinder weight: 0 filter: enabled: name: NodeUnschedulable weight: 0 name: NodeName weight: 0 name: TaintToleration weight: 0 name: NodeAffinity weight: 0 name: NodePorts weight: 0 name: NodeResourcesFit weight: 0 name: VolumeRestrictions weight: 0 name: EBSLimits weight: 0 name: GCEPDLimits weight: 0 name: NodeVolumeLimits weight: 0 name: AzureDiskLimits weight: 0 name: VolumeBinding weight: 0 name: VolumeZone weight: 0 name: PodTopologySpread weight: 0 name: InterPodAffinity weight: 0 permit: {} postBind: {} postFilter: enabled: name: DefaultPreemption weight: 0 preBind: enabled: name: VolumeBinding weight: 0 preFilter: enabled: name: NodeResourcesFit weight: 0 name: NodePorts weight: 0 name: VolumeRestrictions weight: 0 name: PodTopologySpread weight: 0 name: InterPodAffinity weight: 0 name: VolumeBinding weight: 0 name: NodeAffinity weight: 0 preScore: enabled: name: InterPodAffinity weight: 0 name: PodTopologySpread weight: 0 name: TaintToleration weight: 0 name: NodeAffinity weight: 0 queueSort: enabled: name: PrioritySort weight: 0 reserve: enabled: name: VolumeBinding weight: 0 score: enabled: name: NodeResourcesBalancedAllocation weight: 1 name: ImageLocality weight: 1 name: InterPodAffinity weight: 1 name: NodeResourcesFit weight: 1 name: NodeAffinity weight: 1 name: PodTopologySpread weight: 2 name: TaintToleration weight: 1 Here, there are no more escape sequences.
cool, if you have time please feel free to open a PR with your changes

Discussion:
} if klog.V(2).Enabled() { <del> klog.InfoS("Using component config", "config", buf.String()) </del> <ins> klog.Info("Using component config", "n-------------------------Configuration File Contents Start Here---------------------- n", buf.String(), "n------------------------------------Configuration File Contents End Here---------------------------------n") </ins> } if len(fileName) > 0 {