Skip to content

Commit bc313c5

Browse files
authored
Merge pull request #5376 from danwinship/kep-3015-to-beta
KEP-3015: PreferSameZone/PreferSameNode to beta
2 parents ee25de8 + 5e5fd61 commit bc313c5

File tree

3 files changed

+58
-36
lines changed

3 files changed

+58
-36
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
kep-number: 3015
55
alpha:
66
approver: "@wojtek-t"
7+
beta:
8+
approver: "@wojtek-t"

keps/sig-network/3015-prefer-same-node/README.md

Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,20 @@ checklist items _must_ be updated for the enhancement to be released.
5555

5656
Items marked with (R) are required *prior to targeting to a milestone / release*.
5757

58-
- [ ] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
59-
- [ ] (R) KEP approvers have approved the KEP status as `implementable`
60-
- [ ] (R) Design details are appropriately documented
61-
- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
62-
- [ ] e2e Tests for all Beta API Operations (endpoints)
58+
- [X] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
59+
- [X] (R) KEP approvers have approved the KEP status as `implementable`
60+
- [X] (R) Design details are appropriately documented
61+
- [X] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
62+
- [X] e2e Tests for all Beta API Operations (endpoints)
6363
- [ ] (R) Ensure GA e2e tests meet requirements for [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
6464
- [ ] (R) Minimum Two Week Window for GA e2e tests to prove flake free
65-
- [ ] (R) Graduation criteria is in place
66-
- [ ] (R) [all GA Endpoints](https://github.com/kubernetes/community/pull/1806) must be hit by [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
67-
- [ ] (R) Production readiness review completed
68-
- [ ] (R) Production readiness review approved
69-
- [ ] "Implementation History" section is up-to-date for milestone
70-
- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
71-
- [ ] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
65+
- [X] (R) Graduation criteria is in place
66+
- [X] (R) [all GA Endpoints](https://github.com/kubernetes/community/pull/1806) must be hit by [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
67+
- [X] (R) Production readiness review completed
68+
- [X] (R) Production readiness review approved
69+
- [X] "Implementation History" section is up-to-date for milestone
70+
- [X] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
71+
- [X] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
7272

7373
<!--
7474
**Note:** This checklist is iterative and should be reviewed and updated every time this enhancement is being considered for a milestone.
@@ -207,10 +207,21 @@ type EndpointHints struct {
207207

208208
// forNodes indicates the node(s) this endpoint should be targeted by.
209209
// +listType=atomic
210-
ForNodes []string `json:"forNodes,omitempty" protobuf:"bytes,2,name=forNodes"`
210+
ForNodes []ForNode `json:"forNodes,omitempty" protobuf:"bytes,2,name=forNodes"`
211+
}
212+
213+
// ForNode provides information about which nodes should consume this endpoint.
214+
type ForNode struct {
215+
// name represents the name of the node.
216+
Name string `json:"name" protobuf:"bytes,1,name=name"`
211217
}
212218
```
213219

220+
(The KEP originally proposed `ForNodes []string` since there are no
221+
use cases for additional information beyond node name. While
222+
implementing it, we decided it was better to have the API be
223+
consistent with `ForZones`.)
224+
214225
When updating EndpointSlices, if the EndpointSlice controller sees a
215226
Service with `PreferSameNode` traffic distribution, then for each
216227
endpoint in the slice, it will add a `ForNodes` hint including the
@@ -253,34 +264,24 @@ N/A
253264
Tests of validation, endpointslice-controller, and kube-proxy will be
254265
updated.
255266

256-
<!--
257-
Additionally, for Alpha try to enumerate the core package you will be touching
258-
to implement this enhancement and provide the current unit coverage for those
259-
in the form of:
260-
- <package>: <date> - <current test coverage>
261-
The data can be easily read from:
262-
https://testgrid.k8s.io/sig-testing-canaries#ci-kubernetes-coverage-unit
263-
264-
This can inform certain test coverage improvements that we want to do before
265-
extending the production code to implement this enhancement.
266-
-->
267-
268-
- `<package>`: `<date>` - `<test coverage>`
267+
- validation: [`TestValidateServiceCreate`](https://github.com/kubernetes/kubernetes/blob/v1.33.0/pkg/apis/core/validation/validation_test.go#L15472), [`TestValidateEndpointSlice`](https://github.com/kubernetes/kubernetes/blob/v1.33.0/pkg/apis/discovery/validation/validation_test.go#L34), [`Test_dropDisabledFieldsOnCreate`](https://github.com/kubernetes/kubernetes/blob/v1.33.0/pkg/registry/discovery/endpointslice/strategy_test.go#L37), [`Test_dropDisabledFieldsOnUpdate`](https://github.com/kubernetes/kubernetes/blob/v1.33.0/pkg/registry/discovery/endpointslice/strategy_test.go#L130)
268+
- endpointslice-controller: [`TestReconcile_TrafficDistribution`](https://github.com/kubernetes/kubernetes/blob/v1.33.0/staging/src/k8s.io/endpointslice/reconciler_test.go#L1976), [`TestReconcileHints`](https://github.com/kubernetes/kubernetes/blob/v1.33.0/staging/src/k8s.io/endpointslice/trafficdist/trafficdist_test.go#L29)
269+
- kube-proxy: [`TestCategorizeEndpoints`](https://github.com/kubernetes/kubernetes/blob/v1.33.0/pkg/proxy/topology_test.go#L48)
269270

270271
##### Integration tests
271272

272273
We will add a test that disabling the feature results in the hints
273274
being removed from the EndpointSlice for Services using the new
274275
`TrafficDistribution` values.
275276

276-
- <test>: <link to test coverage>
277+
- [`Test_TransitionsForPreferSameTrafficDistribution`](https://github.com/kubernetes/kubernetes/blob/v1.33.0/test/integration/service/service_test.go#L556)
277278

278279
##### e2e tests
279280

280281
E2E tests will be added similar to existing traffic distribution
281282
tests, to cover the new options.
282283

283-
- <test>: <link to test coverage>
284+
- [`test/e2e/network/traffic_distribution.go`](https://github.com/kubernetes/kubernetes/blob/v1.33.0/test/e2e/network/traffic_distribution.go)
284285

285286
### Graduation Criteria
286287

@@ -343,7 +344,7 @@ are sure their cluster is non-skewed.
343344
###### How can this feature be enabled / disabled in a live cluster?
344345

345346
- [X] Feature gate (also fill in values in `kep.yaml`)
346-
- Feature gate name: ImprovedTrafficDistribution
347+
- Feature gate name: PreferSameTrafficDistribution
347348
- Components depending on the feature gate:
348349
- kube-apiserver
349350
- kube-controller-manager
@@ -363,7 +364,10 @@ It starts working again.
363364

364365
###### Are there any tests for feature enablement/disablement?
365366

366-
TBD
367+
The unit tests in
368+
`pkg/registry/discovery/endpointslice/strategy_test.go` confirm that
369+
the EndpointSlice `forNodes` hint gets dropped from existing objects
370+
on update when the feature gate is disabled. We will add a test
367371

368372
### Rollout, Upgrade and Rollback Planning
369373

@@ -385,7 +389,21 @@ stop using the feature if it is not working for them.
385389

386390
###### Were upgrade and rollback tested? Was the upgrade->downgrade->upgrade path tested?
387391

388-
TBD
392+
Tested manually in a kind:
393+
394+
- Enabled feature gate, created a Service with `trafficDistribution:
395+
PreferSameNode`, added a Pod, confirmed that the EndpointSlice
396+
contained `forNodes` hints.
397+
398+
- Disabled feature gate, restarted apiserver/kcm, confirmed that the
399+
EndpointSlice still contained the `forNodes` hint. Added another Pod
400+
to the service and confirmed that the EndpointSlice was rewritten
401+
with no `forNodes` hint (for either endpoint).
402+
403+
- Re-enabled the feature gate, restarted apiserver/kcm, confirmed that
404+
the EndpointSlice still contained no `forNodes` hint. Deleted one of
405+
the Pods and confirmed that the EndpointSlice was rewritten
406+
with a `forNodes` hint for the remaining endpoint.
389407

390408
###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.?
391409

@@ -464,8 +482,9 @@ No
464482

465483
###### Will enabling / using this feature result in increasing size or count of the existing API objects?
466484

467-
No (other than that it means people may set `TrafficDistribution` on
468-
Services where they were not previously setting it).
485+
Using `trafficDistribution: PreferSameNode` will result in each
486+
endpoint in each EndpointSlice for the service gaining a `forNodes`
487+
hint containing the endpoint's node name.
469488

470489
###### Will enabling / using this feature result in increasing time taken by any operations covered by existing SLIs/SLOs?
471490

@@ -495,6 +514,7 @@ N/A
495514
- Initial proposal as "Node-level topology": 2022-01-15
496515
- Initial proposal as `TrafficDistribution: PreferSameNode`: 2025-02-06
497516
- Added `TrafficDistribution: PreferSameZone`: 2025-02-08
517+
- Implemented as Alpha in k8s 1.33: 2025-05-30
498518

499519
## Drawbacks
500520

keps/sig-network/3015-prefer-same-node/kep.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ see-also:
1717
replaces:
1818

1919
# The target maturity stage in the current dev cycle for this KEP.
20-
stage: alpha
20+
stage: beta
2121

2222
# The most recent milestone for which work toward delivery of this KEP has been
2323
# done. This can be the current (upcoming) milestone, if it is being actively
2424
# worked on.
25-
latest-milestone: "v1.33"
25+
latest-milestone: "v1.34"
2626

2727
# The milestone at which this feature was, or is targeted to be, at each stage.
2828
milestone:
@@ -33,7 +33,7 @@ milestone:
3333
# The following PRR answers are required at alpha release
3434
# List the feature gate name and the components for which it must be enabled
3535
feature-gates:
36-
- name: ImprovedTrafficDistribution
36+
- name: PreferSameTrafficDistribution
3737
components:
3838
- kube-apiserver
3939
- kube-controller-manager

0 commit comments

Comments
 (0)