mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
Rename IPFamilyPolicyType => IPFamilyPolicy
This commit is contained in:
parent
65361245ed
commit
55232e2ef7
@ -157,7 +157,7 @@ func SetIPFamilies(families ...api.IPFamily) Tweak {
|
||||
}
|
||||
|
||||
// SetIPFamilyPolicy sets the service IPFamilyPolicy field.
|
||||
func SetIPFamilyPolicy(policy api.IPFamilyPolicyType) Tweak {
|
||||
func SetIPFamilyPolicy(policy api.IPFamilyPolicy) Tweak {
|
||||
return func(svc *api.Service) {
|
||||
svc.Spec.IPFamilyPolicy = &policy
|
||||
}
|
||||
|
@ -3736,27 +3736,27 @@ const (
|
||||
IPv6Protocol IPFamily = "IPv6"
|
||||
)
|
||||
|
||||
// IPFamilyPolicyType represents the dual-stack-ness requested or required by a Service
|
||||
type IPFamilyPolicyType string
|
||||
// IPFamilyPolicy represents the dual-stack-ness requested or required by a Service
|
||||
type IPFamilyPolicy string
|
||||
|
||||
const (
|
||||
// IPFamilyPolicySingleStack indicates that this service is required to have a single IPFamily.
|
||||
// The IPFamily assigned is based on the default IPFamily used by the cluster
|
||||
// or as identified by service.spec.ipFamilies field
|
||||
IPFamilyPolicySingleStack IPFamilyPolicyType = "SingleStack"
|
||||
IPFamilyPolicySingleStack IPFamilyPolicy = "SingleStack"
|
||||
// IPFamilyPolicyPreferDualStack indicates that this service prefers dual-stack when
|
||||
// the cluster is configured for dual-stack. If the cluster is not configured
|
||||
// for dual-stack the service will be assigned a single IPFamily. If the IPFamily is not
|
||||
// set in service.spec.ipFamilies then the service will be assigned the default IPFamily
|
||||
// configured on the cluster
|
||||
IPFamilyPolicyPreferDualStack IPFamilyPolicyType = "PreferDualStack"
|
||||
IPFamilyPolicyPreferDualStack IPFamilyPolicy = "PreferDualStack"
|
||||
// IPFamilyPolicyRequireDualStack indicates that this service requires dual-stack. Using
|
||||
// IPFamilyPolicyRequireDualStack on a single stack cluster will result in validation errors. The
|
||||
// IPFamilies (and their order) assigned to this service is based on service.spec.ipFamilies. If
|
||||
// service.spec.ipFamilies was not provided then it will be assigned according to how they are
|
||||
// configured on the cluster. If service.spec.ipFamilies has only one entry then the alternative
|
||||
// IPFamily will be added by apiserver
|
||||
IPFamilyPolicyRequireDualStack IPFamilyPolicyType = "RequireDualStack"
|
||||
IPFamilyPolicyRequireDualStack IPFamilyPolicy = "RequireDualStack"
|
||||
)
|
||||
|
||||
// ServiceSpec describes the attributes that a user creates on a service
|
||||
@ -3829,7 +3829,7 @@ type ServiceSpec struct {
|
||||
// to this service can be controlled by service.spec.ipFamilies and service.spec.clusterIPs
|
||||
// respectively.
|
||||
// +optional
|
||||
IPFamilyPolicy *IPFamilyPolicyType
|
||||
IPFamilyPolicy *IPFamilyPolicy
|
||||
|
||||
// ExternalName is the external reference that kubedns or equivalent will
|
||||
// return as a CNAME record for this service. No proxying will be involved.
|
||||
|
4
pkg/apis/core/v1/zz_generated.conversion.go
generated
4
pkg/apis/core/v1/zz_generated.conversion.go
generated
@ -7709,7 +7709,7 @@ func autoConvert_v1_ServiceSpec_To_core_ServiceSpec(in *v1.ServiceSpec, out *cor
|
||||
out.PublishNotReadyAddresses = in.PublishNotReadyAddresses
|
||||
out.SessionAffinityConfig = (*core.SessionAffinityConfig)(unsafe.Pointer(in.SessionAffinityConfig))
|
||||
out.IPFamilies = *(*[]core.IPFamily)(unsafe.Pointer(&in.IPFamilies))
|
||||
out.IPFamilyPolicy = (*core.IPFamilyPolicyType)(unsafe.Pointer(in.IPFamilyPolicy))
|
||||
out.IPFamilyPolicy = (*core.IPFamilyPolicy)(unsafe.Pointer(in.IPFamilyPolicy))
|
||||
out.AllocateLoadBalancerNodePorts = (*bool)(unsafe.Pointer(in.AllocateLoadBalancerNodePorts))
|
||||
out.LoadBalancerClass = (*string)(unsafe.Pointer(in.LoadBalancerClass))
|
||||
out.InternalTrafficPolicy = (*core.ServiceInternalTrafficPolicyType)(unsafe.Pointer(in.InternalTrafficPolicy))
|
||||
@ -7728,7 +7728,7 @@ func autoConvert_core_ServiceSpec_To_v1_ServiceSpec(in *core.ServiceSpec, out *v
|
||||
out.ClusterIP = in.ClusterIP
|
||||
out.ClusterIPs = *(*[]string)(unsafe.Pointer(&in.ClusterIPs))
|
||||
out.IPFamilies = *(*[]v1.IPFamily)(unsafe.Pointer(&in.IPFamilies))
|
||||
out.IPFamilyPolicy = (*v1.IPFamilyPolicyType)(unsafe.Pointer(in.IPFamilyPolicy))
|
||||
out.IPFamilyPolicy = (*v1.IPFamilyPolicy)(unsafe.Pointer(in.IPFamilyPolicy))
|
||||
out.ExternalName = in.ExternalName
|
||||
out.ExternalIPs = *(*[]string)(unsafe.Pointer(&in.ExternalIPs))
|
||||
out.LoadBalancerIP = in.LoadBalancerIP
|
||||
|
2
pkg/apis/core/zz_generated.deepcopy.go
generated
2
pkg/apis/core/zz_generated.deepcopy.go
generated
@ -5375,7 +5375,7 @@ func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec) {
|
||||
}
|
||||
if in.IPFamilyPolicy != nil {
|
||||
in, out := &in.IPFamilyPolicy, &out.IPFamilyPolicy
|
||||
*out = new(IPFamilyPolicyType)
|
||||
*out = new(IPFamilyPolicy)
|
||||
**out = **in
|
||||
}
|
||||
if in.ExternalIPs != nil {
|
||||
|
@ -1012,7 +1012,7 @@ func isMatchingPreferDualStackClusterIPFields(after After, before Before) bool {
|
||||
|
||||
// Helper to avoid nil-checks all over. Callers of this need to be checking
|
||||
// for an exact value.
|
||||
func getIPFamilyPolicy(svc *api.Service) api.IPFamilyPolicyType {
|
||||
func getIPFamilyPolicy(svc *api.Service) api.IPFamilyPolicy {
|
||||
if svc.Spec.IPFamilyPolicy == nil {
|
||||
return "" // callers need to handle this
|
||||
}
|
||||
|
@ -1239,7 +1239,7 @@ func proveHealthCheckNodePortDeallocated(t *testing.T, storage *wrapperRESTForTe
|
||||
// functional tests of the registry
|
||||
//
|
||||
|
||||
func fmtIPFamilyPolicy(pol *api.IPFamilyPolicyType) string {
|
||||
func fmtIPFamilyPolicy(pol *api.IPFamilyPolicy) string {
|
||||
if pol == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
@ -1453,7 +1453,7 @@ func TestCreateInitIPFields(t *testing.T) {
|
||||
line string
|
||||
svc *api.Service
|
||||
expectError bool
|
||||
expectPolicy api.IPFamilyPolicyType
|
||||
expectPolicy api.IPFamilyPolicy
|
||||
expectFamilies []api.IPFamily
|
||||
expectHeadless bool
|
||||
}
|
||||
@ -5922,7 +5922,7 @@ func TestCreateInvalidClusterIPInputs(t *testing.T) {
|
||||
name: "bad_ipFamilyPolicy",
|
||||
families: []api.IPFamily{api.IPv4Protocol},
|
||||
svc: svctest.MakeService("foo",
|
||||
svctest.SetIPFamilyPolicy(api.IPFamilyPolicyType("garbage"))),
|
||||
svctest.SetIPFamilyPolicy(api.IPFamilyPolicy("garbage"))),
|
||||
expect: []string{"Unsupported value"},
|
||||
}, {
|
||||
name: "requiredual_ipFamilyPolicy_on_singlestack",
|
||||
|
1797
staging/src/k8s.io/api/core/v1/generated.pb.go
generated
1797
staging/src/k8s.io/api/core/v1/generated.pb.go
generated
File diff suppressed because it is too large
Load Diff
@ -4300,30 +4300,34 @@ const (
|
||||
IPv6Protocol IPFamily = "IPv6"
|
||||
)
|
||||
|
||||
// IPFamilyPolicyType represents the dual-stack-ness requested or required by a Service
|
||||
// IPFamilyPolicy represents the dual-stack-ness requested or required by a Service
|
||||
// +enum
|
||||
type IPFamilyPolicyType string
|
||||
type IPFamilyPolicy string
|
||||
|
||||
const (
|
||||
// IPFamilyPolicySingleStack indicates that this service is required to have a single IPFamily.
|
||||
// The IPFamily assigned is based on the default IPFamily used by the cluster
|
||||
// or as identified by service.spec.ipFamilies field
|
||||
IPFamilyPolicySingleStack IPFamilyPolicyType = "SingleStack"
|
||||
IPFamilyPolicySingleStack IPFamilyPolicy = "SingleStack"
|
||||
// IPFamilyPolicyPreferDualStack indicates that this service prefers dual-stack when
|
||||
// the cluster is configured for dual-stack. If the cluster is not configured
|
||||
// for dual-stack the service will be assigned a single IPFamily. If the IPFamily is not
|
||||
// set in service.spec.ipFamilies then the service will be assigned the default IPFamily
|
||||
// configured on the cluster
|
||||
IPFamilyPolicyPreferDualStack IPFamilyPolicyType = "PreferDualStack"
|
||||
IPFamilyPolicyPreferDualStack IPFamilyPolicy = "PreferDualStack"
|
||||
// IPFamilyPolicyRequireDualStack indicates that this service requires dual-stack. Using
|
||||
// IPFamilyPolicyRequireDualStack on a single stack cluster will result in validation errors. The
|
||||
// IPFamilies (and their order) assigned to this service is based on service.spec.ipFamilies. If
|
||||
// service.spec.ipFamilies was not provided then it will be assigned according to how they are
|
||||
// configured on the cluster. If service.spec.ipFamilies has only one entry then the alternative
|
||||
// IPFamily will be added by apiserver
|
||||
IPFamilyPolicyRequireDualStack IPFamilyPolicyType = "RequireDualStack"
|
||||
IPFamilyPolicyRequireDualStack IPFamilyPolicy = "RequireDualStack"
|
||||
)
|
||||
|
||||
// for backwards compat
|
||||
// +enum
|
||||
type IPFamilyPolicyType = IPFamilyPolicy
|
||||
|
||||
// ServiceSpec describes the attributes that a user creates on a service.
|
||||
type ServiceSpec struct {
|
||||
// The list of ports that are exposed by this service.
|
||||
@ -4528,7 +4532,7 @@ type ServiceSpec struct {
|
||||
// ipFamilies and clusterIPs fields depend on the value of this field. This
|
||||
// field will be wiped when updating a service to type ExternalName.
|
||||
// +optional
|
||||
IPFamilyPolicy *IPFamilyPolicyType `json:"ipFamilyPolicy,omitempty" protobuf:"bytes,17,opt,name=ipFamilyPolicy,casttype=IPFamilyPolicyType"`
|
||||
IPFamilyPolicy *IPFamilyPolicy `json:"ipFamilyPolicy,omitempty" protobuf:"bytes,17,opt,name=ipFamilyPolicy,casttype=IPFamilyPolicy"`
|
||||
|
||||
// allocateLoadBalancerNodePorts defines if NodePorts will be automatically
|
||||
// allocated for services with type LoadBalancer. Default is "true". It
|
||||
|
@ -5405,7 +5405,7 @@ func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec) {
|
||||
}
|
||||
if in.IPFamilyPolicy != nil {
|
||||
in, out := &in.IPFamilyPolicy, &out.IPFamilyPolicy
|
||||
*out = new(IPFamilyPolicyType)
|
||||
*out = new(IPFamilyPolicy)
|
||||
**out = **in
|
||||
}
|
||||
if in.AllocateLoadBalancerNodePorts != nil {
|
||||
|
@ -40,7 +40,7 @@ type ServiceSpecApplyConfiguration struct {
|
||||
PublishNotReadyAddresses *bool `json:"publishNotReadyAddresses,omitempty"`
|
||||
SessionAffinityConfig *SessionAffinityConfigApplyConfiguration `json:"sessionAffinityConfig,omitempty"`
|
||||
IPFamilies []corev1.IPFamily `json:"ipFamilies,omitempty"`
|
||||
IPFamilyPolicy *corev1.IPFamilyPolicyType `json:"ipFamilyPolicy,omitempty"`
|
||||
IPFamilyPolicy *corev1.IPFamilyPolicy `json:"ipFamilyPolicy,omitempty"`
|
||||
AllocateLoadBalancerNodePorts *bool `json:"allocateLoadBalancerNodePorts,omitempty"`
|
||||
LoadBalancerClass *string `json:"loadBalancerClass,omitempty"`
|
||||
InternalTrafficPolicy *corev1.ServiceInternalTrafficPolicyType `json:"internalTrafficPolicy,omitempty"`
|
||||
@ -194,7 +194,7 @@ func (b *ServiceSpecApplyConfiguration) WithIPFamilies(values ...corev1.IPFamily
|
||||
// WithIPFamilyPolicy sets the IPFamilyPolicy 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 IPFamilyPolicy field is set to the value of the last call.
|
||||
func (b *ServiceSpecApplyConfiguration) WithIPFamilyPolicy(value corev1.IPFamilyPolicyType) *ServiceSpecApplyConfiguration {
|
||||
func (b *ServiceSpecApplyConfiguration) WithIPFamilyPolicy(value corev1.IPFamilyPolicy) *ServiceSpecApplyConfiguration {
|
||||
b.IPFamilyPolicy = &value
|
||||
return b
|
||||
}
|
||||
|
@ -694,7 +694,7 @@ func validateNumOfServicePorts(svc *v1.Service, expectedNumOfPorts int) {
|
||||
}
|
||||
}
|
||||
|
||||
func validateServiceAndClusterIPFamily(svc *v1.Service, expectedIPFamilies []v1.IPFamily, expectedPolicy *v1.IPFamilyPolicyType) {
|
||||
func validateServiceAndClusterIPFamily(svc *v1.Service, expectedIPFamilies []v1.IPFamily, expectedPolicy *v1.IPFamilyPolicy) {
|
||||
if len(svc.Spec.IPFamilies) != len(expectedIPFamilies) {
|
||||
framework.Failf("service ip family nil for service %s/%s", svc.Namespace, svc.Name)
|
||||
}
|
||||
@ -777,7 +777,7 @@ func checkNetworkConnectivity(ip, port string, timeout int) []string {
|
||||
}
|
||||
|
||||
// createService returns a service spec with defined arguments
|
||||
func createService(name, ns string, labels map[string]string, ipFamilyPolicy *v1.IPFamilyPolicyType, ipFamilies []v1.IPFamily) *v1.Service {
|
||||
func createService(name, ns string, labels map[string]string, ipFamilyPolicy *v1.IPFamilyPolicy, ipFamilies []v1.IPFamily) *v1.Service {
|
||||
return &v1.Service{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
|
@ -115,7 +115,7 @@ func TestDualStackEndpoints(t *testing.T) {
|
||||
name string
|
||||
serviceType v1.ServiceType
|
||||
ipFamilies []v1.IPFamily
|
||||
ipFamilyPolicy v1.IPFamilyPolicyType
|
||||
ipFamilyPolicy v1.IPFamilyPolicy
|
||||
}{
|
||||
{
|
||||
name: "Service IPv4 Only",
|
||||
|
@ -68,7 +68,7 @@ func TestCreateServiceSingleStackIPv4(t *testing.T) {
|
||||
serviceType v1.ServiceType
|
||||
clusterIPs []string
|
||||
ipFamilies []v1.IPFamily
|
||||
ipFamilyPolicy v1.IPFamilyPolicyType
|
||||
ipFamilyPolicy v1.IPFamilyPolicy
|
||||
expectedIPFamilies []v1.IPFamily
|
||||
expectError bool
|
||||
}{
|
||||
@ -282,7 +282,7 @@ func TestCreateServiceDualStackIPv6(t *testing.T) {
|
||||
clusterIPs []string
|
||||
ipFamilies []v1.IPFamily
|
||||
expectedIPFamilies []v1.IPFamily
|
||||
ipFamilyPolicy v1.IPFamilyPolicyType
|
||||
ipFamilyPolicy v1.IPFamilyPolicy
|
||||
expectError bool
|
||||
}{
|
||||
{
|
||||
@ -497,7 +497,7 @@ func TestCreateServiceDualStackIPv4IPv6(t *testing.T) {
|
||||
clusterIPs []string
|
||||
ipFamilies []v1.IPFamily
|
||||
expectedIPFamilies []v1.IPFamily
|
||||
ipFamilyPolicy v1.IPFamilyPolicyType
|
||||
ipFamilyPolicy v1.IPFamilyPolicy
|
||||
expectError bool
|
||||
}{
|
||||
{
|
||||
@ -725,7 +725,7 @@ func TestCreateServiceDualStackIPv6IPv4(t *testing.T) {
|
||||
clusterIPs []string
|
||||
ipFamilies []v1.IPFamily
|
||||
expectedIPFamilies []v1.IPFamily
|
||||
ipFamilyPolicy v1.IPFamilyPolicyType
|
||||
ipFamilyPolicy v1.IPFamilyPolicy
|
||||
expectError bool
|
||||
}{
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user