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

Feature: kwctl should check for validity of metadata.name #699

Open
viccuad opened this issue Jan 25, 2024 · 0 comments
Open

Feature: kwctl should check for validity of metadata.name #699

viccuad opened this issue Jan 25, 2024 · 0 comments

Comments

@viccuad
Copy link
Member

viccuad commented Jan 25, 2024

Problem

Setting a wrong annotations."io.kubewarden.policy.title" in metadata.yaml may result in a wrong metadata.name of the CRD after scaffolding. For example a name my policy is invalid as it contains spaces, while my-policy is valid. Valid k8s metadata.name must follow:

a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is 'a-z0-9?(.a-z0-9?)*')

This is not necessarily true for raw policies as they don't need to be deployed via a CRD in the K8s api. But maybe is good to enforce it anyways.

Notice that a user can manually edit the metadata.yaml after scaffolding.

Acceptance criteria

  • Running E2E tests with kwctl (for example kwctl run, kwctl scaffold) should error and inform the user of incorrect metadata.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant