* Drop WorkloadRef field and introduce SchedulingGroup field in Pod API
* Introduce v1alpha2 Workload and PodGroup APIs, drop v1alpha1 Workload API
Co-authored-by: yongruilin <yongrlin@outlook.com>
* Run hack/update-codegen.sh
* Adjust kube-scheduler code and integration tests to v1alpha2 API
* Drop v1alpha1 scheduling API group and run make update
---------
Co-authored-by: yongruilin <yongrlin@outlook.com>
This change allows slow impersonation requests to be tracked via the
apiserver.latency.k8s.io/impersonation audit event annotation.
Updated tests to assert that the audit event log:
- Contains the new latency annotation
- Contains the impersonationConstraint field
- Failed impersonation attempts are observable by the response status
Signed-off-by: Monis Khan <mok@microsoft.com>
Cancel informer watch connections before tearing down the test
apiserver to avoid hitting the 60s http.Server.Shutdown drain timeout.
Each subtest was blocking on open watch connections, adding ~300s to
the total suite runtime.
Decouple the informer lifecycle from the apiserver by using a separate
cancellable context for factory.Start(). Go's defer LIFO ordering
ensures the informer stops before test.cleanUp() shuts down the
server.
Also reduce EncryptionConfigFileChangePollDuration to 1s in TestMain.
Add TestBitFlipCorruptObjectDeletion to exercise the decoder error path
for KEP-3926 using Secrets (protobuf encoding). Unlike the existing
TestAllowUnsafeMalformedObjectDeletionFeature which tests transformer
errors (wrong encryption key), this test uses identity encryption and
corrupts stored bytes directly in etcd, triggering "undecodable" errors
at the protobuf decoder layer.
The informer is given an extended timeout (2 minutes) after deletion
to recover from the exponential backoff accumulated during the
corruption window. The reflector's backoff caps at [30s, 60s) with
jitter, so 2 minutes provides sufficient leeway.
The gate=false subtest is skipped because writing corrupt bytes directly
to etcd emits a watch event that the cacher cannot decode, breaking its
watch. Without the feature gate, the subsequent re-list aborts on the
first decode error (abortOnFirstError aggregator), so the cacher never
recovers and GET requests hang. This differs from the encryption-config
swap tests where no etcd data changes and no watch event is emitted.
This is a known issue to be addressed separately.
Add tests that exercise the AllowUnsafeMalformedObjectDeletion feature
gate for Custom Resources (foos.cr.bar.com), mirroring the existing
Secret-based tests. This covers the dynamic storage registry code path
that is distinct from built-in resources, including unsafe delete with
privilege escalation and LIST behavior for corrupt CR objects.
The goroutine did not keep running for long, but waiting for the controller to
stop is better. Noticed because of:
E0303 07:43:20.154262 39037 runtime.go:221] "Work item failed" err="Operation cannot be fulfilled on resourceclaims.resource.k8s.io \"external-claim\": the object has been modified; please apply your changes to the latest version and try again" logger="TestDRA/all/ControllerManagerMetrics leaked goroutine.UnhandledError" item="claim:testdra-all-shareresourceclaimsequentially-9q88d/external-claim"
Besides the "leaked goroutine" warning this also ensures that the controller is
really inactive when the next test runs.
Refactoring as a preparation for the following commits.
Modernize the test file:
- interface{} -> any
- ioutil.ReadFile -> os.ReadFile
- ptr.To[bool](true) -> ptr.To(true)
- Extract grantUserVerbsOnResource from permitUserToDoVerbOnSecret
to support granting RBAC verbs on arbitrary resources, not just secrets