Commit Graph

2950 Commits

Author SHA1 Message Date
Abu Kashem 41067f8ef1 apiserver: fix APF tests, use T functions on the test goroutine
Kubernetes-commit: 62742db16b16449678c888490bfc141047a6939d
2023-02-10 09:49:27 -05:00
Rita Zhang 8ef5a288d6 kmsv2: add metrics for invalid_key_id_from_status_total
Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>

Kubernetes-commit: 5292542b72df0665fb73bb0060fe73553dbf9b05
2023-02-16 11:56:31 -08:00
A. Lombarte 1f02ef5b4e getHost and getHostname have documentation swapped for IPv6
Kubernetes-commit: cb4637b378d464dc8622e637d0a72a29b756336f
2023-02-08 19:50:02 +01:00
Madhav Jivrajani db00da87d8 cacher: Fix watch behaviour for unset RV
The original design was to honour strong consistency
semantics for when the RV is unset, i.e. serve the
watch by doing a quorum read.

However, the implementation did not match the intent,
in that, the Cacher did not distinguish between set
and unset RV. This commit rectifies that behaviour by
serving the watch from the underlying storage if the
RV is unset.

This commit subsequently also adds a test for the same.

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

Kubernetes-commit: 610b67031c79c6c38964631d27dd59df357c6d2e
2023-01-16 11:10:05 +05:30
Madhav Jivrajani fd369afe45 cacher: Allow injecting errors for Watch()
This commit allows injecting errors for the
Watch() method of the dummy storage impl.

As a consequence of this, a race is introduced
between when the injected error is written and
read whenever a Watch() is invoked using the
dummy storage. This commit adds locking in order
to mitigate this.

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

Kubernetes-commit: 2593671337ad449f51b9dcc0b63aa190dd07ab68
2023-01-16 12:48:43 +05:30
Jiahui Feng de2a3360b1 avoid deepcopying schemas.
Kubernetes-commit: 7106d42a275e959d55e407180668873451399d81
2023-02-07 18:03:58 -08:00
Jiahui Feng 5ec13b3cf1 adaptor between structral and OpenAPI.
Kubernetes-commit: 7eb7c8b4fadc40f987de668c37abc99c1d58b557
2023-02-06 18:56:51 -08:00
Jiahui Feng b0c0a5edc5 make structural type use OpenAPI lib.
Kubernetes-commit: e11ea145eaa9c3261a3a6c3ef8c9c5ff29ad5e56
2023-01-11 10:08:11 -08:00
Jiahui Feng ac15595911 create OWNERS file for cel libs.
Kubernetes-commit: 43ef87a2680ecc007a036ca032ee17e294aff55c
2022-12-14 09:19:25 -08:00
Jiahui Feng 46ab726885 implement OpenAPI-based schema resolver.
Kubernetes-commit: 26089a4c957a87c27da31ecbf171e4943f5af6c0
2022-12-14 09:18:54 -08:00
Jiahui Feng bfa588de84 refit CEL typing library
to use OpenAPI schemas.

Kubernetes-commit: f2ee977afd72ee2a66fb491eb74713f1d14a12fd
2022-12-14 09:18:27 -08:00
Li Bo 193a91e8ec refine code
Kubernetes-commit: 2d98d2412a153154396c7089fbe355a56e8a2329
2023-02-14 15:10:54 +08:00
Li Bo d334d385d8 enhance priority-level dumping by adding total requests of dispatched,timed out and rejected
Kubernetes-commit: c0bb425d8f3de4bd3468db9ba83962b777c6331b
2022-09-06 20:06:04 +08:00
Li Bo ce20ca24cd sort by PriorityLevel Configuration name when dumping priority levels
Kubernetes-commit: 20b5308c6c1ab367aee4ee1cc0437be5a61d6138
2022-09-06 21:59:50 +08:00
Andrew Sy Kim f86340dad2 increase expected fairness margin in TestDifferentWidths
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>

Kubernetes-commit: 736720128824264b4246f247b9ec0d09f5383cf0
2022-10-21 11:39:11 -04:00
Paco Xu f4e378eb7b API docs: point to current docs instead of archived designs
Kubernetes-commit: 3d536bd14bba0586f20d1d96560073e5d9e82f97
2023-02-16 15:29:56 +08:00
Paco Xu 1e1b60ce05 archived design proposals are now moved to Design Proposals Archive Repo.
Kubernetes-commit: 019d2615af3f7fd0ed0d593ef9df348f6d85b204
2023-02-08 11:12:22 +08:00
ZhangYu 7e4c7c03fd change unnecessary switch to if in metrics.go
Kubernetes-commit: 48b9f7bb6c8298a00cdc04e394af15afe5804a3e
2022-11-30 11:04:03 +08:00
Rita Zhang f471919cab kmsv2: add metrics
Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>

Kubernetes-commit: bd0f7f8ee8f7f1c7809e17fa60804bb37f65c495
2023-01-29 22:40:18 -08:00
Han Kang 6ae8541062 add 25s bucket
Kubernetes-commit: 7b823002f3ee850b53cc0523ca271bc18661e5ef
2023-02-15 10:27:56 -08:00
Han Kang d92f186e5f use 10 seconds as the biggest bucket for webhook metrics otherwise charts will top out at 2.5s for webhook latencies
Kubernetes-commit: 20b5205dad419fa79b0c6cd69d01183d21f7d9c5
2023-02-15 09:16:16 -08:00
Hippie Hacker 90d239d3a7 Migrate apiserver to registry.k8s.io
Part of kubernetes/k8s.io#4738

Kubernetes-commit: 75da0cc91ad5a268ef5a2b1fa0b251b81347ca56
2023-02-09 06:49:27 +13:00
mantuliu 24f1059004 Remove unused code
Signed-off-by: mantuliu <240951888@qq.com>

Kubernetes-commit: bc70548c470983b2299a6d29add41ea81f676d92
2023-02-14 20:08:11 +08:00
Anish Ramasekar 0304cd9f08 logcheck.conf: ensure that kms and value/encrypt uses structured logging
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: b6b00e65bcfe40fdaca9ce8b214baf5015ad7c5c
2023-02-10 00:17:54 +00:00
Anish Ramasekar c9656aa265 [KMS] Use structured logging in value/encrypt
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: 6db7496db60816c36b519a940fa1b0af1c0898da
2023-02-09 19:54:37 +00:00
Anish Ramasekar 63ca46e40a [KMSv2] Add metrics for grpc service
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: de3b2d525b42d6eedeaa0b157f0f5ab98a4821f4
2023-02-09 07:46:29 +00:00
Anish Ramasekar 421ef770de [KMSv2] store hash of encrypted DEK as key in cache
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: f72cf5c510cf2cf7b8ee375f5c2ec835e3ed225a
2023-01-27 00:19:32 +00:00
baomingwang 3f56cdd970 Added serialization from etcd error metric
Kubernetes-commit: 92c490f0bca03b6caea896ea10415a0d77c9efdc
2022-12-08 19:34:09 -08:00
SataQiu 08b93a6120 using BuildOpenAPISpecFromRoutes instead of deprecated BuildOpenAPISpec
Kubernetes-commit: 5fbd49c1023d1d92f2afad39a2ac847fd5f252a7
2023-02-06 17:47:44 +08:00
Dipankar Das ee11899e67 changes to the fatal message generated
Signed-off-by: Dipankar Das <dipankardas0115@gmail.com>

Kubernetes-commit: 50bc46bd8fdc687811b3e4bba6a3d8d0706c8d59
2023-01-11 08:08:25 +05:30
Dipankar Das 41fdf0ebe7 Added fatalf for error handling
Signed-off-by: Dipankar Das <dipankardas0115@gmail.com>

Kubernetes-commit: 526b4b4ce226349b1e0587db14d1321d0b27bbff
2023-01-07 15:45:45 +05:30
Max Smythe 19d202d87c make CEL admission controller code consumable (#115412)
* Make policy decision object public

Signed-off-by: Max Smythe <smythe@google.com>

* Separate version conversion from validation

Signed-off-by: Max Smythe <smythe@google.com>

* Address review comments

Signed-off-by: Max Smythe <smythe@google.com>

* Fix variable name

Signed-off-by: Max Smythe <smythe@google.com>

---------

Signed-off-by: Max Smythe <smythe@google.com>

Kubernetes-commit: 0ed74145fb00626ce0e900812a54ca3de5406f2e
2023-02-01 17:29:30 -08:00
Alexander Zielenski d816cd004f add openapi typeconverter
Kubernetes-commit: 0c0f524318d0327214580691fd3e060f178caf91
2023-01-09 12:10:16 -08:00
Nilekh Chaudhari f218c03473 chore: improves tests
Signed-off-by: Nilekh Chaudhari <1626598+nilekhc@users.noreply.github.com>

Kubernetes-commit: b3f326722d9025f6633b26f88a47f4799c3abd83
2022-11-14 19:57:50 +00:00
Abu Kashem 4c43232509 apiserver: remove 34s from DELETECOLLECTION rest handler
Kubernetes-commit: 709748a34e501d75162f580b1e1e65969169d0ab
2023-01-26 12:25:02 -05:00
Abu Kashem cb855a88b8 apiserver: CVE-2022-1996, validate cors-allowed-origins server option
Kubernetes-commit: 841311ada2b0ba58e623a89e2e5ac74de0d94d8c
2023-01-20 13:54:02 -05:00
Madhav Jivrajani 74b458857b *: Make docs more accurate for the contention-profiling flag
The --contention-profiling flag enables block profiling by calling
SetBlockProfileRate(). It, however does not call SetMutexProfileFraction
which enables mutex profiling.

Mutex profiling gives us information about lock contention whereas
block profiling on the other hand gives us information on gorotuines
being blocked on sync primitives.

Updating the docs to "block profiling" in order to make it more accurate.
Eventhough a block profile may reflect contention points on locks to some
extent, it also talks about other sources where goroutines may be blocked.

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

Kubernetes-commit: f236ab24dfcb84906a1d453877a79bd4a94f897d
2022-12-14 17:34:47 +05:30
Alexander Zielenski d2e96d0915 use transformer to set gvk back
Kubernetes-commit: 24fb6b89812ac86622a536dba861729ed5a20b74
2023-01-26 12:14:14 -08:00
Alexander Zielenski 721045969b add unfortunate deepcopy
Kubernetes-commit: 65513eac3ab67f08745197d8af469532284b797e
2023-01-24 14:46:35 -08:00
Alexander Zielenski f77de04c6a fix integration test by working around #3030
test uses kind field which is not populated for native types

Kubernetes-commit: 1554e50be43660bc9f03d97cc26b235ad4f94d6c
2023-01-24 12:00:05 -08:00
Alexander Zielenski 1b8963b016 use typedinformer if available
reduces memory and cpu when things like configmap are used as a param

cannot be shared due to limitatoins of sharedinformerfactory

Kubernetes-commit: b969dfec9fd33f8bfff47e54f2995a4865839ea6
2023-01-19 10:04:52 -08:00
Alexander Zielenski 2ea5662b05 use namespacedName for keys in fakeCompiler
Kubernetes-commit: 0c495cb429e54a6d25e9252aca3e32fd9f0aef6b
2023-01-19 10:04:46 -08:00
Richa Banker 6bb270e406 Enable ComponentSLIs as beta feature
Kubernetes-commit: 452343367c21c68f325078357c5dfe794169422c
2023-01-09 17:25:50 -08:00
Joseph Anttila Hall 7fa759edb6 Fix konnectivity-client metric registration.
Kubernetes-commit: 1a428fd1fade54513cb6f609388207ed38d20753
2023-01-25 15:07:48 -08:00
Kevin Delgado c40024ba00 drop Enabled() checks for ServerSideFieldValidation feature gate
Kubernetes-commit: 2d5ceb9b15347b8bb5af360470b6346370157042
2023-01-24 17:48:31 +00:00
Kevin Delgado 3e03fc3433 Graduate field validation to GA
Kubernetes-commit: 3b6c4d307febe24c78099515e45cd51bbba0112d
2023-01-23 18:30:33 +00:00
Anish Ramasekar 9fb6b944f0 kmsv2: implement expire cache with clock
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: 4804baa01187b4251bd632e07721d875f567d6f1
2022-09-14 20:01:45 +00:00
Tim Hockin 979698ec2b Set proto go_package: kms API
This creates some diff to the *.pb.go files to note that
in the "options".

You can dump the gzipped blob with the following program (thanks
StackOverflow!):

```go
package main

import (
	"bytes"
	"compress/gzip"
	"encoding/json"
	"fmt"
	"os"

	"io/ioutil"

	proto "github.com/golang/protobuf/proto"
	dpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
)

func main() {
	m := map[string][]byte{
		"before": blobv1,
		"after": blobv2,
	}
	arg := os.Args[1]
	dump(m[arg])
}

func dump(bytes []byte) {
	fd, err := decodeFileDesc(bytes)
	if err != nil {
		panic(err)
	}
	b, err := json.MarshalIndent(fd, "", "  ")
	if err != nil {
		panic(err)
	}
	fmt.Println(string(b))
}

// decompress does gzip decompression.
func decompress(b []byte) ([]byte, error) {
	r, err := gzip.NewReader(bytes.NewReader(b))
	if err != nil {
		return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
	}
	out, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
	}
	return out, nil
}

func decodeFileDesc(enc []byte) (*dpb.FileDescriptorProto, error) {
	raw, err := decompress(enc)
	if err != nil {
		return nil, fmt.Errorf("failed to decompress enc: %v", err)
	}

	fd := new(dpb.FileDescriptorProto)
	if err := proto.Unmarshal(raw, fd); err != nil {
		return nil, fmt.Errorf("bad descriptor: %v", err)
	}
	return fd, nil
}
```

Kubernetes-commit: ab11d8a4495aa0ff03b94c8d1a5345abfcca2c59
2023-01-14 10:21:53 -08:00
Monis Khan 54f0629e69 Prime KMS v2 key ID inline with transformer construction
Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: 345f41f8e5256ea44066aa884f85c161d44ebd0d
2023-01-23 09:49:18 -05:00
Patrick Ohly 8f8c30ff8f logging: fix names of keys
The stricter checking with the upcoming logcheck v0.4.1 pointed out these names
which don't comply with our recommendations in
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments.

Kubernetes-commit: bc6c7fa91201348d010b638fbadf32007c0ac546
2023-01-16 15:04:01 +01:00
Tim Hockin 72929fc438 Call update-proto-bindings from update-codegen
One script to bring them all ...

Kubernetes-commit: 4dae505d531e149881788dc36148602967419c75
2023-01-05 15:41:51 -08:00
Tim Hockin 05e000c1bd Merge 5 fragile proto-bindings scripts into 1
Each of these scripts is basically identical, and all were too brittle.
Now they should be more resilient and easier to manage.  The script
still needs to be updated if we add new ones, which I do not love.

More cleanup to follow.

Kubernetes-commit: e0ecccff3f5148cc167117ac73233b4edc1640d8
2023-01-05 13:53:59 -08:00
Clayton Coleman fbcccd4f68 wait: ExponentialBackoffWithContext should take context-aware fn
The condition methods will eventually all take a context. Since we
have been provided one, alter the accepted condition type and
change the four references in tree.

Collers of ExponentialBackoffWithContext should use a condition
aware function (ConditionWithContextFunc). If the context can be
ignored the helper ConditionFunc.WithContext can be used to convert
an existing function to the new type.

Kubernetes-commit: 34bfdc3635cb621d94eebde5d8f4b9c0b933c68e
2023-01-16 14:57:57 -05:00
Antoine Pelisse 464161ed52 fieldmanager: Use unstructured rather than built-in types to remove dependency
Kubernetes-commit: bc0962ad809bc5cd0951a1d643f6769459665711
2023-01-19 10:48:46 -08:00
Antoine Pelisse 2a6ed798c7 fieldmanager: Copy LastAppliedAnnotation to remove dependency on corev1
Kubernetes-commit: 577f3d8c9da461da93d4a0b66ca16b2a84f6a4d6
2023-01-19 09:38:04 -08:00
Antoine Pelisse e19154e9ae fieldmanager: Move structured benchmarks to their own file
Kubernetes-commit: 8d40ba73fba3608e76531b1b33230856a58256ed
2023-01-19 09:37:12 -08:00
Rita Zhang 19c40b040a kmsv2: use status key ID to update staleness of encrypted data
Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>

Kubernetes-commit: 510ac9b3919b62cb52e166192a7d0d09a9b2dfb5
2022-12-02 13:32:34 -08:00
Tim Hockin db316c3a3c Fix apiserver example2 to update gen'ed protobufs
regen apiserver example2

Kubernetes-commit: 9a491f79a8770e9eca8e19516b01018ed16cbe8a
2023-01-04 13:55:48 -08:00
Clayton Coleman 03e6089ce8 wait: Use a context implementation for ContextForChannel
ContextForChannel uses a goroutine to transform a channel close to
a context cancel. However, this exposes a synchronization issue if
we want to unify the underlying implementation between contextless
and with context - a ConditionFunc that closes the channel today
expects the behavior that no subsequent conditions will be invoked
(we have a test in wait_test.go TestUntilReturnsImmediately that
verifies this expectation). We can't unify the implementation
without ensuring this property holds.

To do that this commit changes from the goroutine propagation to
implementing context.Context and using stopCh as the Done(). We
then implement Err() by returning context.Canceled and stub the
other methods. Since our context cannot be explicitly cancelled
by users, we cease to return the cancelFn and callers that need
that behavior must wrap the context as normal.

This should be invisible to clients - they would already observe
the same behavior from the context, and the existing error
behavior of Poll* is preserved (which ignores ctx.Err()).

As a side effect, one less goroutine is created making it more
efficient.

Kubernetes-commit: 95051a63b323081daf8a3fe55a252eb79f0053aa
2023-01-17 15:01:02 -05:00
Alexander Zielenski 73db86feab fix bug with param controllers being removed if used by more than one policy
Kubernetes-commit: ecd267d097ec7cd26fa5a6343622c3772f66486f
2023-01-17 15:27:45 -08:00
SataQiu 0f00ee135b the AdvancedAuditing featuregate has been GA since v1.12, and is locked to ture in v1.27
Kubernetes-commit: c25095b2231eb64ac938ae8b3d939c76307da340
2023-01-18 18:50:15 +08:00
Andrew Sy Kim 885060394e apiserver: use the identity value in the apiserver identity hash
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>

Kubernetes-commit: a7de3e15a50bafdd65adf55f5fdc14567e3fa3e2
2023-01-13 15:49:30 -05:00
Andrew Sy Kim 2d94c4699b apiserver: update lease identity prefix from kube-apiserver- to apiserver-
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>

Kubernetes-commit: fb066a883de2b56e533eb622677056bd723748ce
2022-12-19 13:33:24 -05:00
lengrongfu 7deda7bdcd clean up master-service-namespace
Signed-off-by: lengrongfu <rongfu.leng@daocloud.io>

Kubernetes-commit: 556d3fc2b7b4dfd1d94d3039909ddb42d88f7c52
2022-12-13 18:13:16 +08:00
Alexander Zielenski 9be70531b4 refactor admission controller to avoid contention
refresh admission policies up to once per second based upon last known good data

Kubernetes-commit: 5f59f449832e5206fe9b5fd7d9a43721c4c9ae44
2022-12-15 16:30:52 -08:00
Alexander Zielenski 3fe59ceb77 defer Done call
safer in case of panic

Kubernetes-commit: 517df8f3051b5b0a9eb57a5bad1d6bc16fb61985
2022-12-15 13:09:11 -08:00
Paco Xu d49ebea4e2 cleanup: EphemeralContainers feature gate related codes
Kubernetes-commit: 70e56fa71af5aa4f3d1448fcbc26e86309cd0cf3
2022-12-16 23:46:47 +08:00
Krzysztof Ostrowski a85078bf03 apiserver/kmsv2: mv Service interface into kmsv2
Signed-off-by: Krzysztof Ostrowski <kostrows@redhat.com>

Kubernetes-commit: b7701b00eaa8cdc2103beb8ab78f625cc3b62d90
2023-01-09 14:36:06 +01:00
Antoine Pelisse 9451c13844 fieldmanager: remove dependencies on internal
Remove dependencies on internal fieldmanager for admission things. This
is preparing for moving fieldmanager out, but the admission part will
stay here, so it can't depend directly on internal.

Kubernetes-commit: d13b405307262b2b9c0795af3a22d0a5725ef6a0
2022-12-21 15:46:49 -08:00
Daniel Smith f1c42beb68 Fix N^2 startup for webhook configurations
Add a "lazy" type to track when an update is needed. It uses a nested
locking technique to avoid extra evaluation calls.

Kubernetes-commit: 5a1091d88d95bd1dd5c27f2c72cee4ecb4219dda
2023-01-09 23:29:25 +00:00
Monis Khan ebb0d405b3 encryption-at-rest: clean up context usage and duplicated code
This change in a no-op refactor of the encryption at rest code that
primarily changes the wiring to consistently use context for
lifecycle management (instead of a mixture of context and stop
channels).

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

Kubernetes-commit: 70b414b0e5cbe9706e5a4fc0d7299ec6b169d642
2022-11-09 17:33:38 -05:00
Paco Xu d61f1147f3 remove psp in extensions api/apis
Kubernetes-commit: 25686a2c772adea2088f3be087280c39daa81631
2022-11-02 21:12:43 +08:00
Antoine Pelisse 652037afcf fieldmanagertest: Reduce API surface of the test package
Kubernetes-commit: 7899157345a9ef02bacc56898055e98f28d5b9cc
2022-12-15 20:50:38 -08:00
Antoine Pelisse 4079852d5b fieldmanager: Remove obsolete comment
Kubernetes-commit: ad65b25cc33b7323d6651407944fe74d938ac42a
2022-12-15 16:42:40 -08:00
Antoine Pelisse b02ebf4b97 Make internal managers private
This significantly reduces the surface area of the fieldmanager package
by hiding all the private "managers" objects, as well as the interface
that was made specifically for these. There is no reason to configure
these.

Kubernetes-commit: adfc65ec23292ebd95d96727654acd8e8e0452a5
2022-12-12 14:07:13 -08:00
Abu Kashem 9e60654b8a apiserver: refactor WithWaitGroup handler
Kubernetes-commit: 9093f126b87cb686784bb27b08be9eb12b4d5453
2023-01-10 15:55:19 -05:00
root d7c195333e Fixes the issue #114145
Kubernetes-commit: 0f186fd6d8a38601effd443bd4a23dea75e2c033
2023-01-10 04:49:49 +00:00
Jordan Liggitt b0b89e7e65 Prune trailing newlines when enums are disabled
Kubernetes-commit: d0967bbe5e78dbcdd5bc189d5fc2becafc4be0f2
2023-01-06 00:58:23 -05:00
Jefftree deb6c803a5 Add jefftree to OWNERS
Kubernetes-commit: 6b443c2304e22801438a94b0b62f6d5b7c1dc020
2022-11-16 19:12:45 +00:00
Joseph Anttila Hall f1f1cdab79 egress_selector.go: register konnectivity-client metrics.
This registers new metrics provided by https://github.com/kubernetes/kubernetes/pull/114789.

Kubernetes-commit: 43a6eba33bea2712ddef0f8191fb47ebc322c59e
2023-01-04 18:38:22 +00:00
Antoine Pelisse 234f6c3879 Give TypeConverter to TestFieldManager
This is mostly because the path, even for built-in, can change from test
to test, so it's easier to make the whole thing configurable anyway.

Kubernetes-commit: 1617b06c039cb66f05e59b79f9a9963d5614ce31
2022-12-13 14:30:45 -08:00
Antoine Pelisse 94f827cb28 Hide OpeAPI details behind the NewTypeConverter
The fact that we're building the OpenAPI using the proto.Models is an
implementation detail that we shouldn't have to expose. Since we're
going to change the way this is transformed, let's first hide it behind
the common NewTypeConverter so that the next change is transparent.

This will also enable other clean-ups like hiding the gvkParser which
shouldn't be exposed and prevent some refactoring.

Kubernetes-commit: a7ab6b86db83e31ff599e4d21a065f6845fb93dd
2023-01-03 14:26:06 -08:00
kkkkun c465dcc9ec Fix normal request metric verb correctly
Signed-off-by: kkkkun <scuzk373x@gmail.com>

Kubernetes-commit: 0b6e641810fb7a24a74b8068fb772c1bb1eb447c
2023-01-03 13:16:46 +00:00
Arda Güçlü ca82ee6238 Remove GetSingularName for subresources
Kubernetes-commit: 1abf94bec30706afbbeae7e4a1cbf4dbacbaa422
2022-11-18 09:55:18 +03:00
Arda Güçlü d20862a68e Add singular name for the rest of types
Kubernetes-commit: 578ddde80e72a300fdb3798d68e550d2b4a61203
2022-11-03 10:18:45 +03:00
Arda Güçlü da3d6b945b Introduce singularNameProvider for core types
This introduces `singularNameProvider`. This provider will be used
by core types to have their singular names are defined in discovery
endpoint. Thanks to that, core resources singular name always have
higher precedence than CRDs shortcuts or singular names.

Kubernetes-commit: 0990ba1cc92449bbbd9b25a4391f1da834f8c5fd
2022-11-02 12:53:56 +03:00
kkkkun aec915f887 Fix CONNECT requests from others requests
Signed-off-by: kkkkun <scuzk373x@gmail.com>

Kubernetes-commit: 973f7c49b887b00c43874ad1085237632efcc300
2022-12-22 11:52:18 +08:00
Wojciech Tyczyński 8808b718c9 Explicit sorting in TestList storage test
Kubernetes-commit: 34de5fa73dabd9dcbd6f535cf6a853371ec653f1
2022-11-21 12:03:54 +01:00
Wojciech Tyczyński 299c158ba3 Reuse generic List test for watchcache
Kubernetes-commit: ef8c4fbca8e5bed1e7edc162b95c412a7f1a758e
2022-11-04 22:01:37 +01:00
Wojciech Tyczyński 012ace9f52 Fix lack of sorting of list results in watchcache
Kubernetes-commit: aaaee155dd3c9402e674d066f4d6ca30cc971c8e
2022-11-08 13:06:56 +01:00
Wojciech Tyczyński 8cd19efa73 Fix inconsistency in returning list results both in etcd3 and watchcache
Kubernetes-commit: da8d197a7205c01fdf376246995b0a1b3ab53859
2022-11-08 11:47:28 +01:00
Jordan Liggitt c6b4e07ee4 Fix indentation/spacing in comments to render correctly in godoc
Kubernetes-commit: 78cb3862f11225135afdf76f3424e2d7b33104c7
2022-12-17 17:31:05 -05:00
Abu Kashem c44ad6bb02 apiserver: refactor cors filter
Kubernetes-commit: ea251b5605c22d82962d4e699d933428e4c9c211
2022-11-03 09:29:47 -04:00
Abu Kashem 5b1e3f38d8 apiserver: refactor cors unit test
Kubernetes-commit: ae7327ab8eb2e05c3ccb185354eed247795bbc6d
2022-11-03 09:05:40 -04:00
Daniel Smith d053de6ca3 Enable propagration of HasSynced
* Add tracker types and tests
* Modify ResourceEventHandler interface's OnAdd member
* Add additional ResourceEventHandlerDetailedFuncs struct
* Fix SharedInformer to let users track HasSynced for their handlers
* Fix in-tree controllers which weren't computing HasSynced correctly
* Deprecate the cache.Pop function

Kubernetes-commit: 8100efc7b3122ad119ee8fa4bbbedef3b90f2e0d
2022-11-18 00:12:50 +00:00
Antoine Pelisse 76a233ebec Allow profiling information to be served on Unix-Domain Socket
Serving profiling information can leak information or expose the
apiserver to possible DoS attacks. Serving on a UDS is more secure
though slightly less convenient. One can't use `go tool pprof` directly
against the socket since it's not supported, but can either run a proxy
to copy from the socket over to http, or use `curl --unix-socket` to
download the profile and then use `go tool pprof`.

Kubernetes-commit: 667599b0ddfad8ba760d3bbfe006aae0d8f7dec6
2022-11-29 11:07:15 -08:00
qingwave f56a6a65d1 add help for cel metrics
Signed-off-by: qingwave <isguory@gmail.com>

Kubernetes-commit: 90357e62d200a9eb77aa0534298de46f0ae364a4
2022-12-09 04:53:02 +00:00
Rita Zhang 911df25617 Update the godoc on the encryption config API on how to specify group/resources to be encrypted
Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>

Kubernetes-commit: c085031a8f3f366708f9b7aa7ab1695d802d9f5a
2022-11-28 07:18:02 -08:00
Antoine Pelisse 77591ad906 Fix FakeObjectCreater ignoring given gvk
Kubernetes-commit: 948ab9175a8151af44fb958c6511c6d756c983be
2022-12-08 09:24:14 -08:00
Antoine Pelisse 4b7edb49fe fieldmanager: Move TestFieldManager into its own package
Kubernetes-commit: bdbc0eb2088f8d342a281c4f05295bf11861ef1f
2022-12-01 09:32:43 -08:00
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