mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-18 04:54:54 +00:00
Add k8s:optional on Device.Basic
This commit is contained in:
@@ -351,6 +351,14 @@ func Validate_Device(ctx context.Context, op operation.Operation, fldPath *field
|
||||
if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) {
|
||||
return nil
|
||||
}
|
||||
// call field-attached validations
|
||||
earlyReturn := false
|
||||
if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
||||
earlyReturn = true
|
||||
}
|
||||
if earlyReturn {
|
||||
return // do not proceed
|
||||
}
|
||||
// call the type's validation function
|
||||
errs = append(errs, Validate_BasicDevice(ctx, op, fldPath, obj, oldObj)...)
|
||||
return
|
||||
|
||||
@@ -474,6 +474,7 @@ message Device {
|
||||
//
|
||||
// +optional
|
||||
// +oneOf=deviceType
|
||||
// +k8s:optional
|
||||
optional BasicDevice basic = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -304,6 +304,7 @@ type Device struct {
|
||||
//
|
||||
// +optional
|
||||
// +oneOf=deviceType
|
||||
// +k8s:optional
|
||||
Basic *BasicDevice `json:"basic,omitempty" protobuf:"bytes,2,opt,name=basic"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user