From 7c0a335fb0fa2069b9a9b8b65b811f30e0d7e7b9 Mon Sep 17 00:00:00 2001 From: Michal Wozniak Date: Fri, 12 Jul 2024 09:13:22 +0200 Subject: [PATCH] Use omitempty for optional fields in Job Pod Failure Policy Kubernetes-commit: 877e3e49a4aedd5773b24c4ff77ac76395f76ac3 --- batch/v1/types.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/batch/v1/types.go b/batch/v1/types.go index 49b0ec644..adaefbab5 100644 --- a/batch/v1/types.go +++ b/batch/v1/types.go @@ -174,7 +174,7 @@ type PodFailurePolicyOnExitCodesRequirement struct { // When specified, it should match one the container or initContainer // names in the pod template. // +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 // specified values. Containers completed with success (exit code 0) are @@ -234,14 +234,14 @@ type PodFailurePolicyRule struct { // Represents the requirement on the container exit codes. // +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 // 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. // +listType=atomic // +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.