Skip to content

Commit 545eacd

Browse files
committed
Moving Label types to shared_types.go
1 parent 5bf4450 commit 545eacd

File tree

2 files changed

+41
-41
lines changed

2 files changed

+41
-41
lines changed

api/v1alpha2/inferencepool_types.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -146,47 +146,6 @@ const (
146146
FailClose ExtensionFailureMode = "FailClose"
147147
)
148148

149-
// LabelKey was originally copied from: https://github.com/kubernetes-sigs/gateway-api/blob/99a3934c6bc1ce0874f3a4c5f20cafd8977ffcb4/apis/v1/shared_types.go#L694-L731
150-
// Duplicated as to not take an unexpected dependency on gw's API.
151-
//
152-
// LabelKey is the key of a label. This is used for validation
153-
// of maps. This matches the Kubernetes "qualified name" validation that is used for labels.
154-
// Labels are case sensitive, so: my-label and My-Label are considered distinct.
155-
//
156-
// Valid values include:
157-
//
158-
// * example
159-
// * example.com
160-
// * example.com/path
161-
// * example.com/path.html
162-
//
163-
// Invalid values include:
164-
//
165-
// * example~ - "~" is an invalid character
166-
// * example.com. - can not start or end with "."
167-
//
168-
// +kubebuilder:validation:MinLength=1
169-
// +kubebuilder:validation:MaxLength=253
170-
// +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?([A-Za-z0-9][-A-Za-z0-9_.]{0,61})?[A-Za-z0-9]$`
171-
type LabelKey string
172-
173-
// LabelValue is the value of a label. This is used for validation
174-
// of maps. This matches the Kubernetes label validation rules:
175-
// * must be 63 characters or less (can be empty),
176-
// * unless empty, must begin and end with an alphanumeric character ([a-z0-9A-Z]),
177-
// * could contain dashes (-), underscores (_), dots (.), and alphanumerics between.
178-
//
179-
// Valid values include:
180-
//
181-
// * MyValue
182-
// * my.name
183-
// * 123-my-value
184-
//
185-
// +kubebuilder:validation:MinLength=0
186-
// +kubebuilder:validation:MaxLength=63
187-
// +kubebuilder:validation:Pattern=`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$`
188-
type LabelValue string
189-
190149
// InferencePoolStatus defines the observed state of InferencePool
191150
type InferencePoolStatus struct {
192151
// Parents is a list of parent resources (usually Gateways) that are

api/v1alpha2/shared_types.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,44 @@ type ObjectName string
6565
// +kubebuilder:validation:Minimum=1
6666
// +kubebuilder:validation:Maximum=65535
6767
type PortNumber int32
68+
69+
// LabelKey was originally copied from: https://github.com/kubernetes-sigs/gateway-api/blob/99a3934c6bc1ce0874f3a4c5f20cafd8977ffcb4/apis/v1/shared_types.go#L694-L731
70+
// Duplicated as to not take an unexpected dependency on gw's API.
71+
//
72+
// LabelKey is the key of a label. This is used for validation
73+
// of maps. This matches the Kubernetes "qualified name" validation that is used for labels.
74+
// Labels are case sensitive, so: my-label and My-Label are considered distinct.
75+
//
76+
// Valid values include:
77+
//
78+
// * example
79+
// * example.com
80+
// * example.com/path
81+
// * example.com/path.html
82+
//
83+
// Invalid values include:
84+
//
85+
// * example~ - "~" is an invalid character
86+
// * example.com. - can not start or end with "."
87+
//
88+
// +kubebuilder:validation:MinLength=1
89+
// +kubebuilder:validation:MaxLength=253
90+
// +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?([A-Za-z0-9][-A-Za-z0-9_.]{0,61})?[A-Za-z0-9]$`
91+
type LabelKey string
92+
93+
// LabelValue is the value of a label. This is used for validation
94+
// of maps. This matches the Kubernetes label validation rules:
95+
// * must be 63 characters or less (can be empty),
96+
// * unless empty, must begin and end with an alphanumeric character ([a-z0-9A-Z]),
97+
// * could contain dashes (-), underscores (_), dots (.), and alphanumerics between.
98+
//
99+
// Valid values include:
100+
//
101+
// * MyValue
102+
// * my.name
103+
// * 123-my-value
104+
//
105+
// +kubebuilder:validation:MinLength=0
106+
// +kubebuilder:validation:MaxLength=63
107+
// +kubebuilder:validation:Pattern=`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$`
108+
type LabelValue string

0 commit comments

Comments
 (0)