Commit Graph

2950 Commits

Author SHA1 Message Date
Antoine Pelisse 79880fd996 fieldmanager: Make all tests external
Kubernetes-commit: 56cac6465588467d7df39c87930d94a9dc5bc299
2022-11-30 13:53:31 -08:00
Antoine Pelisse 5bc84857f2 fieldmanager: Move private setLastApplied to internal.SetLastApplied
Since this is used both in real-code and in test-code, let's put it
somewhere it can be re-used.

Kubernetes-commit: 9c447177e85dadaba0f12fa95c5d8ee6c4e54602
2022-11-30 13:07:33 -08:00
Antoine Pelisse 4a0d0a943f fieldmanager: remove dependencies on dummy version conversion for tests
Kubernetes-commit: 530d25026e06d0253a6c663d4dde2e35040e82da
2022-11-30 12:53:18 -08:00
Antoine Pelisse 672009bfe3 fieldmanager: Remove unnecessary method for creating TestFieldManager
Kubernetes-commit: 7217e0308dbf1743327345916c6945fb947e8958
2022-11-29 20:37:53 -08:00
Dario Tranchitella 0477735c3a fix(docs): wrong comment block for ResolveEndpoint function
Kubernetes-commit: 01c7559856f6c81d0deb7d042c06bee15be65527
2022-09-06 14:38:30 +02:00
kkkkun fc3eec104b Cleanup reportedVerb only from
Kubernetes-commit: 42f72a3fe9dc27c0b0f10fd7dc4ab4cb6f901314
2022-08-14 13:53:25 +08:00
Alexander Zielenski 4a90b2a1b2 add alexzielenski to OWNERS
Kubernetes-commit: 10b9a1fe196b082c1702ad880cd2f9756ce17a87
2022-11-15 08:43:25 -08:00
Antoine Pelisse dd4640ce38 Add apelisse into some more OWNERS files
Kubernetes-commit: b5f2130f240b0a9ebd1d0edd400b899d0efb8b2b
2022-11-14 16:28:14 -08:00
Tim Allclair 919e9045fa Combine RequestAuditConfig with RequestAuditConfigWithLevel
Kubernetes-commit: 1a1ca5173ea0f6b06a74d4a26e694cff521a2f8e
2022-11-02 15:23:48 -07:00
Monis Khan 4ff5d986e5 kms: use different context for server lifecycle and initial load
Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: cb3410e1b7d3f13a4258eb8c5c882a40fb6d13de
2022-11-16 10:36:42 -05:00
Jordan Liggitt a6d7e01d42 Switch deprecated API serving back to gating on beta
Kubernetes-commit: 32ac434d4dd799545db98cdcce683535c9b7db04
2022-11-15 22:02:49 -05:00
Alexander Zielenski a399b695cd fix aggregated discovery version sorting
add test for level based priorities

Kubernetes-commit: 3c68fe6596922dc535b5af03f409611e57258f9d
2022-11-09 12:40:33 -08:00
Jefftree 9508b3bed7 fix dropped subresources
some subresources were not properly included in the array due to pointers becoming stale over a resize

Kubernetes-commit: d74b6b2cfa9bd2bc322750db9c42fb575e947982
2022-11-09 17:56:02 +00:00
Jefftree 987645aaa7 add aggregated /apis handler for genericapiserver
so that aggregated-apiservers can also take advantage. discovered by e2e tests with feature enabled

Kubernetes-commit: c9b34884004079ed3f184b475f7408984f9226f4
2022-11-09 18:29:27 +00:00
David Ashpole 34af8dc84a Revert "Graduate API Server tracing to beta"
Kubernetes-commit: e799fcdadd3cc3e8aa4ebde75d1bf0c05465b110
2022-11-09 22:37:28 -05:00
Cici Huang 47687312f4 Rename FG to `ValidatingAdmissionPolicy`
Kubernetes-commit: 29737124860b1414affa07ed6db30fccdbae3b55
2022-11-09 17:27:20 +00:00
Cici Huang 55bc692e10 Rename admission cel package to validatingadmissionpolicy
Kubernetes-commit: 40c21dafcdb7d4f7ee85c652b362632f3b620861
2022-11-08 14:18:26 +00:00
Alexander Zielenski 806e2feeca add test for error when informers are not ready
Kubernetes-commit: acf571fcbed6e762a2a654bfbe6c415e668dfed3
2022-11-09 15:28:37 -08:00
Alexander Zielenski 2167932c69 use existing admissionHandler readyfunc to wait for sync
is what other plugins do, and should decrease verbosity in logs

Kubernetes-commit: df315f347c911c5cc189d14f6dc70a23da52e57d
2022-11-08 13:07:42 -08:00
Kermit Alexander II 8884260fa6 Add metrics integration.
Kubernetes-commit: 99494e67779d0db5a1bf304256e7df273070bf95
2022-10-31 19:22:35 +00:00
David Ashpole 855ac5dd3a embed component-base tracing configuration
Kubernetes-commit: 6e13cf69f62e54622d45269e9ae33799a85f7cff
2022-11-08 22:43:28 +00:00
David Ashpole 4bd488aae1 promote TracingConfiguration to v1beta1
Kubernetes-commit: 4be473c774aa1ccd018d6430dc860629a5b22022
2022-11-08 15:15:05 +00:00
David Ashpole 1c6757fe8d graduate API Server tracing to beta
Kubernetes-commit: fc3cec6bf3f39037cd527f49b35df6c212218127
2022-11-07 17:30:09 +00:00
Wojciech Tyczyński a29f52cb30 Standardize naming in generic storage watcher tests
Kubernetes-commit: 593742f092e1ae81988c12e6d833acb29c02009e
2022-11-08 09:52:59 +01:00
Mike Spreitzer 770f2e1fa4 apiserver: finish implementation of borrowing in APF
Also make some design changes exposed in testing and review.

Do not remove the ambiguous old metric
`apiserver_flowcontrol_request_concurrency_limit` because reviewers
though it is too early.  This creates a problem, that metric can not
keep both of its old meanings.  I chose the configured concurrency
limit.

Testing has revealed a design flaw, which concerns the initialization
of the seat demand state tracking.  The current design in the KEP is
as follows.

> Adjustment is also done on configuration change … For a newly
> introduced priority level, we set HighSeatDemand, AvgSeatDemand, and
> SmoothSeatDemand to NominalCL-LendableSD/2 and StDevSeatDemand to
> zero.

But this does not work out well at server startup.  As part of its
construction, the APF controller does a configuration change with zero
objects read, to initialize its request-handling state.  As always,
the two mandatory priority levels are implicitly added whenever they
are not read.  So this initial reconfig has one non-exempt priority
level, the mandatory one called catch-all --- and it gets its
SmoothSeatDemand initialized to the whole server concurrency limit.
From there it decays slowly, as per the regular design.  So for a
fairly long time, it appears to have a high demand and competes
strongly with the other priority levels.  Its Target is higher than
all the others, once they start to show up.  It properly gets a low
NominalCL once other levels show up, which actually makes it compete
harder for borrowing: it has an exceptionally high Target and a rather
low NominalCL.

I have considered the following fix.  The idea is that the designed
initialization is not appropriate before all the default objects are
read.  So the fix is to have a mode bit in the controller.  In the
initial state, those seat demand tracking variables are set to zero.
Once the config-producing controller detects that all the default
objects are pre-existing, it flips the mode bit.  In the later mode,
the seat demand tracking variables are initialized as originally
designed.

However, that still gives preferential treatment to the default
PriorityLevelConfiguration objects, over any that may be added later.

So I have made a universal and simpler fix: always initialize those
seat demand tracking variables to zero.  Even if a lot of load shows
up quickly, remember that adjustments are frequent (every 10 sec) and
the very next one will fully respond to that load.

Also: revise logging logic, to log at numerically lower V level when
there is a change.

Also: bug fix in float64close.

Also, separate imports in some file

Co-authored-by: Han Kang <hankang@google.com>

Kubernetes-commit: feb42277884bc7cfbd6f0bb1d875cc63b1b6caac
2022-10-31 16:13:25 -07:00
Abu Kashem 087be8a557 apiserver: update borrowing parameters for apf bootstrap objects
Kubernetes-commit: 172b27c80cc76f4dcb75973bd5f64fe5ec93f58c
2022-10-12 12:25:39 -04:00
Abu Kashem 63cc9bca2c apiserver: fix defaulting for apf bootstrap configuration
Kubernetes-commit: 424b23bb15d21d8c710e101b6f3a86c24d0249d3
2022-10-20 18:50:14 -04:00
Alexander Zielenski b2bf3ca966 add new aggregated resourcemanager to genericapiserver
Co-authored-by: Jeffrey Ying <jeffrey.ying86@live.com>

Kubernetes-commit: 6e83f6750598d394fb257f66c5d0721cf88f45db
2022-11-08 12:37:50 -08:00
Alexander Zielenski 0a2a637e85 negotiated refactor
Co-authored-by: Jeffrey Ying <jeffrey.ying86@live.com>

Kubernetes-commit: 76f056867a2be388f7780c1ff5c794edcdfd9aa4
2022-11-08 12:12:34 -08:00
Alexander Zielenski 7c2a6f0ee8 fix possible race in admission test of listwatch
Kubernetes-commit: 4e217159cfc1441f3c3234059fc6fca0eb13a66d
2022-11-07 12:01:44 -08:00
Nilekh Chaudhari 25c1e9054d 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>

Kubernetes-commit: 761b7822fca569d475f782b135ef433e5b014147
2022-11-07 22:15:56 +00:00
Joe Betz 0e28c0c81f Fix params to be null instead of an empty map if paramRef is null
Kubernetes-commit: 65460b14d2b9ea20aaf2c6fece191af53ae57249
2022-11-08 13:49:50 -05:00
Andrew Sy Kim 3f92018a06 apiserver: use the correct error when logging errors updating managedFields
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>

Kubernetes-commit: efdd06718646fc7e8912f8aaa8fc7bef3f7cdba0
2022-11-07 23:00:58 -05:00
Joseph Anttila Hall 70826774b2 egress_selector: prevent goroutines leak on connect() step.
Kubernetes-commit: 906b97931abf3c53238eb0294de9c5f27fc08bde
2022-11-01 21:55:42 -07:00
sanwishe cb73680ff8 fix etcd compaction doc
Kubernetes-commit: 8a013b36f3af870aad85654cb317366dc7831cb0
2022-08-17 02:35:16 +00:00
Andrew Sy Kim d9ed5cedb4 kube-apiserver: promote APIServerIdentity to Beta and enabled by default
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>

Kubernetes-commit: 196a3b99f5e13cf13af4e24e988bd4d88b5bcb97
2022-11-04 10:41:46 -04:00
Damien Grisonnet 9a8e2de22e metrics: improve apiserver SLI metric name
Add new kube-apiserver SLI metric better reflecting that the metric is
an SLI and not an SLO and deprecate the existing
apiserver_request_slo_duration_seconds in 1.27. Although the metric is
still in alpha, we prefer deprecating it for one release since it is a
critical metric used for SLOs and to make sure that users that are using
it have time to make the transition.

Going forward we prefer going with SLI specific metrics, we will use
_sli_ instead of _slo_ so for consistency purposes.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>

Kubernetes-commit: 1493da92d9513e383f8382c7e80316a3fa6c94fa
2022-09-22 19:08:34 +02:00
Paweł Banaszewski ebb0a2b606 Added scope as tracing attribute
Kubernetes-commit: e4169d7f4381595152f6fa862af2227950f3fc76
2022-11-08 11:22:57 +00:00
Mike Spreitzer 2c528b2e56 apiserver: add solver for APF concurrency rebalancing
Kubernetes-commit: b2f69fb88772be64504e5c8e36aba4a0ffb4beef
2022-08-30 22:34:16 -04:00
Tim Allclair 3268b0561b Validate etcd paths
Kubernetes-commit: f1693a02c46f79f8c90a4ef17c4a750034f21484
2022-10-10 18:15:22 -07:00
Cici Huang 81aeb1b5e9 Integrate cel admission with API.
Co-authored-by: Alexander Zielenski <zielenski@google.com>
Co-authored-by: Joe Betz <jpbetz@google.com>

Kubernetes-commit: e7d83a1fb7b3e4f6a75ed73bc6e410946e12ad9f
2022-11-07 21:38:55 +00:00
Cici Huang 58f75bc06a Add match check for policy and binding.
Co-authored-by: Max Smythe <smythe@google.com>

Kubernetes-commit: 46f97d4662d5b403badd29675d79d0c74875b9f0
2022-11-07 21:33:17 +00:00
Cici Huang 9f6b13b337 Update admission initializers.
Moved RestMapper and add DynamicClient

Kubernetes-commit: c8a089de4692ef94ec25fc5874906640d0ec9a28
2022-11-07 21:24:46 +00:00
Cici Huang 464de72d97 Adding new api version of admissionregistration.k8s.io v1alpha1 for CEL in Admission Control
Kubernetes-commit: 0486e062618f2181857ae7b235dcd4b8be0964e4
2022-10-04 04:46:55 +00:00
Anish Ramasekar 525c6769a4 [KMS]: validate duplicate kms config name for v1 and v2 when reload=true
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: 47f8c4bec63a2c4d6406cd615b41cd16f12be434
2022-11-07 20:16:04 +00:00
Anish Ramasekar 9adc12f501 [KMSv2]: add validation for duplicate kms config name
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: 176919c4cfb0dc7ecc4987442c6d70b676cea156
2022-10-26 21:18:01 +00:00
Paweł Banaszewski e21a3f224f Added simple tests and changed lazyVerb String method to the same as httplog uses
Kubernetes-commit: b31339231314ae8a72481cfda45539e35097450a
2022-11-07 17:13:26 +00:00
Paweł Banaszewski 490f0b7444 Added Verb and Resource to request trace attributes
Kubernetes-commit: fad094cb70c26f962c49d615b1f48326aa25181d
2022-11-07 14:33:40 +00:00
Andrew Sy Kim c4a89b8fc6 apiserver identity : use SHA256 hash in lease names
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>

Kubernetes-commit: 5b3a9e2d758650ff2919b8343d2a34ba8ca84b2b
2022-11-05 13:52:07 -04:00
Monis Khan e137a3da77 kms: add wiring to support automatic encryption config reload
This change adds a flag --encryption-provider-config-automatic-reload
which will be used to drive automatic reloading of the encryption
config at runtime.  While this flag is set to true, or when KMS v2
plugins are used without KMS v1 plugins, the /healthz endpoints
associated with said plugins are collapsed into a single endpoint at
/healthz/kms-providers - in this state, it is not possible to
configure exclusions for specific KMS providers while including the
remaining ones - ex: using /readyz?exclude=kms-provider-1 to exclude
a particular KMS is not possible.  This single healthz check handles
checking  all configured KMS providers.  When reloading is enabled
but no KMS providers are configured, it is a no-op.

k8s.io/apiserver does not support dynamic addition and removal of
healthz checks at runtime.  Reloading will instead have a single
static healthz check and swap the underlying implementation at
runtime when a config change occurs.

Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: 22e540bc48d9bf698c4f381ccb56ed57dea0dae2
2022-11-02 01:08:42 -04:00
Wojciech Tyczyński 0ed87195b0 Standardize naming in generic storage tests
Kubernetes-commit: e49c225eb9e7c428aca97e8031089e7ad91ca7c4
2022-11-05 12:14:56 +01:00
Wojciech Tyczyński 82397f8421 Fix naming in storage test setup
Kubernetes-commit: 1bc95675b19c68807ed3ae45a24701fc5c2fb935
2022-11-04 15:37:47 +01:00
SataQiu b683f5d16a kube-apiserver: print supported media types on failure to find a serializer
Kubernetes-commit: 56b46e13c21b483ebc70bd6e151eea0a45b399e8
2022-11-05 23:03:23 +08:00
Nick Turner e1dde980a4 Fix formatting of API server diagram
Kubernetes-commit: 02e3fbfeff5c3044321fc59f0427b64fbcfec70d
2022-11-06 16:41:11 -08:00
Wojciech Tyczyński c51bbc3183 Parallelize tests cases in some storage tests
Kubernetes-commit: 6d85f947bf86d12e4459d31029c41d6049d40c0e
2022-11-04 10:23:40 +01:00
Wojciech Tyczyński 44c802979e Reuse generic ListNonRecurisve test for cacher
Kubernetes-commit: e301306d89a69ff1a328a4ae3fa39a9e3deb022e
2022-11-03 14:58:34 +01:00
Wojciech Tyczyński b312c7eb5b Stop exporting storage testing utility functions
Kubernetes-commit: 37db332298fc6d14a798f610ce6049792299f0b1
2022-11-03 08:47:38 +01:00
Tim Hockin b304fee293 Clarify a few validation messages
Kubernetes-commit: 6d4241fe5dc7341e3207b8ab96513ab1ddeae8a2
2022-08-12 12:33:41 -07:00
David Ashpole 0cf3af5b9f add otel tracing to latency filters
Kubernetes-commit: ed1610ad15f91b72017c5d69dc4f7d59a17c270f
2022-10-20 16:17:02 +00:00
Andrew Sy Kim 0a5efb307f apiserver identity: use persistent identity format based on hostname
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>

Kubernetes-commit: 21507902ba123c5c60eaa73436b95c4ae9b75908
2022-10-24 11:24:26 -04:00
Mike Spreitzer 084f1abd96 apiserver: define metrics for API Priority and Fairness borrowing
Kubernetes-commit: ba5ec78916ae5fe9e400a298da6879515029a12f
2022-10-31 15:09:39 -07:00
Mike Spreitzer 17134f6412 apiserver: remove redundant field from seatDemandStats
Kubernetes-commit: 4ad1c0f9cb8aa54efa127975aaa9d5bd3080e8d0
2022-11-03 10:41:50 -07:00
kidddddddddddddddddddddd 0547548a94 strict decode policy first
Kubernetes-commit: 5dcfaae7b90c4838e488eace376e05c9e807f23b
2022-11-02 16:17:52 +08:00
Wojciech Tyczyński a47bbc6347 Minor cleanup in etcd3 tests
Kubernetes-commit: 83399ccfb8822cc31a6a3a66e8352591d88feaa8
2022-10-31 18:02:40 +01:00
Wojciech Tyczyński a24d8963d1 Refactor remaining etcd3 tests to make them generic
Kubernetes-commit: e6ddb69e6fd06bf9a02fa731f12472f3c375762d
2022-10-31 18:02:19 +01:00
Wojciech Tyczyński c38aa93533 Reuse generic TestGet in cache tests.
Kubernetes-commit: 75a1ef87b32213a7d3d1c2027dd515e4f74c1777
2022-10-27 16:00:30 +02:00
David Ashpole 0b88ce8f83 shut down tracerprovider when stopping the kube-apiserver
Kubernetes-commit: 2342721c157e8a715747187b44af2bd9bacd432f
2022-11-02 13:15:27 +00:00
Joseph Anttila Hall 12ce665c8d egress_selector.go: Add a dial starts metric.
Emit this metric before any potentially blocking dial work.

Kubernetes-commit: f89bcffd55e205c610746c418062a305456cf29f
2022-10-31 12:59:26 -07:00
Wojciech Tyczyński 07db92af49 Fix setting resource version on deletion
Kubernetes-commit: bbcf5e38776f2b18026539a0fbcf3aa505386c1f
2022-10-26 21:37:19 +02:00
Marcel Zięba 6887520e10 Fix APF width estimate for creating service account's token
Kubernetes-commit: 2f7b4ca6851aa3d479c9af3c14a168b4974f2fee
2022-10-18 12:27:50 +00:00
Max Smythe 95fe36122a Fix canonical imports
Signed-off-by: Max Smythe <smythe@google.com>

Kubernetes-commit: 003fbae25bf4c76b8b71d56206b51e1ee6e80812
2022-10-25 20:40:27 -07:00
Max Smythe 73e7490c2b Make interface for webhook predicates more specific
Signed-off-by: Max Smythe <smythe@google.com>

Kubernetes-commit: 00ebe0bf623295dc589e43e8c299003f9e939f65
2022-10-25 16:34:06 -07:00
Max Smythe 3dc8d71b8a Move webhook scoping rules into a predicates directory
Signed-off-by: Max Smythe <smythe@google.com>

Kubernetes-commit: b4ee0c0574932b99a9e877c84d880a5f00fdd3cc
2022-10-25 16:28:16 -07:00
Wojciech Tyczyński 499bbb88dc Refactor WatchError test to make it generic
Kubernetes-commit: b3f9272d57a71a9c50b38754b7309ddf68adb93f
2022-10-28 11:35:58 +02:00
Kermit Alexander II 9129598e13 Add metrics for validation admission control.
Kubernetes-commit: ac324cb30c938a6e8eb533feaba4bb4503416e26
2022-10-11 20:04:13 +00:00
Mike Spreitzer 413be63b46 Add instrumentation for seat borrowing
Kubernetes-commit: 9b684579e230f105bcaa743f06bc07c39af703df
2022-10-20 15:21:09 -04:00
Maciej Borsz 49647f7386 Add benchmark for caching object
Kubernetes-commit: e577a77eb8160a5f70668a5d538ab5a1498ba0db
2022-10-25 12:57:24 +00:00
Wojciech Tyczyński 3f5a3e0ae0 Refactor etcd3 list consistency test
Kubernetes-commit: cd5da36c92f3ed52debc22c39a7cd9d369b0eecd
2022-10-27 10:19:09 +02:00
Wojciech Tyczyński c527f6432a Minor cleanup of etcd3 tests
Kubernetes-commit: bbe1ebc82aa019118c91e8447517f91b9d036c1e
2022-10-27 09:48:06 +02:00
Wojciech Tyczyński f6802e074e Refactor storage tests using compaction
Kubernetes-commit: b02f172cbdf7e824d13a6a9c3a9b9fe4f3f92afb
2022-10-26 20:47:19 +02:00
Wojciech Tyczyński 834cf0fc14 Refactor compaction in etcd3 tests
Kubernetes-commit: 7da7ddd779f9ea835f0c57deae05e050c543066b
2022-10-26 16:34:28 +02:00
David Ashpole aa161f2fc0 migrate apiserver utiltrace usage to component-base/tracing
Kubernetes-commit: de26b9023f2872c5cd7e15fad5dd5ab649222c13
2022-10-20 18:15:38 +00:00
Tim Allclair 4b329cff47 Rename WithAuditID to WithAuditInit
Kubernetes-commit: ea28a21a6790d40c1fe540c64a296c8f0db17c65
2022-07-12 14:46:27 -07:00
Tim Allclair bd7c7f52c2 Consolidate AuditContext
Kubernetes-commit: f1d684b7b60b39b7dc1eb4156307c593f0ba74e1
2022-07-12 11:53:57 -07:00
Wojciech Tyczyński 3afe8ebf5f Minor cleanup of etcd3 tests
Kubernetes-commit: e04fe81dfcff189ef5162b9b26b55760f613a010
2022-10-26 13:05:49 +02:00
Wojciech Tyczyński 73a664638b Refactor pagination tests
Kubernetes-commit: 6c8ce894e18a2e2cae20edd2f6e79db9407ebce3
2022-10-26 12:18:21 +02:00
Wojciech Tyczyński dec6f492e8 Refactor GetReads
Kubernetes-commit: 8472e1bc13b0fa8aa3a67e5fcf2f13bfd7974cd3
2022-10-26 11:30:32 +02:00
Wojciech Tyczyński 5a8fdf8480 Move GuaranteedUpdateChecksData test to generic package
Kubernetes-commit: afc5ded83931cdb8a2643486d6834eb8d9b04588
2022-10-25 14:31:20 +02:00
Wojciech Tyczyński d9a3685d6f Minor cleanup of storage tests
Kubernetes-commit: 5344bc5e1b7e50d5ff359c714d522b421b28bd12
2022-10-25 14:09:36 +02:00
Wojciech Tyczyński 1960fa837f Move GuaranteedUpdate test to generic test package
Kubernetes-commit: 012676acc3dd2b235bd601e4105294d2715f155b
2022-10-25 14:04:00 +02:00
Han Kang e9f139f163 swap name for storage metric for underlying storage db
Change-Id: Ic7cd9bf5ef29d9c51a728ef37c94d77172fbf678

Kubernetes-commit: 3a2d1bab26bfb9e7d887207dec0c51645c7017fe
2022-10-24 15:27:05 -04:00
Shihang Zhang 7b63db277d track legacy service account tokens
Kubernetes-commit: 569cd70a52359a294a608fb256693445a89a9dab
2022-03-21 14:21:41 -07:00
Mike Spreitzer b6fd67c2a7 Introduce constants for the two parameters of seat borrowing
Kubernetes-commit: 8d826ee9f8e19f499f5c0a982bb256ae268a9010
2022-10-20 00:47:01 -04:00
Alexander Zielenski ee983a05da fix flaky admission tests
would fllake .04% of the time on my machine.

In tests waiting for objects to be reconciled, would erroneously treat the "Not Found" case as an error rather than waiting a bit.

also add some more context to test errors to improve debuggability

Kubernetes-commit: bfbc1f3479423b5c53231cfec58895746ef2de69
2022-10-21 09:47:18 -07:00
scott 779d3eda81 Fix DeleteCollection API decode DeleteOptions fail
The reason for the issue is that the apiserver uses the Scheme in the
global variable pkg/api/legacyscheme/scheme.go, and registers the
DeleteOptions corresponding to each APIGroup in the Scheme.  But
DeleteOptions in meta.k8s.io/v1 is not registered, resulting
in a notRegisteredErr.

Use metainternalversionscheme.Codecs as Serializer

Kubernetes-commit: e7d7f4a9e56fe5d9c10da437787118fe9ea9e5af
2022-10-18 16:47:50 +08:00
Tim Allclair 8a252ba686 More useful audit error logs
Kubernetes-commit: 8924d0e8b6d185eef8794f9144c321e2f4a0adae
2022-08-04 15:17:13 -07:00
Alexander Zielenski e25b9399a5 add cel admission controller tests
84% coverage

Kubernetes-commit: 8b74e73e3825e725d05376de717ad96506a52eec
2022-10-12 18:03:44 -07:00
Alexander Zielenski cd8f0b6cf7 add cel admission plugin and initializer
Kubernetes-commit: a41a536dbdb72877fa48f85272e479eb628e68f8
2022-10-12 10:21:31 -07:00
Alexander Zielenski b154760894 add generics tests
84.1% coverage

Kubernetes-commit: 74b103cd52da3b0149aa9e50a569a89bdd46e1db
2022-10-13 13:44:03 -07:00
Alexander Zielenski b1196b949c add cel admission controller
Kubernetes-commit: 2286501e227ead064e95880a6f28904526f887a6
2022-10-12 10:21:08 -07:00
Alexander Zielenski bf7388424e add OWNERS
Kubernetes-commit: c52fae186a60f0d480f26628c55656c76c7ccac0
2022-10-12 16:11:11 -07:00
Oscar Utbult 9d3d7b483a grammar: replace all occurrences of "the the" with "the"
Kubernetes-commit: e4f776f23098ecf942cafa898777195adbc800f1
2022-09-17 22:58:01 +02:00
lixiaobing1 c144979a82 replace WithInsecure() with WithTransportCredentials()
Kubernetes-commit: 7892175acdb329d44cf1f34230f78e608b3cb736
2022-10-15 16:41:53 +08:00
Mohammad Zuber Khan 6fe4f87105 add superuser fallback to authorizer (#111558)
* add superuser fallback to authorizer

* change the order of authorizers

* change the order of authorizers

* remove the duplicate superuser authorizer

* add integration test for superuser permissions

Kubernetes-commit: f86acbad68baf1a99d6fa153f6f0cdc7b93932e4
2022-10-19 04:02:04 +00:00
David Ashpole 73fdf7e37b Fix bug in which APIServerTracing did not work with some egress selectors
Kubernetes-commit: 00bcd6cf01b719d0fddc8331ffecd3de35e8896f
2022-10-11 16:22:33 +00:00
Monis Khan f4ac8fc8bb prefixTransformers: allocate after transformation length is known
Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: 59e1a32fc8ed35e328a3971d3a1d640ffc28ff55
2022-10-17 16:56:40 -04:00
Monis Khan be9579fc15 k8s.io/apiserver/pkg/storage/value: allow encryption-at-rest approval
Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: b68bc0678d5876e4c11c7d5289f777b6e37c4917
2022-10-17 17:07:56 -04:00
Davanum Srinivas 96eda3624c Bump log level for health check warning for missing components
Default api server manifest whose liveness check looks like:
"/livez?exclude=etcd&exclude=kms-provider-0&exclude=kms-provider-1"

Which causes spurious messages in apiserver logs every 10 mins:
```
W1017 00:03:39.938956       9 healthz.go:256] cannot exclude some health checks, no health checks are installed matching "kms-provider-0","kms-provider-1"
```

Let's not log excessive messages especially at warning level. We should
do this at a higher level (6 instead of 4).

NOTE: we don't change the message returned to the http request, we keep
that as-is (does not change on log level)

Also see:
https://github.com/aws/eks-distro/blob/v1-19-eks-12/projects/kubernetes/kubernetes/1-19/patches/0016-EKS-PATCH-apiserver-healthz-upper-log-verbosity-for-.patch

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 20de240d5bdb7fc50de3fe9b8cdd95f81bf47034
2022-10-17 09:42:09 -04:00
Han Kang 4ae2cd3dc6 actually resolve the computations for buckets for static analysis
Change-Id: Icafe84e165cc14087a2811f9a3e5d5e69ef3f178

Kubernetes-commit: a07718258aef5cd20a356b4657f1054b6baeb03b
2022-10-13 13:44:51 -07:00
Abu Kashem 538eaa3c92 apiserver: use SSA for apf configuration client
Kubernetes-commit: ecc640f1b40f14a894269e4b2ae6c80158626e93
2022-09-19 14:03:16 -04:00
Abu Kashem c4de3f516b apiserver: fix typo in graceful termination test
Kubernetes-commit: 0af2306a9a1c867fc374eb740b3be2b5a00675e7
2022-10-10 10:47:27 -04:00
Maciej Wyrzuc bfac2bc2b9 do not print status stack in case of timeout from timeout handler
Kubernetes-commit: 886648b820c10011350e7435a3105fd7d329c3c5
2022-09-10 10:13:11 +00:00
twilight0620 2180db0c8d code check modify:
receiver name obj should be consistent with previous receiver name s for SimpleStream
error var hookNotFinished should have name of the form errFoo

Kubernetes-commit: ae385ee874a81cd01ee4fef98efc1bd5c219c9b7
2022-04-21 16:47:22 +08:00
Paco Xu c23bbb6aae fsnotify: use event.Has instead of "event.Op&h == h"
Kubernetes-commit: 2ce7a8116902a47c0b859dff1f546e194d468064
2022-10-13 13:42:11 +08:00
Harsha Narayana 1da54ec21a kmsv2: enable logging for kmsv2 enc/dec operations
Kubernetes-commit: 79d741f1f8efcfc75cecd22898c7b6b689449f0a
2022-08-31 22:08:55 +05:30
Monis Khan 8d68e6f323 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>

Kubernetes-commit: f507bc255382b2e2095351053bc17e74f7100d35
2022-08-29 17:25:48 -04:00
Jiahui Feng ac0ce38abe use DefaultMaxRequestSizeBytes for maxRequestSizeBytes.
Kubernetes-commit: 755f41a185e828d9c64ae3ac37ce829e60592ad1
2022-10-10 14:42:24 -07:00
Jiahui Feng 870da5a58e move CEL package to apiserver package.
only anything that does not require Structural

Kubernetes-commit: 0dd316a5c11261c0e5fc7928d8697754b16ad461
2022-10-07 15:02:47 -07:00
Han Kang a26df69931 wire up feature-gate for component slis
Change-Id: Iba6ffbcac9dba4f4be3023ada6ac31691c1ae17b

Kubernetes-commit: 01bfbdff2dee3be93d286a8ff53f9e52a1ee9724
2022-10-05 15:56:06 -07:00
Manish Kumar a433b219b9 Move celopenapi/model to staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/ (#109959)
Co-authored-by: Manish Kumar <manish.kumar1@india.nec.com>

Kubernetes-commit: 39ffd45175876fe7c846c6239d89613d31a28fa1
2022-10-07 05:43:52 +05:30
Cici Huang 025851852a Update feature gate name to CELValidatingAdmission
Kubernetes-commit: d8ab3fea0d5f91e273fcb3b49cffb71d1b70f7e3
2022-10-05 19:40:50 +00:00
Cici Huang d089253bb2 Add feature gate CelValidatingAdmissionExtensibility
Kubernetes-commit: 9dff2311eacbcde1390ad67233cf0a48f0020eea
2022-09-29 18:45:14 +00:00
Abu Kashem 4ecff81419 rename assuredConcurrencyShares for flowcontrol v1beta3
Kubernetes-commit: 66fc0d703794f309c9715028d3b63f64c281a5fd
2022-09-21 15:40:33 -04:00
Abu Kashem 98ffe5507d apiserver: update apf logic to use v1beta3
Kubernetes-commit: 0a99e6ebb1e241bf421f6df44b15a5a16063a9f2
2022-09-10 07:26:31 -04:00
Abu Kashem e888dae968 apiserver: update apf tests to use v1beta3
Kubernetes-commit: 6edc2516863994905b57f4386450f3e8f818bbc9
2022-09-10 07:05:20 -04:00
Abirdcfly 487ade9f5d go1.19: change some atomic.Value to atomic.Bool
Signed-off-by: Abirdcfly <fp544037857@gmail.com>

Kubernetes-commit: 1d631f7eef4db32afe23460843c4084ed3a3f6bd
2022-09-06 17:13:44 +08:00
SataQiu 2c587cfaab kube-apiserver: mark unused master-service-namespace flag as deprecated
Kubernetes-commit: 3cd3ab5f943a5b0e1bc0dc53c90ed9cf0aa811ad
2022-09-30 16:13:13 +08:00
Monis Khan 25ccbfa75c Use https links for k8s KEPs, issues, PRs, etc
Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: b738be9b46a899571303c8c887e32bf4d5b71a0a
2022-09-23 16:13:22 -04:00
Alex Zielenski c4a7c1b469 Allow timestamp transformer equalities to be configurable (#112158)
* allow noop-ignoring transformer to be configurable

* consolidate timestamp equalities initialization

* remove extra plumbing

* fix typo

* remove CustomEqualities list

Kubernetes-commit: a9a1cdbd1531df06e27029686669a8fea99d44e8
2022-09-28 10:56:34 -04:00
Han Kang 7ede3563fe enable health check SLI metrics for apiserver
Change-Id: I1b43e6dfea35b8c3bfdf5daaa8b42adff2fbc786

Kubernetes-commit: db13f51db97c114bb550b99efddd985548edc082
2022-09-26 16:10:58 -07:00
Anish Ramasekar 1411f0e151 kmsv2: validate annotations key and size
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: d1fb258ff2d009f202cff3fdd25e6fd2bbda08ef
2022-09-14 21:58:17 +00:00
qmloong a32e26b98a fix: remove redundant error log print
Kubernetes-commit: 45ed5ba9939c581d0633772ea3177780fae95db0
2022-09-26 14:52:25 +08:00
Wojciech Tyczyński baa5a012e9 Lock ServerSideApply feature to true
Kubernetes-commit: 57c95fbfa12bc04456330d8b0b29f333106cf156
2022-09-27 11:13:00 +02:00
Monis Khan c602291fa1 encryption config: no-op refactor to prepare for single loading
Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: db850931a8699e780dd794e1763fd0e54b4239b5
2022-08-29 17:25:48 -04:00
Anish Ramasekar c027ae3881 Add staging directory for kms
- Moves kms proto apis to the staging repo
- Updates generate and verify kms proto scripts to check staging repo

Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: c3794e2377016b1c18b1dcb63dc61d686c8ebcbf
2022-08-23 20:22:09 +00:00
Anish Ramasekar ec520ccd91 [KMS]: update envelope caching unit tests
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: 92dce5de71f752c8c136ec7c7417a73d50317cf5
2022-09-15 18:01:48 +00:00
Davanum Srinivas ae4a45db07 update to v1.12.0 of semconv
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 01d8a4f0c56131de2ee8b4ba5ffd384de4b38578
2022-09-18 19:33:02 -04:00
Davanum Srinivas 6c2030e10c update code to use newer otel api
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 3eaca7cf519808fcb98d4c43e666ea750270d825
2022-09-17 14:27:06 -04:00
SataQiu d9a11fffae remove DeprecatedInsecureServingOptionsWithLoopback
Kubernetes-commit: d545de2b96de094107c3b687d8d48663af8f9fae
2022-09-11 21:22:18 +08:00
Marcel Zięba 395682d7b7 Fix list estimator for lists that are executed as gets
Kubernetes-commit: 09f1ce9ec821c14013c775ba106e4888cb29c2c3
2022-09-19 07:42:45 +00:00
viveksahu26 6cb2fda0ab fix warnings or linter errors
Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

Kubernetes-commit: 386bc4a7fa3e975cb247d300fdc5ad1b14a15605
2022-09-05 19:10:43 +05:30
Antonio Ojea 1239036585 rate limit /healthz etcd healthchecks
return the last request error, instead of last error received
The rate limit allows 1 event per healthcheck timeout / 2

Kubernetes-commit: 510a85c53a5138babb1650fadd328e6f34baa03b
2022-08-29 11:09:58 +02:00
Antonio Ojea d2581bb0e0 fix etcd unit tests
stop leaking goroutines

reduce etcd test duration

Kubernetes-commit: dd6d3d95cdeb0e165e8365212d85d0f3b972d3e8
2022-08-28 23:13:45 +02:00
Antonio Ojea fb26cb4f0c don't serialize etcd healthchecks
Kubernetes-commit: 5a67248115ec0bc762c0351a73810117ac0bb814
2022-08-29 17:57:01 +02:00
Monis Khan 70b4742ce2 kms: fix go routine leak in gRPC connection
Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: 4e68e9b5ad70ae074b3fb20f0fb2ba25d0792274
2022-08-24 01:51:19 +00:00
Shyam Jeedigunta f7e0cdae19 Reduce default gzip compression level from 4 to 1 in apiserver
Kubernetes-commit: 7cd5e6597e7137aa3b37a7c7ade2bf831cb7aca9
2022-09-07 13:23:53 -07:00
HaoJie Liu e1af448867 test: use bytes.Buffer.String
Signed-off-by: HaoJie Liu <liuhaojie@beyondcent.com>

Kubernetes-commit: f55d658c1c8b4c59dcb33bd07285e62344ef0186
2022-08-29 15:45:20 +08:00
Mike Spreitzer 3419387b18 Call queueSet::boundNextDispatchLocked enough
Fix the one path where boundNextDispatchLocked was not being called
after modifying a queue.

Also check for negative work in a request.

These are motivated by
https://github.com/kubernetes/kubernetes/issues/112169 but I do not
have a way to reproduce it and so can not check that these changes
actually remove that symptom.  But these changes are good anyway.

Kubernetes-commit: 6ee93e2cee695203a6ce4935da1b9a807b624260
2022-09-01 22:54:53 -04:00
xueqzhan 9d6934f8fa Add DisableAnonymous to DelegatingAuthenticationOptions
Kubernetes-commit: 5619c71eb0b9fae13c831d92797da9427094518f
2022-09-01 11:58:51 -04:00
Alex Zielenski d46c86b62b Update kube_features.go
Kubernetes-commit: 9dab9f3e28652b823d0589d127f84ba901ae4c65
2022-08-30 09:06:29 -07:00
Alex Zielenski 4c7c0de421 update comments
Kubernetes-commit: 92fac4ab8af1e90fc21163ef474c9094573b4ebd
2022-08-30 09:04:06 -07:00
Alexander Zielenski b0ba338767 add aggregated discovery feature gate
Kubernetes-commit: 7b54c492d9586a8c979686795283324b272ad0c6
2022-08-29 16:21:23 -07:00
Antonio Ojea 852f0a02d4 Initialize Name (GenerateName) earlier in the Create process
Kubernetes-commit: af9d36f9310bc3c21791bf17470a667b690573b0
2022-08-26 13:20:43 +02:00
Antonio Ojea 89fb3670f4 test rest error generate name conflict
Kubernetes-commit: 20d190ec2ae90bc521e7342821a3a4301fe573af
2022-08-26 13:20:06 +02:00
Han Kang ce7b4d6e8c Add request body size metric
Change-Id: Ica5d9b5457d4f844c4500b2c05b2f0631c27454c

Kubernetes-commit: 43c95cbf0682895cf5bb79452b1f011123ac4513
2022-08-24 09:15:23 -07:00
Han Kang 270d177e30 add metric and test
Change-Id: Ic2bcf39caef791b2e13448a97d2c3203ed1d94b9

Kubernetes-commit: 07020ab42e8f1a2e9d6fe4969c01d0f971324ae1
2022-08-24 08:54:51 -07:00
Antonio Ojea ea69e5d51c remove DryRun feature gate checks
Kubernetes-commit: a1bfb76458a219577884d312ceb93eb1bb3f7e39
2022-08-26 11:33:56 +02:00
Andy Goldstein 8587d29223 etcd3: include GroupResource in logs/metrics
Use GroupResource instead of object reflection when recording the
following metrics:

- etcd_request_duration_seconds
- etcd_bookmark_counts

Add GroupResource to logs and traces where only reflection-based typing
was previously used.

Both of these changes allow us to disginguish between different CRDs,
all of which are represented as *unstructured.Unstructured.

Signed-off-by: Andy Goldstein <andy.goldstein@redhat.com>

Kubernetes-commit: 305fa2add60ad507417304d865f001006d5175fe
2022-08-25 13:55:55 -04:00
Andy Goldstein 7eb011f596 watch cache: metrics: objectType -> group resource
Use the group resource instead of objectType in watch cache metrics,
because all CustomResources are grouped together as
*unstructured.Unstructured, instead of 1 entry per type.

Signed-off-by: Andy Goldstein <andy.goldstein@redhat.com>

Kubernetes-commit: d08b69e8d35a5aa73a178c508f9b0e1ad74b882d
2022-08-11 15:51:21 -04:00
Andy Goldstein ecf3a57374 watch cache: log GroupResource, not objectType
All CustomResources are treated as *unstructured.Unstructured, leading
the watch cache to log anything related to CRs as Unstructured. This
change uses the schema.GroupResource instead of object type for all type
related log messages in the watch cache, resulting in distinct output
for each CR type.

Signed-off-by: Andy Goldstein <andy.goldstein@redhat.com>

Kubernetes-commit: 397533a4c2df9639ff4422c907d06fae195a1835
2022-08-11 15:45:04 -04:00
cndoit18 902be89708 style: remove redundant judgment
Signed-off-by: cndoit18 <cndoit18@outlook.com>

Kubernetes-commit: ec43037d0f57fdfc2fdc4960fdb8a7e31ac79fae
2022-07-29 18:25:05 +08:00
Jordan Liggitt 9397c6d674 Enforce strict handling in alpha
Kubernetes-commit: 065cca38e937bcd517504a21472e72987e0f95a7
2022-08-23 09:07:46 -04:00
Anish Ramasekar bdd7082eed chore(kms): remove unused plugin name and migrate from deprecated `io/ioutil` pkg
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: 7db7a63959162d743f771183bf4e88e82afef868
2022-08-23 22:55:22 +00:00
leilei.wan.cn 9f91290828 not reset when exempt pl panic
Kubernetes-commit: aef47c3c3b2e5a66b38f073ac05825f831eeb3fd
2022-08-18 19:13:47 +08:00
wanlei bb7342b40b fix(apf): not reset apf when panic
Kubernetes-commit: 22b0be9842640eabac961132a42239a9f22cdf71
2022-08-15 10:38:50 +08:00
Han Kang d5fac85195 clean-up apiserver metrics and use subsystem
this is specifically so that we have more structured information when
the metric is parsed and stored as a stable metric. This change does not
change the name of the actual metrics.

Change-Id: I861482401ad9a0ae12306b93abf91d6f76d7a407

Kubernetes-commit: 178e57c17b66eb572a961690bd10782aeb3c3582
2022-07-29 12:51:29 -07:00
David Eads 6a7c6a0940 Revert "Add an option to conditionally disable compression based on client ip."
This reverts commit 023583a15586328569ccab505db2f57f398e04b3.

Kubernetes-commit: 2f3ffbed2cffaaba63304318bc1d09b0144600ff
2022-08-17 15:08:39 -04:00
David Eads c6b4b28cf9 Revert "enforce strict alpha handling for API serving"
This reverts commit 233e0cb8c3a723f57d578be2179284e4eb9d017d.

Kubernetes-commit: 696e41a69859f196ac02d3ceb270a3979fc2861f
2022-08-10 09:42:37 -04:00
Anish Ramasekar 225e26ac4a Implement KMS v2alpha1
- add feature gate
- add encrypted object and run generated_files
- generate protobuf for encrypted object and add unit tests
- move parse endpoint to util and refactor
- refactor interface and remove unused interceptor
- add protobuf generate to update-generated-kms.sh
- add integration tests
- add defaulting for apiVersion in kmsConfiguration
- handle v1/v2 and default in encryption config parsing
- move metrics to own pkg and reuse for v2
- use Marshal and Unmarshal instead of serializer
- add context for all service methods
- check version and keyid for healthz

Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: f19f3f409938ff9ac8a61966e47fbe9c6075ec90
2022-06-29 20:51:35 +00:00
Sally O'Malley 4f9e133507 kubelet tracing
Signed-off-by: Sally O'Malley <somalley@redhat.com>
Co-authored-by: David Ashpole <dashpole@google.com>

Kubernetes-commit: 47e7d8034ff3be8e198dde6a671d05a11c30e333
2021-10-10 09:17:27 -04:00
Maciej Borsz 40280f9889 Add an option to conditionally disable compression based on client ip.
Kubernetes-commit: 023583a15586328569ccab505db2f57f398e04b3
2022-07-29 08:44:14 +00:00
Anish Ramasekar 8ab3aa3011 feat:(kms) encrypt data with DEK using AES-GCM instead of AES-CBC
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: d54631a41a869f7a28d82fcab2e174ee85879027
2022-07-13 17:14:50 +00:00
Nic Cope 9b243e9d90 Copy etcd client debug level logic from upstream
Replicated from https://github.com/etcd-io/etcd/blob/v3.5.4/client/v3/logger.go#L47

The logic of this function doesn't make a lot of sense to me, but
copying it will avoid any behaviour change.

Signed-off-by: Nic Cope <nicc@rk0n.org>

Kubernetes-commit: c1aa7a0fe73cbcab8e70f7b73a845ae9394f9a71
2022-07-29 14:26:31 -07:00
Nic Cope a105c2570c Give etcd client logger a name
Logic copied from https://github.com/etcd-io/etcd/blob/v3.5.4/client/v3/client.go#L374

Signed-off-by: Nic Cope <nicc@rk0n.org>

Kubernetes-commit: f54d2606336e2e8130339d2a0bc04fac6906aa78
2022-07-29 14:24:17 -07:00
Nic Cope 463756f91d Share a single etcd3 client logger across all clients
Currently the API server creates one etcd client per CRD. If clients
aren't provided a logger they'll each create their own. These loggers
can account for ~20% of API server memory consumption on a cluster with
hundreds of CRDs.

Signed-off-by: Nic Cope <nicc@rk0n.org>

Kubernetes-commit: 0c81eabb853e581abbcb37ebf094af3316e1012e
2022-07-28 19:51:55 -07:00
Nic Cope ef17269e10 Disable the etcd3 client logger
This logger is responsible for 20% of the API server's memory usage when
many CRDs are installed. See the below issue for more context.

https://github.com/kubernetes/kubernetes/issues/111476

Signed-off-by: Nic Cope <nicc@rk0n.org>

Kubernetes-commit: 0e5401c93940126beac45264aa056507b0950075
2022-07-27 14:44:49 -07:00
Cici Huang 45072c5fc4 Promote feature CustomResourceValidationExpressions to beta
Kubernetes-commit: e0fb5714acf0b72bcc95fa59d62913ede51151c6
2022-07-14 18:32:51 +00:00
Wojciech Tyczyński 6ab5ae374a Fix draining cacher tests
Kubernetes-commit: a530a6898a36d43eef766f041eab4e4b6d5adedb
2022-07-28 10:20:23 +02:00
Lukasz Szaszkiewicz 684cf11215 cacher: add support for consistent streaming
design details https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/3157-watch-list#design-details

Kubernetes-commit: debace151cfffc1b5d805341efcbf5f0062e95ed
2022-07-05 15:48:30 +02:00
Marcel Zięba 3c024b4916 Add option to retry internal api error in reflector.
Kubernetes-commit: 0b2b6489de8f75d5299f54180617601126bb8878
2022-07-25 08:02:54 +00:00
jupblb 16f776a534 Switch initial/final seats type to uint64
Kubernetes-commit: 3c46482eb09d7343e0f98a930a9aaa158237e278
2022-07-28 10:48:40 +02:00
Abirdcfly 3fde82e2dd clean Unreachable code
Signed-off-by: Abirdcfly <fp544037857@gmail.com>

Kubernetes-commit: f71718d6448418d0289b9649905a16bfb1962b68
2022-07-19 00:58:17 +08:00
Maciej Wyrzuc cb0bb2af35 Add additional etcd check to readyz with 2 seconds timeout.
Kubernetes-commit: b42045a64fd07fb948660839b6c7c14440bee9df
2022-07-25 13:08:50 +00:00
Davanum Srinivas 7e94033a61 Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: a9593d634c6a053848413e600dadbf974627515f
2022-07-19 20:54:13 -04:00
Davanum Srinivas a13e0b29d5 fix patch_test for gofmt issue
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: ea7dff551f648d8a46087f59e40767216d00f60e
2022-07-26 10:12:54 -04:00
Mikko Ylinen 12a8b7fef3 grpc: move to use grpc.WithTransportCredentials()
v1.43.0 marked grpc.WithInsecure() deprecated so this commit moves to use
what is the recommended replacement:

grpc.WithTransportCredentials(insecure.NewCredentials())

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>

Kubernetes-commit: 2c8bfad9106039aa15233b5bf7282b25a7b7e0a0
2022-05-11 12:13:28 +03:00
Alexander Zielenski 43763b31c6 use more apt name for flag
Kubernetes-commit: c2cbc460f2c5be07b0f5762005642625b06b6a75
2022-07-20 10:45:21 -07:00
Alexander Zielenski feb8f08b78 guard usage of timestamp transformer under fieldManager non nil
not strictly necessary for correctness, but it is not needed unless SSA is enabled

Kubernetes-commit: 48786d90da794bd1a0ef588f6393a0dddffcc400
2022-07-20 08:58:28 -07:00
Alexander Zielenski c2e73305f9 add envar to disable non semantic updates feature
enabled by default. can easily be changed in backports

Kubernetes-commit: 076051135d16b70c08d8d6382e73ef983614240f
2022-07-14 11:28:10 -07:00
Alexander Zielenski 48eb70e1d1 benchmark and metrics for new timestamp transformer comparison
add proper metrics

rename & improve documentation for path metric dimension

Kubernetes-commit: 40343793f7b9787b2d4b88f0a0439ce9e538075a
2022-03-01 14:24:12 -08:00
Alexander Zielenski 81749c6ee9 revert timestamp updates to object if non-managed fields do not change
add short-circuiting logic for long comaprison

replace timestamps rather than doing a full managed fields deepcopy

add guard

Kubernetes-commit: 7233538008489c189d09bb042fbabca97d9cdbaf
2022-07-14 11:40:20 -07:00
Mike Spreitzer eb15930b31 Fix APF metric denominator problems
Co-authored-by: JUN YANG <yang.jun22@zte.com.cn>

Kubernetes-commit: fdd921cad0cd9308ec62c1b86c9c1cc5d12e5d21
2022-05-22 23:39:49 -04:00
Wojciech Tyczyński 8f7c120935 Eliminate MaintainObservations function in P&F
Kubernetes-commit: badf436ac4451590e5e84e537f2234e3632ea3b4
2021-11-25 12:44:50 +01:00
twilight0620 9c84b3466c add test case for ToValidOperationID method: TestToValidOperationID
Kubernetes-commit: 2ca7c8d82b4844afbcd8b6859166cf7f6c23d7b9
2022-04-27 11:48:44 +08:00
HaoJie Liu 4c5e4623d3 cleanup: use append other than for loop
Signed-off-by: HaoJie Liu <liuhaojie@beyondcent.com>

Kubernetes-commit: 29b5cd04bd2c7e2676687d3b613c9b065b128e54
2022-07-21 15:29:30 +08:00
Mike Spreitzer 7aa625fb37 Make timeout test properly liberal
Make the test accept all the legitimate outcomes.

Expand the explanation of how TestPriorityAndFairnessWithPanicRecoveryAndTimeoutFilter/priority_level_concurrency_is_set_to_1,_queue_length_is_1,_first_request_should_time_out_and_second_(enqueued)_request_should_time_out_as_well is supposed to work.

Expand debug information that is available when the test fails.

Kubernetes-commit: 1f450695ffd5b2d028c87328b8b32630a8052129
2022-07-14 19:45:15 -04:00
Wojciech Tyczyński 2049cfbb9e Adjust watch channel sizes in watchcache
Kubernetes-commit: 0db5c05bdb8bbc510307a48cbade712583bb009e
2022-04-28 11:56:41 +02:00
jupblb 738a050cda Introduce config for API Priority and Fairness
Linked all the default values with a single config structure.

Kubernetes-commit: 1c594e7e01a899807431c806cd11c1d27c885c9c
2022-07-20 11:33:45 +02:00
Lukasz Szaszkiewicz 27a7c443bd cacher: with expiredBookmarkWatchers
expiredBookmarkWatchers allows us to schedule the next bookmark event after dispatching not before as it was previously.
It opens a new functionality in which a watcher might decide to change when the next bookmark should be delivered based on some internal state.

Kubernetes-commit: 0576f6a011cba8f0c8550fd3dd31111376c9dcd0
2022-07-15 15:28:50 +02:00
Kevin Delgado 0897fdf521 Enable ServerSideFieldValidation feature gate on by default in beta
Kubernetes-commit: 36dbecd438beefd3f7e3b9cb990c5a34c033e2c7
2022-03-24 23:56:48 +00:00
Artur Żyliński e34c622d49 Add audit-id to storage traces
Refactor GetAuditIDTruncated to use context instead of request

Kubernetes-commit: b1e12b01b6c578da3eb593805b48e9d4a69efe54
2022-06-20 17:09:32 +02:00
Abirdcfly dde070e1ff cleanup: remove duplicate import
Signed-off-by: Abirdcfly <fp544037857@gmail.com>

Kubernetes-commit: 00b9ead02c37921011ebe5293558cea5277cd295
2022-04-24 20:58:04 +08:00
Tim Allclair 9c0ce32da0 Delete dead audit code
Kubernetes-commit: e7f0fd7cf705f2745b6e10e5846c776a9095445d
2022-07-13 17:22:26 -07:00
Vladimir Nachev 5236515712 Ensure the dir of --audit-log-path exists
Signed-off-by: Vladimir Nachev <vladimir.nachev@sap.com>

Kubernetes-commit: a380ef5c416194826b70ae75dc4e86776e1a3afe
2022-06-27 17:21:02 +03:00
zk ad01c712d9 Update etcdRequestLatency metrics bucket size
Kubernetes-commit: fb372d07982463984dfdab7cf24d937b91b0bb83
2022-01-09 23:45:09 +08:00
Madhav Jivrajani 218ed2fae0 cacher: Use PodList type for use in GetList
Using a Pod type in a GetList() call in a test
can panic at worst and error out at best. Here,
neither happened because the error condition
being tested for (cacher being stopped or not)
gets returned before the list pointer can be
enforced.

This commit changes the above to use PodList.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: 487761f4e2543114db158f0d59e598dedc481882
2022-07-15 12:22:04 +05:30
Artur Żyliński 87b03dd4f5 Always log APF InitialSeats and FinalSeats values
Add apf_additionalLatency field, to have all WorkEstimate data

Kubernetes-commit: 962eb52be433bd1302210645d8cdbb0a6f6b8b24
2022-07-13 10:38:11 +02:00
Mike Spreitzer 959fbf9f84 Use timing ratio histograms instead of sample-and-watermark histograms
Kubernetes-commit: 0c0b7ca49f9ade72b990bf3a6f568485586af8b4
2022-05-18 02:56:48 -04:00
Mike Spreitzer 32237d0a84 Add timing ratio histograms
Following is the result of benchmarking the two kinds of histograms on
my laptop.

% go test  -benchmem -run=^$ -bench Histogram .
goos: darwin
goarch: amd64
pkg: k8s.io/apiserver/pkg/util/flowcontrol/metrics
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkSampleAndWaterMarkHistogramsVecEltSafeEarly-16    	  980143	      1230 ns/op	       0 B/op	       0 allocs/op
BenchmarkSampleAndWaterMarkHistogramsVecEltSafeLate-16     	  932380	      1216 ns/op	       0 B/op	       0 allocs/op
BenchmarkTimingRatioHistogram-16                           	12665247	        94.13 ns/op	       0 B/op	       0 allocs/op
BenchmarkTimingRatioHistogramVecElementSimple-16           	11015806	       100.4 ns/op	       0 B/op	       0 allocs/op
BenchmarkTimingRatioHistogramVecElementSafeEarly-16        	 7142589	       172.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkTimingRatioHistogramVecElementSafeLate-16         	11487517	        96.67 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	k8s.io/apiserver/pkg/util/flowcontrol/metrics	7.718s

Kubernetes-commit: 8039f9d600c08450a81b60494b392a6aada0c14b
2022-05-18 02:30:06 -04:00
21kyu a31219e583 Change reflect.Ptr to reflect.Pointer
Kubernetes-commit: df168d5b5c2dab7414fc00ead1a51257ec326a98
2022-06-26 01:23:43 +09:00
Anish Ramasekar c6c1465ed7 Add KMS v2alpha1 API
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: 907545445ab8b4e34c1068ab9828a930c30cbfc4
2022-05-24 23:43:09 +00:00
Ikko Ashimine f0eede2023 fix typo in genericapiserver.go
runnning -> running

Kubernetes-commit: a3f66a45977f95274ede281a6994350352b5fd36
2022-03-20 23:29:01 +09:00
Abirdcfly 6be1a93b55 fix: --chunk-size with selector returns missing result
Signed-off-by: Abirdcfly <fp544037857@gmail.com>

Kubernetes-commit: fba297629d82866078faa6dc076cb5f81633e557
2022-06-20 00:54:57 +08:00
Tim Hockin 970b3ee9bb Initialize UID earlier in the Create process
Before:
  Create()
      BeginCreate()
      BeforeCreate()
          init UID <---------------------
          strategy code

After:
  Create()
      init UID <-------------------------
      BeginCreate()
      BeforeCreate()
          strategy code

This also wipes UID early (suggested by David) and asserts it is set in
BeforeCreate().

Kubernetes-commit: 5615de51f9e768dd01d7fe49a48e8db756bd8ac8
2022-06-17 15:32:25 -07:00
ialidzhikov 057c272d7b Fix a typo
Signed-off-by: ialidzhikov <i.alidjikov@gmail.com>

Kubernetes-commit: b2fc44f3f064f56fd9d772f8ecc192614ed79c69
2022-05-18 13:18:47 +03:00
Mike Spreitzer c86ffebc09 Make sure metrics are registered in tests
Also, include metrics registration in server construction --- for
convenience.

Kubernetes-commit: 5ecf5f4ad30bbaac74a4fc87e8af06009ceb8dc0
2022-06-11 01:26:38 -04:00
scott 91c6c18439 Fix issue that Audit Server could not correctly encode DeleteOption
Kubernetes-commit: 286a67d78c5be2b9ee39ed9fe26aa5a232058832
2022-05-18 20:23:16 +08:00
Mike Spreitzer 0796534fe5 Remove the PairVec types
Kubernetes-commit: 1f1cfba2a3fb35a8542bbf64a46746214355674c
2022-06-11 00:57:19 -04:00
Davanum Srinivas 30571358f5 Switch to v3 of github.com/emicklei/go-restful
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: ab690750df1d27409d31fd270d77b4390bac4431
2022-06-02 10:03:29 -04:00
Han Kang a414002089 cleanup deprecated metrics and usages
Kubernetes-commit: f223b900907b71431d7b6ceefa1642bb44fd9d84
2022-06-01 11:55:14 -07:00
Han Kang de98becc1d add explicit typing for continue tests
Our tests are mostly error based and explicit error typing allows
us to test against error types directly. Having made this change also
makes it obvious that our test coverage was lacking in two branches,
specifically, we were previously not testing empty start keys nor were
we testing for invalid start RVs.

Kubernetes-commit: 213e380a2e48830db6c71d2da5485d4226d95625
2022-05-31 10:23:07 -07:00
Davanum Srinivas 8a97d520ab Move from k8s.gcr.io to registry.k8s.io
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 50bea1dad89930ad565526910aadc314b9e9f38b
2022-05-10 08:30:09 -04:00
Han Kang 5e26f39c93 remove deprecated metric and promote the replacement to STABLE
Kubernetes-commit: 731397086b763b9a951a414d37018f7e4f03b99c
2022-05-31 09:05:31 -07:00
scott 8becd60e02 fix audit union loop variables in closures
Kubernetes-commit: 85b027e6fa90dafac5d68d3ba41fd0dc4c53cbf1
2022-05-20 17:38:26 +08:00
Wojciech Tyczyński 2428ade32a Fix leaking goroutines in QuotaEvaluator
Kubernetes-commit: 9d974e6e89285e3e0cb7ff928407a3350b224084
2022-05-26 21:10:10 +02:00
Antonio Ojea 1024248666 remove SelectorIndex field
Kubernetes-commit: 209fb99f28ae1b5b7f2aaa98d0d1835dc3f9b6f2
2022-05-26 17:27:45 +02:00
Mike Spreitzer 0f5737dda8 Remove unhelpful pairing of members of read_vs_write_request_count_samples
Members are not used in (waiting,executing) pairs, so stopped
using the wrapper that adds such pairing.

Kubernetes-commit: cd33c7cf2260b351dd345497223a944e80bc7b61
2022-05-22 22:39:06 -04:00
Abu Kashem 658eeac034 fix preshutdown hook behavor with graceful termination
Kubernetes-commit: 9644edc321e3b7e5180eb7c15a27bf28e19485db
2022-05-12 19:58:33 -04:00
Mikhail Mazurskiy 17134151a6 Always dial using a context
Kubernetes-commit: 2d62c57533f96985b7847dd63f91471167bd6006
2022-05-18 10:39:35 +10:00
Mike Spreitzer 10da00a048 Rename observer.go to interface.go
Kubernetes-commit: a4c18fa7fc3e370a8cfbbafc66bbdf4d1d834713
2022-05-23 16:11:05 -04:00
Mike Spreitzer cae328fb1c Give apf metrics abstractions more familiar names
The logic is similar to Prometheus gauges and vectors,
adopt that terminology.

Kubernetes-commit: 7d64a93a1407f91b5e13bf540a0fa834a41622eb
2022-05-17 23:27:47 -04:00
Guillaume Le Biller e6f50ae491 Update managedFields time when value is modified
Kubernetes-commit: f681821fcf028e0e8082be6a9daf0a8ff9392a66
2022-05-15 17:30:36 +02:00
Wojciech Tyczyński 5ab2c69c4c Fix ResourceQuota admission shutdown
Kubernetes-commit: f8211d7e447cc6c29139ebf3422f0752278d6da1
2022-05-18 19:30:23 +02:00
Abu Kashem eb2b1d986c apiserver: refactor graceful termination test
Kubernetes-commit: f28710bc465189b56c085876caf5aaa1ad037654
2022-05-18 22:58:36 -04:00
Wojciech Tyczyński 2f9a2acafb Fix stop signal to drained signal in genericapiserver config
Kubernetes-commit: b56491e6cfe216adc245abfa099757e779403982
2022-05-18 18:55:45 +02:00
David Eads 25c5c2ccf3 Handle panic during validating admission webhook admission
Validating admission webhook evaluation can fail, if uncaught this
crashes a kube-apiserver.  Add handling to catch panic while preserving
the behavior of "must not fail".

Kubernetes-commit: d412bf92b3b02bda93707c6aaba945f28bf60c72
2022-03-16 13:47:32 -04:00
Abu Kashem 2000c163ec apiserver: add lifecycle signal for preshutdown hook
Kubernetes-commit: b1f7b60515798934b011d27bfeba1cee4fcd26b7
2022-05-17 12:00:04 -04:00
Mike Spreitzer 8628966894 Fix more initial numerators
Kubernetes-commit: ba690c2257af76bd971d0dfb6bef13ff9099e549
2022-05-18 00:22:30 -04:00
Abu Kashem 771df84108 apiserver: refactor - move AuditBackend.Run out of NonBlockingRun
Kubernetes-commit: 6b8398318c005753383700f27bd398f4724b37a9
2022-05-17 11:14:11 -04:00
Wojciech Tyczyński 751a040f24 Cleanup CRD storage on shutdown
Kubernetes-commit: 01cf641ffbb3c876c4fc6c3e53a0613356f883e5
2022-05-15 22:25:43 +02:00
Wojciech Tyczyński 30c4077e0e Diagram for graceful shutdown
Kubernetes-commit: 1145582de367b9aa4072e631845ce3abc37b8540
2022-05-12 17:22:36 +02:00
Steve Kuznetsov 03363cd42b storage: move some list tests to generic package
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Kubernetes-commit: 162450c01c9004ded53bb77f651f9a3f30920b30
2022-05-12 15:16:07 -07:00
Steve Kuznetsov 289ed89252 storage/etcd3: make some list tests generic
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Kubernetes-commit: a8067f8e865475cbdb11d812c915927714690676
2022-05-12 15:13:23 -07:00
Steve Kuznetsov ae4cc8bfc8 storage/etcd3: factor out non-paginated list tests
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Kubernetes-commit: 8fcf00ef9171cfb623525d2a6aea1d721c3b5e74
2022-05-11 07:18:05 -07:00
Steve Kuznetsov 139068ca91 storage/etcd3: factor store setup into a separate function
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Kubernetes-commit: 31d7a28c65c34f2e2a28cfc41c2c517d370e7045
2022-05-11 07:17:26 -07:00
Wojciech Tyczyński f5d65d90e9 Avoid leaking StorageObjectCountTracker goroutine
Kubernetes-commit: 564b376812836fb1e77452d478ab16eee5101447
2022-05-15 09:57:26 +02:00
Steve Kuznetsov b2d4efbca3 apiserver/storage: add myself to the reviewers list
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Kubernetes-commit: 0d616946c036d5ead9dd03e312c6ac16f9a91c3e
2022-05-12 15:40:33 -07:00
Steve Kuznetsov 6bff431f4a storage: move test utiltiies out of test files
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Kubernetes-commit: e50cb6c8d36ca73c99c935126978cbec01f9be01
2022-05-12 11:52:28 -07:00
Steve Kuznetsov 67344c728d storage: move continue token definition to storage
The means by which we encode and decode the continue token during a
paginated LIST call is not specific to etcd3. In order to allow for a
generic suite of tests against any storage.Interface implementation, we
need this logic to live outside of the etcd3 package, or import cycles
will exist.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Kubernetes-commit: eb3aa5be10393968d8083c79f5958501fc029e8d
2022-05-11 07:52:02 -07:00
Artur Żyliński 62aa70cd37 Fix requests scope classification
create (POST) custom resources should be scope:resource

Kubernetes-commit: 690c912369a6ca7f35363a307a843e91cadd7f6e
2022-05-12 14:27:51 +02:00