Commit Graph

662 Commits

Author SHA1 Message Date
Jiahui Feng
feb18b3f5f implmementing type checking
with multi-type support.
2023-03-07 15:49:19 -08:00
Jefftree
387d97605e Add metrics for aggregated discovery 2023-03-09 17:24:02 +00:00
Alexander Zielenski
c485cb2435 supply OpenAPIV3Config unconditionally
the handlers are still gated, but OpenAPIV3 is required for SSA
2023-02-28 13:29:57 -08:00
TommyStarK
527b905aaa cmd/kubeapiserver: Clean code, avoid unnecessary condition, avoid non-nil but zero-length slice
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
2023-01-06 18:03:41 +01:00
Kubernetes Prow Robot
8058e8eff8
Merge pull request #113171 from Jefftree/aggregated-discovery-generic
Aggregated discovery server changes
2022-11-09 00:08:12 -08:00
Kubernetes Prow Robot
e62cfabf93
Merge pull request #112050 from nilekhc/kms-hot-reload
Implements hot reload of the KMS `EncryptionConfiguration`
2022-11-08 17:24:12 -08:00
Alexander Zielenski
6e83f67505 add new aggregated resourcemanager to genericapiserver
Co-authored-by: Jeffrey Ying <jeffrey.ying86@live.com>
2022-11-08 14:44:49 -08:00
Nilekh Chaudhari
761b7822fc
feat: implements kms encryption config hot reload
This change enables hot reload of encryption config file when api server
flag --encryption-provider-config-automatic-reload is set to true. This
allows the user to change the encryption config file without restarting
kube-apiserver. The change is detected by polling the file and is done
by using fsnotify watcher. When file is updated it's process to generate
new set of transformers and close the old ones.

Signed-off-by: Nilekh Chaudhari <1626598+nilekhc@users.noreply.github.com>
2022-11-08 21:47:59 +00:00
Andrew Sy Kim
02020b20e7 kube-apiserver: remove flags --identity-lease-duration-seconds and --identity-lease-renew-interval-seconds
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
2022-11-07 19:36:22 -05:00
Monis Khan
f507bc2553
Load encryption config once
This change updates the API server code to load the encryption
config once at start up instead of multiple times.  Previously the
code would set up the storage transformers and the etcd healthz
checks in separate parse steps.  This is problematic for KMS v2 key
ID based staleness checks which need to be able to assert that the
API server has a single view into the KMS plugin's current key ID.

Signed-off-by: Monis Khan <mok@microsoft.com>
2022-10-13 10:52:29 -04:00
Kubernetes Prow Robot
9720af2ba3
Merge pull request #112306 from tkashem/v1beta3
add v1beta3 for Priority And Fairness
2022-10-03 10:06:14 -07:00
Han Kang
e95179ffb6 Wire up feature_gate.go with metrics via AddMetrics method
wire up feature_gate.go with metrics via AddMetrics method

Change-Id: I9b4f6b04c0f4eb9bcb198b16284393d21c774ad8

wire in metrics to kubernetes components

Change-Id: I6d4ef8b26f149f62b03f32d1658f04f3056fe4dc

rename metric since we're using the value to determine if enabled is true or false

Change-Id: I13a6b6df90a5ffb4b9c5b34fa187562413bea029

Update staging/src/k8s.io/component-base/featuregate/feature_gate.go

Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
2022-09-26 08:44:42 -07:00
Abu Kashem
0a99e6ebb1
apiserver: update apf logic to use v1beta3 2022-09-21 18:54:20 -04:00
SataQiu
baade6c730 using simpler wrapper function capabilities.Setup instead of calling Initialize directly 2022-09-14 23:37:32 +08:00
Kubernetes Prow Robot
cc4b7dc3c5
Merge pull request #111986 from enj/enj/i/transformer_leak
kms: fix go routine leak in gRPC connection
2022-09-08 09:49:46 -07:00
Monis Khan
4e68e9b5ad
kms: fix go routine leak in gRPC connection
Signed-off-by: Monis Khan <mok@microsoft.com>
2022-09-08 11:46:57 -04:00
Monis Khan
ec283e526b
Expand aggregated API server integration test to include CRUD
This change updates TestAggregatedAPIServer and the related test
server wiring to exercise the full network path between the Kube API
server and the aggregated API server.  We now assert that the wardle
API service and Kube API server discovery endpoints are fully healthy.
CRUD operations are performed through the Kube API server to the
wardle API server.

Signed-off-by: Monis Khan <mok@microsoft.com>
2022-08-30 10:44:01 -04:00
Sally O'Malley
47e7d8034f
kubelet tracing
Signed-off-by: Sally O'Malley <somalley@redhat.com>
Co-authored-by: David Ashpole <dashpole@google.com>
2022-08-01 12:55:02 -04:00
Patrick Ohly
4c6338ac0f logs: replace config methods with functions
API types are only supposed to have methods related to serialization.
2022-06-17 20:22:13 +02:00
Patrick Ohly
1aceac797d logs: make LoggingConfiguration an unversioned API
Making the LoggingConfiguration part of the versioned component-base/config API
had the theoretic advantage that components could have offered different
configuration APIs with experimental features limited to alpha versions (for
example, sanitization offered only in a v1alpha1.KubeletConfiguration). Some
components could have decided to only use stable logging options.

In practice, this wasn't done. Furthermore, we don't want different components
to make different choices regarding which logging features they offer to
users. It should always be the same everywhere, for the sake of consistency.

This can be achieved with a saner Go API by dropping the distinction between
internal and external LoggingConfiguration types. Different stability levels of
indidividual fields have to be covered by documentation (done) and potentially
feature gates (not currently done).

Advantages:

- everything related to logging is under component-base/logs;
  previously this was scattered across different packages and
  different files under "logs" (why some code was in logs/config.go
  vs. logs/options.go vs. logs/logs.go always confused me again
  and again when coming back to the code):

  - long-term config and command line API are clearly separated
    into the "api" package underneath that

  - logs/logs.go itself only deals with legacy global flags and
    logging configuration

- removal of separate Go APIs like logs.BindLoggingFlags and
  logs.Options

- LogRegistry becomes an implementation detail, with less code
  and less exported functionality (only registration needs to
  be exported, querying is internal)
2022-06-17 20:22:13 +02:00
Wojciech Tyczyński
0527a0dd45 Cleanup rest storage resources on shutdown 2022-04-19 15:59:13 +02:00
Jefftree
67d3dbfaae Separate OpenAPI V2 and V3 Config 2022-03-29 17:49:56 -07:00
Patrick Ohly
7de1b05e85 logging: add ContextualLogging feature
InitLogs overrides the klog default and turns contextual logging off. This
ensures that it is only enabled in Kubernetes commands that explicitly enable
it via a feature gate. A feature gate for it gets defined in
k8s.io/component-base/logs and is then used by Options.ValidateAndApply.

The effect of disabling contextual logging is very limited according to
benchmarks with kube-scheduler. The feature gets added anyway to satisfy the
PRR recommendation that features should be controllable.

The following commands have support for contextual logging:
- kube-apiserver
- kube-controller-manager
- kubelet
- kube-scheduler
- component-base/logs example

Supporting a feature gate check in ValidateAndApply and not in InitLogs is a
simplification: changing InitLogs to accept a FeatureGate would have implied
changing also component-base/cli.Run. This didn't seem worthwhile because
ValidateAndApply already covers the relevant commands.
2022-03-29 13:29:57 +02:00
Wojciech Tyczyński
ef2e32ab65 Log main golang runtime env vars 2022-03-04 08:04:02 +01:00
Jian Zeng
9573b4a6b9
refactor(apiserver): remove the insecure flags
Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
2021-12-08 10:53:44 +08:00
Jiahui Feng
9c05de2f31 prune enum when OpenAPIEnums is disabled. 2021-11-09 13:00:00 -08:00
Patrick Ohly
4df70dfd41 component-base: initialize logging as soon as possible
In various places log messages where emitted as part of validation or even
before it (for example, cli.PrintFlags). Those log messages did not use the
final logging configuration, for example text output instead of JSON or not the
final verbosity. The last point became more obvious after moving the setup of
verbosity into logs.Options.Apply because PrintFlags never printed anything
anymore.

In order to force applications to deal with logging as soon as possible, the
Options.Validate and Options.Apply methods are now private. Applications should
use the new Options.ValidateAndApply directly after parsing.
2021-11-03 11:55:54 +01:00
Patrick Ohly
3948cb8d1b component-base: move v/vmodule/log-flush-frequency into LoggingConfiguration
These three options are the ones from logs.AddFlags which are not deprecated.
Therefore it makes sense to make them available also via the configuration file
support in the one command which currently supports that (kubelet).

Long-term, all commands should use LoggingConfiguration, either with a
configuration file (as in kubelet) or via flags (kube-scheduler,
kube-apiserver, kube-controller-manager).

Short-term, both approaches have to be supported. As the majority of the
commands only use logs.AddFlags, that function by default continues to register
the flags and only leaves that to Options.AddFlags when explicitly requested.

A drive-by bug fix is done for log flushing: the periodic flushing called
klog.Flush and therefore missed explicit flushing of the newer logr
backend. This bug was never present in any release Kubernetes and therefore the
fix is not submitted in a separate PR.
2021-11-03 07:41:46 +01:00
Lukasz Szaszkiewicz
9e2bdfee02 rename to muxAndDiscoveryComplete 2021-10-19 13:26:59 +02:00
Lukasz Szaszkiewicz
53867975e7 apiserver: indroduces NotFoundHanlder
The new handler is meant to be executed at the end of the delegation chain.
It simply checks if the request have been made before the server has installed all known HTTP paths.
In that case it returns a 503 response otherwise it returns a 404.

We don't want to add additional checks to the readyz path as it might prevent fixing bricked clusters.
This specific handler is meant to "protect" requests that arrive before the paths and handlers are fully initialized.
2021-10-19 09:55:04 +02:00
Lukasz Szaszkiewicz
7a342a0f8a kube-apiserver: wires the notFoundHandler 2021-10-18 12:41:42 +02:00
Abu Kashem
28f2b42a41
apf: update apf logic to use v1beta2 2021-09-09 08:28:58 -04:00
Antonio Ojea
0cd75e8fec run hack/update-netparse-cve.sh 2021-08-20 10:42:09 +02:00
Kubernetes Prow Robot
3c72622a1f
Merge pull request #104229 from astraw99/fix_trivial_code
Fix single pointer variable parenthesis
2021-08-12 21:16:31 -07:00
astraw99
ff7307bf9c fix single pointer variable 2021-08-11 10:40:10 +08:00
David Ashpole
9dd59017c4 add tracing to webhook requests 2021-07-09 06:30:05 -07:00
David Ashpole
71f810bb71 Add distributed tracing to the etcd client 2021-06-26 09:19:39 -07:00
David Ashpole
79550ed40c Add distributed tracing to the apiserver using OpenTelemetry 2021-06-25 05:20:27 -07:00
Mike Spreitzer
0762f492c5 Add config checking for inflight limits
When API Priority and Fairness is enabled, the inflight limits must
add up to something positive.
This rejects the configuration that prompted
https://github.com/kubernetes/kubernetes/issues/102885

Update help for max inflight flags
2021-06-23 14:06:50 -04:00
Kubernetes Prow Robot
57fbeb8030
Merge pull request #101993 from wongma7/waitforetcd
Remove etcd connection apiserver preflight check
2021-06-08 12:26:20 -07:00
David Eads
84590fe27c remove --ssh- options, deprecated 13 releases, that only work on GCE 2021-06-03 13:54:35 -04:00
Danil-Grigorev
5d57b3794c Add DisableCloudProviders FG
FeatureGate acts as a secondary switch to disable cloud-controller loops
in KCM, Kubelet and KAPI.

Provide comprehensive logging information to users, so they will be
guided in adoption of out-of-tree cloud provider implementation.
2021-05-21 16:09:44 +02:00
Matthew Wong
c201a78dff Remove etcd connection apiserver preflight check 2021-05-19 13:46:20 -07:00
Kubernetes Prow Robot
8365e2384c
Merge pull request #101187 from GreenApple10/feature/import_cleanup
remove duplicate packet import
2021-04-30 12:06:25 -07:00
Kubernetes Prow Robot
fbc93bd34c
Merge pull request #101403 from wangyx1992/redundant-silce-nilcheck
cleanup: omit redundant nil check around loop in apiserver
2021-04-27 12:31:38 -07:00
Kubernetes Prow Robot
e640a01219
Merge pull request #101068 from BinacsLee/binacs-apiserver-remove-useless-code-logic
code cleanup: apiserver remove useless code logic
2021-04-26 00:03:01 -07:00
wangyx1992
b9ea207ff7 cleanup: omit redundant nil check around loop in apiserver
Signed-off-by: wangyx1992 <wang.yixiang@zte.com.cn>
2021-04-23 11:38:28 +08:00
BinacsLee
75dde4dce4 code cleanup: Abstract repetitive codes in cmd as a function 2021-04-22 23:35:04 +08:00
Shihang Zhang
925900317e allow multiple of --service-account-issuer 2021-04-19 09:54:11 -07:00
c00522440
a1335cba68 del duplicate import 2021-04-16 16:57:57 +08:00