Commit Graph

308 Commits

Author SHA1 Message Date
Mike Dame
4960d0976a Wire contexts to Core controllers 2021-11-01 10:29:00 -04: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
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
372103f4b8
Merge pull request #100672 from wangyx1992/structured-log
Structured Logging migration: modify logs of controller-manager
2021-09-22 20:27:10 -07:00
Jiahui Feng
6f437c7155 use common controller interface in CCM. 2021-08-25 13:29:03 -07:00
Stephen Augustus
481cf6fbe7
generated: Run hack/update-gofmt.sh
Signed-off-by: Stephen Augustus <foo@auggie.dev>
2021-08-24 15:47:49 -04:00
Nick Turner
a5b47f7dd0 Allow custom client names to be used for cloud controllers
* This allows a controller to use cloud provider managed RBAC
  when --use-service-account-credentials is set.
* Create ControllerInitFuncConstructor to pass to init funcs to avoid
  future function signature growth.
* Add comments for context around legacy naming of node controllers.
* Add example for setting client names from cloud controller manager.
2021-08-24 00:51:24 +00:00
Antonio Ojea
0cd75e8fec run hack/update-netparse-cve.sh 2021-08-20 10:42:09 +02:00
Mzhiing
2635415482 fix error variable name 2021-07-29 20:10:06 +08:00
wangyx1992
7175d82a27 Structured Logging migration: modify logs of controller-manager
Signed-off-by: wangyx1992 <wang.yixiang@zte.com.cn>
2021-04-25 11:27:44 +08:00
chenyw1990
e2020f62ac add normalize function to global FlagSet 2021-03-18 09:23:52 +08:00
cici37
408258c6d5 Update to use cliflag.NamedFlagSets 2021-03-02 13:23:44 -08:00
cici37
9b3d42f20a Address comments. 2021-03-01 16:36:56 -08:00
cici37
716122ccec Update NodeIPAM wrapper 2021-03-01 13:51:59 -08:00
cici37
69fee369c9 Update extension mechanism and related sample. 2021-03-01 10:22:22 -08:00
cici37
9849079d4e Address review comments 2021-03-01 10:22:18 -08:00
cici37
b669f04648 Modify integration test to fill CCM test gap 2021-03-01 10:22:16 -08:00
cici37
27aaee2b40 Move initialize cloud provider with client builder reference inside controller start func 2021-03-01 10:22:10 -08:00
cici37
498fa39af2 Separate example func and add README.md 2021-03-01 10:22:09 -08:00
cici37
52bab024af Separate func 2021-03-01 10:21:57 -08:00
cici37
7b0a6db097 Add demonstration of wiring nodeIPAMController config object 2021-03-01 10:21:52 -08:00
cici37
4729fa49e1 Remove cloud provider name as input parameter. 2021-03-01 10:21:49 -08:00
cici37
2b3d2303a5 Fix flag passing in CCM. 2021-03-01 10:21:46 -08:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
changshuchao
854b74d9e2 Optimize some irregular variable names
Signed-off-by: changshuchao <chang.shuchao1@zte.com.cn>
2021-01-06 02:54:18 +08:00
Nicole Han
b80abf6d34 update cloud-controller-manager samples to read --cloud-config flag 2020-12-15 10:56:22 -08:00
cici37
4d201764dc Move feature IPv6DualStack to k8s.io/controller-manager 2020-11-25 15:42:13 -08:00
cici37
443f829703 Adding sample files to demonstrate how cloud provider leverage CCM. 2020-11-11 19:50:06 -08:00
cici37
895a0a8d5e Adding config extension to CCM. 2020-11-06 02:42:44 -08:00
cici37
9465d95ea6 Move CCM to staging k8s.io/cloud-provider 2020-10-29 20:50:23 -07:00
Kubernetes Prow Robot
4df8d97af0
Merge pull request #95725 from p0lyn0mial/delegated-authz-sar-timeout
sets explicit timeout for SubjectAccessReview client
2020-10-27 03:37:59 -07:00
Lukasz Szaszkiewicz
2160cbc53f DelegatingAuthorizationOptions: exposes and sets a default timeout for SubjectAccessReview client
previously no timeout was set. Requests without explicit timeout might potentially hang forever and lead to starvation of the application.
2020-10-26 17:11:59 +01:00
cici37
95acec5a3b Move client_builder to k8s.io/controller-manager 2020-10-19 14:48:22 -07:00
cici37
ae8ce0d190 Move cmd/controller-manager to k8s.io/controller-manager and cloud specific configs to k8s.io/cloud-provider. 2020-10-08 13:23:16 -07:00
cici37
33e23c4005 Move cloud related feature gates to controller-manager 2020-10-05 10:19:08 -07:00
wfender
ecf3bfe3b1 Adding cheftako to CCM owners. 2020-09-17 14:52:53 -07:00
wojtekt
805c1753cd Migrate scheduler, controller-manager and cloud-controller-manager to lease lock. 2020-09-10 11:57:18 +02:00
Daniel Smith
75f835aa08 move port definitions to a common location 2020-09-02 10:48:25 -07:00
Jordan Liggitt
1420b377e4 Add providerless tags 2020-07-30 13:48:40 -04:00
Nikhita Raghunath
c00dae0607 Revert "Merge pull request #93156 from logicalhan/triage-api-machinery"
This reverts commit 32438cf269, reversing
changes made to bb6a6aa391.
2020-07-24 13:01:02 +05:30
Han Kang
9129dbc98b automatically assign triage labels to api-machinery tagged PRs
Change-Id: Ifcc8a85d190d6370423af27f6e6c4c90b8472981
2020-07-16 13:13:59 -07:00
Kubernetes Prow Robot
633ab1ca61
Merge pull request #92880 from cici37/importCloudProvider
Import cloud provider from k8s.io/legacy-cloud-provider
2020-07-14 18:12:37 -07:00
cici37
cff8562c18 Import cloud provider from k8s.io/legacy-cloud-provider 2020-07-07 11:43:27 -07:00
Rob Scott
e701cb0205
Enabling the EndpointSliceMirroring controller, adding related config 2020-07-06 12:43:34 -07:00
Kobayashi Daisuke
4ecbec75a6 Run update-bazel.sh 2020-06-22 10:49:15 +09:00
Kobayashi Daisuke
4ae11dac2e Replace StartLogging(klog.Infof) with StartStructuredLogging(0) 2020-06-15 17:48:35 +09:00
Andrew Sy Kim
41dc075a85 move pkg/controller/cloud/node_lifecycle_controller.go to k8s.io/cloud-provider/controllers/nodelifecycle for easier external consumption
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
2020-06-08 17:34:01 -04:00
Andrew Sy Kim
6d4a19b31c move pkg/controller/cloud/node_controller.go to k8s.io/cloud-provider/controllers/node for easier external consumption
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
2020-06-08 17:34:01 -04:00
Andrew Sy Kim
99d9dda5a7 move pkg/controller/route to k8s.io/cloud-provider/controllers/route for easier external consumption
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
2020-06-08 17:34:01 -04:00