Commit Graph

14286 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
dbd8d3bcd6 Merge pull request #105141 from VilledeMontreal/fix/noloadPluginsForComp
Do not try to load plugins for cobra commands
2021-10-06 12:18:31 -07:00
Kubernetes Prow Robot
afd55590e2 Merge pull request #104557 from tkashem/optimize-httplog
apiserver: construct logger for httplog only when log level is  3
2021-10-06 00:54:33 -07:00
Abu Kashem
b05d805fd3 remove httplog filter from handler chain when klog.v < 3 2021-10-05 14:05:09 -04:00
Kubernetes Prow Robot
b7da9ef49f Merge pull request #105156 from aojea/clientgo_trace
Enhance client-go url timing logging with http statistics
2021-10-05 09:23:21 -07:00
Kubernetes Prow Robot
7cce7eec11 Merge pull request #105466 from liggitt/json-stdlib-pretty
Use json stdlib for pretty-printer encoding
2021-10-05 08:23:20 -07:00
Antonio Ojea
72c35be086 client-go httpstats
enhance client-go DebugURLTiming roundtripper using golang httptrace
to provide timing statistics for:
- dns lookup
- tcp dialing
- tls handshake
- time to get a connection from the pool
- time to process a request
2021-10-05 16:13:30 +02:00
Kubernetes Prow Robot
519b164db1 Merge pull request #105222 from cyclinder/remove_node_lease_GA
remove nodeLease feature GA
2021-10-05 05:41:21 -07:00
Kubernetes Prow Robot
6f942a0701 Merge pull request #105412 from MikeSpreitzer/define-seat-seconds
Define datatype for seat-seconds and prevent overflow
2021-10-05 02:05:09 -07:00
Kubernetes Prow Robot
efa9029a0d Merge pull request #104920 from tkashem/response-writer-cleanup
apiserver: decorate http.ResponseWriter correctly
2021-10-05 00:53:09 -07:00
Author cyclinder
e61b901628 remove nodeLease feature GA
Signed-off-by: cyclinder <qifeng.guo@daocloud.io>
2021-10-05 12:23:27 +08:00
Kubernetes Prow Robot
9fdcc4b199 Merge pull request #105312 from Karthik-K-N/fix-reatelimite-testfail
Fix for TestWithMaxWaitRateLimiter test case failure
2021-10-04 14:13:03 -07:00
Kubernetes Prow Robot
70d1360ab8 Merge pull request #105103 from tkashem/extend-audit-policy
apiserver: refactor PolicyRuleEvaluator interface
2021-10-04 14:12:40 -07:00
Mike Spreitzer
4b5e139819 Use SeatSeconds 2021-10-04 14:02:53 -07:00
Mike Spreitzer
d866f94458 Draft datatype for seat-seconds 2021-10-04 14:02:35 -07:00
Jordan Liggitt
74ca1b953a Compact pretty-printed compatibility fixtures when decoding 2021-10-04 15:18:00 -04:00
Jordan Liggitt
17111241ba Fix pretty-printed fixtures 2021-10-04 15:18:00 -04:00
Jordan Liggitt
a166f887f6 Use stdlib json encoder for yaml and pretty-json marshaling 2021-10-04 15:18:00 -04:00
Kubernetes Prow Robot
04f747d09f Merge pull request #104782 from kerthcet/cleanup/remove-cc-v1beta1
remove scheduler component config v1beta1
2021-10-04 08:53:08 -07:00
Abu Kashem
0d50c969c5 apiserver: wrap ResponseWriter using abstraction 2021-10-04 10:59:11 -04:00
Kubernetes Prow Robot
e5976909c6 Merge pull request #105414 from pohly/log-example-verbosity
component-base: verbosity in example command
2021-10-04 04:19:38 -07:00
Kubernetes Prow Robot
e4e2c51648 Merge pull request #105042 from pohly/log-deprecate-klog-flags
deprecate klog flags
2021-10-04 04:19:18 -07:00
Kubernetes Prow Robot
e380ce5714 Merge pull request #105384 from seans3/command-headers-fix
Fixes kubectl command headers which hangs on kubectl run
2021-10-01 18:25:17 -07:00
Kubernetes Prow Robot
0465cd7d04 Merge pull request #104227 from astraw99/fix_typo
Fix typo `registry`
2021-10-01 16:49:05 -07:00
Patrick Ohly
d6519150ca component-base: verbosity in example command
The global klog flags were not enabled (an oversight?). Once they
get added, logging at different verbosity levels can be demonstrated.
2021-10-01 23:37:12 +02:00
Patrick Ohly
27d6ce4479 deprecate klog flags
Upstream klog continues to support all of its flags, but in Kubernetes only
some will be supported going format (-v, -vmodule). With this change,
the kubelet flags now look like this:

  $ go run ./cmd/kubelet --help | grep -e --log-dir -e '--v ' -e --vmodule -e --logging-format
  --log-dir string                                           If non-empty, write log files in this directory (DEPRECATED: will be removed in a future release, see https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --logging-format string                                    Sets the log format. Permitted formats: "json", "text".
                Non-default formats don't honor these flags: --add_dir_header, --alsologtostderr, --log_backtrace_at, --log_dir, --log_file, --log_file_max_size, --logtostderr, --one_output, --skip_headers, --skip_log_headers, --stderrthreshold, --vmodule, --log-flush-frequency, --add_dir_header, --alsologtostderr, --log_backtrace_at, --log_dir, --log_file, --log_file_max_size, --logtostderr, --one_output, --skip_headers, --skip_log_headers, --stderrthreshold, --vmodule.
  -v, --v Level                                                  number for the log level verbosity
      --vmodule moduleSpec                                       comma-separated list of pattern=N settings for file-filtered logging
2021-10-01 23:36:48 +02:00
Kubernetes Prow Robot
82da9bdaab Merge pull request #105076 from pohly/log-flush-frequency-bug
initialize logging after flag parsing + refactor commands
2021-10-01 14:30:18 -07:00
Abu Kashem
96e8fd69e3 apiserver: introduce abstraction for wrapping ResponseWriter 2021-10-01 15:58:11 -04:00
Kubernetes Prow Robot
d3b37e1f6b Merge pull request #104499 from liggitt/visitor-source
Propagate source to list items when flattening
2021-10-01 09:45:23 -07:00
Kubernetes Prow Robot
ca08978c2d Merge pull request #104653 from astraw99/fix-word-comment
Fix word most `comment` to `common` and typo
2021-10-01 07:31:22 -07:00
Kubernetes Prow Robot
26365faf31 Merge pull request #105185 from ialidzhikov/fix/azure-lb-deletion
Ignore VMs in vmss delete backend pools
2021-10-01 01:55:21 -07:00
Karthik K N
7134657304 Changes to fix the flake test case in ratelimiter 2021-10-01 12:20:12 +05:30
Kubernetes Prow Robot
dec5153eb0 Merge pull request #105383 from tkashem/lifecycle-signal
make lifecycle signal thread safe
2021-09-30 18:33:57 -07:00
Sean Sullivan
1d1a5499e7 Fixes kubectl command headers which hangs on kubectl run 2021-09-30 13:53:00 -07:00
Abu Kashem
d3e2e9ede2 make lifecycle signal thread safe 2021-09-30 15:33:09 -04:00
Madhav Jivrajani
a43fca76ea run hack/{pind-dependency.sh, update-vendor.sh}
Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
2021-09-30 19:15:43 +05:30
Patrick Ohly
1957fb6508 command lines: harmonize command line parse error handling
The recommendation from #sig-cli was to print usage, then the error. Extra care
is taken to only print the usage instruction when the error really was about
flag parsing.

Taking kube-scheduler as example:

  $ _output/bin/kube-scheduler
  I0929 09:42:42.289039  149029 serving.go:348] Generated self-signed cert in-memory
  ...
  W0929 09:42:42.489255  149029 client_config.go:620] error creating inClusterConfig, falling back to default config: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
  E0929 09:42:42.489366  149029 run.go:98] "command failed" err="invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable"

  $ _output/bin/kube-scheduler --xxx
  Usage:
    kube-scheduler [flags]

  ...
       --vmodule moduleSpec
                  comma-separated list of pattern=N settings for file-filtered logging

  Error: unknown flag: --xxx

The kubectl behavior doesn't change:

  $ _output/bin/kubectl get nodes
  Unable to connect to the server: dial tcp: lookup xxxx: No address associated with hostname

  $ _output/bin/kubectl --xxx
  Error: unknown flag: --xxx
  See 'kubectl --help' for usage.
2021-09-30 13:46:49 +02:00
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
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
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
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
Shiming Zhang
13fe94f136 Add unit test coverage for events expansion 2021-09-29 10:11:27 +08:00