Skip to content

Conversation

@ivankatliarchuk
Copy link
Member

@ivankatliarchuk ivankatliarchuk commented Jan 2, 2026

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.

TODO

  • execute tests on real cluster

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:#99ff99
Loading

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

  • Yes, this PR title follows Conventional Commits
  • Yes, I added unit tests
  • Yes, I updated end user documentation accordingly

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign szuecs for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the controller Issues or PRs related to the controller label Jan 2, 2026
@k8s-ci-robot k8s-ci-robot added source size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 2, 2026
@ivankatliarchuk ivankatliarchuk marked this pull request as draft January 2, 2026 10:03
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 2, 2026
@ivankatliarchuk ivankatliarchuk changed the title refactore(kubeclient): consolidate duplicate code to ensure consisten… refactore(kubeclient): consolidate duplicate code Jan 2, 2026
@coveralls
Copy link

coveralls commented Jan 2, 2026

Pull Request Test Coverage Report for Build 20656426648

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 124 unchanged lines in 5 files lost coverage.
  • Overall coverage increased (+0.1%) to 78.905%

Files with Coverage Reduction New Missed Lines %
openshift_route.go 1 84.29%
events/types.go 9 88.39%
events/controller.go 10 77.33%
execute.go 34 59.88%
store.go 70 44.35%
Totals Coverage Status
Change from base Build 20636734136: 0.1%
Covered Lines: 15807
Relevant Lines: 20033

💛 - Coveralls

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 2, 2026
@mloiseleur mloiseleur changed the title refactore(kubeclient): consolidate duplicate code refactor(kubeclient): consolidate duplicate code Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. controller Issues or PRs related to the controller do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants