Skip to content
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

fix: map KongConsumer to respective KongConsumerGroup in Konnect #7144

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

programmer04
Copy link
Member

@programmer04 programmer04 commented Feb 19, 2025

What this PR does / why we need it:

KIC 3.0.3 was the last without feature gate SanitizeKonnectConfigDumps=true by default (everything works as expected).

For newer versions mapping of KongConsumers to respective KongConsumersGroup is broken because the code responsible for sanitization omits consumer groups by mistake.

This field is crucial for proper mapping, see how the config is generated

for _, c := range k8sState.Consumers {
consumer := file.FConsumer{Consumer: c.Consumer}
// If a consumer with no username and no custom_id is provided deck wont be able to process it,
// but we shouldn't fail the rest of the deckgen either or this will result in one bad consumer
// being capable of stopping all updates to the Kong Admin API.
// This shouldn't happen as we enforce either of those field being present in CRD CEL validation rules.
if consumer.Username == nil && consumer.CustomID == nil {
logger.Error(nil, "Invalid consumer received (username and custom_id were empty)")
continue
}
for _, cg := range c.ConsumerGroups {
consumer.Groups = append(consumer.Groups, &cg)
}

Which issue this PR fixes:

fixes #7143

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@programmer04 programmer04 added area/konnect Issues and PRs related to Konnect fix labels Feb 19, 2025
@programmer04 programmer04 added this to the KIC v3.4.x milestone Feb 19, 2025
@programmer04 programmer04 self-assigned this Feb 19, 2025
@programmer04 programmer04 marked this pull request as ready for review February 19, 2025 16:23
@programmer04 programmer04 requested a review from a team as a code owner February 19, 2025 16:23
@programmer04 programmer04 enabled auto-merge (squash) February 19, 2025 16:25
@programmer04 programmer04 added the ci/run-e2e Trigger e2e test run from PR label Feb 19, 2025
@team-k8s-bot
Copy link
Collaborator

E2E (targeted) tests with KIND-based clusters were started at https://github.com/Kong/kubernetes-ingress-controller/actions/runs/13417500743

@team-k8s-bot team-k8s-bot removed the ci/run-e2e Trigger e2e test run from PR label Feb 19, 2025
Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.0%. Comparing base (d4d18a4) to head (ff2a3d9).
Report is 80 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #7144     +/-   ##
=======================================
+ Coverage   76.9%   79.0%   +2.1%     
=======================================
  Files        214     213      -1     
  Lines      25169   24977    -192     
=======================================
+ Hits       19356   19746    +390     
+ Misses      4794    4202    -592     
- Partials    1019    1029     +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@programmer04 programmer04 merged commit 86b681f into main Feb 20, 2025
114 of 163 checks passed
@programmer04 programmer04 deleted the fix-groups branch February 20, 2025 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/konnect Issues and PRs related to Konnect fix size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SanitizeKonnectConfigDumps breaking consumer group mapping in Konnect
3 participants