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

Support override root name and generateName schema in crd #1105

Open
liubog2008 opened this issue Dec 17, 2024 · 2 comments
Open

Support override root name and generateName schema in crd #1105

liubog2008 opened this issue Dec 17, 2024 · 2 comments

Comments

@liubog2008
Copy link

See https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/2335-vanilla-crd-openapi-subset-structural-schemas#metadata

I want to change the pattern of the metadata.name.

@JoelSpeed
Copy link
Contributor

When you say you would like to change the pattern, is that to say, you want to enforce some kind of regex on the value of the metadata.name field?

Have you considered using CEL?

type MyCustomResource struct {
  *metav1.TypeMeta `json:",inline"

  // +kubebuilder:validation:XValidation:rule="self.name.matches("<insert regex>"),message="CRD name must match..."
  *metav1.ObjectMeta `json:"metadata,omitempty"

  ...
}

@liubog2008
Copy link
Author

That's what I need, thanks. I'll try it first

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

No branches or pull requests

2 participants