kubernetes/test/utils
Monis Khan 6a6771b514
svm: set UID and RV on SSA patch to cause conflict on logical create
When a resource gets deleted during migration, the SVM SSA patch
calls are interpreted as a logical create request.  Since the object
from storage is nil, the merged result is just a type meta object,
which lacks a name in the body.  This fails when the API server
checks that the name from the request URL and the body are the same.
Note that a create request is something that SVM controller should
never do.

Once the UID is set on the patch, the API server will fail the
request at a slightly earlier point with an "uid mismatch" conflict
error, which the SVM controller can handle gracefully.

Setting UID by itself is not sufficient.  When a resource gets
deleted and recreated, if RV is not set but UID is set, we would get
an immutable field validation error for attempting to update the
UID.  To address this, we set the resource version on the SSA patch
as well.  This will cause that update request to also fail with a
conflict error.

Added the create verb on all resources for SVM controller RBAC as
otherwise the API server will reject the request before it fails
with a conflict error.

The change addresses a host of other issues with the SVM controller:

1. Include failure message in SVM resource
2. Do not block forever on unsynced GC monitor
3. Do not immediately fail on GC monitor being missing, allow for
   a grace period since discovery may be out of sync
4. Set higher QPS and burst to handle large migrations

Test changes:

1. Clean up CRD webhook convertor logs
2. Allow SVM tests to be run multiple times to make finding flakes easier
3. Create and delete CRs during CRD test to force out any flakes
4. Add a stress test with multiple parallel migrations
5. Enable RBAC on KAS
6. Run KCM directly to exercise wiring and RBAC
7. Better logs during CRD migration
8. Scan audit logs to confirm SVM controller never creates

Signed-off-by: Monis Khan <mok@microsoft.com>
2024-07-18 17:19:11 -04:00
..
apiserver svm: set UID and RV on SSA patch to cause conflict on logical create 2024-07-18 17:19:11 -04:00
crd e2e: use Ginkgo context 2022-12-16 20:14:04 +01:00
format test: extend gomega to use YAML for API types 2022-10-28 15:43:48 +02:00
harness Generate and format files 2022-07-26 13:14:05 -04:00
image Bump images, dependencies and versions to go 1.22.5 and distroless iptables 2024-07-04 16:34:18 +02:00
junit hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
ktesting fix: enable and fixes rules from testifylint on test package 2024-06-30 05:44:47 +00:00
kubeconfig svm: set UID and RV on SSA patch to cause conflict on logical create 2024-07-18 17:19:11 -04:00
oidc Switch to stretchr/testify / mockery for mocks 2024-06-20 19:42:53 +02:00
admission_webhook.go Generate and format files 2022-07-26 13:14:05 -04:00
audit.go svm: set UID and RV on SSA patch to cause conflict on logical create 2024-07-18 17:19:11 -04:00
conditions.go Cleanup unused test functions - cont-ed 2024-07-17 16:22:11 +02:00
create_resources.go Cleanup unused test functions - cont-ed 2024-07-17 16:22:11 +02:00
delete_resources.go Cleanup unused test functions - cont-ed 2024-07-17 16:22:11 +02:00
density_utils.go switch over k/k to use klog v2 2020-05-16 07:54:27 -04:00
deployment.go Cleanup unused test functions - cont-ed 2024-07-17 16:22:11 +02:00
node.go Move pkg/api/v1/node to pkg/util/node (#73656) 2019-02-26 11:05:32 -08:00
paths.go Setup e2e_node to support testing on ARM64 2023-05-20 00:07:44 +00:00
pki_helpers.go update serial number to a valid non-zero number in ca certificate (#117791) 2023-05-09 06:34:08 -07:00
pod_store.go generated: run refactor 2020-02-07 18:16:47 -08:00
replicaset.go Cleanup unused test functions - cont-ed 2024-07-17 16:22:11 +02:00
runners.go Cleanup unused test functions - cont-ed 2024-07-17 16:22:11 +02:00
tmpdir.go io/ioutil has already been deprecated in golang 1.16, so replace all ioutil with io and os 2022-02-03 05:32:12 +08:00
update_resources.go Error message should not be capitalized. 2021-05-28 16:00:05 +08:00