openshift / api

Canonical location of the OpenShift API definition.
http://www.openshift.org
Apache License 2.0
95 stars 510 forks source link

Power VS: Use CEL to check if endpoint is valid or oldSelf #1965

Open mjturek opened 2 months ago

mjturek commented 2 months ago

To allow us to match against valid endpoint names, we need to update the endpoint validation to check against the valid set of endpoint names. While endpoint overrides should be unused in previous releases, we'll also allow for legacy values in case they were used.

openshift-ci[bot] commented 2 months ago

Hello @mjturek! Some important instructions when contributing to openshift/api: API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

mjturek commented 2 months ago

Alternative to https://github.com/openshift/api/pull/1931

@JoelSpeed thoughts on this?

openshift-ci[bot] commented 2 months ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mjturek Once this PR has been reviewed and has the lgtm label, please assign knobunc for approval. For more information see the Kubernetes Code Review Process.

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

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/openshift/api/blob/master/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
mjturek commented 2 months ago

Testing the new regex

https://play.golang.com/p/qRU6Li0AAMS

JoelSpeed commented 2 months ago

What are we trying to achieve with this change (PR description would be helpful)? I didn't think we really wanted free-form text here, but instead, want to try and align the Power and VPC APIs on using an enum, but in a backwards compatible way, right?

Rather than updating the pattern, if we moved to using CEL, you could allow the existing pattern, or, an enumeration of values, so the new validation wouldn't just allow any random upper case string, which would in fact weaken the validation from where we are at now

mjturek commented 2 months ago

What are we trying to achieve with this change (PR description would be helpful)? I didn't think we really wanted free-form text here, but instead, want to try and align the Power and VPC APIs on using an enum, but in a backwards compatible way, right?

Rather than updating the pattern, if we moved to using CEL, you could allow the existing pattern, or, an enumeration of values, so the new validation wouldn't just allow any random upper case string, which would in fact weaken the validation from where we are at now

You are correct, we should really move to CEL for validation like you suggested. I wanted to propose extending the validation as it seemed like the simplest solution but that doesn't make it the right solution.

mjturek commented 2 months ago

/retest

openshift-ci[bot] commented 1 month ago

@mjturek: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-serial 3160cf97dafc1ed6aefc4383ba03471097a8dcce link true /test e2e-aws-serial
ci/prow/e2e-gcp 3160cf97dafc1ed6aefc4383ba03471097a8dcce link false /test e2e-gcp
ci/prow/e2e-azure 3160cf97dafc1ed6aefc4383ba03471097a8dcce link false /test e2e-azure
ci/prow/integration 3160cf97dafc1ed6aefc4383ba03471097a8dcce link true /test integration
ci/prow/verify 3160cf97dafc1ed6aefc4383ba03471097a8dcce link true /test verify
ci/prow/e2e-aws-ovn-hypershift 3160cf97dafc1ed6aefc4383ba03471097a8dcce link true /test e2e-aws-ovn-hypershift
ci/prow/e2e-upgrade-minor 3160cf97dafc1ed6aefc4383ba03471097a8dcce link true /test e2e-upgrade-minor
ci/prow/e2e-upgrade 3160cf97dafc1ed6aefc4383ba03471097a8dcce link true /test e2e-upgrade
ci/prow/e2e-aws-ovn 3160cf97dafc1ed6aefc4383ba03471097a8dcce link true /test e2e-aws-ovn
ci/prow/e2e-aws-ovn-techpreview 3160cf97dafc1ed6aefc4383ba03471097a8dcce link true /test e2e-aws-ovn-techpreview
ci/prow/e2e-aws-serial-techpreview 3160cf97dafc1ed6aefc4383ba03471097a8dcce link true /test e2e-aws-serial-techpreview
ci/prow/minor-e2e-upgrade-minor 3160cf97dafc1ed6aefc4383ba03471097a8dcce link true /test minor-e2e-upgrade-minor

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).