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(crd): enforce setting KongConsumer's either of username of custom_id via CRD validation rules #5137

Merged
merged 1 commit into from
Nov 10, 2023

Conversation

pmalek
Copy link
Member

@pmalek pmalek commented Nov 9, 2023

What this PR does / why we need it:

According to https://docs.konghq.com/gateway/latest/admin-api/#consumer-object either of username or custom_id has to be set (both are also allowed) so update the CRD validation rules to enforce those rules.

Which issue this PR fixes:

Part of #5062

Special notes for your reviewer:

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

@pmalek pmalek added the area/CRD Changes in existing CRDs or introduction of new ones label Nov 9, 2023
@pmalek pmalek added this to the KIC v3.1.x milestone Nov 9, 2023
@pmalek pmalek self-assigned this Nov 9, 2023
Copy link

codecov bot commented Nov 9, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b4718ab) 77.8% compared to head (e593d65) 77.7%.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #5137     +/-   ##
=======================================
- Coverage   77.8%   77.7%   -0.1%     
=======================================
  Files        168     168             
  Lines      18907   18906      -1     
=======================================
- Hits       14714   14705      -9     
- Misses      3360    3366      +6     
- Partials     833     835      +2     
Files Coverage Δ
internal/admission/validator.go 73.2% <ø> (+0.7%) ⬆️
internal/dataplane/kongstate/kongstate.go 86.7% <100.0%> (+<0.1%) ⬆️

... and 6 files with indirect coverage changes

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

@pmalek pmalek force-pushed the kongconsumer-crd-validation-expression branch from 3ce7be2 to e593d65 Compare November 9, 2023 19:17
@pmalek pmalek marked this pull request as ready for review November 9, 2023 19:17
@pmalek pmalek requested a review from a team as a code owner November 9, 2023 19:17
@rainest rainest merged commit 27755d7 into main Nov 10, 2023
36 checks passed
@rainest rainest deleted the kongconsumer-crd-validation-expression branch November 10, 2023 00:19
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/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move CRD validation that's possible to be done in CEL, from webhook to CRD Validation Expressions
2 participants