Skip to content

fix(source/wrappers/events): events not triggered under certain conditions #5687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ivankatliarchuk
Copy link
Contributor

@ivankatliarchuk ivankatliarchuk commented Jul 25, 2025

What does it do ?

  • Add debug logs for wrappers EventHanders + Endpoints. To simplify debugging
  • Add a temp config AddSourceWrapper to capture which wrappers enabled/disabled under certain conditions
  • For each wrapper add tests for event handlers
  • Added docs to provide a description about wrappers

follow-up

  • review/design wrappers to simplify testing, as currently logic is coupled in controller and easy to make a mistake
  • nat64 improve logic, disable when not enabled, build prefix list only once, not on every endpoint run
    parsedNAT64Prefixes := make([]netip.Prefix, 0)
    for _, prefix := range s.nat64Prefixes {
    pPrefix, err := netip.ParsePrefix(prefix)
    if err != nil {
    return nil, err
    }
    if pPrefix.Bits() != 96 {
    return nil, fmt.Errorf("NAT64 prefixes need to be /96 prefixes")
    }
    parsedNAT64Prefixes = append(parsedNAT64Prefixes, pPrefix)
    }

Motivation

Fixes #5680

More

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

Tested

Case target filter disabled (not enabled)

go run main.go \
    --provider=aws \
    --registry=txt \
    --source=service \
    --interval=20m \
    --log-level=debug \
    --events \
    --listen-endpoint-events \
    --min-event-sync-interval=10s

Results (target net filter disabled while events working without issues)
Screenshot 2025-07-26 at 16 43 53
Screenshot 2025-07-26 at 16 46 23

Case target filter enabled

go run main.go \
    --provider=aws \
    --registry=txt \
    --source=service \
    --interval=20m \
    --log-level=debug \
    --events \
    --listen-endpoint-events \
    --min-event-sync-interval=10s \
    --target-net-filter=192.168.0.0/16
Screenshot 2025-07-26 at 16 55 09

@k8s-ci-robot k8s-ci-robot added the controller Issues or PRs related to the controller label Jul 25, 2025
@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 mloiseleur for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 source cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 25, 2025
@ivankatliarchuk ivankatliarchuk marked this pull request as draft July 25, 2025 21:14
@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 Jul 25, 2025
@ivankatliarchuk ivankatliarchuk changed the title fix(source/wrappers/events): events not triggered WIP fix(source/wrappers/events): events not triggered Jul 25, 2025
@k8s-ci-robot k8s-ci-robot added apis Issues or PRs related to API change docs internal Issues or PRs related to internal code provider Issues or PRs related to a provider size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 26, 2025
@ivankatliarchuk ivankatliarchuk force-pushed the fix-events branch 3 times, most recently from 42e58f7 to 85e5013 Compare July 26, 2025 15:07
@ivankatliarchuk ivankatliarchuk marked this pull request as ready for review July 26, 2025 15:17
@ivankatliarchuk ivankatliarchuk changed the title WIP fix(source/wrappers/events): events not triggered fix(source/wrappers/events): events not triggered under certain conditions Jul 26, 2025
@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 Jul 26, 2025
@ivankatliarchuk
Copy link
Contributor Author

Hi @redbaron when have pls have a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apis Issues or PRs related to API change cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. controller Issues or PRs related to the controller docs internal Issues or PRs related to internal code provider Issues or PRs related to a provider 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.

2 participants