-
Notifications
You must be signed in to change notification settings - Fork 90
Consistent validation for reference types #430
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
Copyright 2025 The Kubernetes Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha2 | ||
|
||
// Group refers to a Kubernetes Group. It must either be an empty string or a | ||
// RFC 1123 subdomain. | ||
// | ||
// This validation is based off of the corresponding Kubernetes validation: | ||
// https://github.com/kubernetes/apimachinery/blob/02cfb53916346d085a6c6c7c66f882e3c6b0eca6/pkg/util/validation/validation.go#L208 | ||
// | ||
// Valid values include: | ||
// | ||
// * "" - empty string implies core Kubernetes API group | ||
// * "gateway.networking.k8s.io" | ||
// * "foo.example.com" | ||
// | ||
// Invalid values include: | ||
// | ||
// * "example.com/bar" - "/" is an invalid character | ||
// | ||
// +kubebuilder:validation:MaxLength=253 | ||
// +kubebuilder:validation:Pattern=`^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` | ||
type Group string | ||
|
||
// Kind refers to a Kubernetes Kind. | ||
// | ||
// Valid values include: | ||
// | ||
// * "Service" | ||
// * "HTTPRoute" | ||
// | ||
// Invalid values include: | ||
// | ||
// * "invalid/kind" - "/" is an invalid character | ||
// | ||
// +kubebuilder:validation:MinLength=1 | ||
// +kubebuilder:validation:MaxLength=63 | ||
// +kubebuilder:validation:Pattern=`^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$` | ||
type Kind string | ||
|
||
// ObjectName refers to the name of a Kubernetes object. | ||
// Object names can have a variety of forms, including RFC 1123 subdomains, | ||
// RFC 1123 labels, or RFC 1035 labels. | ||
// | ||
// +kubebuilder:validation:MinLength=1 | ||
// +kubebuilder:validation:MaxLength=253 | ||
type ObjectName string | ||
|
||
// PortNumber defines a network port. | ||
// | ||
// +kubebuilder:validation:Minimum=1 | ||
// +kubebuilder:validation:Maximum=65535 | ||
type PortNumber int32 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.