mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
ServiceInternalTrafficPolicyType: s/Type//
Rename ServiceInternalTrafficPolicyType => ServiceInternalTrafficPolicy
This commit is contained in:
parent
d0e2b06850
commit
dd0a50336e
@ -177,7 +177,7 @@ func SetNodePorts(values ...int) Tweak {
|
||||
}
|
||||
|
||||
// SetInternalTrafficPolicy sets the internalTrafficPolicy field for a Service.
|
||||
func SetInternalTrafficPolicy(policy api.ServiceInternalTrafficPolicyType) Tweak {
|
||||
func SetInternalTrafficPolicy(policy api.ServiceInternalTrafficPolicy) Tweak {
|
||||
return func(svc *api.Service) {
|
||||
svc.Spec.InternalTrafficPolicy = &policy
|
||||
}
|
||||
|
@ -297,8 +297,8 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
types := []core.ServiceExternalTrafficPolicy{core.ServiceExternalTrafficPolicyCluster, core.ServiceExternalTrafficPolicyLocal}
|
||||
*p = types[c.Rand.Intn(len(types))]
|
||||
},
|
||||
func(p *core.ServiceInternalTrafficPolicyType, c fuzz.Continue) {
|
||||
types := []core.ServiceInternalTrafficPolicyType{core.ServiceInternalTrafficPolicyCluster, core.ServiceInternalTrafficPolicyLocal}
|
||||
func(p *core.ServiceInternalTrafficPolicy, c fuzz.Continue) {
|
||||
types := []core.ServiceInternalTrafficPolicy{core.ServiceInternalTrafficPolicyCluster, core.ServiceInternalTrafficPolicyLocal}
|
||||
*p = types[c.Rand.Intn(len(types))]
|
||||
},
|
||||
func(ct *core.Container, c fuzz.Continue) {
|
||||
|
@ -3781,18 +3781,18 @@ const (
|
||||
ServiceTypeExternalName ServiceType = "ExternalName"
|
||||
)
|
||||
|
||||
// ServiceInternalTrafficPolicyType describes the endpoint-selection policy for
|
||||
// ServiceInternalTrafficPolicy describes the endpoint-selection policy for
|
||||
// traffic sent to the ClusterIP.
|
||||
type ServiceInternalTrafficPolicyType string
|
||||
type ServiceInternalTrafficPolicy string
|
||||
|
||||
const (
|
||||
// ServiceInternalTrafficPolicyCluster routes traffic to all endpoints.
|
||||
ServiceInternalTrafficPolicyCluster ServiceInternalTrafficPolicyType = "Cluster"
|
||||
ServiceInternalTrafficPolicyCluster ServiceInternalTrafficPolicy = "Cluster"
|
||||
|
||||
// ServiceInternalTrafficPolicyLocal routes traffic only to endpoints on the same
|
||||
// node as the traffic was received on (dropping the traffic if there are no
|
||||
// local endpoints).
|
||||
ServiceInternalTrafficPolicyLocal ServiceInternalTrafficPolicyType = "Local"
|
||||
ServiceInternalTrafficPolicyLocal ServiceInternalTrafficPolicy = "Local"
|
||||
)
|
||||
|
||||
// ServiceExternalTrafficPolicy describes the endpoint-selection policy for
|
||||
@ -4064,7 +4064,7 @@ type ServiceSpec struct {
|
||||
// "Cluster", uses the standard behavior of routing to all endpoints evenly
|
||||
// (possibly modified by topology and other features).
|
||||
// +optional
|
||||
InternalTrafficPolicy *ServiceInternalTrafficPolicyType
|
||||
InternalTrafficPolicy *ServiceInternalTrafficPolicy
|
||||
}
|
||||
|
||||
// ServicePort represents the port on which the service is exposed
|
||||
|
@ -1859,7 +1859,7 @@ func TestSetDefaultServiceInternalTrafficPolicy(t *testing.T) {
|
||||
local := v1.ServiceInternalTrafficPolicyLocal
|
||||
testCases := []struct {
|
||||
name string
|
||||
expectedInternalTrafficPolicy *v1.ServiceInternalTrafficPolicyType
|
||||
expectedInternalTrafficPolicy *v1.ServiceInternalTrafficPolicy
|
||||
svc v1.Service
|
||||
}{
|
||||
{
|
||||
|
4
pkg/apis/core/v1/zz_generated.conversion.go
generated
4
pkg/apis/core/v1/zz_generated.conversion.go
generated
@ -7858,7 +7858,7 @@ func autoConvert_v1_ServiceSpec_To_core_ServiceSpec(in *v1.ServiceSpec, out *cor
|
||||
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))
|
||||
out.InternalTrafficPolicy = (*core.ServiceInternalTrafficPolicy)(unsafe.Pointer(in.InternalTrafficPolicy))
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -7886,7 +7886,7 @@ func autoConvert_core_ServiceSpec_To_v1_ServiceSpec(in *core.ServiceSpec, out *v
|
||||
out.PublishNotReadyAddresses = in.PublishNotReadyAddresses
|
||||
out.AllocateLoadBalancerNodePorts = (*bool)(unsafe.Pointer(in.AllocateLoadBalancerNodePorts))
|
||||
out.LoadBalancerClass = (*string)(unsafe.Pointer(in.LoadBalancerClass))
|
||||
out.InternalTrafficPolicy = (*v1.ServiceInternalTrafficPolicyType)(unsafe.Pointer(in.InternalTrafficPolicy))
|
||||
out.InternalTrafficPolicy = (*v1.ServiceInternalTrafficPolicy)(unsafe.Pointer(in.InternalTrafficPolicy))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -13510,7 +13510,7 @@ func TestValidateServiceCreate(t *testing.T) {
|
||||
{
|
||||
name: "invalid internalTraffic field",
|
||||
tweakSvc: func(s *core.Service) {
|
||||
invalid := core.ServiceInternalTrafficPolicyType("invalid")
|
||||
invalid := core.ServiceInternalTrafficPolicy("invalid")
|
||||
s.Spec.InternalTrafficPolicy = &invalid
|
||||
},
|
||||
numErrs: 1,
|
||||
|
2
pkg/apis/core/zz_generated.deepcopy.go
generated
2
pkg/apis/core/zz_generated.deepcopy.go
generated
@ -5502,7 +5502,7 @@ func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec) {
|
||||
}
|
||||
if in.InternalTrafficPolicy != nil {
|
||||
in, out := &in.InternalTrafficPolicy, &out.InternalTrafficPolicy
|
||||
*out = new(ServiceInternalTrafficPolicyType)
|
||||
*out = new(ServiceInternalTrafficPolicy)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
|
@ -5620,7 +5620,7 @@ func TestInternalTrafficPolicyE2E(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
line int
|
||||
internalTrafficPolicy *v1.ServiceInternalTrafficPolicyType
|
||||
internalTrafficPolicy *v1.ServiceInternalTrafficPolicy
|
||||
featureGateOn bool
|
||||
endpoints []endpoint
|
||||
expectEndpointRule bool
|
||||
@ -8642,7 +8642,7 @@ func TestNoEndpointsMetric(t *testing.T) {
|
||||
metrics.RegisterMetrics()
|
||||
testCases := []struct {
|
||||
name string
|
||||
internalTrafficPolicy *v1.ServiceInternalTrafficPolicyType
|
||||
internalTrafficPolicy *v1.ServiceInternalTrafficPolicy
|
||||
externalTrafficPolicy v1.ServiceExternalTrafficPolicy
|
||||
endpoints []endpoint
|
||||
expectedSyncProxyRulesNoLocalEndpointsTotalInternal int
|
||||
|
@ -4805,7 +4805,7 @@ func TestTestInternalTrafficPolicyE2E(t *testing.T) {
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
internalTrafficPolicy *v1.ServiceInternalTrafficPolicyType
|
||||
internalTrafficPolicy *v1.ServiceInternalTrafficPolicy
|
||||
endpoints []endpoint
|
||||
expectVirtualServer bool
|
||||
expectLocalEntries bool
|
||||
@ -5947,7 +5947,7 @@ func TestNoEndpointsMetric(t *testing.T) {
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
internalTrafficPolicy *v1.ServiceInternalTrafficPolicyType
|
||||
internalTrafficPolicy *v1.ServiceInternalTrafficPolicy
|
||||
externalTrafficPolicy v1.ServiceExternalTrafficPolicy
|
||||
endpoints []endpoint
|
||||
expectedSyncProxyRulesNoLocalEndpointsTotalInternal int
|
||||
|
@ -52,7 +52,7 @@ type BaseServicePortInfo struct {
|
||||
healthCheckNodePort int
|
||||
externalPolicyLocal bool
|
||||
internalPolicyLocal bool
|
||||
internalTrafficPolicy *v1.ServiceInternalTrafficPolicyType
|
||||
internalTrafficPolicy *v1.ServiceInternalTrafficPolicy
|
||||
hintsAnnotation string
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ func (bsvcPortInfo *BaseServicePortInfo) InternalPolicyLocal() bool {
|
||||
}
|
||||
|
||||
// InternalTrafficPolicy is part of ServicePort interface
|
||||
func (bsvcPortInfo *BaseServicePortInfo) InternalTrafficPolicy() *v1.ServiceInternalTrafficPolicyType {
|
||||
func (bsvcPortInfo *BaseServicePortInfo) InternalTrafficPolicy() *v1.ServiceInternalTrafficPolicy {
|
||||
return bsvcPortInfo.internalTrafficPolicy
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ type ServicePort interface {
|
||||
// InternalPolicyLocal returns if a service has only node local endpoints for internal traffic.
|
||||
InternalPolicyLocal() bool
|
||||
// InternalTrafficPolicy returns service InternalTrafficPolicy
|
||||
InternalTrafficPolicy() *v1.ServiceInternalTrafficPolicyType
|
||||
InternalTrafficPolicy() *v1.ServiceInternalTrafficPolicy
|
||||
// HintsAnnotation returns the value of the v1.AnnotationTopologyAwareHints annotation.
|
||||
HintsAnnotation() string
|
||||
// ExternallyAccessible returns true if the service port is reachable via something
|
||||
|
@ -1243,7 +1243,7 @@ func fmtIPFamilyPolicy(pol *api.IPFamilyPolicy) string {
|
||||
return string(*pol)
|
||||
}
|
||||
|
||||
func fmtInternalTrafficPolicy(pol *api.ServiceInternalTrafficPolicyType) string {
|
||||
func fmtInternalTrafficPolicy(pol *api.ServiceInternalTrafficPolicy) string {
|
||||
if pol == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
@ -11356,7 +11356,7 @@ func TestFeatureInternalTrafficPolicy(t *testing.T) {
|
||||
prove := func(proofs ...svcTestProof) []svcTestProof {
|
||||
return proofs
|
||||
}
|
||||
proveITP := func(want api.ServiceInternalTrafficPolicyType) svcTestProof {
|
||||
proveITP := func(want api.ServiceInternalTrafficPolicy) svcTestProof {
|
||||
return func(t *testing.T, storage *wrapperRESTForTests, before, after *api.Service) {
|
||||
t.Helper()
|
||||
if got := after.Spec.InternalTrafficPolicy; got == nil {
|
||||
|
1822
staging/src/k8s.io/api/core/v1/generated.pb.go
generated
1822
staging/src/k8s.io/api/core/v1/generated.pb.go
generated
File diff suppressed because it is too large
Load Diff
@ -4368,20 +4368,24 @@ const (
|
||||
ServiceTypeExternalName ServiceType = "ExternalName"
|
||||
)
|
||||
|
||||
// ServiceInternalTrafficPolicyType describes how nodes distribute service traffic they
|
||||
// ServiceInternalTrafficPolicy describes how nodes distribute service traffic they
|
||||
// receive on the ClusterIP.
|
||||
// +enum
|
||||
type ServiceInternalTrafficPolicyType string
|
||||
type ServiceInternalTrafficPolicy string
|
||||
|
||||
const (
|
||||
// ServiceInternalTrafficPolicyCluster routes traffic to all endpoints.
|
||||
ServiceInternalTrafficPolicyCluster ServiceInternalTrafficPolicyType = "Cluster"
|
||||
ServiceInternalTrafficPolicyCluster ServiceInternalTrafficPolicy = "Cluster"
|
||||
|
||||
// ServiceInternalTrafficPolicyLocal routes traffic only to endpoints on the same
|
||||
// node as the client pod (dropping the traffic if there are no local endpoints).
|
||||
ServiceInternalTrafficPolicyLocal ServiceInternalTrafficPolicyType = "Local"
|
||||
ServiceInternalTrafficPolicyLocal ServiceInternalTrafficPolicy = "Local"
|
||||
)
|
||||
|
||||
// for backwards compat
|
||||
// +enum
|
||||
type ServiceInternalTrafficPolicyType = ServiceInternalTrafficPolicy
|
||||
|
||||
// ServiceExternalTrafficPolicy describes how nodes distribute service traffic they
|
||||
// receive on one of the Service's "externally-facing" addresses (NodePorts, ExternalIPs,
|
||||
// and LoadBalancer IPs.
|
||||
@ -4734,7 +4738,7 @@ type ServiceSpec struct {
|
||||
// "Cluster", uses the standard behavior of routing to all endpoints evenly
|
||||
// (possibly modified by topology and other features).
|
||||
// +optional
|
||||
InternalTrafficPolicy *ServiceInternalTrafficPolicyType `json:"internalTrafficPolicy,omitempty" protobuf:"bytes,22,opt,name=internalTrafficPolicy"`
|
||||
InternalTrafficPolicy *ServiceInternalTrafficPolicy `json:"internalTrafficPolicy,omitempty" protobuf:"bytes,22,opt,name=internalTrafficPolicy"`
|
||||
}
|
||||
|
||||
// ServicePort contains information on service's port.
|
||||
|
@ -5517,7 +5517,7 @@ func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec) {
|
||||
}
|
||||
if in.InternalTrafficPolicy != nil {
|
||||
in, out := &in.InternalTrafficPolicy, &out.InternalTrafficPolicy
|
||||
*out = new(ServiceInternalTrafficPolicyType)
|
||||
*out = new(ServiceInternalTrafficPolicy)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
|
@ -43,7 +43,7 @@ type ServiceSpecApplyConfiguration struct {
|
||||
IPFamilyPolicy *corev1.IPFamilyPolicy `json:"ipFamilyPolicy,omitempty"`
|
||||
AllocateLoadBalancerNodePorts *bool `json:"allocateLoadBalancerNodePorts,omitempty"`
|
||||
LoadBalancerClass *string `json:"loadBalancerClass,omitempty"`
|
||||
InternalTrafficPolicy *corev1.ServiceInternalTrafficPolicyType `json:"internalTrafficPolicy,omitempty"`
|
||||
InternalTrafficPolicy *corev1.ServiceInternalTrafficPolicy `json:"internalTrafficPolicy,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceSpecApplyConfiguration constructs an declarative configuration of the ServiceSpec type for use with
|
||||
@ -218,7 +218,7 @@ func (b *ServiceSpecApplyConfiguration) WithLoadBalancerClass(value string) *Ser
|
||||
// WithInternalTrafficPolicy sets the InternalTrafficPolicy 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 InternalTrafficPolicy field is set to the value of the last call.
|
||||
func (b *ServiceSpecApplyConfiguration) WithInternalTrafficPolicy(value corev1.ServiceInternalTrafficPolicyType) *ServiceSpecApplyConfiguration {
|
||||
func (b *ServiceSpecApplyConfiguration) WithInternalTrafficPolicy(value corev1.ServiceInternalTrafficPolicy) *ServiceSpecApplyConfiguration {
|
||||
b.InternalTrafficPolicy = &value
|
||||
return b
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user