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
This commit is contained in:
Shiming Zhang 2022-03-30 02:46:07 +08:00 committed by Kubernetes Publisher
parent 94a1081faf
commit 0c14d0c485
6 changed files with 75 additions and 8 deletions

View File

@ -0,0 +1,39 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
// HostIPApplyConfiguration represents an declarative configuration of the HostIP type for use
// with apply.
type HostIPApplyConfiguration struct {
IP *string `json:"ip,omitempty"`
}
// HostIPApplyConfiguration constructs an declarative configuration of the HostIP type for use with
// apply.
func HostIP() *HostIPApplyConfiguration {
return &HostIPApplyConfiguration{}
}
// WithIP sets the IP field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the IP field is set to the value of the last call.
func (b *HostIPApplyConfiguration) WithIP(value string) *HostIPApplyConfiguration {
b.IP = &value
return b
}

View File

@ -32,6 +32,7 @@ type PodStatusApplyConfiguration struct {
Reason *string `json:"reason,omitempty"`
NominatedNodeName *string `json:"nominatedNodeName,omitempty"`
HostIP *string `json:"hostIP,omitempty"`
HostIPs []HostIPApplyConfiguration `json:"hostIPs,omitempty"`
PodIP *string `json:"podIP,omitempty"`
PodIPs []PodIPApplyConfiguration `json:"podIPs,omitempty"`
StartTime *metav1.Time `json:"startTime,omitempty"`
@ -100,6 +101,19 @@ func (b *PodStatusApplyConfiguration) WithHostIP(value string) *PodStatusApplyCo
return b
}
// WithHostIPs adds the given value to the HostIPs field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the HostIPs field.
func (b *PodStatusApplyConfiguration) WithHostIPs(values ...*HostIPApplyConfiguration) *PodStatusApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithHostIPs")
}
b.HostIPs = append(b.HostIPs, *values[i])
}
return b
}
// WithPodIP sets the PodIP field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PodIP field is set to the value of the last call.

View File

@ -4623,6 +4623,12 @@ var schemaYAML = typed.YAMLObject(`types:
- name: ip
type:
scalar: string
- name: io.k8s.api.core.v1.HostIP
map:
fields:
- name: ip
type:
scalar: string
- name: io.k8s.api.core.v1.HostPathVolumeSource
map:
fields:
@ -5883,6 +5889,12 @@ var schemaYAML = typed.YAMLObject(`types:
- name: hostIP
type:
scalar: string
- name: hostIPs
type:
list:
elementType:
namedType: io.k8s.api.core.v1.HostIP
elementRelationship: associative
- name: initContainerStatuses
type:
list:

View File

@ -611,6 +611,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationscorev1.GRPCActionApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("HostAlias"):
return &applyconfigurationscorev1.HostAliasApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("HostIP"):
return &applyconfigurationscorev1.HostIPApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("HostPathVolumeSource"):
return &applyconfigurationscorev1.HostPathVolumeSourceApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("HTTPGetAction"):

8
go.mod
View File

@ -34,8 +34,8 @@ require (
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
google.golang.org/protobuf v1.27.1
k8s.io/api v0.0.0-20220329085248-f457c96d1ad5
k8s.io/apimachinery v0.0.0-20220328200121-3b8fb46ed6f1
k8s.io/api v0.0.0-20220329211022-ed1c913933d7
k8s.io/apimachinery v0.0.0-20220329130813-31e52c987dc1
k8s.io/klog/v2 v2.60.1
k8s.io/kube-openapi v0.0.0-20220324211241-9f9c01d62a3a
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
@ -44,6 +44,6 @@ require (
)
replace (
k8s.io/api => k8s.io/api v0.0.0-20220329085248-f457c96d1ad5
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20220328200121-3b8fb46ed6f1
k8s.io/api => k8s.io/api v0.0.0-20220329211022-ed1c913933d7
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20220329130813-31e52c987dc1
)

8
go.sum
View File

@ -628,10 +628,10 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20220329085248-f457c96d1ad5 h1:TXyh1FXkZDbvc5kgfNe3TIiOZWCmkrp/ZpvHdFEJxWc=
k8s.io/api v0.0.0-20220329085248-f457c96d1ad5/go.mod h1:9dsqcUbHQ0TcKcDbIZizDq/CAc9ZzLsdgUQ0EE1Jqbo=
k8s.io/apimachinery v0.0.0-20220328200121-3b8fb46ed6f1 h1:VaUIEA4wzN15Ak47QL3NBB4pdwQKe5tCztCLTK+8Fnw=
k8s.io/apimachinery v0.0.0-20220328200121-3b8fb46ed6f1/go.mod h1:WkN7hnr/sIpKTK8v3BZKqLkdqTMz00TBdMWqE0M0O7Q=
k8s.io/api v0.0.0-20220329211022-ed1c913933d7 h1:jkj8qyruAlbi+qRLYnpM9Cz/llMLfJYiykRF0Xqd0qs=
k8s.io/api v0.0.0-20220329211022-ed1c913933d7/go.mod h1:DtY4NYpJTdEZbyZNYT6OchYvejyTwdm7DK07dMzPcII=
k8s.io/apimachinery v0.0.0-20220329130813-31e52c987dc1 h1:ESix+UawmXFu9oem7ngnHSbufLCiIQrvn9TXHB1x/w4=
k8s.io/apimachinery v0.0.0-20220329130813-31e52c987dc1/go.mod h1:WkN7hnr/sIpKTK8v3BZKqLkdqTMz00TBdMWqE0M0O7Q=
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=