Skip to content

Conversation

@ivankatliarchuk
Copy link
Member

@ivankatliarchuk ivankatliarchuk commented Jan 9, 2026

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
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 ivankatliarchuk 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 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
Copy link

coveralls commented Jan 9, 2026

Pull Request Test Coverage Report for Build 20855079367

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 309 unchanged lines in 13 files lost coverage.
  • Overall coverage decreased (-0.004%) to 78.895%

Files with Coverage Reduction New Missed Lines %
annotations/processors.go 2 97.26%
node.go 8 92.19%
openshift_route.go 16 84.44%
ingress.go 16 88.36%
istio_gateway.go 16 88.89%
contour_httpproxy.go 19 83.8%
ambassador_host.go 21 83.22%
gateway.go 23 85.92%
istio_virtualservice.go 31 86.25%
kong_tcpingress.go 32 48.42%
Totals Coverage Status
Change from base Build 20810601084: -0.004%
Covered Lines: 15869
Relevant Lines: 20114

💛 - 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
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. 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.

3 participants