Use omitempty for optional fields in Job Pod Failure Policy

This commit is contained in:
Michal Wozniak 2024-07-12 09:13:22 +02:00
parent e5ff4b8fcd
commit f523be6f70

View File

@ -176,7 +176,7 @@ type PodFailurePolicyOnExitCodesRequirement struct {
// When specified, it should match one the container or initContainer // When specified, it should match one the container or initContainer
// names in the pod template. // names in the pod template.
// +optional // +optional
ContainerName *string `json:"containerName" protobuf:"bytes,1,opt,name=containerName"` ContainerName *string `json:"containerName,omitempty" protobuf:"bytes,1,opt,name=containerName"`
// Represents the relationship between the container exit code(s) and the // Represents the relationship between the container exit code(s) and the
// specified values. Containers completed with success (exit code 0) are // specified values. Containers completed with success (exit code 0) are
@ -236,14 +236,14 @@ type PodFailurePolicyRule struct {
// Represents the requirement on the container exit codes. // Represents the requirement on the container exit codes.
// +optional // +optional
OnExitCodes *PodFailurePolicyOnExitCodesRequirement `json:"onExitCodes" protobuf:"bytes,2,opt,name=onExitCodes"` OnExitCodes *PodFailurePolicyOnExitCodesRequirement `json:"onExitCodes,omitempty" protobuf:"bytes,2,opt,name=onExitCodes"`
// Represents the requirement on the pod conditions. The requirement is represented // Represents the requirement on the pod conditions. The requirement is represented
// as a list of pod condition patterns. The requirement is satisfied if at // as a list of pod condition patterns. The requirement is satisfied if at
// least one pattern matches an actual pod condition. At most 20 elements are allowed. // least one pattern matches an actual pod condition. At most 20 elements are allowed.
// +listType=atomic // +listType=atomic
// +optional // +optional
OnPodConditions []PodFailurePolicyOnPodConditionsPattern `json:"onPodConditions" protobuf:"bytes,3,opt,name=onPodConditions"` OnPodConditions []PodFailurePolicyOnPodConditionsPattern `json:"onPodConditions,omitempty" protobuf:"bytes,3,opt,name=onPodConditions"`
} }
// PodFailurePolicy describes how failed pods influence the backoffLimit. // PodFailurePolicy describes how failed pods influence the backoffLimit.