Skip to content

chore(source): standardize sources - #6089

Merged
k8s-ci-robot merged 12 commits into
kubernetes-sigs:masterfrom
gofogo:source-standartization-v2
Jan 21, 2026
Merged

chore(source): standardize sources#6089
k8s-ci-robot merged 12 commits into
kubernetes-sigs:masterfrom
gofogo:source-standartization-v2

Conversation

@ivankatliarchuk

@ivankatliarchuk ivankatliarchuk commented Jan 9, 2026

Copy link
Copy Markdown
Member

What does it do ?

This PR standardizes controller mismatch checking and empty endpoint logging across all source implementations by extracting duplicated logic into reusable helper functions.

New helper functions

  1. endpoint.HasEmptyEndpoints() (file created endpoint/utils.go similar to source/utils.go)
    - Checks if endpoint list is empty and logs a standardized debug message
    - Returns true if empty, false otherwise
  2. annotations.IsControllerMismatch() (source/annotations/processors.go)
    - Checks if a resource should be skipped due to controller annotation not matching
    - Logs a standardized debug message when skipping

Motivation

  • DRY principle: Each source had nearly identical code for checking controller annotations and logging empty endpoints. This was duplicated 12+ times.
  • Consistent logging: All sources now use the same log message format, making debugging easier.
  • Maintainability: Bug fixes or log format changes only need to happen in one place.
  • Type safety: Sources now use typed constants from source/types package instead of hardcoded strings for resource types.

More

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

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
@ivankatliarchuk
ivankatliarchuk marked this pull request as draft January 9, 2026 11:06
@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 9, 2026
@k8s-ci-robot
k8s-ci-robot requested a review from vflaux January 9, 2026 11:06
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 9, 2026
@coveralls

coveralls commented Jan 9, 2026

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 21064023875

Warning: 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

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 703 unchanged lines in 26 files lost coverage.
  • Overall coverage increased (+0.2%) to 79.056%

Files with Coverage Reduction New Missed Lines %
utils.go 1 98.0%
fqdn/fqdn.go 1 98.63%
informers/informers.go 2 90.0%
annotations/processors.go 2 97.26%
endpoints.go 2 96.92%
v1alpha1/groupversion_info.go 3 0.0%
pod.go 6 95.54%
node.go 12 90.24%
events/types.go 13 90.85%
ingress.go 14 88.48%
Totals Coverage Status
Change from base Build 20810601084: 0.2%
Covered Lines: 16038
Relevant Lines: 20287

💛 - Coveralls

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
@ivankatliarchuk
ivankatliarchuk marked this pull request as ready for review January 9, 2026 14:29
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 9, 2026
@k8s-ci-robot
k8s-ci-robot requested a review from szuecs January 9, 2026 14:29
Comment thread endpoint/utils.go Outdated
Comment thread endpoint/utils_test.go
Comment thread endpoint/utils_test.go
Comment thread source/annotations/processors_test.go Outdated
Comment thread source/gateway.go
Comment thread source/annotations/processors_test.go Outdated
ivankatliarchuk and others added 2 commits January 15, 2026 08:50
Co-authored-by: vflaux <38909103+vflaux@users.noreply.github.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Comment thread source/annotations/processors_test.go Outdated
Co-authored-by: vflaux <38909103+vflaux@users.noreply.github.com>
Comment thread source/annotations/processors.go
@vflaux

vflaux commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 21, 2026
@ivankatliarchuk

Copy link
Copy Markdown
Member Author

/approve

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[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

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 21, 2026
@k8s-ci-robot
k8s-ci-robot merged commit 89eec81 into kubernetes-sigs:master Jan 21, 2026
18 checks passed
@ivankatliarchuk
ivankatliarchuk deleted the source-standartization-v2 branch January 21, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants