mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Don't use pointers for session affinity
This commit is contained in:
@@ -645,7 +645,7 @@ type ServiceSpec struct {
|
||||
ContainerPort util.IntOrString `json:"containerPort,omitempty"`
|
||||
|
||||
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
|
||||
SessionAffinity *AffinityType `json:"sessionAffinity,omitempty"`
|
||||
SessionAffinity AffinityType `json:"sessionAffinity,omitempty"`
|
||||
}
|
||||
|
||||
// Service is a named abstraction of software service (for example, mysql) consisting of local port
|
||||
|
||||
@@ -506,7 +506,7 @@ type Service struct {
|
||||
ProxyPort int `json:"proxyPort,omitempty" description:"if non-zero, a pre-allocated host port used for this service by the proxy on each node; assigned by the master and ignored on input"`
|
||||
|
||||
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
|
||||
SessionAffinity *AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; Disabled if unspecified"`
|
||||
SessionAffinity AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
|
||||
}
|
||||
|
||||
// Endpoints is a collection of endpoints that implement the actual service, for example:
|
||||
|
||||
@@ -469,7 +469,7 @@ type Service struct {
|
||||
ProxyPort int `json:"proxyPort,omitempty" description:"if non-zero, a pre-allocated host port used for this service by the proxy on each node; assigned by the master and ignored on input"`
|
||||
|
||||
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
|
||||
SessionAffinity *AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; Disabled if unspecified"`
|
||||
SessionAffinity AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
|
||||
}
|
||||
|
||||
// Endpoints is a collection of endpoints that implement the actual service, for example:
|
||||
|
||||
@@ -672,7 +672,7 @@ type ServiceSpec struct {
|
||||
ContainerPort util.IntOrString `json:"containerPort,omitempty"`
|
||||
|
||||
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
|
||||
SessionAffinity *AffinityType `json:"sessionAffinity,omitempty"`
|
||||
SessionAffinity AffinityType `json:"sessionAffinity,omitempty"`
|
||||
}
|
||||
|
||||
// Service is a named abstraction of software service (for example, mysql) consisting of local port
|
||||
|
||||
@@ -474,10 +474,10 @@ func ValidateService(service *api.Service, lister ServiceLister, ctx api.Context
|
||||
}
|
||||
}
|
||||
}
|
||||
if service.Spec.SessionAffinity != nil {
|
||||
if !supportedSessionAffinityType.Has(string(*service.Spec.SessionAffinity)) {
|
||||
allErrs = append(allErrs, errs.NewFieldNotSupported("spec.sessionAffinity", service.Spec.SessionAffinity))
|
||||
}
|
||||
if service.Spec.SessionAffinity == "" {
|
||||
service.Spec.SessionAffinity = api.AffinityTypeNone
|
||||
} else if !supportedSessionAffinityType.Has(string(service.Spec.SessionAffinity)) {
|
||||
allErrs = append(allErrs, errs.NewFieldNotSupported("spec.sessionAffinity", service.Spec.SessionAffinity))
|
||||
}
|
||||
|
||||
return allErrs
|
||||
|
||||
Reference in New Issue
Block a user