Commit Graph

174 Commits

Author SHA1 Message Date
Quan Tian
38966453ce Skip updating Endpoints and EndpointSlice if no relevant fields change
When comparing EndpointSubsets and Endpoints, we ignore the difference
in ResourceVersion of Pod to avoid unnecessary updates caused by Pod
updates that we don't care, e.g. annotation update.

Otherwise periodic Service resync would intensively update Endpoints or
EndpointSlice whose Pods have irrelevant change between two resyncs,
leading to delay in processing newly created Services. In a scale
cluster with thousands of such Endpoints, we observed 2 minutes of
delay when the resync happens.
2022-02-18 20:47:27 +08:00
He Xiaoxi
ae9f117387 Remove tolerate-unready-endpoints annotation
Remove `tolerate-unready-endpoints` annotation in Service deprecated

from 1.11, use `Service.spec.publishNotReadyAddresses` instead.

Signed-off-by: He Xiaoxi <tossmilestone@gmail.com>
2022-02-09 17:17:29 +08:00
Mike Dame
4960d0976a Wire contexts to Core controllers 2021-11-01 10:29:00 -04:00
Khaled Henidak (Kal)
a53e2eaeab
move IPv6DualStack feature to stable. (#104691)
* kube-proxy

* endpoints controller

* app: kube-controller-manager

* app: cloud-controller-manager

* kubelet

* app: api-server

* node utils + registry/strategy

* api: validation (comment removal)

* api:pod strategy (util pkg)

* api: docs

* core: integration testing

* kubeadm: change feature gate to GA

* service registry and rest stack

* move feature to GA

* generated
2021-09-24 16:30:22 -07:00
Masato Naka
baf0bf831d Fix typo in comment in endpoints_controller 2021-07-18 21:56:34 +09:00
Swetha Repakula
9bd857ca04 Truncate endpoints over a 1000 addresses
* set `endpoints.kubernetes.io/over-capacity` to "truncated" when
 number of addresses has been truncated to a 1000
 * ready addresses are prioritized over non-ready addresses
 * addresses are proportionally truncated across subsets
2021-07-07 12:48:43 -07:00
cndoit18
51717256f9
fix(timezone): the timezone is standardized to UTC
Signed-off-by: cndoit18 <cndoit18@outlook.com>
2021-06-03 23:55:39 +08:00
Rob Scott
8a3f72074e
Adding new EndpointsOverCapacity annotation for Endpoints controller
Now that the EndpointSlice API and controllers are GA, the Endpoints
controller will use this annotation to warn when Endpoints are over
capacity. In a future release, this warning will be replaced with
truncation.
2021-03-09 09:48:53 -08:00
Rob Scott
b044fadf66
Graduating AppProtocol to GA 2020-11-09 11:08:19 -08:00
Khaled Henidak (Kal)
6675eba3ef
dual stack services (#91824)
* api: structure change

* api: defaulting, conversion, and validation

* [FIX] validation: auto remove second ip/family when service changes to SingleStack

* [FIX] api: defaulting, conversion, and validation

* api-server: clusterIPs alloc, printers, storage and strategy

* [FIX] clusterIPs default on read

* alloc: auto remove second ip/family when service changes to SingleStack

* api-server: repair loop handling for clusterIPs

* api-server: force kubernetes default service into single stack

* api-server: tie dualstack feature flag with endpoint feature flag

* controller-manager: feature flag, endpoint, and endpointSlice controllers handling multi family service

* [FIX] controller-manager: feature flag, endpoint, and endpointSlicecontrollers handling multi family service

* kube-proxy: feature-flag, utils, proxier, and meta proxier

* [FIX] kubeproxy: call both proxier at the same time

* kubenet: remove forced pod IP sorting

* kubectl: modify describe to include ClusterIPs, IPFamilies, and IPFamilyPolicy

* e2e: fix tests that depends on IPFamily field AND add dual stack tests

* e2e: fix expected error message for ClusterIP immutability

* add integration tests for dualstack

the third phase of dual stack is a very complex change in the API,
basically it introduces Dual Stack services. Main changes are:

- It pluralizes the Service IPFamily field to IPFamilies,
and removes the singular field.
- It introduces a new field IPFamilyPolicyType that can take
3 values to express the "dual-stack(mad)ness" of the cluster:
SingleStack, PreferDualStack and RequireDualStack
- It pluralizes ClusterIP to ClusterIPs.

The goal is to add coverage to the services API operations,
taking into account the 6 different modes a cluster can have:

- single stack: IP4 or IPv6 (as of today)
- dual stack: IPv4 only, IPv6 only, IPv4 - IPv6, IPv6 - IPv4

* [FIX] add integration tests for dualstack

* generated data

* generated files

Co-authored-by: Antonio Ojea <aojea@redhat.com>
2020-10-26 13:15:59 -07:00
Martin Schimandl
104ad794e5 Fix lint errors in pkg/contoller/endpoint
Also mark reason for lint errors in:
pkg/controller/endpoint/config/v1alpha1,
pkg/controller/endpointslice/config/v1alpha1
pkg/controller/endpointslicemirroring/config/v1alpha1
2020-10-01 09:11:00 +02:00
Mike Dame
44d1976f8d Remove HeadlessService label in endpoints controller before comparing 2020-09-03 09:55:18 -04:00
Swetha Repakula
23a3353a6a Requeue service after endpoint deletion
- ensure endpoints that have been deleted and are desired are recreated
 despite a possibly out of date endpoint cache
2020-08-05 11:50:23 -07:00
Dan Winship
e46572ef4b Improve EndpointController's handling of headless services under dual-stack
EndpointController was accidentally requiring all headless services to
be IPv4-only in clusters with IPv6DualStack enabled.

This still leaves "legacy" (ie, IPFamily-less) headless services as
always IPv4-only because the controller doesn't currently have easy
access to the information that would allow it to fix that.
(EndpointSliceController had the same problem already, and still
does.) This can be fixed, if needed, by manually setting IPFamily,
and the proposed API for 1.20 will handle this situation better.
2020-07-17 15:26:21 -04:00
Dan Winship
9fb6e2ef55 Fix Endpoint/EndpointSlice pod change detection
The endpoint controllers responded to Pod changes by trying to figure
out if the generated endpoint resource would change, rather than just
checking if the Pod had changed, but since the set of Pod fields that
need to be checked depend on the Service and Node as well, the code
ended up only checking for a subset of the changes it should have.

In particular, EndpointSliceController ended up only looking at IPv4
Pod IPs when processing Pod update events, so when a Pod went from
having no IP to having only an IPv6 IP, EndpointSliceController would
think it hadn't changed.
2020-07-17 15:22:59 -04:00
Kobayashi Daisuke
4ae11dac2e Replace StartLogging(klog.Infof) with StartStructuredLogging(0) 2020-06-15 17:48:35 +09:00
tahsinrahman
78318c7a26 Migrate to log calls to klog.InfoS and klog.ErroS for pkg/controller 2020-06-05 13:23:01 +08:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
Mike Danese
c58e69ec79 automated refactor 2020-03-05 14:59:46 -08:00
Rob Scott
6a33727632
Adding AppProtocol to Service and Endpoints Ports 2020-02-25 17:42:34 -08:00
Mike Danese
25651408ae generated: run refactor 2020-02-08 12:30:21 -05:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
Jordan Liggitt
08b5c809d2 Fix label mutation in endpoints controller 2019-11-15 16:24:10 -05:00
Rob Scott
0c7548f020
Setting Hostname from Pods on EndpointSlice to match Endpoints behavior.
This was an oversight in the initial EndpointSlice release. This update
will ensure that Endpoints and EndpointSlices use the same logic to set
the Hostname attribute.
2019-11-07 13:22:54 -08:00
louisgong
2133f9e9ff add service selector cache in endpoint controller and endpointSlice controller 2019-11-06 10:55:26 +08:00
Clayton Coleman
937ef77257
endpoints: If namespace is terminating, drop item immediately
Avoid sending an event to the namespace that is being terminated,
since it will be rejected.
2019-10-20 18:38:59 -04:00
louisgong
9b7b50c9da remove duplicate function 2019-10-15 09:41:30 +08:00
Yassine TIJANI
c1487840bc move util/metrics to component-base
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-10-08 14:42:31 +02:00
Rob Scott
75f6c24923
Adding EndpointSlice controller 2019-08-28 21:13:27 -07:00
Kubernetes Prow Robot
550fb1bfc3
Merge pull request #79386 from khenidak/phase2-dualstack
Phase 2 dualstack
2019-08-28 20:39:56 -07:00
Kubernetes Prow Robot
af54eae69a
Merge pull request #81612 from rikatz/issue81060
Remove watching Endpoints of Headless Services
2019-08-28 14:44:25 -07:00
Khaled Henidak(Kal)
93c06821e6 Phase 2: service and endpoint processing 2019-08-28 15:59:43 +00:00
Yassine TIJANI
7e4c3096fe move WaitForCacheSync to the sharedInformer package
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-08-22 16:13:41 +01:00
Ricardo Pchevuzinske Katz
e389237171 Remove watching Endpoints of Headless Services
Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@serpro.gov.br>
2019-08-21 16:37:09 -03:00
Tim Allclair
b2a02140db Don't delete service endpoints when a generic error occurs 2019-07-31 15:10:14 -07:00
Maciej Borsz
2fae3cbcfe Add simple batching to endpoints controller 2019-07-24 11:36:53 +02:00
Kubernetes Prow Robot
d6de0454e9
Merge pull request #73968 from freehan/big-endpoint-event
record event on endpoint update failure
2019-02-22 16:15:20 -08:00
Matt Matejczyk
bf25f7160b Clear EndpointsLastChangeTriggerTime on no-change.
We should clean the EndpointsLastChangeTriggerTime annotation when there
is no new trigger time to be exported. Not clearing it may result in
kube-proxy exporting the wrong Network Programming Latency SLI.
2019-02-20 11:53:40 +01:00
Minhan Xia
299fa607c0 record event on endpoint update failure 2019-02-12 13:56:20 -08:00
Matt Matejczyk
9e7f7df94e Introduce the TriggerTimeTracker util.
It will be used by the Endpoints Controller to compute and export the EndpointsLastChangeTriggerTime annotation, which in turn will be used to compute the In-Cluster Network Programming Latency SLI.
See https://github.com/kubernetes/community/blob/master/sig-scalability/slos/network_programming_latency.md for more details.
2019-02-05 09:37:31 +01:00
hchiramm
68416bdf29 Remove explicit nil declaration of some variables in endpoint ctrl.
Signed-off-by: hchiramm <hchiramm@redhat.com>
2019-01-11 16:25:50 +05:30
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
Tim Hockin
06b785ca52 Allow headless svc without ports to have endpoints
As cited in
https://github.com/kubernetes/dns/issues/174 - this is documented to
work, and I don't see why it shouldn't work.  We allowed the definition
of headless services without ports, but apparently nobody tested it very
well.

Manually tested clusterIP services with no ports - validation error.

Manually tested services with negative ports - validation error.

New tests failed, output inspected and verified.  Now pass.
2018-08-21 08:36:27 -07:00
yue9944882
5a4455dbbd dup key func 2018-08-03 16:41:23 +08:00
Tim Hockin
c038f60d04 Actually support service publishNotReadyAddresses
This was added and the annotation was deprecated, but it was never
implemented.
2018-05-14 14:19:54 -07:00
Kubernetes Submit Queue
7eb88f11d2
Merge pull request #59727 from wgliang/master.time
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

should use time.Since instead of time.Now().Sub

**What this PR does / why we need it**:
should use time.Since instead of time.Now().Sub

**Special notes for your reviewer**:
2018-05-10 20:29:40 -07:00
Kubernetes Submit Queue
28a19562bd
Merge pull request #61970 from sak0/dev-endpoints
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

controller/endpoint: explict log msg when syncing error

explict log msg for retrying sync

Signed-off-by: CuiHaozhi <cuihaozhi@chinacloud.com.cn>



**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-06 19:47:30 -07:00
Zihong Zheng
36f9bc085d Fix bug for headless services without ports 2018-04-12 15:42:26 -07:00
Wang Guoliang
89669283fe should use time.Since instead of time.Now().Sub 2018-04-10 12:05:51 +08:00
CuiHaozhi
a4d01b8bdd controller/endpoint: explict log msg when syncing error
Signed-off-by: CuiHaozhi <cuihaozhi@chinacloud.com.cn>
2018-03-31 11:30:14 +08:00