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

feat: enforce KongConsumer's credentials and consumerGroups uniqueness #5894

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

czeslavo
Copy link
Contributor

What this PR does / why we need it:

I propose an alternative to the admission webhook-based approach that annotates credentials and consumerGroup with +listType=set which enforces the uniqueness of the elements in the list.

I verified the following scenario to ensure that migrating from the old CRD manifests to the new ones (with x-kubernetes-list-type: set) is allowed:

  1. Create a fresh cluster, and apply old CRD manifests.
  2. Create a couple of KongConsumers (both with duplicate and non-duplicate credentials/consumerGroups).
  3. Apply the new CRD manifests (with x-kubernetes-list-type: set).
  4. Ensure it works as expected:
    • Fetching the old KongConsumers works.
    • New KongConsumers violating the constraints are rejected.

Which issue this PR fixes:

Fixes #5402.

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

@czeslavo czeslavo force-pushed the feat/consumers-unique-lists branch from 2b36bb3 to fc1f6f5 Compare April 19, 2024 11:00
@czeslavo czeslavo self-assigned this Apr 19, 2024
@czeslavo czeslavo added the area/CRD Changes in existing CRDs or introduction of new ones label Apr 19, 2024
@czeslavo czeslavo added this to the KIC v3.2.x milestone Apr 19, 2024
@czeslavo czeslavo marked this pull request as ready for review April 19, 2024 11:01
@czeslavo czeslavo requested a review from a team as a code owner April 19, 2024 11:01
Copy link

codecov bot commented Apr 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (main@ad79fae). Click here to learn what that means.

Additional details and impacted files
@@          Coverage Diff           @@
##             main   #5894   +/-   ##
======================================
  Coverage        ?   69.0%           
======================================
  Files           ?     178           
  Lines           ?   18306           
  Branches        ?       0           
======================================
  Hits            ?   12637           
  Misses          ?    4679           
  Partials        ?     990           

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

Copy link
Member

@programmer04 programmer04 left a comment

Choose a reason for hiding this comment

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

nice

@czeslavo czeslavo merged commit 5bcd583 into main Apr 22, 2024
38 checks passed
@czeslavo czeslavo deleted the feat/consumers-unique-lists branch April 22, 2024 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/CRD Changes in existing CRDs or introduction of new ones size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limit uniqueness of items in credentials in KongConsumer
3 participants