Skip to content

Commit ed1c913

Browse files
wzshimingk8s-publishing-bot
authored andcommitted
Field status.hostIPs added for Pod (#101566)
* Add FeatureGate PodHostIPs * Add HostIPs field and update PodIPs field * Types conversion * Add dropDisabledStatusFields * Add HostIPs for kubelet * Add fuzzer for PodStatus * Add status.hostIPs in ConvertDownwardAPIFieldLabel * Add status.hostIPs in validEnvDownwardAPIFieldPathExpressions * Downward API support for status.hostIPs * Add DownwardAPI validation for status.hostIPs * Add e2e to check that hostIPs works * Add e2e to check that Downward API works * Regenerate Kubernetes-commit: 61b3c028ba618a939559c39befb546ae5e5fd0b9
1 parent f457c96 commit ed1c913

13 files changed

+1357
-1056
lines changed

core/v1/generated.pb.go

Lines changed: 1257 additions & 1036 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/v1/generated.proto

Lines changed: 23 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/v1/types.go

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3605,11 +3605,15 @@ type PodDNSConfigOption struct {
36053605
Value *string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"`
36063606
}
36073607

3608-
// IP address information for entries in the (plural) PodIPs field.
3609-
// Each entry includes:
3610-
// IP: An IP address allocated to the pod. Routable at least within the cluster.
3608+
// PodIP address information for entries in the (plural) PodIPs field.
36113609
type PodIP struct {
3612-
// ip is an IP address (IPv4 or IPv6) assigned to the pod
3610+
// IP is the IP address assigned to the pod
3611+
IP string `json:"ip,omitempty" protobuf:"bytes,1,opt,name=ip"`
3612+
}
3613+
3614+
// HostIP address information for entries in the (plural) HostIPs field.
3615+
type HostIP struct {
3616+
// IP is the IP address assigned to the host
36133617
IP string `json:"ip,omitempty" protobuf:"bytes,1,opt,name=ip"`
36143618
}
36153619

@@ -3830,10 +3834,24 @@ type PodStatus struct {
38303834
// +optional
38313835
NominatedNodeName string `json:"nominatedNodeName,omitempty" protobuf:"bytes,11,opt,name=nominatedNodeName"`
38323836

3833-
// IP address of the host to which the pod is assigned. Empty if not yet scheduled.
3837+
// hostIP holds the IP address of the host to which the pod is assigned.
3838+
// Empty if the pod has not started yet.
3839+
// A pod can be assigned to a node that has a problem in kubelet which in turns mean that HostIP will
3840+
// not be updated even if there is node is assigned to pod
38343841
// +optional
38353842
HostIP string `json:"hostIP,omitempty" protobuf:"bytes,5,opt,name=hostIP"`
3836-
// IP address allocated to the pod. Routable at least within the cluster.
3843+
3844+
// hostIPs holds the IP addresses allocated to the host. If this field is specified, the first entry must
3845+
// match the hostIP field. This list is empty if the pod has not started yet.
3846+
// A pod can be assigned to a node that has a problem in kubelet which in turns means that HostIPs will
3847+
// not be updated even if there is a node is assigned to this pod.
3848+
// +optional
3849+
// +patchStrategy=merge
3850+
// +patchMergeKey=ip
3851+
// +listType=set
3852+
HostIPs []HostIP `json:"hostIPs,omitempty" protobuf:"bytes,14,rep,name=hostIPs" patchStrategy:"merge" patchMergeKey:"ip"`
3853+
3854+
// podIP address allocated to the pod. Routable at least within the cluster.
38373855
// Empty if not yet allocated.
38383856
// +optional
38393857
PodIP string `json:"podIP,omitempty" protobuf:"bytes,6,opt,name=podIP"`

core/v1/types_swagger_doc_generated.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,15 @@ func (HostAlias) SwaggerDoc() map[string]string {
825825
return map_HostAlias
826826
}
827827

828+
var map_HostIP = map[string]string{
829+
"": "HostIP address information for entries in the (plural) HostIPs field.",
830+
"ip": "IP is the IP address assigned to the host",
831+
}
832+
833+
func (HostIP) SwaggerDoc() map[string]string {
834+
return map_HostIP
835+
}
836+
828837
var map_HostPathVolumeSource = map[string]string{
829838
"": "Represents a host path mapped into a pod. Host path volumes do not support ownership management or SELinux relabeling.",
830839
"path": "path of the directory on the host. If the path is a symlink, it will follow the link to the real path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath",
@@ -1534,8 +1543,8 @@ func (PodExecOptions) SwaggerDoc() map[string]string {
15341543
}
15351544

15361545
var map_PodIP = map[string]string{
1537-
"": "IP address information for entries in the (plural) PodIPs field. Each entry includes:\n IP: An IP address allocated to the pod. Routable at least within the cluster.",
1538-
"ip": "ip is an IP address (IPv4 or IPv6) assigned to the pod",
1546+
"": "PodIP address information for entries in the (plural) PodIPs field.",
1547+
"ip": "IP is the IP address assigned to the pod",
15391548
}
15401549

15411550
func (PodIP) SwaggerDoc() map[string]string {
@@ -1683,8 +1692,9 @@ var map_PodStatus = map[string]string{
16831692
"message": "A human readable message indicating details about why the pod is in this condition.",
16841693
"reason": "A brief CamelCase message indicating details about why the pod is in this state. e.g. 'Evicted'",
16851694
"nominatedNodeName": "nominatedNodeName is set only when this pod preempts other pods on the node, but it cannot be scheduled right away as preemption victims receive their graceful termination periods. This field does not guarantee that the pod will be scheduled on this node. Scheduler may decide to place the pod elsewhere if other nodes become available sooner. Scheduler may also decide to give the resources on this node to a higher priority pod that is created after preemption. As a result, this field may be different than PodSpec.nodeName when the pod is scheduled.",
1686-
"hostIP": "IP address of the host to which the pod is assigned. Empty if not yet scheduled.",
1687-
"podIP": "IP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.",
1695+
"hostIP": "hostIP holds the IP address of the host to which the pod is assigned. Empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns mean that HostIP will not be updated even if there is node is assigned to pod",
1696+
"hostIPs": "hostIPs holds the IP addresses allocated to the host. If this field is specified, the first entry must match the hostIP field. This list is empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns means that HostIPs will not be updated even if there is a node is assigned to this pod.",
1697+
"podIP": "podIP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.",
16881698
"podIPs": "podIPs holds the IP addresses allocated to the pod. If this field is specified, the 0th entry must match the podIP field. Pods may be allocated at most 1 value for each of IPv4 and IPv6. This list is empty if no IPs have been allocated yet.",
16891699
"startTime": "RFC 3339 date and time at which the object was acknowledged by the Kubelet. This is before the Kubelet pulled the container image(s) for the pod.",
16901700
"initContainerStatuses": "The list has one entry per init container in the manifest. The most recent successful init container will have ready = true, the most recently started container will have startTime set. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status",

core/v1/zz_generated.deepcopy.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ go 1.16
77
require (
88
github.com/gogo/protobuf v1.3.2
99
github.com/stretchr/testify v1.7.0
10-
k8s.io/apimachinery v0.0.0-20220328200121-3b8fb46ed6f1
10+
k8s.io/apimachinery v0.0.0-20220329130813-31e52c987dc1
1111
)
1212

13-
replace k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20220328200121-3b8fb46ed6f1
13+
replace k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20220329130813-31e52c987dc1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v
221221
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
222222
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
223223
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
224-
k8s.io/apimachinery v0.0.0-20220328200121-3b8fb46ed6f1 h1:VaUIEA4wzN15Ak47QL3NBB4pdwQKe5tCztCLTK+8Fnw=
225-
k8s.io/apimachinery v0.0.0-20220328200121-3b8fb46ed6f1/go.mod h1:WkN7hnr/sIpKTK8v3BZKqLkdqTMz00TBdMWqE0M0O7Q=
224+
k8s.io/apimachinery v0.0.0-20220329130813-31e52c987dc1 h1:ESix+UawmXFu9oem7ngnHSbufLCiIQrvn9TXHB1x/w4=
225+
k8s.io/apimachinery v0.0.0-20220329130813-31e52c987dc1/go.mod h1:WkN7hnr/sIpKTK8v3BZKqLkdqTMz00TBdMWqE0M0O7Q=
226226
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
227227
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
228228
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=

testdata/HEAD/core.v1.Pod.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,6 +1582,11 @@
15821582
"reason": "reasonValue",
15831583
"nominatedNodeName": "nominatedNodeNameValue",
15841584
"hostIP": "hostIPValue",
1585+
"hostIPs": [
1586+
{
1587+
"ip": "ipValue"
1588+
}
1589+
],
15851590
"podIP": "podIPValue",
15861591
"podIPs": [
15871592
{

testdata/HEAD/core.v1.Pod.pb

11 Bytes
Binary file not shown.

testdata/HEAD/core.v1.Pod.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,8 @@ status:
11591159
message: messageValue
11601160
reason: reasonValue
11611161
hostIP: hostIPValue
1162+
hostIPs:
1163+
- ip: ipValue
11621164
initContainerStatuses:
11631165
- containerID: containerIDValue
11641166
image: imageValue

testdata/HEAD/core.v1.PodStatusResult.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@
6060
"reason": "reasonValue",
6161
"nominatedNodeName": "nominatedNodeNameValue",
6262
"hostIP": "hostIPValue",
63+
"hostIPs": [
64+
{
65+
"ip": "ipValue"
66+
}
67+
],
6368
"podIP": "podIPValue",
6469
"podIPs": [
6570
{
11 Bytes
Binary file not shown.

testdata/HEAD/core.v1.PodStatusResult.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ status:
114114
message: messageValue
115115
reason: reasonValue
116116
hostIP: hostIPValue
117+
hostIPs:
118+
- ip: ipValue
117119
initContainerStatuses:
118120
- containerID: containerIDValue
119121
image: imageValue

0 commit comments

Comments
 (0)