Commit Graph

183 Commits

Author SHA1 Message Date
John Howard
d9f2cc0c95 endpoints: remove obsolete ServiceSelectorCache
Since https://github.com/kubernetes/kubernetes/pull/112648, we can
efficiently handle selectors from pre-existing `map[string]string`,
making the cache obsolete.

Benchmark:

```
name                         old time/op    new time/op    delta
GetPodServiceMemberships-48     189µs ± 1%     193µs ± 1%  +2.10%  (p=0.000 n=10+10)

name                         old alloc/op   new alloc/op   delta
GetPodServiceMemberships-48    59.0kB ± 0%    58.9kB ± 0%  -0.09%  (p=0.000 n=9+9)

name                         old allocs/op  new allocs/op  delta
GetPodServiceMemberships-48     1.02k ± 0%     1.02k ± 0%    ~     (all equal)
```
2022-12-12 08:00:48 -08:00
Kubernetes Prow Robot
bf14677914
Merge pull request #112546 from oscr/the-the
grammar: replace all occurrences of "the the" with "the"
2022-10-19 10:03:02 -07:00
Oscar Utbult
e4f776f230 grammar: replace all occurrences of "the the" with "the" 2022-10-14 09:03:14 +02:00
Han Kang
2bbd445f50 remove rate limiter metric as it is not in use
Change-Id: I91157653e3860eeecc3f572aee88da6ffc65faed
2022-10-13 13:07:11 -07:00
ldsdsy
eacddf9f28 Optimising print information 2022-07-14 15:03:03 +08:00
Wojciech Tyczyński
c20f7cc4e1 Clean shutdown of endpoints/endpointslice integration tests 2022-05-30 20:17:35 +02:00
Rob Scott
aa02b7a434
Updating e2e test to check EndpointSlices and Endpoints as well 2022-05-27 21:10:59 +00:00
Antonio Ojea
aa35f6f160 endpoints controller: don't consider terminal endpoints
Terminal pods, whose phase its Failed or Succeeded, are guaranteed
to never regress and to be stopped, so their IPs never should
be published on the Endpoints.
2022-05-27 06:42:58 +02:00
Quan Tian
906e6d4670 Stop publishing Pod ResourceVersion in Endpoints and EndpointSlice API
The field is not used anywhere and its value may be stale as Endpoints
and EndpointSlice won't be updated if there is only Pod ResourceVersion
change..
2022-03-02 22:12:35 +08:00
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