Skip to content

Commit cada2eb

Browse files
authored
Merge pull request kubernetes#92660 from damemi/condition-validation
Add kubebuilder tags to Condition type
2 parents 883e4eb + 9a32a70 commit cada2eb

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,29 +1369,45 @@ type Condition struct {
13691369
// ---
13701370
// Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
13711371
// useful (see .node.status.conditions), the ability to deconflict is important.
1372+
// The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
13721373
// +required
1374+
// +kubebuilder:validation:Required
1375+
// +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_.]*)?[A-Za-z0-9])$`
1376+
// +kubebuilder:validation:MaxLength=316
13731377
Type string `json:"type" protobuf:"bytes,1,opt,name=type"`
13741378
// status of the condition, one of True, False, Unknown.
13751379
// +required
1380+
// +kubebuilder:validation:Required
1381+
// +kubebuilder:validation:Enum=True;False;Unknown
13761382
Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status"`
13771383
// observedGeneration represents the .metadata.generation that the condition was set based upon.
13781384
// For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
13791385
// with respect to the current state of the instance.
13801386
// +optional
1387+
// +kubebuilder:validation:Minimum=0
13811388
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
13821389
// lastTransitionTime is the last time the condition transitioned from one status to another.
13831390
// This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
13841391
// +required
1392+
// +kubebuilder:validation:Required
1393+
// +kubebuilder:validation:Type=string
1394+
// +kubebuilder:validation:Format=date-time
13851395
LastTransitionTime Time `json:"lastTransitionTime" protobuf:"bytes,4,opt,name=lastTransitionTime"`
13861396
// reason contains a programmatic identifier indicating the reason for the condition's last transition.
13871397
// Producers of specific condition types may define expected values and meanings for this field,
13881398
// and whether the values are considered a guaranteed API.
13891399
// The value should be a CamelCase string.
13901400
// This field may not be empty.
13911401
// +required
1402+
// +kubebuilder:validation:Required
1403+
// +kubebuilder:validation:MaxLength=1024
1404+
// +kubebuilder:validation:MinLength=1
1405+
// +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$`
13921406
Reason string `json:"reason" protobuf:"bytes,5,opt,name=reason"`
13931407
// message is a human readable message indicating details about the transition.
13941408
// This may be an empty string.
13951409
// +required
1410+
// +kubebuilder:validation:Required
1411+
// +kubebuilder:validation:MaxLength=32768
13961412
Message string `json:"message" protobuf:"bytes,6,opt,name=message"`
13971413
}

0 commit comments

Comments
 (0)