diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index f42b0c9096..90e9839ca7 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -79671,7 +79671,7 @@ "x-kubernetes-patch-strategy": "merge" }, "publishNotReadyAddresses": { - "description": "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. This field will replace the service.alpha.kubernetes.io/tolerate-unready-endpoints when that annotation is deprecated and all clients have been converted to use this field.", + "description": "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.", "type": "boolean" }, "selector": { diff --git a/api/swagger-spec/v1.json b/api/swagger-spec/v1.json index b1a691f2e0..90ccea023a 100644 --- a/api/swagger-spec/v1.json +++ b/api/swagger-spec/v1.json @@ -22696,7 +22696,7 @@ }, "publishNotReadyAddresses": { "type": "boolean", - "description": "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. This field will replace the service.alpha.kubernetes.io/tolerate-unready-endpoints when that annotation is deprecated and all clients have been converted to use this field." + "description": "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": { "$ref": "v1.SessionAffinityConfig", diff --git a/docs/api-reference/v1/definitions.html b/docs/api-reference/v1/definitions.html index de1f986cb5..4fb5def2e4 100755 --- a/docs/api-reference/v1/definitions.html +++ b/docs/api-reference/v1/definitions.html @@ -6146,7 +6146,7 @@ Examples:

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. This field will replace the service.alpha.kubernetes.io/tolerate-unready-endpoints when that annotation is deprecated and all clients have been converted to use this field.

+

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.

false

boolean

false

diff --git a/pkg/apis/core/types.go b/pkg/apis/core/types.go index 00cb5c819c..44f6b9753a 100644 --- a/pkg/apis/core/types.go +++ b/pkg/apis/core/types.go @@ -3053,9 +3053,6 @@ type ServiceSpec struct { // 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. - // This field will replace the service.alpha.kubernetes.io/tolerate-unready-endpoints - // when that annotation is deprecated and all clients have been converted to use this - // field. // +optional PublishNotReadyAddresses bool } diff --git a/pkg/controller/endpoint/endpoints_controller.go b/pkg/controller/endpoint/endpoints_controller.go index 69ed4b45d5..dbce2630fd 100644 --- a/pkg/controller/endpoint/endpoints_controller.go +++ b/pkg/controller/endpoint/endpoints_controller.go @@ -64,7 +64,7 @@ const ( // containers in the pod and marks it "Running", till the kubelet stops all // containers and deletes the pod from the apiserver. // This field is deprecated. v1.Service.PublishNotReadyAddresses will replace it - // subsequent releases. + // subsequent releases. It will be removed no sooner than 1.13. TolerateUnreadyEndpointsAnnotation = "service.alpha.kubernetes.io/tolerate-unready-endpoints" ) @@ -420,7 +420,8 @@ func (e *EndpointController) syncService(key string) error { return err } - var tolerateUnreadyEndpoints bool + // If the user specified the older (deprecated) annotation, we have to respect it. + tolerateUnreadyEndpoints := service.Spec.PublishNotReadyAddresses if v, ok := service.Annotations[TolerateUnreadyEndpointsAnnotation]; ok { b, err := strconv.ParseBool(v) if err == nil { diff --git a/staging/src/k8s.io/api/core/v1/generated.proto b/staging/src/k8s.io/api/core/v1/generated.proto index 2ee9b7c4d9..d6b7fcd68f 100644 --- a/staging/src/k8s.io/api/core/v1/generated.proto +++ b/staging/src/k8s.io/api/core/v1/generated.proto @@ -4101,9 +4101,6 @@ message ServiceSpec { // 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. - // This field will replace the service.alpha.kubernetes.io/tolerate-unready-endpoints - // when that annotation is deprecated and all clients have been converted to use this - // field. // +optional optional bool publishNotReadyAddresses = 13; diff --git a/staging/src/k8s.io/api/core/v1/types.go b/staging/src/k8s.io/api/core/v1/types.go index d4c9260c55..783ba3ba4b 100644 --- a/staging/src/k8s.io/api/core/v1/types.go +++ b/staging/src/k8s.io/api/core/v1/types.go @@ -3362,9 +3362,6 @@ type ServiceSpec struct { // 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. - // This field will replace the service.alpha.kubernetes.io/tolerate-unready-endpoints - // when that annotation is deprecated and all clients have been converted to use this - // field. // +optional PublishNotReadyAddresses bool `json:"publishNotReadyAddresses,omitempty" protobuf:"varint,13,opt,name=publishNotReadyAddresses"` // sessionAffinityConfig contains the configurations of session affinity. diff --git a/staging/src/k8s.io/api/core/v1/types_swagger_doc_generated.go b/staging/src/k8s.io/api/core/v1/types_swagger_doc_generated.go index 2aa49d5b69..92df18b154 100644 --- a/staging/src/k8s.io/api/core/v1/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/api/core/v1/types_swagger_doc_generated.go @@ -2020,7 +2020,7 @@ var map_ServiceSpec = map[string]string{ "externalName": "externalName is the external reference that kubedns or equivalent will return as a CNAME record for this service. No proxying will be involved. Must be a valid RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) and requires Type to be ExternalName.", "externalTrafficPolicy": "externalTrafficPolicy denotes if this Service desires to route external traffic to node-local or cluster-wide endpoints. \"Local\" preserves the client source IP and avoids a second hop for LoadBalancer and Nodeport type services, but risks potentially imbalanced traffic spreading. \"Cluster\" obscures the client source IP and may cause a second hop to another node, but should have good overall load-spreading.", "healthCheckNodePort": "healthCheckNodePort specifies the healthcheck nodePort for the service. If not specified, HealthCheckNodePort is created by the service api backend with the allocated nodePort. Will use user-specified nodePort value if specified by the client. Only effects when Type is set to LoadBalancer and ExternalTrafficPolicy is set to Local.", - "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. This field will replace the service.alpha.kubernetes.io/tolerate-unready-endpoints when that annotation is deprecated and all clients have been converted to use this field.", + "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.", } diff --git a/test/e2e/testing-manifests/statefulset/cockroachdb/service.yaml b/test/e2e/testing-manifests/statefulset/cockroachdb/service.yaml index a320bb0af6..4acf5eec5d 100644 --- a/test/e2e/testing-manifests/statefulset/cockroachdb/service.yaml +++ b/test/e2e/testing-manifests/statefulset/cockroachdb/service.yaml @@ -9,13 +9,6 @@ metadata: labels: app: cockroachdb annotations: - # This is needed to make the peer-finder work properly and to help avoid - # edge cases where instance 0 comes up after losing its data and needs to - # decide whether it should create a new cluster or try to join an existing - # one. If it creates a new cluster when it should have joined an existing - # one, we'd end up with two separate clusters listening at the same service - # endpoint, which would be very bad. - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" # Enable automatic monitoring of all instances when Prometheus is running in the cluster. prometheus.io/scrape: "true" prometheus.io/path: "_status/vars" @@ -31,3 +24,10 @@ spec: clusterIP: None selector: app: cockroachdb + # This is needed to make the peer-finder work properly and to help avoid + # edge cases where instance 0 comes up after losing its data and needs to + # decide whether it should create a new cluster or try to join an existing + # one. If it creates a new cluster when it should have joined an existing + # one, we'd end up with two separate clusters listening at the same service + # endpoint, which would be very bad. + publishNotReadyAddresses: true diff --git a/test/e2e/testing-manifests/statefulset/etcd/service.yaml b/test/e2e/testing-manifests/statefulset/etcd/service.yaml index 3932f04f42..bf204e8413 100644 --- a/test/e2e/testing-manifests/statefulset/etcd/service.yaml +++ b/test/e2e/testing-manifests/statefulset/etcd/service.yaml @@ -1,8 +1,5 @@ apiVersion: v1 kind: Service -metadata: - annotations: - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" metadata: name: etcd labels: @@ -16,3 +13,4 @@ spec: clusterIP: None selector: app: etcd + publishNotReadyAddresses: true diff --git a/test/e2e/testing-manifests/statefulset/mysql-galera/service.yaml b/test/e2e/testing-manifests/statefulset/mysql-galera/service.yaml index 8fa9c324a3..514e605ab8 100644 --- a/test/e2e/testing-manifests/statefulset/mysql-galera/service.yaml +++ b/test/e2e/testing-manifests/statefulset/mysql-galera/service.yaml @@ -2,8 +2,6 @@ apiVersion: v1 kind: Service metadata: - annotations: - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" name: galera labels: app: mysql @@ -15,4 +13,4 @@ spec: clusterIP: None selector: app: mysql - + publishNotReadyAddresses: true diff --git a/test/e2e/testing-manifests/statefulset/redis/service.yaml b/test/e2e/testing-manifests/statefulset/redis/service.yaml index 376c7beefb..bfdc346557 100644 --- a/test/e2e/testing-manifests/statefulset/redis/service.yaml +++ b/test/e2e/testing-manifests/statefulset/redis/service.yaml @@ -2,8 +2,6 @@ apiVersion: v1 kind: Service metadata: - annotations: - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" name: redis labels: app: redis @@ -15,4 +13,3 @@ spec: clusterIP: None selector: app: redis - diff --git a/test/e2e/testing-manifests/statefulset/zookeeper/service.yaml b/test/e2e/testing-manifests/statefulset/zookeeper/service.yaml index 8659a2af60..cf6e6972f3 100644 --- a/test/e2e/testing-manifests/statefulset/zookeeper/service.yaml +++ b/test/e2e/testing-manifests/statefulset/zookeeper/service.yaml @@ -2,8 +2,6 @@ apiVersion: v1 kind: Service metadata: - annotations: - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" name: zk labels: app: zk @@ -17,4 +15,4 @@ spec: clusterIP: None selector: app: zk - + publishNotReadyAddresses: true diff --git a/test/images/pets/peer-finder/README.md b/test/images/pets/peer-finder/README.md index f523a57979..4c9a2c9c30 100644 --- a/test/images/pets/peer-finder/README.md +++ b/test/images/pets/peer-finder/README.md @@ -6,7 +6,7 @@ All it does is watch DNS for changes in the set of endpoints that are part of th of the PetSet. It periodically looks up the SRV record of the DNS entry that corresponds to a Kubernetes Service which enumerates the set of peers for this the specified service. -Be sure to use the `service.alpha.kubernetes.io/tolerate-unready-endpoints` on the governing service +Be sure to use the `publishNotReadyAddresses` field on the governing service of the StatefulSet so that all peers are listed in endpoints before any peers are started. There are several ways to bundle it with your main application.