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(kgo): added ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding for validating DataPlane ports #1215

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pmalek
Copy link
Member

@pmalek pmalek commented Jan 14, 2025

What this PR does / why we need it:

Move DataPlane ports validation to ValidatingAdmissionPolicy.

Testing of these rules remains an aspect to tackle.

Special notes for your reviewer:

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • PR is based off the current tip of the main branch.
  • Changes are documented under the "Unreleased" header in CHANGELOG.md
  • New or modified sections of values.yaml are documented in the README.md
  • Commits follow the Kong commit message guidelines

@pmalek pmalek self-assigned this Jan 14, 2025
@pmalek pmalek force-pushed the kgo-dataplane-ports-validation-vap-and-vapb branch 2 times, most recently from 1dff7d3 to 22a6133 Compare January 14, 2025 19:21
@pmalek
Copy link
Member Author

pmalek commented Jan 14, 2025

Wait for #1216 to add chartsnap validation.

@pmalek pmalek changed the title feat(kgo): add Added and for validating ports. feat(kgo): added ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding for validating DataPlane ports Jan 14, 2025
@pmalek pmalek force-pushed the kgo-dataplane-ports-validation-vap-and-vapb branch from 22a6133 to fe6aad1 Compare January 15, 2025 16:02
@pmalek pmalek marked this pull request as ready for review January 15, 2025 16:04
@pmalek pmalek requested a review from a team as a code owner January 15, 2025 16:04
Copy link
Contributor

@czeslavo czeslavo left a comment

Choose a reason for hiding this comment

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

One thing I'm worried about is that we end up with the logic responsible for validating objects (we have CEL rules defined on CRDs in KCFG and now ValidatingAdmissionPolicy/Binding here) scattered over different places.

What do you think about defining these in KCFG, e.g. in a separate directory under config/validation/gateway-operator? That would allow testing them using the same test machinery we use for CRDs there and we would have a single place to live for the validation logic. We could "import" them in charts the same way we do with CRDs - copy them over to charts/gateway-operator/charts/gateway-operator-validation. One thing that is not clear to me is whether we could make the installation of a subchart depend on the capabilities like you did. Edit: We could have a dedicated script in charts/gateway-operator/scripts that would do the copying and adding conditional on capabilities to every file.

charts/gateway-operator/CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Grzegorz Burzyński <czeslavo@gmail.com>
@pmalek
Copy link
Member Author

pmalek commented Jan 15, 2025

One thing I'm worried about is that we end up with the logic responsible for validating objects (we have CEL rules defined on CRDs in KCFG and now ValidatingAdmissionPolicy/Binding here) scattered over different places.

I share this concern.

What do you think about defining these in KCFG, e.g. in a separate directory under config/validation/gateway-operator? That would allow testing them using the same test machinery we use for CRDs there and we would have a single place to live for the validation logic. We could "import" them in charts the same way we do with CRDs - copy them over to charts/gateway-operator/charts/gateway-operator-validation. One thing that is not clear to me is whether we could make the installation of a subchart depend on the capabilities like you did. Edit: We could have a dedicated script in charts/gateway-operator/scripts that would do the copying and adding conditional on capabilities to every file.

That would be nice to put in kcfg which is a dedicated repo ATM for these things. I'm worried this will make the workflow here unnecessarily complicated and error prone 🤔 The subcharts approach seems to me quite problematic to update and maintain but perhaps the reason for this is not enough automation on our side.

The problem I see with using kcfg is that we might not want to create numerous releases in that repo which then would create unnecessary dependency updates in other repositories (and also be user facing)

I'm happy to discuss this further as I believe the approach you proposed has advantages.

whether we could make the installation of a subchart depend on the capabilities

That I believe would not be possible as according to https://helm.sh/docs/topics/charts/#the-chartyaml-file the condition is A yaml path that resolves to a boolean, used for enabling/disabling charts (e.g. subchart1.enabled )

@pmalek
Copy link
Member Author

pmalek commented Jan 16, 2025

As agreed on slack: we keep the definition of policies for now both in charts and in KGO repositories. When we decide to move the charts internals (the releases would remain in charts) to KGO then we use the policies from KGO's repo.

Waiting on this one to get a final review in Kong/gateway-operator#1007.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants