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

better enforcement for CR metada.name field #3093

Closed
acpana opened this issue Oct 19, 2023 · 2 comments
Closed

better enforcement for CR metada.name field #3093

acpana opened this issue Oct 19, 2023 · 2 comments
Labels

Comments

@acpana
Copy link
Contributor

acpana commented Oct 19, 2023

Background

For a CR that will have a status subresource, the current paradigm is to add the name of the CR as a label on the status subresource. Labels have a char limit of 64.

Current Issue

Currently we have a patch that applies to the 0th (first) version of a CRD's schema but not the rest, leaving room for mutators with long names to break status.

- op: add
path: /spec/versions/0/schema/openAPIV3Schema/properties/metadata/properties
value:
name:
type: string
maxLength: 63

Solutions
  • it would be best to have a at validation time check for "gatekeeper" related resources and that would "shift left" this check too
  • however, the schema definitions need to be updated too for scenarios where the webhook is down for instance and for good API design
    • looking at some programatic way to apply the patches would be best (kpt?)
    • it may also be worth to stand up a little guide on how to contribute a CRD for gatekeeper
Things considered
  • kubebuilder tags -- X needs to be applied on the metadata.name field which we cannot access in our API definitions.
  • kustomize "glob" style functionality -- X not something natively supported AFAICT where we can put out a spec/versions/*/...
Misc

It would be helpful to have a gatekeeper resource specific validation/ linting step (GH action/ bash script/ etc) that validates that metadata field's schema includes

          metadata:
            properties:
              name:
                maxLength: 63
                type: string
            type: object
Copy link

stale bot commented Dec 20, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 20, 2023
@stale stale bot closed this as completed Jan 3, 2024
@ritazh
Copy link
Member

ritazh commented Jan 3, 2024

@acpana has this issue been fully addressed? if not, feel free to reopen.

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

No branches or pull requests

2 participants