kubernetes/test/integration
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
..
apimachinery Merge pull request #97350 from FabianKramm/master 2021-08-20 11:19:31 -07:00
apiserver migrate k8s.io/apimachinery/util/clock -> k8s.io/utils/clock 2021-09-21 15:54:44 +05:30
auth Introduces Impersonate-Uid to client-go. 2021-09-24 14:06:30 -07:00
authutil This introduces an Impersonate-Uid header to server side code. 2021-07-06 10:13:16 -07:00
benchmark hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
certificates Merge pull request #99961 from margocrawf/master 2021-07-06 18:46:43 -07:00
client 'New' Event namespace validate failed (#100125) 2021-09-16 04:29:45 -07:00
configmap Part3: master to controlplane in test/integration 2021-06-03 11:06:19 +08:00
controlplane generated: Run hack/update-gofmt.sh 2021-08-24 15:47:49 -04:00
cronjob integration test for cronjob with controllerv2 2021-08-31 21:15:10 +08:00
daemonset sched: start dynamicInformerFactory along with regular informerFactory (#105016) 2021-09-16 19:33:00 -07:00
defaulttolerationseconds Rename masterConfig to controlPlaneConfig 2021-06-04 20:55:08 +08:00
deployment Clean up the master term in test/integration comments 2021-06-18 16:31:05 +08:00
disruption generated 2021-03-09 10:29:11 -05:00
dryrun remove webhook.go to revert changes to conformance test 2021-07-01 20:24:46 +00:00
dualstack move IPv6DualStack feature to stable. (#104691) 2021-09-24 16:30:22 -07:00
endpoints test/integration/endpoints: check for pod existencen in TestEndpointWithTerminatingPod 2021-07-12 14:22:34 -04:00
endpointslice test/intergration/endpointslice: add tests for endpointslice terminating condition 2021-07-08 17:59:11 -04:00
etcd apf: ebable v1beta2 2021-09-09 08:28:53 -04:00
events hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
evictions fix ineffassign and varcheck 2021-07-14 08:41:22 -04:00
examples run hack/update-netparse-cve.sh 2021-08-20 10:42:09 +02:00
framework initialize logging after flag parsing 2021-09-30 13:46:49 +02:00
garbagecollector Merge pull request #97779 from tiloso/staticcheck-test-integration-gs 2021-03-10 16:04:23 -08:00
ipamperf run hack/update-netparse-cve.sh 2021-08-20 10:42:09 +02:00
job Revert "Limit number of Pods counted in a single Job sync" 2021-09-21 15:16:50 -04:00
kubelet Migrate to k8s.io/utils/clock in pkg/kubelet 2021-09-10 12:20:09 +02:00
metrics Rename master to apiserver in test/integration 2021-06-18 17:40:46 +08:00
namespace Rename masterConfig to controlPlaneConfig 2021-06-04 20:55:08 +08:00
network move repair loop interval to a constant 2021-09-13 23:54:19 +02:00
node Rename master to apiserver in test/integration 2021-06-17 15:48:39 +08:00
objectmeta Part3: master to controlplane in test/integration 2021-06-03 11:06:19 +08:00
openshift part1 of e2e: master to apiserver/control-plane 2021-03-31 15:50:18 +08:00
pods Part3: master to controlplane in test/integration 2021-06-03 11:06:19 +08:00
quota test/integration/quota: poll for ResourceQuota used status in TestQuotaLimitService 2021-07-06 07:10:20 -04:00
replicaset Rename masterConfig to controlPlaneConfig 2021-06-04 20:55:08 +08:00
replicationcontroller Rename masterConfig to controlPlaneConfig 2021-06-04 20:55:08 +08:00
scale Drop use of deprecated clientv3.SetLogger 2021-06-15 09:53:06 -04:00
scheduler Provide a timeout function to fail quick on blocking operations 2021-09-17 10:23:06 -07:00
scheduler_perf Merge pull request #105206 from pohly/test-integration-help 2021-09-24 10:29:23 -07:00
secrets Part3: master to controlplane in test/integration 2021-06-03 11:06:19 +08:00
service fix loadbalancerclass integration test funcation name 2021-06-28 20:07:02 -07:00
serviceaccount Clean up the master term in test/integration comments 2021-06-18 16:31:05 +08:00
serving kube-scheduler: stop using insecure serving bits 2021-06-14 22:50:53 +02:00
statefulset Clean up the master term in test/integration comments 2021-06-18 16:31:05 +08:00
storageclasses Part3: master to controlplane in test/integration 2021-06-03 11:06:19 +08:00
storageversion remove more CRD v1beta1 client dependencies 2021-03-05 08:10:47 -05:00
tls hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
ttlcontroller Part3: master to controlplane in test/integration 2021-06-03 11:06:19 +08:00
util sched: start dynamicInformerFactory along with regular informerFactory (#105016) 2021-09-16 19:33:00 -07:00
volume Part3: master to controlplane in test/integration 2021-06-03 11:06:19 +08:00
volumescheduling sched: start dynamicInformerFactory along with regular informerFactory (#105016) 2021-09-16 19:33:00 -07:00
.import-restrictions Make integration tests not depend on e2e tests 2021-03-25 23:02:52 +08:00
benchmark-controller.json updates pause image references 2021-08-29 21:50:05 -07:00
doc.go
utils.go Clean up the master term in test/integration comments 2021-06-18 16:31:05 +08:00