Skip to content

Conversation

ivankatliarchuk
Copy link
Contributor

Description

Quite often we have Traefik as ingress. I think is worth to improve code coverage and slightly refactoring. Mainly

  • Reduce code duplication, as functions are very similar. Example; The methods ingressRouteEndpoints, ingressRouteTCPEndpoints, ingressRouteUDPEndpoints, oldIngressRouteEndpoints, oldIngressRouteTCPEndpoints, and oldIngressRouteUDPEndpoints share a lot of similar logic.
  • Consistent string trimming: Use strings.Trim(host, "")` in all functions for consistency.
  • Comment clarity
  • Combine Filtering Functions; The filtering functions filterIngressRouteByAnnotation, filterIngressRouteTcpByAnnotations, and filterIngressRouteUdpByAnnotations are nearly identical.
  • Added unit tests, to improve code coverage. Still below 80%, current is 65%

I've no idea why the code is copied https://github.com/kubernetes-sigs/external-dns/blob/master/source/traefik_proxy.go#L764-L1094. At some point, we better rely on official code from here https://github.com/kubernetes-sigs/external-dns/blob/master/source/traefik_proxy.go#L764-L1094 as example. Less code -> less to bugs

Checklist

  • Unit tests updated
  • End user documentation updated

@k8s-ci-robot k8s-ci-robot requested review from mloiseleur and szuecs May 11, 2025 13:36
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 11, 2025
@mloiseleur
Copy link
Collaborator

@linoleparquet Do you think you can review this PR ?

Copy link
Contributor

@linolayani linolayani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@k8s-ci-robot
Copy link
Contributor

@linoleparquet: changing LGTM is restricted to collaborators

In response to this:

lgtm 👍

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ivankatliarchuk
Copy link
Contributor Author

If possible can we first approve/merge the other pr #5304, mainly due to it's size

@mloiseleur
Copy link
Collaborator

@ivankatliarchuk Once you have rebased this PR, I think we can merge it, too.

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 14, 2025
@ivankatliarchuk
Copy link
Contributor Author

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label May 14, 2025
@ivankatliarchuk ivankatliarchuk force-pushed the chore-code-quality-traefik-v1 branch from 9051e98 to 0118fab Compare May 14, 2025 08:47
@ivankatliarchuk
Copy link
Contributor Author

rebased

@mloiseleur mloiseleur changed the title chore(source/traefik_proxy): code coverage and refactoring chore(source): code coverage and refactoring of traefik May 15, 2025
Copy link
Collaborator

@mloiseleur mloiseleur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 15, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: linoleparquet, mloiseleur

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

The pull request process is described here

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 May 15, 2025
@k8s-ci-robot k8s-ci-robot merged commit 4ea5f9d into kubernetes-sigs:master May 15, 2025
14 checks passed
@ivankatliarchuk ivankatliarchuk deleted the chore-code-quality-traefik-v1 branch May 15, 2025 23:25
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants