Skip to content

Commit c0e42f4

Browse files
authored
Merge pull request kubernetes#2661 from wzshiming/add-pod-host-ips
KEP-2681: Field status.hostIPs added for Pod
2 parents 809c51c + 622ebf9 commit c0e42f4

File tree

3 files changed

+409
-0
lines changed

3 files changed

+409
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kep-number: 2681
2+
alpha:
3+
approver: "@wojtek-t"
Lines changed: 359 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,359 @@
1+
# KEP-2681: Field status.hostIPs added for Pod
2+
3+
<!-- toc -->
4+
- [Release Signoff Checklist](#release-signoff-checklist)
5+
- [Summary](#summary)
6+
- [Motivation](#motivation)
7+
- [Goals](#goals)
8+
- [Non-Goals](#non-goals)
9+
- [Proposal](#proposal)
10+
- [User Stories](#user-stories)
11+
- [Story 1](#story-1)
12+
- [Risks and Mitigations](#risks-and-mitigations)
13+
- [Design Details](#design-details)
14+
- [Versioned API Change: PodStatus v1 core](#versioned-api-change-podstatus-v1-core)
15+
- [PodStatus Internal Representation](#podstatus-internal-representation)
16+
- [Maintaining Compatible Interworking between Old and New Clients](#maintaining-compatible-interworking-between-old-and-new-clients)
17+
- [Container Environment Variables](#container-environment-variables)
18+
- [Test Plan](#test-plan)
19+
- [Expected behavior](#expected-behavior)
20+
- [Graduation Criteria](#graduation-criteria)
21+
- [Alpha](#alpha)
22+
- [Alpha -&gt; Beta Graduation](#alpha---beta-graduation)
23+
- [Beta -&gt; GA Graduation](#beta---ga-graduation)
24+
- [Removing a Deprecated Flag](#removing-a-deprecated-flag)
25+
- [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy)
26+
- [Version Skew Strategy](#version-skew-strategy)
27+
- [Production Readiness Review Questionnaire](#production-readiness-review-questionnaire)
28+
- [Feature Enablement and Rollback](#feature-enablement-and-rollback)
29+
- [Rollout, Upgrade and Rollback Planning](#rollout-upgrade-and-rollback-planning)
30+
- [Monitoring Requirements](#monitoring-requirements)
31+
- [Dependencies](#dependencies)
32+
- [Scalability](#scalability)
33+
- [Troubleshooting](#troubleshooting)
34+
- [Implementation History](#implementation-history)
35+
- [Drawbacks](#drawbacks)
36+
- [Alternatives](#alternatives)
37+
- [Infrastructure Needed (Optional)](#infrastructure-needed-optional)
38+
<!-- /toc -->
39+
40+
## Release Signoff Checklist
41+
42+
Items marked with (R) are required *prior to targeting to a milestone / release*.
43+
44+
- [x] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
45+
- [ ] (R) KEP approvers have approved the KEP status as `implementable`
46+
- [ ] (R) Design details are appropriately documented
47+
- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
48+
- [ ] e2e Tests for all Beta API Operations (endpoints)
49+
- [ ] (R) Ensure GA e2e tests for meet requirements for [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
50+
- [ ] (R) Minimum Two Week Window for GA e2e tests to prove flake free
51+
- [ ] (R) Graduation criteria is in place
52+
- [ ] (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)
53+
- [ ] (R) Production readiness review completed
54+
- [ ] (R) Production readiness review approved
55+
- [ ] "Implementation History" section is up-to-date for milestone
56+
- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
57+
- [ ] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
58+
59+
[kubernetes.io]: https://kubernetes.io/
60+
[kubernetes/enhancements]: https://git.k8s.io/enhancements
61+
[kubernetes/kubernetes]: https://git.k8s.io/kubernetes
62+
[kubernetes/website]: https://git.k8s.io/website
63+
64+
## Summary
65+
66+
The proposal aims to improve the Pod's ability to obtain the address of the node
67+
68+
## Motivation
69+
70+
### Goals
71+
72+
- Field `status.hostIPs` added for Pod
73+
- Downward API support for `status.hostIPs`
74+
75+
### Non-Goals
76+
77+
## Proposal
78+
79+
### User Stories
80+
81+
#### Story 1
82+
83+
Applications that originally used IPv4 migrated to IPv6 during the dual-stack transition phase,
84+
For smooth migration, IP-related attributes should have both IPv4 and IPv6.
85+
86+
### Risks and Mitigations
87+
88+
<!--
89+
What are the risks of this proposal, and how do we mitigate? Think broadly.
90+
For example, consider both security and how this will impact the larger
91+
Kubernetes ecosystem.
92+
93+
How will security be reviewed, and by whom?
94+
95+
How will UX be reviewed, and by whom?
96+
97+
Consider including folks who also work outside the SIG or subproject.
98+
-->
99+
100+
## Design Details
101+
102+
### Versioned API Change: PodStatus v1 core
103+
104+
In order to maintain backwards compatibility for the core V1 API, this proposal
105+
retains the existing (singular) "HostIP" field in the core V1 version of the
106+
PodStatus V1 core API and adds a new array of structures that store host IPs
107+
along with associated metadata for that IP.
108+
109+
``` go
110+
// HostIP represents the IP address of a host.
111+
// IP address information. Each entry includes:
112+
// IP: An IP address allocated to the host.
113+
type HostIP struct {
114+
// ip is an IP address (IPv4 or IPv6) assigned to the host
115+
IP string
116+
}
117+
118+
// HostIPs holds the IP addresses allocated to the host. If this field is specified, the 0th entry must
119+
// match the hostIP field. This list is empty if no IPs have been allocated yet.
120+
// +optional
121+
HostIPs []HostIP
122+
```
123+
124+
### PodStatus Internal Representation
125+
126+
PodStatus internally indicates that the original use of HostIP will remain unchanged,
127+
and HostIPs is added for subsequent use
128+
129+
``` go
130+
// HostIP address information for entries in the (plural) HostIPs field.
131+
// Each entry includes:
132+
// IP: An IP address allocated to the host.
133+
type HostIP struct {
134+
// ip is an IP address (IPv4 or IPv6) assigned to the host
135+
IP string `json:"ip,omitempty" protobuf:"bytes,1,opt,name=ip"`
136+
}
137+
138+
// HostIPs holds the IP addresses allocated to the host. If this field is specified, the 0th entry must
139+
// match the hostIP field. This list is empty if no IPs have been allocated yet.
140+
// +optional
141+
// +patchStrategy=merge
142+
// +patchMergeKey=ip
143+
HostIPs []HostIP `json:"hostIPs,omitempty" protobuf:"bytes,14,rep,name=hostIPs" patchStrategy:"merge" patchMergeKey:"ip"`
144+
```
145+
146+
### Maintaining Compatible Interworking between Old and New Clients
147+
148+
[See the making a singular field plural](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md#making-a-singular-field-plural)
149+
150+
### Container Environment Variables
151+
152+
The Downward API [status.hostIP](https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#capabilities-of-the-downward-api)
153+
will preserve the existing single IP address, and will be set to the default IP for each pod.
154+
A new pod API field named `status.hostIPs` will contain a list of IP addresses.
155+
The new pod API will have a slice of structures for the additional IP addresses.
156+
Kubelet will translate the pod structures and return `status.hostIPs` as a comma-delimited string.
157+
158+
Here is an example of how to define a pluralized `MY_HOST_IPS` environmental
159+
variable in a pod definition yaml file:
160+
161+
``` yaml
162+
- name: MY_HOST_IPS
163+
valueFrom:
164+
fieldRef:
165+
fieldPath: status.hostIPs
166+
```
167+
168+
This definition will cause an environmental variable setting in the pod similar
169+
to the following:
170+
171+
```
172+
# PodHostIPs FeatureGate is enabled
173+
MY_HOST_IPS=fd00:10:20:0:3::3,10.20.3.3
174+
175+
# PodHostIPs FeatureGate is disabled
176+
MY_HOST_IPS=
177+
```
178+
179+
### Test Plan
180+
181+
Test whether FeatureGate behaves as expected when it is turned on or off
182+
Test whether Downward API supports `status.hostIPs`
183+
184+
#### Expected behavior
185+
186+
- If PodHostIPs FeatureGate is enabled:
187+
- `status.hostIPs` there will be all host IPs (IPv4 and IPv6)
188+
- Else:
189+
- `status.hostIPs` will be empty and the ApiServer will reject Downward API `status.hostIPs`,
190+
if Pods already existing Downward API `status.hostIPs`, ensure to ignore it and not affect others.
191+
192+
### Graduation Criteria
193+
194+
#### Alpha
195+
196+
- Feature implemented behind a feature flag
197+
- Add `status.hostIPs` to the PodStatus API
198+
- Downward API support for `status.hostIPs`
199+
- Basic units and e2e tests completed and enabled
200+
201+
#### Alpha -> Beta Graduation
202+
203+
- Gather feedback from developers and users
204+
- Expand the e2e tests with more scenarios
205+
- Tests are in Testgrid and linked in the KEP
206+
207+
#### Beta -> GA Graduation
208+
209+
- 2 examples of end users using this field
210+
- Allowing time for feedback
211+
212+
#### Removing a Deprecated Flag
213+
214+
- Announce deprecation and support policy of the existing flag
215+
- Two versions passed since introducing the functionality that deprecates the flag (to address version skew)
216+
- Address feedback on usage/changed behavior, provided on GitHub issues
217+
- Deprecate the flag
218+
219+
### Upgrade / Downgrade Strategy
220+
221+
N/A
222+
223+
### Version Skew Strategy
224+
225+
N/A
226+
227+
## Production Readiness Review Questionnaire
228+
229+
### Feature Enablement and Rollback
230+
231+
###### How can this feature be enabled / disabled in a live cluster?
232+
233+
- [x] Feature gate (also fill in values in `kep.yaml`)
234+
- Feature gate name: PodHostIPs
235+
- Components depending on the feature gate: `kube-apiserver`, `kubelet`
236+
- [ ] Other
237+
- Describe the mechanism:
238+
- Will enabling / disabling the feature require downtime of the control
239+
plane?
240+
- Will enabling / disabling the feature require downtime or reprovisioning
241+
of a node? (Do not assume `Dynamic Kubelet Config` feature is enabled).
242+
243+
###### Does enabling the feature change any default behavior?
244+
245+
No.
246+
247+
###### Can the feature be disabled once it has been enabled (i.e. can we roll back the enablement)?
248+
249+
Yes. Using the featuregate is the only way to enable/disable this feature.
250+
251+
###### What happens if we reenable the feature if it was previously rolled back?
252+
253+
The feature should continue to work just fine.
254+
255+
###### Are there any tests for feature enablement/disablement?
256+
257+
No, these will be introduced in the Alpha phase.
258+
259+
### Rollout, Upgrade and Rollback Planning
260+
261+
###### How can a rollout or rollback fail? Can it impact already running workloads?
262+
263+
If the dependent [KEP 563-dual-stack](https://github.com/kubernetes/enhancements/issues/563) is wrong, or could not get IP of host, or setting the field is crashing, this feature may fail to rollout/rollback.
264+
The field is only informative, it doesn't affect running workloads.
265+
266+
###### What specific metrics should inform a rollback?
267+
268+
The `status.hostIPs` field in Pod is empty, or frequently updated, or cause any other to crash.
269+
270+
###### Were upgrade and rollback tested? Was the upgrade->downgrade->upgrade path tested?
271+
272+
TBD.
273+
274+
###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.?
275+
276+
No.
277+
278+
### Monitoring Requirements
279+
280+
###### How can an operator determine if the feature is in use by workloads?
281+
282+
Pod has a `status.hostIPs` field and use it in downwardAPI to expose it.
283+
284+
###### How can someone using this feature know that it is working for their instance?
285+
286+
- [ ] Events
287+
- Event Reason:
288+
- [x] API .status
289+
- Other field: `pod.status.hostIPs` is not empty.
290+
- [ ] Other (treat as last resort)
291+
- Details:
292+
293+
###### What are the reasonable SLOs (Service Level Objectives) for the enhancement?
294+
295+
- The feature is only informative, no increased failure rates during use the feature.
296+
297+
###### What are the SLIs (Service Level Indicators) an operator can use to determine the health of the service?
298+
299+
- TBD
300+
301+
###### Are there any missing metrics that would be useful to have to improve observability of this feature?
302+
303+
No additional metrics needed for this new API field.
304+
305+
### Dependencies
306+
307+
###### Does this feature depend on any specific services running in the cluster?
308+
309+
N/A
310+
311+
### Scalability
312+
313+
###### Will enabling / using this feature result in any new API calls?
314+
315+
No
316+
317+
###### Will enabling / using this feature result in introducing new API types?
318+
319+
No
320+
321+
###### Will enabling / using this feature result in any new calls to the cloud provider?
322+
323+
No
324+
325+
###### Will enabling / using this feature result in increasing size or count of the existing API objects?
326+
327+
Yes.
328+
329+
- API type(s): Pod
330+
- Estimated increase in size:
331+
- New field in Status about 8 bytes, additional bytes based on whether IPv4(about 4 bytes) or IPv6(about 16 bytes) exists
332+
333+
###### Will enabling / using this feature result in increasing time taken by any operations covered by existing SLIs/SLOs?
334+
335+
No
336+
337+
###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components?
338+
339+
No
340+
341+
### Troubleshooting
342+
343+
N/A
344+
345+
## Implementation History
346+
347+
- 2021-05-06: Initial KEP
348+
349+
## Drawbacks
350+
351+
N/A
352+
353+
## Alternatives
354+
355+
N/A
356+
357+
## Infrastructure Needed (Optional)
358+
359+
N/A

0 commit comments

Comments
 (0)