gateway-api icon indicating copy to clipboard operation
gateway-api copied to clipboard

`ControllerName` validation helper

Open mlavacca opened this issue 3 years ago • 6 comments

What type of PR is this?

/kind feature

What this PR does / why we need it: A utility to check the Controller name validity has been added to apis//util/validation.

Which issue(s) this PR fixes:

Fixes #1410

Does this PR introduce a user-facing change?:

NONE

mlavacca avatar Sep 27 '22 13:09 mlavacca

Hi @mlavacca. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Sep 27 '22 13:09 k8s-ci-robot

TBH I don't get the use case. Seems like each impl will make pick controllerName as a constant, and if its invalid they will pick a new one? Not sure why we need a Go helper...

Recently in the Kong implementation, we have had to make it customizable via argument. This helper is meant to validate the controllerName in such a use case.

mlavacca avatar Sep 27 '22 14:09 mlavacca

I'm not sure why, but re-asking the review to @howardjohn, @sunjayBhatia, and @akankshakumari393 removed the review request to @mikemorris and @keithmattix. The PR is ready for review and all the conversations have been resolved.

mlavacca avatar Sep 29 '22 13:09 mlavacca

Yeah it happens, If you request one, the others would be removed from review request.

akankshakumari393 avatar Sep 29 '22 14:09 akankshakumari393

For the case that people take the controllerName as an argument, having common code to validate seems like a great idea to me.

/approve

I'll leave the LGTM for someone else though.

youngnick avatar Oct 12 '22 22:10 youngnick

We're putting this in two places with the same regex. Having copied code is usually not ideal. We recently made changes to share types between v1alpha2 and v1beta1 to reduce some of these copies, I think we should do the same here.

I factorized the regexp and kept only the v1beta1 instance.

mlavacca avatar Oct 17 '22 11:10 mlavacca

We should be able to share all the v1beta1 code backwards to v1alpha2, rather than just the regexp no?

Sure, I factorized the whole helper and removed the v1alpha2 test case as it is useless now.

mlavacca avatar Oct 18 '22 14:10 mlavacca

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mlavacca, shaneutt, youngnick

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • ~~OWNERS~~ [shaneutt,youngnick]

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 avatar Oct 18 '22 14:10 k8s-ci-robot