Commit Graph

422 Commits

Author SHA1 Message Date
Monis Khan
e9866d2794
Clear front proxy headers after authentication is complete
This matches the logic we have for the Authorization header as well
as the impersonation headers.

Signed-off-by: Monis Khan <mok@microsoft.com>
2023-03-21 10:51:22 -04:00
tangwz
be080584c6
scheduler(NodeResourcesFit & NodeResourcesBalancedAllocation): calculatePodResourceRequest in PreScore phase (#115655)
* scheduler(NodeResourcesFit): calculatePodResourceRequest in PreScore phase

* scheduler(NodeResourcesFit and NodeResourcesBalancedAllocation): calculatePodResourceRequest in PreScore phase

* modify the comments and tests.

* revert the tests.

* don't need consider nodes.

* use list instead of map.

* add comment for podRequests.

* avoid using negative wording in variable names.
2023-03-10 07:44:53 -08:00
Wei Huang
72863f65d6
Graduate PodSchedulingReadiness to beta 2023-02-17 18:45:20 -08:00
Lucas Severo Alves
6b34fafdaf
Add ctx logging involved in KS startup (#115588)
* ctx logging involved in startup

as per https://github.com/kubernetes/kubernetes/pull/111155#pullrequestreview-1283257121

* use klog.Background().Error in flag handling

* revert scheduler_perf changes

* refence issue in code comment

* enable ctx logcheck for cmd/kube-scheduler
2023-02-13 09:19:29 -08:00
Kubernetes Prow Robot
4b074c816e
Merge pull request #115298 from knelasevero/StartTestServerCtx
Pass context to StartTestServer to get contextualized logger from it during tests
2023-01-30 09:07:12 -08:00
Kubernetes Prow Robot
a94a35293b
Merge pull request #114490 from MadhavJivrajani/update-contention-profiling-docs
*: Make docs more accurate for the contention-profiling flag
2023-01-29 17:20:49 -08:00
Lucas Severo Alves
6a06b63554 comment change from t.Fatal to panic 2023-01-25 11:44:12 +01:00
Lucas Severo Alves
636f8e1a3e chore: changes needed before #111155 2023-01-24 17:55:32 +01:00
Daniel Vega-Myhre
41817b1888 optionally ignore preferred terms of existing pods unless incoming pod
has inter-pod affinities
2023-01-13 23:15:53 +00:00
Jordan Liggitt
78cb3862f1
Fix indentation/spacing in comments to render correctly in godoc 2022-12-17 23:27:38 -05:00
Madhav Jivrajani
f236ab24df *: Make docs more accurate for the contention-profiling flag
The --contention-profiling flag enables block profiling by calling
SetBlockProfileRate(). It, however does not call SetMutexProfileFraction
which enables mutex profiling.

Mutex profiling gives us information about lock contention whereas
block profiling on the other hand gives us information on gorotuines
being blocked on sync primitives.

Updating the docs to "block profiling" in order to make it more accurate.
Eventhough a block profile may reflect contention points on locks to some
extent, it also talks about other sources where goroutines may be blocked.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
2022-12-14 17:34:47 +05:30
Wei Huang
0b27f25252
PreEnqueue implementation
- Add PreEnqueuePlugin to Scheduler Framework
- Implement PreEnqueuePlugin in scheduler queue
- Implementation of SchedulingGates plugin
- Metrics
2022-11-07 14:02:58 -08:00
Wojciech Tyczyński
3786cfdf85 Clean shutdown of serving integration test 2022-11-02 21:08:43 +01:00
Wei Huang
761d06d91a
cleanup scheduler server_test.go 2022-10-20 18:09:05 -07:00
Kubernetes Prow Robot
521fbd7e6a
Merge pull request #112521 from yuanchen8911/profile-config
Add a scheduler profile level parameter percentageOfNodesToScore
2022-10-17 11:09:06 -07:00
Yuan Chen
7297f48f12 Add profile level percentageOfNodesToScore
Fix conversion errors

Changed the order

update

update

fix manaul coversions

keep the global parameter for backward compatibility

Address Wei's comments

Fix an error

Fix issues

Add unit tests for validation

Fix a comment

Address comments

Update comments

fix verifiation errors

Add tests for scheme_test.go

Convert percentageOfNodesToScore to pointer

Fix errors

Resolve conflicts

Fix testing errors

Address Wei's comments

Revert IntPtr to Int changes

Address comments

Not overrite percentageOfNodesToScore

Fix a bug

Fix a bug

change errs to err

Fix a nit

Remove duplication

Address comments

Fix lint warning

Fix an issue

Update comments

Clean up

Address comments

Revert changes to defaults

fix unit test error

Update

Fix tests

Use default PluginConfigs
2022-10-14 13:01:06 -07:00
Richa Banker
0dae5510b2 add metrics/slis to kube-scheduler health checks 2022-10-12 13:05:47 -07:00
Han Kang
e95179ffb6 Wire up feature_gate.go with metrics via AddMetrics method
wire up feature_gate.go with metrics via AddMetrics method

Change-Id: I9b4f6b04c0f4eb9bcb198b16284393d21c774ad8

wire in metrics to kubernetes components

Change-Id: I6d4ef8b26f149f62b03f32d1658f04f3056fe4dc

rename metric since we're using the value to determine if enabled is true or false

Change-Id: I13a6b6df90a5ffb4b9c5b34fa187562413bea029

Update staging/src/k8s.io/component-base/featuregate/feature_gate.go

Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
2022-09-26 08:44:42 -07:00
Kubernetes Prow Robot
05f17ee5d6
Merge pull request #111076 from claudiubelu/unittests-6
unittests: Fixes cmd unit tests for Windows
2022-09-16 07:39:27 -07:00
kerthcet
700065a18d Add deprecation warning of removing scheduler CC v1beta3
Signed-off-by: kerthcet <kerthcet@gmail.com>
2022-09-07 10:09:27 +08:00
kerthcet
532d1df7ca Modify release version of removing scheduler CC v1beta2
Signed-off-by: kerthcet <kerthcet@gmail.com>
2022-09-06 14:15:55 +08:00
Claudiu Belu
d192029e6a unittests: Fixes cmd unit tests for Windows
Currently, there are some unit tests that are failing on Windows due to
various reasons:

- filepath.IsAbs does not consider "/" or "\" as absolute paths, even
  though files can be addressed as such.
- paths not properly joined (filepath.Join should be used).
- files not closed, which means that they cannot be removed / renamed.
- some assertions fail due to slashes / backslashes not matching.
- backslashes need to be escaped in yaml files, or put between ''
instead of "".
2022-08-26 16:03:13 +03:00
Davanum Srinivas
8bec318b5d
Switch klog call to use structured logging
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-08-04 10:54:37 -04:00
Kubernetes Prow Robot
96439a0c3c
Merge pull request #111547 from kerthcet/feat/mark-cc-v1beta2-deprecated
Deprecate kubescheduler ComponentConfig v1beta2
2022-08-02 12:48:06 -07:00
kerthcet
c8fbd78c16 Deprecate kubescheduler ComponentConfig v1beta2
Signed-off-by: kerthcet <kerthcet@gmail.com>
2022-08-02 22:11:11 +08:00
Kubernetes Prow Robot
442548a064
Merge pull request #110534 from kerthcet/feat/ga-component-config
Graduate component config to stable in kube-scheduler
2022-07-29 09:59:11 -07:00
kerthcet
02f77a1b84 Feat: ga component config in kube-scheduler
Signed-off-by: kerthcet <kerthcet@gmail.com>
2022-07-29 08:47:48 +08:00
Davanum Srinivas
a9593d634c
Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
Dave Chen
79cac48b30 No need to assert an error when the error is not nil
Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-07-25 12:26:35 +08:00
Patrick Ohly
4c6338ac0f logs: replace config methods with functions
API types are only supposed to have methods related to serialization.
2022-06-17 20:22:13 +02:00
Patrick Ohly
1aceac797d logs: make LoggingConfiguration an unversioned API
Making the LoggingConfiguration part of the versioned component-base/config API
had the theoretic advantage that components could have offered different
configuration APIs with experimental features limited to alpha versions (for
example, sanitization offered only in a v1alpha1.KubeletConfiguration). Some
components could have decided to only use stable logging options.

In practice, this wasn't done. Furthermore, we don't want different components
to make different choices regarding which logging features they offer to
users. It should always be the same everywhere, for the sake of consistency.

This can be achieved with a saner Go API by dropping the distinction between
internal and external LoggingConfiguration types. Different stability levels of
indidividual fields have to be covered by documentation (done) and potentially
feature gates (not currently done).

Advantages:

- everything related to logging is under component-base/logs;
  previously this was scattered across different packages and
  different files under "logs" (why some code was in logs/config.go
  vs. logs/options.go vs. logs/logs.go always confused me again
  and again when coming back to the code):

  - long-term config and command line API are clearly separated
    into the "api" package underneath that

  - logs/logs.go itself only deals with legacy global flags and
    logging configuration

- removal of separate Go APIs like logs.BindLoggingFlags and
  logs.Options

- LogRegistry becomes an implementation detail, with less code
  and less exported functionality (only registration needs to
  be exported, querying is internal)
2022-06-17 20:22:13 +02:00
Wojciech Tyczyński
fe3616cafb Clean shutdown of kcm, ccm and scheduler 2022-05-26 12:36:59 +02:00
Kubernetes Prow Robot
5b8dbfbbcf
Merge pull request #108995 from pohly/log-contextual
contextual logging
2022-03-29 17:35:59 -07:00
Patrick Ohly
7de1b05e85 logging: add ContextualLogging feature
InitLogs overrides the klog default and turns contextual logging off. This
ensures that it is only enabled in Kubernetes commands that explicitly enable
it via a feature gate. A feature gate for it gets defined in
k8s.io/component-base/logs and is then used by Options.ValidateAndApply.

The effect of disabling contextual logging is very limited according to
benchmarks with kube-scheduler. The feature gets added anyway to satisfy the
PRR recommendation that features should be controllable.

The following commands have support for contextual logging:
- kube-apiserver
- kube-controller-manager
- kubelet
- kube-scheduler
- component-base/logs example

Supporting a feature gate check in ValidateAndApply and not in InitLogs is a
simplification: changing InitLogs to accept a FeatureGate would have implied
changing also component-base/cli.Run. This didn't seem worthwhile because
ValidateAndApply already covers the relevant commands.
2022-03-29 13:29:57 +02:00
Kubernetes Prow Robot
b5f8d9ec16
Merge pull request #107724 from kkkkun/fix-leaderlost
Fixes exited messages when leaderelection lost
2022-03-28 06:44:48 -07:00
Kubernetes Prow Robot
d60df5ba04
Merge pull request #108159 from pohly/logcheck
logcheck update and golangci-lint integration
2022-03-24 18:37:50 -07:00
Patrick Ohly
0f4d0660a7 kube-scheduler: finish conversion to structured logging
Thanks to support for multi-line string values we can now also convert
these remaining klog.Info calls without making the output unreadable
in text format.

The debug log messages intentionally don't get changed to ensure that
developers looking for it still find it.

The output now looks like this:

I0322 11:44:46.715093  458409 configfile.go:96] "Using component config" config=<
	apiVersion: kubescheduler.config.k8s.io/v1beta2
	clientConnection:
	  acceptContentTypes: ""
	  burst: 100
	  contentType: application/vnd.kubernetes.protobuf
	  kubeconfig: /var/run/kubernetes/scheduler.kubeconfig
	  qps: 50
	enableContentionProfiling: true
 ...
	  schedulerName: default-scheduler
 >

I0322 11:45:08.695649  458409 comparer.go:42] "Cache comparer started"
I0322 11:45:08.695718  458409 comparer.go:67] "Cache comparer finished"
I0322 11:45:08.695820  458409 dumper.go:52] "Dump of cached NodeInfo" nodes=<
	Node name: 127.0.0.1
	Deleted: false
	Requested Resources: &{MilliCPU:0 Memory:0 EphemeralStorage:0 AllowedPodNumber:0 ScalarResources:map[]}
	Allocatable Resources:&{MilliCPU:36000 Memory:67019448320 EphemeralStorage:181555660500 AllowedPodNumber:110 ScalarResources:map[hugepages-1Gi:0 hugepages-2Mi:0]}
	Scheduled Pods(number: 0):
 >
I0322 11:45:08.695873  458409 dumper.go:62] "Dump of scheduling queue" pods=<
	name: coredns-6874cd75d4-fv6hv, namespace: kube-system, uid: f1df106f-7fd9-460d-8403-333df61b2751, phase: Pending, nominated node:
 >
2022-03-24 11:13:50 +01:00
Alex Wang
8a5df1302a rename unschedulableQ to unschedulablePods
Signed-off-by: Alex Wang <wangqingcan1990@gmail.com>
2022-03-24 17:38:49 +08:00
Kun Zhang
6f8e9aa05d Fixes exited messages when leaderelection lost 2022-03-24 17:33:16 +08:00
Wei Huang
d330f4dcb4
Fix a bug that out-of-tree plugin is misplaced when using scheduler v1beta3 config 2022-03-21 10:46:26 -07:00
Alex Wang
e772202e95 set PodMaxUnschedulableQDuration as 5 min 2022-03-17 15:37:34 +08:00
Kubernetes Prow Robot
d7d121999d
Merge pull request #108480 from wojtek-t/log_golang_envs
Log main golang runtime env vars
2022-03-04 00:10:51 -08:00
Wojciech Tyczyński
ef2e32ab65 Log main golang runtime env vars 2022-03-04 08:04:02 +01:00
kerthcet
4439fc3590 feat: graduate DefaultPodTopologySpread to GA
Co-authored-by: drfish <drfish.me@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
2022-02-23 19:45:27 +08:00
Alex Wang
87549203e9 add deprecated flag for flush pods to activeq interval 2022-02-16 11:05:52 +08:00
ahrtr
972dc46a1f replace deprecated io/ioutil with os and io for cmd 2022-02-01 13:59:41 +08:00
Patrick Ohly
9eaa2dc554 avoid klog Info calls without verbosity
In the following code pattern, the log message will get logged with v=0 in JSON
output although conceptually it has a higher verbosity:

   if klog.V(5).Enabled() {
       klog.Info("hello world")
   }

Having the actual verbosity in the JSON output is relevant, for example for
filtering out only the important info messages. The solution is to use
klog.V(5).Info or something similar.

Whether the outer if is necessary at all depends on how complex the parameters
are. The return value of klog.V can be captured in a variable and be used
multiple times to avoid the overhead for that function call and to avoid
repeating the verbosity level.
2022-01-12 07:48:36 +01:00
Kubernetes Prow Robot
9bbc5b15e7
Merge pull request #105870 from cyclinder/kube_scheduler_MarkFlagFilename
kube-scheduler: log possible error
2022-01-07 19:05:04 -08:00
Kubernetes Prow Robot
ac318a6518
Merge pull request #106865 from jonyhy96/cleanup-scheduler-flag
[scheduler] cleanup: remove insecure flag
2022-01-07 08:58:45 -08:00
cyclinder
1a16de783b kube-scheduler: log the unhandled error
Signed-off-by: cyclinder <qifeng.guo@daocloud.io>
2022-01-07 18:21:11 +08:00