Commit Graph

103964 Commits

Author SHA1 Message Date
Patrick Ohly
00e4a599f6 command lines: always show flags with hyphens
All Kubernetes commands should show flags with hyphens in their help text even
when the flag originally was defined with underscore. Converting a command to
this style is not breaking its command line API because the old-style parameter
with underscore is accepted as alias.

The easiest solution to achieve this is to set normalization shortly before
running the command in the new central cli.Run or the few places where that
function isn't used yet.

There may be some texts which depends on normalization at flag definition time,
like the --logging-format usage warning. Those get generated assuming that
hyphens will be used.
2021-09-30 13:46:49 +02:00
Patrick Ohly
21d1bcd6b8 initialize logging after flag parsing
It wasn't documented that InitLogs already uses the log flush frequency, so
some commands have called it before parsing (for example, kubectl in the
original code for logs.go). The flag never had an effect in such commands.

Fixing this turned into a major refactoring of how commands set up flags and
run their Cobra command:

- component-base/logs: implicitely registering flags during package init is an
  anti-pattern that makes it impossible to use the package in commands which
  want full control over their command line. Logging flags must be added
  explicitly now, something that the new cli.Run does automatically.

- component-base/logs: AddFlags would have crashed in kubectl-convert if it
  had been called because it relied on the global pflag.CommandLine. This
  has been fixed and kubectl-convert now has the same --log-flush-frequency
  flag as other commands.

- component-base/logs/testinit: an exception are tests where flag.CommandLine has
  to be used. This new package can be imported to add flags to that
  once per test program.

- Normalization of the klog command line flags was inconsistent. Some commands
  unintentionally didn't normalize to the recommended format with hyphens. This
  gets fixed for sample programs, but not for production programs because
  it would be a breaking change.

This refactoring has the following user-visible effects:

- The validation error for `go run ./cmd/kube-apiserver --logging-format=json
  --add-dir-header` now references `add-dir-header` instead of `add_dir_header`.

- `staging/src/k8s.io/cloud-provider/sample` uses flags with hyphen instead of
  underscore.

- `--log-flush-frequency` is not listed anymore in the --logging-format flag's
  `non-default formats don't honor these flags` usage text because it will also
  work for non-default formats once it is needed.

- `cmd/kubelet`: the description of `--logging-format` uses hyphens instead of
  underscores for the flags, which now matches what the command is using.

- `staging/src/k8s.io/component-base/logs/example/cmd`: added logging flags.

- `apiextensions-apiserver` no longer prints a useless stack trace for `main`
  when command line parsing raises an error.
2021-09-30 13:46:49 +02:00
Kubernetes Prow Robot
38746752af
Merge pull request #104365 from jyz0309/adjust-log-level
[PodSecurity] log nsPolicy evaluation for the request
2021-09-30 01:00:08 -07:00
Umanga Chapagain
e262278772
fix incorrect structured log patterns
proxy/winkernel/proxier.go was using format specifier with
structured logging pattern which is wrong. This commit removes
use of format specifiers to align with the pattern.

Signed-off-by: Umanga Chapagain <chapagainumanga@gmail.com>
2021-09-30 11:10:13 +05:30
Kubernetes Prow Robot
ed40a89f2e
Merge pull request #104965 from CKchen0726/invalid_nil_check
remove redundant nil check
2021-09-29 19:44:07 -07:00
Kubernetes Prow Robot
dac94e1c9e
Merge pull request #105121 from wujiangfa-xlauncher/master
fix top node output format incorrect
2021-09-29 16:42:08 -07:00
Kubernetes Prow Robot
d551560a78
Merge pull request #105330 from liggitt/importboss-doc
Make package paths referenced by import boss valid
2021-09-29 15:34:56 -07:00
Kubernetes Prow Robot
995a1c5abf
Merge pull request #105117 from cmssczy/fix_useless_error_handling
handle error when parse Quantity
2021-09-29 15:34:44 -07:00
Kubernetes Prow Robot
bac45abf77
Merge pull request #105327 from julianvmodesto/kubectl-dry-run-flag-removals
Remove deprecated kubectl --dry-run values.
2021-09-29 13:31:21 -07:00
Elana Hashman
132fa1cbf3
Revert "Build non-static binaries with PIE buildmode" 2021-09-29 11:36:20 -07:00
Kubernetes Prow Robot
1ad3e14f1f
Merge pull request #105188 from nilo19/bug/cherry-pick-794
fix: consolidate logs for instance not found error
2021-09-29 11:23:21 -07:00
Kubernetes Prow Robot
6f47878926
Merge pull request #105107 from cici37/addFG
Add feature gate CustomResourceValidationExpressions
2021-09-29 08:08:48 -07:00
Kubernetes Prow Robot
bceefb7a86
Merge pull request #101125 from damemi/kcm-wire-contexts
Set up kube-controller-manager functions to accept contexts
2021-09-29 07:02:49 -07:00
Kubernetes Prow Robot
49f9e227e9
Merge pull request #105247 from Jille/patch-1
Fix double formatting on error message
2021-09-29 04:14:48 -07:00
Kubernetes Prow Robot
fafbe3aa51
Merge pull request #103900 from ash2k/ash2k/cache-mapper-and-client
Cache rest mapper and discovery client
2021-09-29 02:10:49 -07:00
Kubernetes Prow Robot
c9b9c40109
Merge pull request #105315 from wzshiming/test/events-expansion
Add unit test coverage for events expansion
2021-09-29 01:00:48 -07:00
Kubernetes Prow Robot
32fefd5580
Merge pull request #105048 from mauriciopoppe/fix-double-storage-class-setup
Remove a duplicate StorageClass creation call
2021-09-28 23:36:48 -07:00
Kubernetes Prow Robot
598a8829c1
Merge pull request #105267 from llhuii/fix-topology-hint-bug
TopologyAwareHints: fix getHintsByZone bug
2021-09-28 20:54:48 -07:00
llhuii
e7350d126e TopologyAwareHints: add getHintsByZone unit test 2021-09-29 10:39:03 +08:00
Shiming Zhang
13fe94f136 Add unit test coverage for events expansion 2021-09-29 10:11:27 +08:00
jyz0309
f157aa17f2 bump version to 5
Signed-off-by: jyz0309 <45495947@qq.com>
2021-09-29 09:30:16 +08:00
Kubernetes Prow Robot
198c9c70f1
Merge pull request #104925 from prameshj/ilbracefix
Process GCE ILB services with the v1 annotation in the service controller
2021-09-28 18:06:48 -07:00
Qi Ni
0406ba32ea fix: skip not found nodes when reconciling LB backend address pools 2021-09-29 08:00:28 +08:00
“Ibrahim
26ce6df217 Update Windows base images GCE provider 2021-09-28 22:40:04 +00:00
Jordan Liggitt
f6b831aeac Make package paths referenced by import boss valid 2021-09-28 18:05:58 -04:00
Kubernetes Prow Robot
66e1d27a59
Merge pull request #104300 from wojtek-t/converting_informer
Create TransformingInformer
2021-09-28 14:02:34 -07:00
Kubernetes Prow Robot
3b2b23cee7
Merge pull request #105234 from wojtek-t/optimize_indexer
Optimize indexer
2021-09-28 12:50:34 -07:00
Kubernetes Prow Robot
e138afc35d
Merge pull request #105213 from yxxhero/remove_StartedPodsErrorsTotal_metrice_message
Remove StartedPodsErrorsTotal metric message
2021-09-28 10:45:16 -07:00
Julian V. Modesto
e0b7a85ee5 Remove deprecated kubectl --dry-run values.
The boolean values for --dry-run have been deprecated for removal since
1.18, more than 2 releases.

The default value for --dry-run with the flag set and unspecified has
been deprecated for removal since 1.18, more than 2 releases.

Both values are now removed in this change. Any kubectl --dry-run
usage no longer accepts --dry-run=(true|false) boolean values and usage
now requires that a value of (client|server|none) is specified.
2021-09-28 10:21:04 -04:00
Anago GCB
b290671b1b Merge remote-tracking branch 'origin/master' 2021-09-28 14:20:58 +00:00
Patrick Ohly
c9c4357c03 cli: centralize command execution
Many commands have the same boilerplate code for setting up randomization and
logging. The new k8s.io/component-base/cli.Run method contains that common code
and simplifies the code of commands which are using it.
2021-09-28 15:19:52 +02:00
Anago GCB
7171ff8658 CHANGELOG: Update directory for v1.23.0-alpha.3 release 2021-09-28 12:58:38 +00:00
Kubernetes Prow Robot
80e9eda95f
Merge pull request #105175 from sanposhiho/scheduler/usage-message
cmd/kube-scheduler: add usage message only when parsing flags failed
2021-09-28 05:44:43 -07:00
Kubernetes Prow Robot
bf000e8770
Merge pull request #104770 from pacoxu/dual-stack-ga-kubeadm
cleanup: DualStack GA for kubeadm
2021-09-28 03:42:42 -07:00
Shiming Zhang
f63c135e1f Update comments 2021-09-28 18:07:50 +08:00
Kubernetes Prow Robot
2ba872513d
Merge pull request #105283 from ricky-rav/dev_BZ_1997235
add NET_RAW capability to server container in "should drop INVALID conntrack entries" e2e test
2021-09-28 02:28:42 -07:00
jyz0309
88e35021e6 address comment
Signed-off-by: jyz0309 <45495947@qq.com>
2021-09-28 17:15:44 +08:00
Paco Xu
751ad37a05 kubeadm: cleanup remove some empty feature gate for dual-stack 2021-09-28 15:34:26 +08:00
Kubernetes Prow Robot
9005160245
Merge pull request #105272 from wojtek-t/add_jittering_for_kubelet
Add jittering for Kubelet status computing
2021-09-28 00:20:42 -07:00
Riccardo Ravaioli
d97a1b8d63 add NET_RAW capability to server container in "should drop INVALID conntrack entries" test
The boom-server container forges out-of-order TCP packets and injects them into the network. This requires the container to have the CAP_NET_RAW linux capability, otherwise the test will fail.

Signed-off-by: Riccardo Ravaioli <rravaiol@redhat.com>
2021-09-28 08:50:55 +02:00
wojtekt
75273a0689 Optimize index updating 2021-09-28 08:40:09 +02:00
kerthcet
75a255d2ed remove scheduler component config v1beta1
Signed-off-by: kerthcet <kerthcet@gmail.com>
2021-09-28 13:13:17 +08:00
Kubernetes Prow Robot
16fdb2f391
Merge pull request #105196 from yibozhuang/improve-scheduler-pv-not-exist-err
Enhance ErrReasonPVNotExist in volumebinding scheduler plugin
2021-09-27 19:04:42 -07:00
llhuii
528cd30145 TopologyAwareHints: fix getHintsByZone bug
The bug could result in the EndpointSlice controller unnecessarily updating
EndpointSlices associated with a Service that had Topology Aware Hints enabled.
2021-09-28 09:02:24 +08:00
Kubernetes Prow Robot
ce4958d908
Merge pull request #105009 from harjas27/printer_event_count
kubectl: remove extra +1 for printing event count
2021-09-27 16:24:43 -07:00
Kubernetes Prow Robot
e35dff68af
Merge pull request #105232 from wojtek-t/optimize_watchcache
Optimize watchcache by not starting a gorotuine for all Get/List requests setting RV=0
2021-09-27 15:15:56 -07:00
Kubernetes Prow Robot
c647c5614b
Merge pull request #104985 from caesarxuchao/aggregator-no-spdy
Aggregator uses the regular transport when handling upgrade requests
2021-09-27 15:15:44 -07:00
Yibo Zhuang
603a4e1931 Enhance ErrReasonPVNotExist in volumebinding scheduler plugin
This change will make the message more clear when there
is a case of PVC(s) bound to PV(s) that no longer exists
and scheduler does not select the node due to this issue.

Previous error message would look like:
0/2 nodes are available: 2 pvc(s) bound to non-existent pv(s)

Updated message looks like:
0/2 nodes are available: 2 node(s) unavailable due to one or more
pvc(s) bound to non-existent pv(s)

For larger clusters with many different reasons of nodes that
are not available, the current message can be very misleading for
users to think that there are many PVCs lost due to PVs deleted but
in fact it could be just a single PVC case but many nodes not selected
by the scheduler due to this case.

Signed-off By: Yibo Zhuang <yibzhuang@gmail.com>
2021-09-27 15:02:35 -07:00
Kubernetes Prow Robot
2210c9ca59
Merge pull request #105285 from spiffxp/revert-104116
Revert "Use docker buildx for etcd image"
2021-09-27 13:59:56 -07:00
Kubernetes Prow Robot
dca007bac8
Merge pull request #105212 from BinacsLee/binacs-scheduler-do-not-reference-range-loop-vars
scheduler: do not reference range-loop variable
2021-09-27 13:59:45 -07:00