Commit Graph

140 Commits

Author SHA1 Message Date
hbostan
db827e67fc Add a new workqueue to endpointslice controller for updating topology
cache and checking node topology distribution.
2024-06-04 08:33:32 +00:00
Alvaro Aleman
6d0ac8c561 Use the generic/typed workqueue throughout
This change makes us use the generic workqueue throughout the project in
order to improve type safety and readability of the code.
2024-05-04 14:33:12 -04:00
Gaurav Ghildiyal
ec6fd2befa Add options construct to EndpointSlice NewReconciler for the new trafficDistributionEnabled field 2024-03-04 15:40:22 -08:00
Gaurav Ghildiyal
51a3fa2e6f Start reconciling on the new field 2024-03-03 22:46:03 -08:00
Mengjiao Liu
b584b87a94 kube-controller-manager: readjust log verbosity
- Increase the global level for broadcaster's logging to 3 so that users can ignore event messages by lowering the logging level. It reduces information noise.
- Making sure the context is properly injected into the broadcaster, this will allow the -v flag value to be used also in that broadcaster, rather than the above global value.
- test: use cancellation from ktesting
- golangci-hints: checked error return value
2024-02-26 14:51:56 +08:00
Christoph Mewes
79a7833ade fix typo Mininum => Minimum 2023-09-17 11:24:29 +02:00
Maciej Skrocki
7c873327b6 Convert controller name to reconciler variable. 2023-07-11 18:08:25 +00:00
Maciej Skrocki
29fad383da move endpointslice reconciler to staging endpointslice repo 2023-07-11 18:08:12 +00:00
Naman
09849b09cf migrated pkg/controller/endpointslice to contextual logging
Signed-off-by: Naman <namanlakhwani@gmail.com>
2023-07-11 01:28:22 +05:30
Kubernetes Prow Robot
3fbf67a403
Merge pull request #116732 from czybjtu/cleanup_map_to_sets
Cleanup: use Set instead of map in endpointSlice utils
2023-06-07 07:38:13 -07:00
Akhil Velagapudi
69eccd41b8 endpointslice: reduce visibility of vars/funcs
Reduce the visibility of various public identifiers that are only used
within the scope of a package.

This was originally motivated by KEP-3685 in order to reduce the public
API surface and improve supportability.
2023-05-02 15:58:07 -07:00
Stephen Kitt
1c4b97ea27
network: replace intstr.FromInt with intstr.FromInt32
This touches cases where FromInt() is used on numeric constants, or
values which are already int32s, or int variables which are defined
close by and can be changed to int32s with little impact.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-05-01 09:17:30 +02:00
Kubernetes Prow Robot
5550bd5eac
Merge pull request #117249 from tnqn/fix-data-race
Fix a data race in TopologyCache
2023-04-12 16:28:30 -07:00
Quan Tian
d567d61aa5 Fix a data race in TopologyCache
The member variable `cpuRatiosByZone` should be accessed with the lock
acquired as it could be be updated by `SetNodes` concurrently.

Signed-off-by: Quan Tian <qtian@vmware.com>
Co-authored-by: Antonio Ojea <aojea@google.com>
2023-04-13 02:03:16 +08:00
Quan Tian
a62563f130 Fix TopologyAwareHint not working when zone label is added after Node creation
The topology.kubernetes.io/zone label may be added by could provider
asynchronously after the Node is created. The previous code didn't
update the topology cache after receiving the Node update event, causing
TopologyAwareHint to not work until kube-controller-manager restarts or
other Node events trigger the update.

Signed-off-by: Quan Tian <qtian@vmware.com>
2023-04-13 01:47:55 +08:00
czybjtu
10b36075df Cleanup: use Set instead of map in endpointSlice utils 2023-03-18 22:43:03 +08:00
Rob Scott
e23af041f5
Introducing Topology Mode Annotation, Deprecating Topology Hints
Annotation

As part of this change, kube-proxy accepts any value for either
annotation that is not "disabled".

Change-Id: Idfc26eb4cc97ff062649dc52ed29823a64fc59a4
2023-03-14 02:23:11 +00:00
Enrique Llorente
697ea476e2 svc: Support pods with same address
If different pods with same address are exposed by the same service if
some of the endpointslices endpoints are overwriten. This change add the
pod name to the hash function to ensure that all the endpoints are in
place.

Signed-off-by: Enrique Llorente <ellorent@redhat.com>
2023-02-23 11:37:57 +01:00
Viacheslav Panasovets
6adf60fdf4
Do not create endpoints if service of type ExternalName (#114814) 2023-01-18 03:12:34 -08:00
Kubernetes Prow Robot
7f7bf68c7c
Merge pull request #111178 from lucming/cleanup
clean up code
2022-12-16 19:17:52 -08:00
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
9303ea836f
Merge pull request #114076 from akhilles/remove-unused-var
Remove unused `numExistingEndpoints` variable
2022-12-10 06:04:25 -08:00
ialidzhikov
aede3fbf40 pkg/controller: Replace deprecated func usage from the k8s.io/utils/pointer pkg 2022-11-23 17:40:23 +02:00
Akhil Velagapudi
70d31ea917 Remove unused numExistingEndpoints variable 2022-11-23 00:54:50 +00:00
Lior Lieberman
4faede03fa Added events publishing for topologyHints changes 2022-11-07 19:45:40 +00:00
Andrew Sy Kim
e282b6c6b3 pkg/controller/endpointslice: remove all references to the EndpointSliceTerminatingCondition feature gate
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
2022-11-03 20:26:51 -04: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
Antonio Ojea
c3259df151 fix endpoint slice controller logging format error
Co-authored-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>
2022-09-16 16:47:51 +02:00
Damien Grisonnet
0f0526cd6a endpointslice: update max sync backoff
Update the maximum sync backoff value to 1000s to match the sequence of
delays expected by the endpointslice controller when syncing Services:

Before this change the sequence was:

> 1s, 2s, 4s, 8s, 16s, 32s, 64s, 100s

Now it is:

> 1s, 2s, 4s, 8s, 16s, 32s, 64s, 128s, 256s, 512s, 1000s

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2022-09-09 16:27:16 +02:00
Davanum Srinivas
a9593d634c
Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
lucming
e536d565ea clean up code 2022-07-15 20:22:37 +08:00
Abirdcfly
00b9ead02c cleanup: remove duplicate import
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-07-14 11:25:19 +08:00
Abirdcfly
8e9a896483
cleanup:use append other than for loop
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-06-28 16:31:59 +08:00
Antonio Ojea
b8ba6ab005 endpointslices: node missing on Pod scenario
When a Pod is referencing a Node that doesn't exist on the local
informer cache, the current behavior was to return an error to
retry later and stop processing.
However, this can cause scenarios that a missing node leaves a
Slice stuck, it can no reflect other changes, or be created.
Also, this doesn't respect the publishNotReadyAddresses options
on Services, that considers ok to publish pod Addresses that are
known to not be ready.

The new behavior keeps retrying the problematic Service, but it
keeps processing the updates, reflacting current state on the
EndpointSlice. If the publishNotReadyAddresses is set, a missing
node on a Pod is not treated as an error.
2022-06-22 09:45:16 +02:00
Antonio Ojea
baecb1981e fix metrics for placeholder slice
There is always a placeholder slice.

The ServicePortCache logic was considering always one endpointSlice
per Endpoint, but if there are multiple empty Endpoints, we just
use one placeholder slice, not multiple placeholder slices.
2022-06-22 09:45:02 +02:00
Antonio Ojea
0d9689a55d fix a bug on endpointslices tests comparing the wrong metrics 2022-06-22 09:40:18 +02:00
Spencer Hance
5f8dc48fbe Fix unnecessary recreation of placeholder EndpointSlice
Fixes Issue 108231 by checking `slicesToDelete` in the EndpointSlice
reconciler for a pre-existing placeholder slice.

Also adds a helper function for comparing the slices.
2022-06-14 09:24:38 -07:00
Kubernetes Prow Robot
e8d6b76f8b
Merge pull request #109624 from aryan9600/fix-endpointslice-deletion
Ignore EndpointSlices that are marked for deletion
2022-06-09 00:11:42 -07:00
Sanskar Jaiswal
4314e58ae5 move the ignore logic higher up to the reconciler
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-06-06 09:49:57 +05:30
Kubernetes Prow Robot
03d0e2c338
Merge pull request #110264 from wojtek-t/fix_leaking_goroutines_4
Fix leaking goroutines in multiple integration tests
2022-06-02 03:59:47 -07:00
Kubernetes Prow Robot
22fda4e7ee
Merge pull request #108232 from qmloong/qmloong/chore
fix: remove the redundant count variable
2022-06-01 10:53:40 -07: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
Kubernetes Prow Robot
34a6a7ca11
Merge pull request #108316 from hyschumi/fix_unnecessary_handlecrash
endpointslice: remove unnecessary HandleCrash
2022-03-07 18:20:34 -08: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
hyschumi
d8536122b9 endpointslice: remove unnecessary HandleCrash 2022-02-24 09:59:09 +08:00
menglong.qi
a1269198ec fix: remove the redundant count variable 2022-02-21 00:32:21 +08:00
Antonio Ojea
60502c9b32 endpointslice: don't try to update topology cache if node informer error 2022-02-11 12:14:01 +01:00
Rob Scott
242c33615e
Improving performance of EndpointSlice controller metrics cache 2021-12-20 10:26:47 -08:00
Davanum Srinivas
9405e9b55e
Check in OWNERS modified by update-yamlfmt.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-12-09 21:31:26 -05:00