Skip to content

Commit 26e22a6

Browse files
authored
Merge branch 'kubernetes:master' into kep-hpa-tolerance
2 parents bd0b164 + 60dd2a9 commit 26e22a6

File tree

26 files changed

+343
-171
lines changed

26 files changed

+343
-171
lines changed

OWNERS_ALIASES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ aliases:
5858
- dgrisonnet
5959
- logicalhan
6060
- rexagod
61+
- richabanker
6162
sig-k8s-infra-leads:
6263
- BenTheElder
6364
- ameukam
6465
- dims
6566
- upodroid
67+
- xmudrii
6668
sig-multicluster-leads:
6769
- jeremyot
6870
- skitt

keps/prod-readiness/sig-network/1880.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ kep-number: 1880
22
alpha:
33
approver: "@johnbelamaric"
44
beta:
5+
approver: "@soltysh"
6+
stable:
57
approver: "@soltysh"

keps/prod-readiness/sig-scheduling/3633.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ alpha:
33
approver: "@wojtek-t"
44
beta:
55
approver: "@wojtek-t"
6+
stable:
7+
approver: "@wojtek-t"

keps/prod-readiness/sig-storage/2589.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ kep-number: 2589
22
alpha:
33
approver: "@ehashman"
44
beta:
5+
approver: "@wojtek-t"
6+
stable:
57
approver: "@wojtek-t"

keps/sig-api-machinery/3962-mutating-admission-policies/README.md

Lines changed: 68 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
- [Implementation History](#implementation-history)
6868
- [Drawbacks](#drawbacks)
6969
- [Alternatives](#alternatives)
70-
- [Alternative 1: JSONPatch](#alternative-1-jsonpatch)
7170
- [Alternative 2: Introduce new syntax](#alternative-2-introduce-new-syntax)
7271
- [Infrastructure Needed (Optional)](#infrastructure-needed-optional)
7372
<!-- /toc -->
@@ -123,7 +122,7 @@ API](/keps/sig-api-machinery/3488-cel-admission-control/README.md) for
123122
validating admission policies.
124123

125124
This enhancement proposes an approach where mutations are declared in CEL by
126-
combining CEL's object instantiation and Server Side Apply's merge algorithms.
125+
combining CEL's object instantiation, JSON Patch, and Server Side Apply's merge algorithms.
127126

128127
## Motivation
129128

@@ -180,18 +179,18 @@ Very similar to what we have in ValidatingAdmissionPolicy, this API separates po
180179
- Policy param resources (custom resources or config maps)
181180

182181
The idea is to leverage the CEL power of the object construction and allow users to define how they want to mutate the admission request through CEL expression.
183-
This proposal aims to allow mutations to be expressed using the "apply configuration" introduced by Server Side Apply.
182+
This proposal aims to allow mutations to be expressed using JSON Patch, or the "apply configuration" introduced by Server Side Apply.
184183
And users would be able to define only the fields they care about inside MutatingAdmissionPolicy, the object will be constructed using CEL which would be similar to a Server Side Apply configuration patch and then be merged into the request object using the structural merge strategy.
185184
See sigs.k8s.io/structured-merge-diff for more details.
186185

187186
Note: See the alternative consideration section for the alternatives.
188187

189188
Pros:
190-
- Consistent with Server Side Apply so that we will continue investing SSA as the best way to do patch updates to resources;
191-
- Does not require the users to learn a new syntax;
192-
- Inherit the declarative nature;
193-
- Existing merging strategy to be leverage without rewritten and the effort of maintaining multiple systems;
194-
- Support the existing makers/openapi extensions.
189+
- JSON Patch provides a migration path from mutating admission webhooks, which must use JSON Patch.
190+
- Also build on Server Side Apply so that we will continue investing SSA as the best way to do patch updates to resources;
191+
- Does not require the users to learn a new syntax;
192+
- Inherit the declarative nature;
193+
- Leverages existing merging strategy, markers and openapi extensions.
195194

196195
Cons:
197196
- Lack of deletion support (see the unsetting values section for the details and workaround);
@@ -229,7 +228,7 @@ spec:
229228
reinvocationPolicy: IfNeeded
230229
mutations:
231230
- patchType: "ApplyConfiguration" // "ApplyConfiguration", "JSONPatch" supported.
232-
mutation: >
231+
expression: >
233232
Object{
234233
spec: Object.spec{
235234
initContainers: [
@@ -250,13 +249,42 @@ The "ApplyConfiguration" strategy will prevent user from performing ambiguous ac
250249
The detailed definition of ambiguous action should be reviewed before beta.
251250
For any mutation requires modification regarding with ambiguous action, "JSONPatch" strategy is needed.
252251

253-
Note:
254-
- "JSONPatch" should be supported before the feature going to beta
255-
- The API design of "JSONPatch" should be discussed before second alpha
252+
The "JSONPatch" strategy will use JSON Patch like what is done in Mutating Webhook.
256253

257-
The "JSONPatch" strategy will use JSONPatch like what is done in Mutating Webhook.
258-
@andrewsykim has a [prototype](https://github.com/kubernetes/enhancements/pull/3776) on this earlier.
259-
The following context will focus on "ApplyConfiguration" strategy.
254+
Example JSON Patch:
255+
256+
```yaml
257+
apiVersion: admissionregistration.k8s.io/v1alpha1
258+
kind: MutatingAdmissionPolicy
259+
metadata:
260+
name: "sidecar-policy.example.com"
261+
spec:
262+
paramKind:
263+
group: mutations.example.com
264+
kind: Sidecar
265+
version: v1
266+
matchConstraints:
267+
resourceRules:
268+
- apiGroups: ["apps"]
269+
apiVersions: ["v1"]
270+
operations: ["CREATE"]
271+
resources: ["pods"]
272+
matchConditions:
273+
- name: does-not-already-have-sidecar
274+
expression: "!object.spec.initContainers.exists(ic, ic.name == params.name)"
275+
failurePolicy: Fail
276+
reinvocationPolicy: IfNeeded
277+
mutations:
278+
- patchType: "JSONPatch"
279+
expression: >
280+
JSONPatch{op: "add", path: "/spec/initContainers/-", value: Object.spec.initContainers{
281+
name: params.name,
282+
image: params.image,
283+
args: params.args,
284+
restartPolicy: params.restartPolicy
285+
// ... other container fields injected here ...
286+
}
287+
```
260288

261289
When "ApplyConfiguration" specified, the expression evaluates to an object that has the same type as the incoming object, and the type alias Object refers to the type (see Type Handling for details).
262290

@@ -460,7 +488,8 @@ For example, to remove the env of a sidecar container, filter by its name.
460488

461489
```yaml
462490
mutations:
463-
- mutaton: >
491+
- patchType: "ApplyConfiguration"
492+
expression: >
464493
Object{
465494
spec: Object.spec{
466495
containers: object.spec.containers{
@@ -496,7 +525,8 @@ List with "map" merge type:
496525
- For associatedList with multiple keys like example above, a directive field added could be used to indicate the deletion.
497526
```yaml
498527
mutations:
499-
- mutaton: >
528+
- patchType: "ApplyConfiguration"
529+
expression: >
500530
Object{
501531
spec: Object.spec{
502532
assocListField: [Object.spec.assocListField{
@@ -512,7 +542,8 @@ mutations:
512542
For examples of removing item from List with Map filtered by a subfield:
513543
```yaml
514544
mutations:
515-
- mutaton: >
545+
- patchType: "ApplyConfiguration"
546+
expression: >
516547
Object{
517548
spec: Object.spec{
518549
containers: object.spec.containers.filter(c, c.envvar != "remove-this-container")
@@ -525,7 +556,8 @@ mutations:
525556
For granular list removal, a use case would be removing an item with a sub field named `remove-this-item`.
526557
```yaml
527558
mutations:
528-
- mutation: >
559+
- patchType: "ApplyConfiguration"
560+
expression: >
529561
Object{
530562
spec: Object.spec{
531563
granularList: object.spec.granularList.filter(c, c.subField != "remove-this-item")
@@ -555,7 +587,7 @@ metadata:
555587
spec:
556588
# ...
557589
mutations:
558-
mutation: >
590+
expression: >
559591
Object{
560592
spec: Object.spec{
561593
initContainers: [
@@ -618,7 +650,8 @@ variables:
618650
variables.targetContainers.map(c, {"name": c.name, "env": {"name": "FOO",
619651
"value": "foo"}})
620652
mutations:
621-
- mutation: |
653+
- patchType: "ApplyConfiguration"
654+
expression: |
622655
Object{
623656
spec: Object.spec{
624657
template: Object.spec.template{
@@ -636,7 +669,8 @@ variables:
636669
expression: >-
637670
params.foo == "bar" ? true : "true"
638671
mutations:
639-
- mutation: |
672+
- patchType: "ApplyConfiguration"
673+
expression: |
640674
Object{
641675
spec: Object.spec{
642676
template: Object.spec.template{
@@ -696,7 +730,8 @@ matchConditions:
696730
- name: 'need-default-ingress-class'
697731
expression: '!has(object.spec.ingressClassName)'
698732
mutations:
699-
- mutation: |
733+
- patchType: "ApplyConfiguration"
734+
expression: |
700735
Object{
701736
spec: Object.spec{
702737
ingressClassName: "defaultIngressClass"
@@ -712,7 +747,8 @@ matchConditions:
712747
- name: 'need-default-storage-class'
713748
expression: '!has(object.spec.storageClassName)'
714749
mutations:
715-
- mutation: |
750+
- patchType: "ApplyConfiguration"
751+
expression: |
716752
Object{
717753
spec: Object.spec{
718754
storageClassName: "defaultStorageClass"
@@ -734,7 +770,8 @@ variables:
734770
- name: volumesList
735771
expression: "object.spec.volumes.map(v, v.name)"
736772
mutations:
737-
- mutation: |
773+
- patchType: "ApplyConfiguration"
774+
expression: |
738775
Object{
739776
spec: Object.spec{
740777
volumes: volumeMountsList.filter(n, !(n in volumesList)).map(v, {
@@ -751,7 +788,8 @@ I have a [gist example](https://gist.github.com/cici37/e8181e53069435a307cd78223
751788
Apply default resource requests to Pods that don't specify any.
752789
```yaml
753790
mutations:
754-
- mutation: |
791+
- patchType: "ApplyConfiguration"
792+
expression: |
755793
Object{
756794
spec: Object.spec{
757795
containers: object.spec.containers.filter(c, !has(c.resources)).map(c,
@@ -771,7 +809,8 @@ matchConditions:
771809
- name: 'no-priority-class'
772810
expression: '!has(object.spec.priorityClassName)'
773811
mutations:
774-
- mutation: |
812+
- patchType: "ApplyConfiguration"
813+
expression: |
775814
Object{
776815
spec: Object.spec{
777816
priorityClassName: params.defaultPriorityClass
@@ -824,7 +863,7 @@ Object{
824863
```
825864

826865
#### Use case: modify deprecated field under CRD versions
827-
Support atomic list modification through JSONPatch
866+
Support atomic list modification through JSON Patch
828867

829868

830869
#### Use Case - mutation VS controller fight
@@ -1523,21 +1562,8 @@ What other approaches did you consider, and why did you rule them out? These do
15231562
not need to be as detailed as the proposal, but should include enough
15241563
information to express the idea and why it was not acceptable.
15251564
-->
1526-
Here are the alternative considerations compared to using the apply configurations introduced by Server Side Apply.
1565+
Here are the alternative considerations compared to using JSON Patch and the apply configurations introduced by Server Side Apply.
15271566

1528-
### Alternative 1: JSONPatch
1529-
1530-
Mutating Admission Webhooks express intended mutation in JSONPatch. Previous attempt by Andrew Sy Kim proposed a similar solution. However, because MutatingAdmissionPolicy, running inside the API server, no longer requires a remote call, modification can apply without serialization as JSONPatch.
1531-
- Pros:
1532-
- Same as the current way Mutation Webhook used
1533-
- Support most of the existing use cases
1534-
- Low learning curve while migration from Mutation Webhook
1535-
- Cons:
1536-
- No type checking
1537-
- Long JSON in declarative API
1538-
- Do not support types like `strategicMergePatch`, `JSONMergePatch` and `ApplyConfigurations`
1539-
- Low learning curve while setting up mutations from scratch
1540-
15411567
### Alternative 2: Introduce new syntax
15421568

15431569
Another alternative consideration would be rewriting your own merge algorithm which is a lot of duplicated effort.

keps/sig-apps/1847-autoremove-statefulset-pvcs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ so that scale-up can leverage the existing volumes. When the application is fini
165165
volumes created by the StatefulSet are no longer needed and can be automatically
166166
reclaimed.
167167

168-
The user would set `persistentVolumeClaimRetentionPolicy.whenDeleted` to `Delete, which
168+
The user would set `persistentVolumeClaimRetentionPolicy.whenDeleted` to `Delete`, which
169169
would ensure that the PVCs created automatically during the StatefulSet
170170
activation is deleted once the StatefulSet is deleted.
171171

keps/sig-apps/3335-statefulset-slice/kep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ owning-sig: sig-apps
66
participating-sigs:
77
- sig-multicluster
88
- sig-storage
9-
status: implementable
9+
status: implemented
1010
creation-date: 2022-06-02
1111
reviewers:
1212
- "@soltysh"

keps/sig-architecture/4330-compatibility-versions/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,7 @@ We intend to have this up and running for Beta
881881
(Leveraging work from KEP-4355 if possible)
882882
- All existing features migrated to versioned feature gate - [kubernetes #125031](https://github.com/kubernetes/kubernetes/issues/125031)
883883
- Verification machinery added - [kubernetes #125032](https://github.com/kubernetes/kubernetes/issues/125032)
884+
- Integrate [test/featuregate_linter](https://github.com/kubernetes/kubernetes/blob/35488ef5c7212a3d491b86e02b1ba05dbbc4b894/test/featuregates_linter/README.md) into golangci-lint
884885

885886
<!--
886887
**Note:** *Not required until targeted at a release.*

keps/sig-auth/3257-cluster-trust-bundles/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ kind: ClusterTrustBundle
290290
metadata:
291291
name: example.com:server-tls:foo
292292
labels:
293-
kubernetes.io/cluster-trust-bundle-version: live
293+
example.com/cluster-trust-bundle-version: live
294294
spec:
295295
signerName: example.com/server-tls
296296
trustBundle: "<... PEM DATA ...>"
@@ -321,7 +321,7 @@ spec:
321321
+ - clusterTrustBundle:
322322
+ signerName: example.com/server-tls
323323
+ labelSelector:
324-
+ kubernetes.io/cluster-trust-bundle-version: live
324+
+ example.com/cluster-trust-bundle-version: live
325325
+ path: ca_certificates.pem
326326
```
327327

@@ -562,11 +562,11 @@ Human operators or controllers may use unique names and labels to maintain diffe
562562

563563
For example, if I maintain `example.com/my-signer`, I can use the following strategy:
564564
* I maintain one ClusterTrustBundle named `example.com:my-signer:live`, labeled
565-
`kubernetes.io/cluster-trust-bundle-version=live` (the object name is mostly
565+
`example.com/cluster-trust-bundle-version=live` (the object name is mostly
566566
irrelevant).
567567
* I maintain an additional ClusterTrustBundle named
568568
`example.com:my-signer:canary`, labeled
569-
`kubernetes.io/cluster-trust-bundle-version=canary`.
569+
`example.com/cluster-trust-bundle-version=canary`.
570570
* I have coordinated some fraction of my workloads to use the canary label
571571
selector, while the bulk of them use the live label selector
572572
* When I want to perform a root rotation or other trust change, I edit the

keps/sig-auth/3257-cluster-trust-bundles/kep.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ stage: beta
2727
# The most recent milestone for which work toward delivery of this KEP has been
2828
# done. This can be the current (upcoming) milestone, if it is being actively
2929
# worked on.
30-
latest-milestone: "v1.32"
30+
latest-milestone: "v1.33"
3131

3232
# The milestone at which this feature was, or is targeted to be, at each stage.
3333
milestone:
3434
alpha: "v1.29"
35-
beta: "v1.32"
35+
beta: "v1.33"
3636
stable: ""
3737

3838
# The following PRR answers are required at alpha release

0 commit comments

Comments
 (0)