mirror of https://github.com/k3s-io/k3s
Restore deprecatedPublicIPs for compat
The v1 API will retain deprecatedPublicIPs, but externalIPs is preferred.pull/6/head
parent
fd91d3f0ec
commit
f14709b493
|
@ -13818,7 +13818,14 @@
|
|||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "ExternalIPs are used by external load balancers, or can be set by users to handle external traffic that arrives at a node. Externally visible IPs (e.g. load balancers) that should be proxied to this service."
|
||||
"description": "externalIPs is a list of IP addresses for which nodes in the cluster will also accept traffic for this service. These IPs are not managed by Kubernetes. The user is responsible for ensuring that traffic arrives at a node with this IP. A common example is external load-balancers that are not part of the Kubernetes system. A previous form of this functionality exists as the deprecatedPublicIPs field. When using this field, callers should also clear the deprecatedPublicIPs field."
|
||||
},
|
||||
"deprecatedPublicIPs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "deprecatedPublicIPs is deprecated and replaced by the externalIPs field with almost the exact same semantics. This field is retained in the v1 API for compatibility until at least 8/20/2016. It will be removed from any new API revisions. If both deprecatedPublicIPs *and* externalIPs are set, deprecatedPublicIPs is used."
|
||||
},
|
||||
"sessionAffinity": {
|
||||
"type": "string",
|
||||
|
|
|
@ -29,8 +29,10 @@ func addConversionFuncs() {
|
|||
err := api.Scheme.AddConversionFuncs(
|
||||
convert_api_PodSpec_To_v1_PodSpec,
|
||||
convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec,
|
||||
convert_api_ServiceSpec_To_v1_ServiceSpec,
|
||||
convert_v1_PodSpec_To_api_PodSpec,
|
||||
convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec,
|
||||
convert_v1_ServiceSpec_To_api_ServiceSpec,
|
||||
)
|
||||
if err != nil {
|
||||
// If one of the conversion functions is malformed, detect it immediately.
|
||||
|
@ -365,3 +367,28 @@ func convert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conversi
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func convert_api_ServiceSpec_To_v1_ServiceSpec(in *api.ServiceSpec, out *ServiceSpec, s conversion.Scope) error {
|
||||
if err := autoconvert_api_ServiceSpec_To_v1_ServiceSpec(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
// Publish both externalIPs and deprecatedPublicIPs fields in v1.
|
||||
for _, ip := range in.ExternalIPs {
|
||||
out.DeprecatedPublicIPs = append(out.DeprecatedPublicIPs, ip)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func convert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *api.ServiceSpec, s conversion.Scope) error {
|
||||
if err := autoconvert_v1_ServiceSpec_To_api_ServiceSpec(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
// Prefer the legacy deprecatedPublicIPs field, if provided.
|
||||
if len(in.DeprecatedPublicIPs) > 0 {
|
||||
out.ExternalIPs = nil
|
||||
for _, ip := range in.DeprecatedPublicIPs {
|
||||
out.ExternalIPs = append(out.ExternalIPs, ip)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -2819,10 +2819,6 @@ func autoconvert_api_ServiceSpec_To_v1_ServiceSpec(in *api.ServiceSpec, out *Ser
|
|||
return nil
|
||||
}
|
||||
|
||||
func convert_api_ServiceSpec_To_v1_ServiceSpec(in *api.ServiceSpec, out *ServiceSpec, s conversion.Scope) error {
|
||||
return autoconvert_api_ServiceSpec_To_v1_ServiceSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoconvert_api_ServiceStatus_To_v1_ServiceStatus(in *api.ServiceStatus, out *ServiceStatus, s conversion.Scope) error {
|
||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||
defaulting.(func(*api.ServiceStatus))(in)
|
||||
|
@ -5798,15 +5794,12 @@ func autoconvert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *api.Ser
|
|||
} else {
|
||||
out.ExternalIPs = nil
|
||||
}
|
||||
// in.DeprecatedPublicIPs has no peer in out
|
||||
out.SessionAffinity = api.ServiceAffinity(in.SessionAffinity)
|
||||
out.LoadBalancerIP = in.LoadBalancerIP
|
||||
return nil
|
||||
}
|
||||
|
||||
func convert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *api.ServiceSpec, s conversion.Scope) error {
|
||||
return autoconvert_v1_ServiceSpec_To_api_ServiceSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoconvert_v1_ServiceStatus_To_api_ServiceStatus(in *ServiceStatus, out *api.ServiceStatus, s conversion.Scope) error {
|
||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||
defaulting.(func(*ServiceStatus))(in)
|
||||
|
|
|
@ -2098,6 +2098,14 @@ func deepCopy_v1_ServiceSpec(in ServiceSpec, out *ServiceSpec, c *conversion.Clo
|
|||
} else {
|
||||
out.ExternalIPs = nil
|
||||
}
|
||||
if in.DeprecatedPublicIPs != nil {
|
||||
out.DeprecatedPublicIPs = make([]string, len(in.DeprecatedPublicIPs))
|
||||
for i := range in.DeprecatedPublicIPs {
|
||||
out.DeprecatedPublicIPs[i] = in.DeprecatedPublicIPs[i]
|
||||
}
|
||||
} else {
|
||||
out.DeprecatedPublicIPs = nil
|
||||
}
|
||||
out.SessionAffinity = in.SessionAffinity
|
||||
out.LoadBalancerIP = in.LoadBalancerIP
|
||||
return nil
|
||||
|
|
|
@ -1496,11 +1496,22 @@ type ServiceSpec struct {
|
|||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#external-services
|
||||
Type ServiceType `json:"type,omitempty"`
|
||||
|
||||
// ExternalIPs are used by external load balancers, or can be set by
|
||||
// users to handle external traffic that arrives at a node.
|
||||
// Externally visible IPs (e.g. load balancers) that should be proxied to this service.
|
||||
// externalIPs is a list of IP addresses for which nodes in the cluster
|
||||
// will also accept traffic for this service. These IPs are not managed by
|
||||
// Kubernetes. The user is responsible for ensuring that traffic arrives
|
||||
// at a node with this IP. A common example is external load-balancers
|
||||
// that are not part of the Kubernetes system. A previous form of this
|
||||
// functionality exists as the deprecatedPublicIPs field. When using this
|
||||
// field, callers should also clear the deprecatedPublicIPs field.
|
||||
ExternalIPs []string `json:"externalIPs,omitempty"`
|
||||
|
||||
// deprecatedPublicIPs is deprecated and replaced by the externalIPs field
|
||||
// with almost the exact same semantics. This field is retained in the v1
|
||||
// API for compatibility until at least 8/20/2016. It will be removed from
|
||||
// any new API revisions. If both deprecatedPublicIPs *and* externalIPs are
|
||||
// set, deprecatedPublicIPs is used.
|
||||
DeprecatedPublicIPs []string `json:"deprecatedPublicIPs,omitempty"`
|
||||
|
||||
// Supports "ClientIP" and "None". Used to maintain session affinity.
|
||||
// Enable client IP based session affinity.
|
||||
// Must be ClientIP or None.
|
||||
|
|
|
@ -1290,14 +1290,15 @@ func (ServicePort) SwaggerDoc() map[string]string {
|
|||
}
|
||||
|
||||
var map_ServiceSpec = map[string]string{
|
||||
"": "ServiceSpec describes the attributes that a user creates on a service.",
|
||||
"ports": "The list of ports that are exposed by this service. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#virtual-ips-and-service-proxies",
|
||||
"selector": "This service will route traffic to pods having labels matching this selector. Label keys and values that must match in order to receive traffic for this service. If empty, all pods are selected, if not specified, endpoints must be manually specified. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#overview",
|
||||
"clusterIP": "ClusterIP is usually assigned by the master and is the IP address of the service. If specified, it will be allocated to the service if it is unused or else creation of the service will fail. Valid values are None, empty string (\"\"), or a valid IP address. 'None' can be specified for a headless service when proxying is not required. Cannot be updated. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#virtual-ips-and-service-proxies",
|
||||
"type": "Type of exposed service. Must be ClusterIP, NodePort, or LoadBalancer. Defaults to ClusterIP. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#external-services",
|
||||
"externalIPs": "ExternalIPs are used by external load balancers, or can be set by users to handle external traffic that arrives at a node. Externally visible IPs (e.g. load balancers) that should be proxied to this service.",
|
||||
"sessionAffinity": "Supports \"ClientIP\" and \"None\". Used to maintain session affinity. Enable client IP based session affinity. Must be ClientIP or None. Defaults to None. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#virtual-ips-and-service-proxies",
|
||||
"loadBalancerIP": "Only applies to Service Type: LoadBalancer LoadBalancer will get created with the IP specified in this field. This feature depends on whether the underlying cloud-provider supports specifying the loadBalancerIP when a load balancer is created. This field will be ignored if the cloud-provider does not support the feature.",
|
||||
"": "ServiceSpec describes the attributes that a user creates on a service.",
|
||||
"ports": "The list of ports that are exposed by this service. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#virtual-ips-and-service-proxies",
|
||||
"selector": "This service will route traffic to pods having labels matching this selector. Label keys and values that must match in order to receive traffic for this service. If empty, all pods are selected, if not specified, endpoints must be manually specified. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#overview",
|
||||
"clusterIP": "ClusterIP is usually assigned by the master and is the IP address of the service. If specified, it will be allocated to the service if it is unused or else creation of the service will fail. Valid values are None, empty string (\"\"), or a valid IP address. 'None' can be specified for a headless service when proxying is not required. Cannot be updated. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#virtual-ips-and-service-proxies",
|
||||
"type": "Type of exposed service. Must be ClusterIP, NodePort, or LoadBalancer. Defaults to ClusterIP. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#external-services",
|
||||
"externalIPs": "externalIPs is a list of IP addresses for which nodes in the cluster will also accept traffic for this service. These IPs are not managed by Kubernetes. The user is responsible for ensuring that traffic arrives at a node with this IP. A common example is external load-balancers that are not part of the Kubernetes system. A previous form of this functionality exists as the deprecatedPublicIPs field. When using this field, callers should also clear the deprecatedPublicIPs field.",
|
||||
"deprecatedPublicIPs": "deprecatedPublicIPs is deprecated and replaced by the externalIPs field with almost the exact same semantics. This field is retained in the v1 API for compatibility until at least 8/20/2016. It will be removed from any new API revisions. If both deprecatedPublicIPs *and* externalIPs are set, deprecatedPublicIPs is used.",
|
||||
"sessionAffinity": "Supports \"ClientIP\" and \"None\". Used to maintain session affinity. Enable client IP based session affinity. Must be ClientIP or None. Defaults to None. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#virtual-ips-and-service-proxies",
|
||||
"loadBalancerIP": "Only applies to Service Type: LoadBalancer LoadBalancer will get created with the IP specified in this field. This feature depends on whether the underlying cloud-provider supports specifying the loadBalancerIP when a load balancer is created. This field will be ignored if the cloud-provider does not support the feature.",
|
||||
}
|
||||
|
||||
func (ServiceSpec) SwaggerDoc() map[string]string {
|
||||
|
|
Loading…
Reference in New Issue