159 Commits
Author SHA1 Message Date
Patrick Ohly 2579861734 kube-controller-manager: use context-aware client-go
Kubernetes 1.37 finished the introduction of context-aware client-go APIs.
Components like kube-controller-manager which are meant to support contextual
logging should use those new APIs.

This is not enforced yet because existing code must be updated first. Once
that is done, enforcement of everything touched here can be enabled tree-wide.
2026-09-07 16:49:09 +02:00
Dan Winship 10b3fc23da Drop PreferSameTrafficDistribution feature gate 2026-09-01 14:52:35 -04:00
杨军10092085 15f49643c4 fix endpointslice out of sync bug 2026-08-28 22:12:03 +08:00
Joe Betz e89ecc6af0 generate 2026-06-30 18:02:28 -04:00
Joe Betz 119a1460c1 Generate deepcopy 2026-05-11 12:27:56 -04:00
Dan Winship f278b47ecd Drop TopologyAwareHints and ServiceTraficDistribution feature gates 2026-01-09 12:42:34 -05:00
Ondra Kupka cd73e8777b controller/endpointslice: Improve goroutine mgmt
Make sure all threads are terminated when Run returns.
2025-10-29 19:00:31 +01:00
Shyam Jeedigunta 8346bed9e7 Introduce pod queuing in endpoint/slice controllers 2025-10-21 17:08:01 -07:00
Aditi Gupta 7d14367f57 Change WaitForNamedCacheSync to WaitForNamedCacheSyncWithContext.
This is part of the ongoing effort to adopt contextual logging
and utilities throughout the codebase.

Contributes to  #126379

Signed-off-by: Aditi Gupta <aditigpta@google.com>
2025-09-05 18:49:31 +00:00
Dan Winship 19952a2b7b Implement the EndpointSlice controller side of PreferSameZone/PreferSameNode 2025-03-19 08:39:13 -04:00
Dan Winship d4c55d06cf Export endpoints, endpointslice, mirroring controller names 2025-03-07 10:52:54 -05:00
Dan Winship 29be52b3f7 Make EndpointSlice controller always canonicalize the IPs it writes out 2025-02-11 21:46:15 -05:00
Patrick Ohly 8a908e0c0b remove import doc comments
The "// import <path>" comment has been superseded by Go modules.
We don't have to remove them, but doing so has some advantages:

- They are used inconsistently, which is confusing.
- We can then also remove the (currently broken) hack/update-vanity-imports.sh.
- Last but not least, it would be a first step towards avoiding the k8s.io domain.

This commit was generated with
   sed -i -e 's;^package \(.*\) // import.*;package \1;' $(git grep -l '^package.*// import' | grep -v 'vendor/')

Everything was included, except for
   package labels // import k8s.io/kubernetes/pkg/util/labels
because that package is marked as "read-only".
2024-12-02 16:59:34 +01:00
Joe Betz 2595aa1309 generate 2024-09-03 14:26:26 -04:00
Matthieu MOREL be59afc102 fix: enable testifylint on pkg/controller
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-07-12 06:18:34 +00:00
Matthieu MORELandPatrick Ohly f014b754fb fix: enable empty and len rules from testifylint on pkg package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
2024-07-06 23:15:43 +00:00
Kubernetes Prow Robot 6a0aeb2adb Merge pull request #125151 from skitt/drop-ptr-wrappers-pkg-controller
pkg/controller: drop pointer wrapper functions
2024-07-02 09:28:00 -07:00
Stephen Kitt f55b59fc02 pkg/controller: drop pointer wrapper functions
The new k8s.io/utils/ptr package provides generic wrapper functions,
which can be used instead of type-specific pointer wrapper functions.
This replaces the latter with the former, and migrates other uses of
the deprecated pointer package to ptr in affected files.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2024-07-02 16:19:12 +02:00
Matthieu MORELandPatrick Ohly 0cde5f1e28 fix: enable bool-compare rule from testifylint linter (#125135)
* fix: enable bool-compare rule from testifylint linter

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update hack/golangci.yaml.in

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>

* Update golangci.yaml.in

* Update golangci-strict.yaml

* Update golangci.yaml.in

* Update golangci.yaml.in

* Update golangci.yaml.in

* Update golangci.yaml.in

* Update golangci.yaml

* Update golangci-hints.yaml

* Update golangci-strict.yaml

* Update golangci.yaml.in

* Update golangci.yaml

* Update mux_test.go

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
2024-06-28 10:58:05 -07:00
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 TianandAntonio Ojea 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 OjeaandSurya Seetharaman 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