Commit Graph

103790 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
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
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
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
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
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
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
Kubernetes Prow Robot
597f197e61
Merge pull request #105275 from tkashem/apf-rename-seats
apf: rename WorkEstimate.Seats to InitialSeats
2021-09-27 12:49:57 -07:00
Kubernetes Prow Robot
7c1e37ef27
Merge pull request #104803 from bobbypage/runtimeclass-skip
Skip runtimeclass test unless provider GCE
2021-09-27 12:49:45 -07:00
Kubernetes Prow Robot
5130d43200
Merge pull request #102802 from adisky/metrics-credential-provider-1
Add Metrics for Kubelet credential provider
2021-09-27 11:02:22 -07:00
Aaron Crickenberger
d41f9339f6 Revert "Use docker buildx for etcd image"
This reverts commit ea1bc18bc1.

But bumps the REVISION var

This commit broke etcd image builds
2021-09-27 10:46:17 -07:00
wojtekt
65d8037ae3 Add jittering for Kubelet status computing 2021-09-27 19:39:50 +02:00
Kubernetes Prow Robot
aec9acda68
Merge pull request #105214 from alculquicondor/job-update
Remove GET job and retries for status updates
2021-09-27 09:05:47 -07:00
Kubernetes Prow Robot
04f3d19bea
Merge pull request #104507 from wzshiming/fix/match
Check namespaces match in UpdateWithEventNamespace
2021-09-27 09:05:35 -07:00
Kubernetes Prow Robot
dc2fe6d56c
Merge pull request #105078 from aramase/fix-typo-kms-config
fix typo in kms encryption config logs
2021-09-27 07:33:49 -07:00
Kubernetes Prow Robot
48d844ec64
Merge pull request #104483 from margocrawf/master
Add UID to client-go impersonation config
2021-09-27 07:33:36 -07:00
Kubernetes Prow Robot
6a71f85ccf
Merge pull request #105263 from cyclinder/bump_metrics_server
bump metrics-server to 0.5.1
2021-09-27 03:39:34 -07:00
Kubernetes Prow Robot
486ca678a0
Merge pull request #104923 from davidkarlsen/xfsFormatIssue
mount-utils: force-format xfs-filesystems too
2021-09-27 02:29:36 -07:00
Kubernetes Prow Robot
d385d0602a
Merge pull request #105158 from justaugustus/its-a-bullseye
releng: Update build images to Debian 11 (Bullseye)
2021-09-26 23:14:23 -07:00
cyclinder
3e426355b9 bump metrics-server to 0.5.1
Signed-off-by: cyclinder <qifeng.guo@daocloud.io>
2021-09-27 11:18:03 +08:00
Carlos Panato
9bad325cb6
kube-cross: update image to v1.23.0-go1.17.1-bullseye.1
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
2021-09-26 15:17:00 +02:00
Kubernetes Prow Robot
b15f788d29
Merge pull request #105250 from ishangupta-ds/remaining-err
updated errors pkg to native go pkg for test/e2e/network/netopol test_helper
2021-09-26 05:12:21 -07:00
Kubernetes Prow Robot
d25d741c5f
Merge pull request #105249 from Nordix/issue-105192
Clear initial UDP conntrack entries for loadBalancerIPs for proxy-mode=ipvs
2021-09-26 00:26:21 -07:00
ishangupta-ds
4353365aa9 updated errors pkg to fmt for test/e2e/network/netopol test_helper
Signed-off-by: ishangupta-ds <ishangupta.ds@gmail.com>
2021-09-26 10:50:38 +05:30
Lars Ekman
4d6db6f1fc Clear initial UDP conntrack entries for loadBalancerIPs 2021-09-25 16:03:56 +02:00
Abu Kashem
5d67896ade
apf: rename WorkEstimate.Seats to InitialSeats 2021-09-24 19:49:25 -04:00
Khaled Henidak (Kal)
a53e2eaeab
move IPv6DualStack feature to stable. (#104691)
* kube-proxy

* endpoints controller

* app: kube-controller-manager

* app: cloud-controller-manager

* kubelet

* app: api-server

* node utils + registry/strategy

* api: validation (comment removal)

* api:pod strategy (util pkg)

* api: docs

* core: integration testing

* kubeadm: change feature gate to GA

* service registry and rest stack

* move feature to GA

* generated
2021-09-24 16:30:22 -07:00
Kubernetes Prow Robot
c74d799677
Merge pull request #105190 from RinkiyaKeDad/test-templates
adding sig info to failing/flaking test issue templates
2021-09-24 14:57:49 -07:00
Margo Crawford
d9ddfb26e1 Introduces Impersonate-Uid to client-go.
* Updates ImpersonationConfig in rest/config.go to include UID
  attribute, and pass it through when copying the config
* Updates ImpersonationConfig in transport/config.go to include UID
  attribute
* In transport/round_tripper.go, Set the "Impersonate-Uid" header in
  requests based on the UID value in the config
* Update auth_test.go integration test to specify a UID through the new
  rest.ImpersonationConfig field rather than manually setting the
  Impersonate-Uid header

Signed-off-by: Margo Crawford <margaretc@vmware.com>
2021-09-24 14:06:30 -07:00
Kubernetes Prow Robot
86d23cf441
Merge pull request #105206 from pohly/test-integration-help
test/integration: skip etcd startup for -help flag
2021-09-24 10:29:23 -07:00
Kubernetes Prow Robot
a6f9b2b2cb
Merge pull request #105235 from spiffxp/use-k8s-infra-gcb-docker-gcloud
use k8s-staging-test-infra/gcb-docker-gcloud
2021-09-24 08:03:23 -07:00
Aaron Crickenberger
42a955b3ae use k8s-staging-test-infra/gcb-docker-gcloud 2021-09-24 06:54:40 -07:00
wojtekt
37f93fc63d Optimize watchcache by not starting a gorotuine for all Get/List requests setting RV=0 2021-09-24 14:14:19 +02:00
Patrick Ohly
81b4a695b3 test/integration: skip etcd startup for -help flag
By parsing flags in the test's main function before starting etcd we bail out
early without ever starting etcd when the test was invoked with -help.

Otherwise etcd must be available, gets started and then hangs because
flag.Parse itself exits when called by testing.go. This bypasses the code in
EtcdMain which normally stops etcd.
2021-09-24 11:51:58 +02:00
Kubernetes Prow Robot
7bff8adaf6
Merge pull request #92853 from cosmo0920/add-sniffer-class-loading-feature-on-es-image
[fluentd/elasticsearch] Add mechanism to load simple sniffer class
2021-09-23 23:07:24 -07:00
Kubernetes Prow Robot
005dfcd09e
Merge pull request #105218 from khenidak/fix-sig-net-105182
mute unnecessary logs when failing to parse IPs
2021-09-23 17:27:23 -07:00
Kubernetes Prow Robot
b6924839ca
Merge pull request #101987 from sky-philipalmeida/patch-1
Log if PV is still in use trying to delete it
2021-09-23 14:30:54 -07:00
Khaled (Kal) Henidak
59dd238fd4 mute unnecessary logs 2021-09-23 20:52:18 +00:00
Kubernetes Prow Robot
24408ef7f5
Merge pull request #104892 from zzchun/fix-typo-in-node_affinity_test
fix typo in node_affinity_test
2021-09-23 13:22:55 -07:00
Kubernetes Prow Robot
ab4d8bd1e5
Merge pull request #105159 from jyz0309/fix-klog-error
Fix klog error in `pkg/proxy`
2021-09-23 11:17:38 -07:00
Kubernetes Prow Robot
e5c4defa8e
Merge pull request #103370 from verb/1.22-cleanup-shareprocesses-e2e
Remove ShareProcessNamespace tags from e2e_node tests
2021-09-23 10:11:14 -07:00