Skip to content

Commit

Permalink
Merge pull request #72046 from m1093782566/service-topology-api
Browse files Browse the repository at this point in the history
Service Topology implementation

Kubernetes-commit: d9be37e926b97c1687abef74953df4844f013972
  • Loading branch information
k8s-publishing-bot committed Nov 15, 2019
2 parents 0347760 + 9000e69 commit 9d92e2f
Show file tree
Hide file tree
Showing 8 changed files with 954 additions and 857 deletions.
1,755 changes: 903 additions & 852 deletions core/v1/generated.pb.go

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions core/v1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions core/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const (
NamespaceAll string = ""
// NamespaceNodeLease is the namespace where we place node lease objects (used for node heartbeats)
NamespaceNodeLease string = "kube-node-lease"
// TopologyKeyAny is the service topology key that matches any node
TopologyKeyAny string = "*"
)

// Volume represents a named volume in a pod that may be accessed by any container in the pod.
Expand Down Expand Up @@ -3826,6 +3828,8 @@ const (
IPv4Protocol IPFamily = "IPv4"
// IPv6Protocol indicates that this IP is IPv6 protocol
IPv6Protocol IPFamily = "IPv6"
// MaxServiceTopologyKeys is the largest number of topology keys allowed on a service
MaxServiceTopologyKeys = 16
)

// ServiceSpec describes the attributes that a user creates on a service.
Expand Down Expand Up @@ -3940,6 +3944,7 @@ type ServiceSpec struct {
// of peer discovery.
// +optional
PublishNotReadyAddresses bool `json:"publishNotReadyAddresses,omitempty" protobuf:"varint,13,opt,name=publishNotReadyAddresses"`

// sessionAffinityConfig contains the configurations of session affinity.
// +optional
SessionAffinityConfig *SessionAffinityConfig `json:"sessionAffinityConfig,omitempty" protobuf:"bytes,14,opt,name=sessionAffinityConfig"`
Expand All @@ -3953,6 +3958,21 @@ type ServiceSpec struct {
// cluster (e.g. IPv6 in IPv4 only cluster) is an error condition and will fail during clusterIP assignment.
// +optional
IPFamily *IPFamily `json:"ipFamily,omitempty" protobuf:"bytes,15,opt,name=ipFamily,Configcasttype=IPFamily"`

// topologyKeys is a preference-order list of topology keys which
// implementations of services should use to preferentially sort endpoints
// when accessing this Service, it can not be used at the same time as
// externalTrafficPolicy=Local.
// Topology keys must be valid label keys and at most 16 keys may be specified.
// Endpoints are chosen based on the first topology key with available backends.
// If this field is specified and all entries have no backends that match
// the topology of the client, the service has no backends for that client
// and connections should fail.
// The special value "*" may be used to mean "any topology". This catch-all
// value, if used, only makes sense as the last value in the list.
// If this is not specified or empty, no topology constraints will be applied.
// +optional
TopologyKeys []string `json:"topologyKeys,omitempty" protobuf:"bytes,16,opt,name=topologyKeys"`
}

// ServicePort contains information on service's port.
Expand Down
1 change: 1 addition & 0 deletions core/v1/types_swagger_doc_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -2204,6 +2204,7 @@ var map_ServiceSpec = map[string]string{
"publishNotReadyAddresses": "publishNotReadyAddresses, when set to true, indicates that DNS implementations must publish the notReadyAddresses of subsets for the Endpoints associated with the Service. The default value is false. The primary use case for setting this field is to use a StatefulSet's Headless Service to propagate SRV records for its Pods without respect to their readiness for purpose of peer discovery.",
"sessionAffinityConfig": "sessionAffinityConfig contains the configurations of session affinity.",
"ipFamily": "ipFamily specifies whether this Service has a preference for a particular IP family (e.g. IPv4 vs. IPv6). If a specific IP family is requested, the clusterIP field will be allocated from that family, if it is available in the cluster. If no IP family is requested, the cluster's primary IP family will be used. Other IP fields (loadBalancerIP, loadBalancerSourceRanges, externalIPs) and controllers which allocate external load-balancers should use the same IP family. Endpoints for this Service will be of this family. This field is immutable after creation. Assigning a ServiceIPFamily not available in the cluster (e.g. IPv6 in IPv4 only cluster) is an error condition and will fail during clusterIP assignment.",
"topologyKeys": "topologyKeys is a preference-order list of topology keys which implementations of services should use to preferentially sort endpoints when accessing this Service, it can not be used at the same time as externalTrafficPolicy=Local. Topology keys must be valid label keys and at most 16 keys may be specified. Endpoints are chosen based on the first topology key with available backends. If this field is specified and all entries have no backends that match the topology of the client, the service has no backends for that client and connections should fail. The special value \"*\" may be used to mean \"any topology\". This catch-all value, if used, only makes sense as the last value in the list. If this is not specified or empty, no topology constraints will be applied.",
}

func (ServiceSpec) SwaggerDoc() map[string]string {
Expand Down
5 changes: 5 additions & 0 deletions core/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions testdata/HEAD/core.v1.Service.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,17 @@
"timeoutSeconds": -1973740160
}
},
"ipFamily": "³-Ǐ忄*齧獚敆ȎțêɘIJ斬"
"ipFamily": "³-Ǐ忄*齧獚敆ȎțêɘIJ斬",
"topologyKeys": [
"28"
]
},
"status": {
"loadBalancer": {
"ingress": [
{
"ip": "28",
"hostname": "29"
"ip": "29",
"hostname": "30"
}
]
}
Expand Down
Binary file modified testdata/HEAD/core.v1.Service.pb
Binary file not shown.
6 changes: 4 additions & 2 deletions testdata/HEAD/core.v1.Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ spec:
sessionAffinityConfig:
clientIP:
timeoutSeconds: -1973740160
topologyKeys:
- "28"
type: .蘯6ċV夸
status:
loadBalancer:
ingress:
- hostname: "29"
ip: "28"
- hostname: "30"
ip: "29"

0 comments on commit 9d92e2f

Please sign in to comment.