|
24 | 24 | - [Windows Support](#windows-support)
|
25 | 25 | - [Flexible Extension Support](#flexible-extension-support)
|
26 | 26 | - [Test Plan](#test-plan)
|
| 27 | + - [Prerequisite testing updates](#prerequisite-testing-updates) |
| 28 | + - [Unit tests](#unit-tests) |
| 29 | + - [Integration tests](#integration-tests) |
| 30 | + - [e2e tests](#e2e-tests) |
27 | 31 | - [Monitoring](#monitoring)
|
28 | 32 | - [Audit Annotations](#audit-annotations)
|
29 | 33 | - [PodSecurityPolicy Migration](#podsecuritypolicy-migration)
|
@@ -553,41 +557,43 @@ publish the following tools:
|
553 | 557 |
|
554 | 558 | ### Test Plan
|
555 | 559 |
|
556 |
| -The admission controller can safely be enabled as a no-op with the default-defaults, i.e. everything |
557 |
| -is privileged. This will let us run the admission controller in our standard E2E test jobs, by |
558 |
| -relabeling specific test namespaces. |
| 560 | +##### Prerequisite testing updates |
559 | 561 |
|
560 |
| -**E2E Tests:** The following tests should be added: |
| 562 | +None. |
561 | 563 |
|
562 |
| -1. Enforce mode tests: |
563 |
| - - Test all profile levels |
564 |
| - - Test profile version support |
565 |
| -2. Warning mode tests: |
566 |
| - - Profile levels & version support |
567 |
| -3. Namespace policy relabeling |
568 |
| - - Ensure labeling completes even when there are warnings |
569 |
| - - Test warning on violating pods |
570 |
| - - Test dry-run mode |
| 564 | +##### Unit tests |
571 | 565 |
|
572 |
| -Additionally, we should add tests to the upgrade test suite to ensure that version skew is properly |
573 |
| -handled: |
| 566 | +- `k8s.io/pod-security-admission/admission`: `2022-05-12` - `80.7% of statements` |
| 567 | +- `k8s.io/pod-security-admission/admission/api`: `2022-05-12` - `1.4% of statements` (mostly boilerplate & generated code) |
| 568 | +- `k8s.io/pod-security-admission/admission/api/load`: `2022-05-12` - `88.5% of statements` |
| 569 | +- `k8s.io/pod-security-admission/admission/api/scheme`: `2022-05-12` - `100.0% of statements` |
| 570 | +- `k8s.io/pod-security-admission/admission/api/v1alpha1`: `2022-05-12` - `1.7% of statements` (generated API) |
| 571 | +- `k8s.io/pod-security-admission/admission/api/v1beta1`: `2022-05-12` - `1.7% of statements` (generated API) |
| 572 | +- `k8s.io/pod-security-admission/admission/api/validation`: `2022-05-12` - `100.0% of statements` |
| 573 | +- `k8s.io/pod-security-admission/api`: `2022-05-12` - `9.3% of statements` **room for improvement** |
| 574 | +- `k8s.io/pod-security-admission/cmd/webhook`: `2022-05-12` - `no unit tests` (mostly server setup, covered by integration) |
| 575 | +- `k8s.io/pod-security-admission/cmd/webhook/server`: `2022-05-12` - `no unit tests` (mostly server setup, covered by integration) |
| 576 | +- `k8s.io/pod-security-admission/cmd/webhook/server/options`: `2022-05-12` - `no unit tests` (mostly server setup, covered by integration) |
| 577 | +- `k8s.io/pod-security-admission/metrics`: `2022-05-12` - `93.8% of statements` |
| 578 | +- `k8s.io/pod-security-admission/policy`: `2022-05-12` - `88.3% of statements` |
| 579 | +- `k8s.io/pod-security-admission/test`: `2022-05-12` - `73.7% of statements` |
574 | 580 |
|
575 |
| -- A minimally specified pod (just a container image) should always be allowed by the baseline |
576 |
| - policy. |
577 |
| -- A privileged pod should never be allowed by baseline or restricted |
578 |
| -- A Fully specified pod within the bounds of baseline should be allowed by baseline, and rejected by |
579 |
| - restricted. |
580 |
| -- A minimally specified restricted pod should be allowed at a pinned version. |
| 581 | +##### Integration tests |
581 | 582 |
|
582 |
| -**Integration Tests:** Audit mode tests should be added to integration testing, where we have |
583 |
| -existing audit logging tests. |
| 583 | +`k8s.io/kubernetes/test/integration/auth/podsecurity_test.go` |
| 584 | +https://storage.googleapis.com/k8s-triage/index.html?test=TestPodSecurity |
584 | 585 |
|
585 |
| -**Manual Testing Resources:** Pod resources will be provided covering all dimensions of the baseline |
586 |
| -& restricted profiles, for validation of 3rd party policy implementations. These have been drafted |
587 |
| -by @JimBugwadia: https://github.com/JimBugwadia/pod-security-tests |
| 586 | +Pod Security admission has very thorough integration test coverage, including: |
| 587 | +- Generated test fixtures for failing & passing pods across every type of check, version and level. |
| 588 | +- Tests with only GA feature gates enabled, and the default set. |
| 589 | +- Tests running as a built-in admission controller & webhook. |
| 590 | +- Tests pods run directly & via a controller |
588 | 591 |
|
589 |
| -**Unit Tests:** Both the library and admission controller implementations will have thorough |
590 |
| -coverage of unit tests. |
| 592 | +##### e2e tests |
| 593 | + |
| 594 | +There are no Pod Security specific E2E tests (we rely on integration test coverage instead), but the |
| 595 | +Pod Security admission controller is enabled in E2E clusters, and all E2E test namespaces are |
| 596 | +labeled with the enforcement label for Pod Security. |
591 | 597 |
|
592 | 598 | ### Monitoring
|
593 | 599 |
|
@@ -735,15 +741,27 @@ We are targeting Beta in v1.23.
|
735 | 741 |
|
736 | 742 | #### GA
|
737 | 743 |
|
738 |
| -<<[UNRESOLVED]>> |
739 |
| - |
740 |
| -We are targeting GA in v1.24 to allow for migration off PodSecurityPolicy before it is removed in |
741 |
| -v1.25. |
| 744 | +Targeting GA in v1.25. |
742 | 745 |
|
743 |
| -- Examples of real world usage and positive user feedback. |
744 |
| -- [Conformance test plan](#conformance) |
745 |
| - |
746 |
| -<<[/UNRESOLVED]>> |
| 746 | +**Conformance:** |
| 747 | +- Enabling the admission controller with the "default-default" enforcing mode of privileged is |
| 748 | + essentially a no-op without adding namespace labels, so it doesn't have any impact on |
| 749 | + conformance. |
| 750 | +- E2E framework has been updated to explicitly label test namespaces with the appropriate |
| 751 | + enforcement level, using the `NamespacePodSecurityEnforceLevel` framework value. For GA, |
| 752 | + conformance tests should be updated to use the most restrictive level possible. |
| 753 | +- Pod Security Admission is *not* required for conformance. |
| 754 | + |
| 755 | +**User Experience Improvements:** |
| 756 | +- [Warn when labeling exempt namespaces](https://github.com/kubernetes/kubernetes/issues/109549) |
| 757 | +- [Dedupe overlapping forbidden messages](https://github.com/kubernetes/kubernetes/issues/106129) |
| 758 | +- [Aggregate identical warnings for multiple pods in a namespace](https://github.com/kubernetes/kubernetes/issues/103213) |
| 759 | +- [Add context to failure messages](https://github.com/kubernetes/kubernetes/pull/105314) |
| 760 | + |
| 761 | +**API Changes:** |
| 762 | +- No changes to namespace label schema |
| 763 | +- Add `pod-security.admission.config.k8s.io/v1` (admission configuration, not a REST API) with no |
| 764 | + changes from the `v1beta1` API. |
747 | 765 |
|
748 | 766 | ### Upgrade / Downgrade Strategy
|
749 | 767 |
|
@@ -910,6 +928,8 @@ previous answers based on experience in the field._
|
910 | 928 | There will be a hard cap on the number of pods analyzed, and a timeout for the review of those pods
|
911 | 929 | that ensures evaluation does not exceed a percentage of the time allocated to the request.
|
912 | 930 | See [Namespace policy update warnings](#namespace-policy-update-warnings).
|
| 931 | + - Timeout: minimum of 1 second or (remaining request deadline / 2) |
| 932 | + - Max pods to check: 3000 ([benchmarks](https://github.com/kubernetes/kubernetes/pull/104588) indicate that 3000 pods should evaluate in under 10ms) |
913 | 933 |
|
914 | 934 | * **Will enabling / using this feature result in introducing new API types?**
|
915 | 935 | - No.
|
@@ -1046,13 +1066,10 @@ templated pod resources. This could be useful in CI/CD pipelines and tests.
|
1046 | 1066 |
|
1047 | 1067 | ### Conformance
|
1048 | 1068 |
|
1049 |
| -As this feature progresses towards GA, we should think more about how it interacts with conformance. |
1050 |
| - |
1051 |
| -- Enabling the admission controller with the "default-default" enforcing mode of privileged is |
1052 |
| - essentially a no-op without adding namespace labels, so it shouldn't have any impact on |
1053 |
| - conformance. |
1054 |
| -- If we want a more restricted version to still be considered conformant, we might need to |
1055 |
| - explicitly label namespaces in the conformance tests with the privilege level the tests require. |
| 1069 | +Clusters requiring baseline or restricted Pod Security levels should still be able to pass |
| 1070 | +conformance. This might require |
| 1071 | +[Conformance Profiles](https://github.com/kubernetes/enhancements/tree/master/keps/sig-architecture/1618-conformance-profiles) |
| 1072 | +to be feasible. |
1056 | 1073 |
|
1057 | 1074 | ## Implementation History
|
1058 | 1075 |
|
|
0 commit comments