mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Mark RC.Spec.MinReadySeconds as k8s:optional
+k8s:optional should be used everywhere +optional is. This does not change the vailidation of the field, but it is a good practice, and code generator recognizes the fields tags and outputs this comment above the field validation as a result: "optional value-type fields with zero-value defaults are purely documentation".
This commit is contained in:
parent
1e33616068
commit
177193ed19
1
pkg/apis/core/v1/zz_generated.validations.go
generated
1
pkg/apis/core/v1/zz_generated.validations.go
generated
@ -102,6 +102,7 @@ func Validate_ReplicationControllerSpec(ctx context.Context, op operation.Operat
|
|||||||
errs = append(errs,
|
errs = append(errs,
|
||||||
func(fldPath *field.Path, obj, oldObj *int32) (errs field.ErrorList) {
|
func(fldPath *field.Path, obj, oldObj *int32) (errs field.ErrorList) {
|
||||||
errs = append(errs, validate.Minimum(ctx, op, fldPath, obj, oldObj, 0)...)
|
errs = append(errs, validate.Minimum(ctx, op, fldPath, obj, oldObj, 0)...)
|
||||||
|
// optional value-type fields with zero-value defaults are purely documentation
|
||||||
return
|
return
|
||||||
}(fldPath.Child("minReadySeconds"), &obj.MinReadySeconds, safe.Field(oldObj, func(oldObj *corev1.ReplicationControllerSpec) *int32 { return &oldObj.MinReadySeconds }))...)
|
}(fldPath.Child("minReadySeconds"), &obj.MinReadySeconds, safe.Field(oldObj, func(oldObj *corev1.ReplicationControllerSpec) *int32 { return &oldObj.MinReadySeconds }))...)
|
||||||
|
|
||||||
|
@ -5094,6 +5094,7 @@ message ReplicationControllerSpec {
|
|||||||
// without any of its container crashing, for it to be considered available.
|
// without any of its container crashing, for it to be considered available.
|
||||||
// Defaults to 0 (pod will be considered available as soon as it is ready)
|
// Defaults to 0 (pod will be considered available as soon as it is ready)
|
||||||
// +optional
|
// +optional
|
||||||
|
// +k8s:optional
|
||||||
// +default=0
|
// +default=0
|
||||||
// +k8s:minimum=0
|
// +k8s:minimum=0
|
||||||
optional int32 minReadySeconds = 4;
|
optional int32 minReadySeconds = 4;
|
||||||
|
@ -5116,6 +5116,7 @@ type ReplicationControllerSpec struct {
|
|||||||
// without any of its container crashing, for it to be considered available.
|
// without any of its container crashing, for it to be considered available.
|
||||||
// Defaults to 0 (pod will be considered available as soon as it is ready)
|
// Defaults to 0 (pod will be considered available as soon as it is ready)
|
||||||
// +optional
|
// +optional
|
||||||
|
// +k8s:optional
|
||||||
// +default=0
|
// +default=0
|
||||||
// +k8s:minimum=0
|
// +k8s:minimum=0
|
||||||
MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"`
|
MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"`
|
||||||
|
Loading…
Reference in New Issue
Block a user