refactor(kubeclient): consolidate duplicate code#6076
refactor(kubeclient): consolidate duplicate code#6076k8s-ci-robot merged 15 commits intokubernetes-sigs:masterfrom
Conversation
…t client creation Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Pull Request Test Coverage Report for Build 21311701509Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
…t client creation Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
…t client creation Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
…t client creation Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
…t client creation Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
…t client creation Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
…t client creation Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
…t client creation Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
vflaux
left a comment
There was a problem hiding this comment.
Just small nitpicks, but LGTM.
…t client creation Co-authored-by: vflaux <38909103+vflaux@users.noreply.github.com>
…t client creation Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
…t client creation Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
pkg/client/config.go
Outdated
| return client, nil | ||
| } | ||
|
|
||
| func GetRestConfig1(kubeConfig, apiServerURL string) (*rest.Config, error) { |
There was a problem hiding this comment.
Not used but I assume it's related to the TODO of GetRestConfig?
https://github.com/gofogo/k8s-sigs-external-dns-fork/blob/22008dc0327142b1e717b38c945edd0604692216/pkg/client/config.go#L40
Was this committed by mistake?
There was a problem hiding this comment.
Yep. Removed. The code works at least on my setups, just not sure what the potential edge cases are
…t client creation Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
…t client creation Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
|
Hola @vflaux. Is there anything left or we are good to go? |
|
/lgtm |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ivankatliarchuk The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* master: chore(cloudflare): improve tests (kubernetes-sigs#6150) refactor(kubeclient): consolidate duplicate code (kubernetes-sigs#6076) remove call to get latest kubectl (kubernetes-sigs#6148) refactor(aws): extract and restructure alias-handling logic to enable safe upcoming fixes (kubernetes-sigs#6021)
…_total * master: chore(deps): bump mkdocs-git-revision-date-localized-plugin (kubernetes-sigs#6161) fix(annotations): initialize annotation keys at declaration time (kubernetes-sigs#6159) chore(linter): unused params and functions linter (kubernetes-sigs#6142) docs(fqdn): use correct arguments order in FQDN Templating custom functions (kubernetes-sigs#6144) chore(cloudflare): improve tests (kubernetes-sigs#6150) refactor(kubeclient): consolidate duplicate code (kubernetes-sigs#6076) remove call to get latest kubectl (kubernetes-sigs#6148) refactor(aws): extract and restructure alias-handling logic to enable safe upcoming fixes (kubernetes-sigs#6021) feat(pihole): deprecate v5 API support (kubernetes-sigs#6123) chore(cloudflare): move custom hostnames logic to dedicated files (kubernetes-sigs#6114) chore(provider): zone cache provider interface (kubernetes-sigs#6120)
What does it do ?
Create a new pkg/kubeclient package to consolidate duplicate Kubernetes client creation logic, add metrics instrumentation to the events controller, and use the.
tested here #6099. all works without issues
How kube client created and shared with different packages
flowchart TD A[externaldns.Config] -->|passed to| B[source.NewClientGenerator] B -->|creates| C[SingletonClientGenerator] C -->|used by| D[buildController] C -->|used by| E[buildSource] D -->|calls| F[clientGen.EventsClient] F -->|returns| G[EventsV1Interface] G -->|passed to| H[events.NewEventController] E -->|calls| I[source.ByNames] I -->|calls| J[clientGen.KubeClient] J -->|returns| K[kubernetes.Interface] K -->|used by| L[Sources<br/>Service/Ingress/etc] subgraph "Shared Client" C M[clientGen.KubeClient] -->|creates once| N[kubernetes.Clientset] F2[clientGen.EventsClient] -->|delegates to| N N -->|.EventsV1| G2[EventsV1Interface] style N fill:#99ccff end style C fill:#ffcc99 style H fill:#99ff99 style L fill:#99ff99Follow-up
Motivation
Currently event generator and source have 2 distinct clients. As a result rate limiting not working as it should on clusters with large ~50k records.
Work relates to
More
Follow up: