Skip to content

Commit 6a4aadc

Browse files
authored
Merge pull request kubernetes#3310 from tallclair/psa-ga
KEP-2579: Pod Security GA plan
2 parents b57a34e + 026a9f6 commit 6a4aadc

File tree

3 files changed

+69
-47
lines changed

3 files changed

+69
-47
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
# The KEP must have an approver from the
2+
# "prod-readiness-approvers" group
3+
# of http://git.k8s.io/enhancements/OWNERS_ALIASES
14
kep-number: 2579
25
alpha:
36
approver: "@deads2k"
47
beta:
58
approver: "@deads2k"
9+
stable:
10+
approver: "@deads2k"

keps/sig-auth/2579-psp-replacement/README.md

Lines changed: 60 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
- [Windows Support](#windows-support)
2525
- [Flexible Extension Support](#flexible-extension-support)
2626
- [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)
2731
- [Monitoring](#monitoring)
2832
- [Audit Annotations](#audit-annotations)
2933
- [PodSecurityPolicy Migration](#podsecuritypolicy-migration)
@@ -553,41 +557,43 @@ publish the following tools:
553557

554558
### Test Plan
555559

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
559561

560-
**E2E Tests:** The following tests should be added:
562+
None.
561563

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
571565

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`
574580

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
581582

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
584585

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
588591

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.
591597

592598
### Monitoring
593599

@@ -735,15 +741,27 @@ We are targeting Beta in v1.23.
735741

736742
#### GA
737743

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.
742745

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.
747765

748766
### Upgrade / Downgrade Strategy
749767

@@ -910,6 +928,8 @@ previous answers based on experience in the field._
910928
There will be a hard cap on the number of pods analyzed, and a timeout for the review of those pods
911929
that ensures evaluation does not exceed a percentage of the time allocated to the request.
912930
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)
913933

914934
* **Will enabling / using this feature result in introducing new API types?**
915935
- No.
@@ -1046,13 +1066,10 @@ templated pod resources. This could be useful in CI/CD pipelines and tests.
10461066

10471067
### Conformance
10481068

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.
10561073

10571074
## Implementation History
10581075

keps/sig-auth/2579-psp-replacement/kep.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,26 @@ see-also:
2929
replaces: []
3030

3131
# The target maturity stage in the current dev cycle for this KEP.
32-
stage: beta
32+
stage: stable
3333

3434
# The most recent milestone for which work toward delivery of this KEP has been
3535
# done. This can be the current (upcoming) milestone, if it is being actively
3636
# worked on.
37-
latest-milestone: "v1.23"
37+
latest-milestone: "v1.25"
3838

3939
# The milestone at which this feature was, or is targeted to be, at each stage.
4040
milestone:
4141
alpha: "v1.22"
4242
beta: "v1.23"
43-
stable: TBD
43+
stable: "v1.25"
4444

4545
# The following PRR answers are required at alpha release
4646
# List the feature gate name and the components for which it must be enabled
4747
feature-gates:
4848
- name: PodSecurity
4949
components:
5050
- kube-apiserver (PodSecurity admission plugin)
51-
disable-supported: true
51+
disable-supported: false
5252

5353
# The following PRR answers are required at beta release
5454
metrics:

0 commit comments

Comments
 (0)