Job: Support for the JobSuccessPolicy (alpha)

Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>

Kubernetes-commit: e216742672aa1bfd10b5cc84fa9191eddadeac72
This commit is contained in:
Yuki Iwai 2024-02-21 15:49:35 +09:00 committed by Kubernetes Publisher
parent 47abbe0251
commit 49bc97e518
5 changed files with 126 additions and 0 deletions

View File

@ -31,6 +31,7 @@ type JobSpecApplyConfiguration struct {
Completions *int32 `json:"completions,omitempty"`
ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"`
PodFailurePolicy *PodFailurePolicyApplyConfiguration `json:"podFailurePolicy,omitempty"`
SuccessPolicy *SuccessPolicyApplyConfiguration `json:"successPolicy,omitempty"`
BackoffLimit *int32 `json:"backoffLimit,omitempty"`
BackoffLimitPerIndex *int32 `json:"backoffLimitPerIndex,omitempty"`
MaxFailedIndexes *int32 `json:"maxFailedIndexes,omitempty"`
@ -82,6 +83,14 @@ func (b *JobSpecApplyConfiguration) WithPodFailurePolicy(value *PodFailurePolicy
return b
}
// WithSuccessPolicy sets the SuccessPolicy field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SuccessPolicy field is set to the value of the last call.
func (b *JobSpecApplyConfiguration) WithSuccessPolicy(value *SuccessPolicyApplyConfiguration) *JobSpecApplyConfiguration {
b.SuccessPolicy = value
return b
}
// WithBackoffLimit sets the BackoffLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the BackoffLimit field is set to the value of the last call.

View File

@ -0,0 +1,44 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
// SuccessPolicyApplyConfiguration represents an declarative configuration of the SuccessPolicy type for use
// with apply.
type SuccessPolicyApplyConfiguration struct {
Rules []SuccessPolicyRuleApplyConfiguration `json:"rules,omitempty"`
}
// SuccessPolicyApplyConfiguration constructs an declarative configuration of the SuccessPolicy type for use with
// apply.
func SuccessPolicy() *SuccessPolicyApplyConfiguration {
return &SuccessPolicyApplyConfiguration{}
}
// WithRules adds the given value to the Rules field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Rules field.
func (b *SuccessPolicyApplyConfiguration) WithRules(values ...*SuccessPolicyRuleApplyConfiguration) *SuccessPolicyApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithRules")
}
b.Rules = append(b.Rules, *values[i])
}
return b
}

View File

@ -0,0 +1,48 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
// SuccessPolicyRuleApplyConfiguration represents an declarative configuration of the SuccessPolicyRule type for use
// with apply.
type SuccessPolicyRuleApplyConfiguration struct {
SucceededIndexes *string `json:"succeededIndexes,omitempty"`
SucceededCount *int32 `json:"succeededCount,omitempty"`
}
// SuccessPolicyRuleApplyConfiguration constructs an declarative configuration of the SuccessPolicyRule type for use with
// apply.
func SuccessPolicyRule() *SuccessPolicyRuleApplyConfiguration {
return &SuccessPolicyRuleApplyConfiguration{}
}
// WithSucceededIndexes sets the SucceededIndexes field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SucceededIndexes field is set to the value of the last call.
func (b *SuccessPolicyRuleApplyConfiguration) WithSucceededIndexes(value string) *SuccessPolicyRuleApplyConfiguration {
b.SucceededIndexes = &value
return b
}
// WithSucceededCount sets the SucceededCount field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SucceededCount field is set to the value of the last call.
func (b *SuccessPolicyRuleApplyConfiguration) WithSucceededCount(value int32) *SuccessPolicyRuleApplyConfiguration {
b.SucceededCount = &value
return b
}

View File

@ -3880,6 +3880,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: selector
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector
- name: successPolicy
type:
namedType: io.k8s.api.batch.v1.SuccessPolicy
- name: suspend
type:
scalar: boolean
@ -3992,6 +3995,24 @@ var schemaYAML = typed.YAMLObject(`types:
elementType:
namedType: io.k8s.api.batch.v1.PodFailurePolicyOnPodConditionsPattern
elementRelationship: atomic
- name: io.k8s.api.batch.v1.SuccessPolicy
map:
fields:
- name: rules
type:
list:
elementType:
namedType: io.k8s.api.batch.v1.SuccessPolicyRule
elementRelationship: atomic
- name: io.k8s.api.batch.v1.SuccessPolicyRule
map:
fields:
- name: succeededCount
type:
scalar: numeric
- name: succeededIndexes
type:
scalar: string
- name: io.k8s.api.batch.v1.UncountedTerminatedPods
map:
fields:

View File

@ -559,6 +559,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationsbatchv1.PodFailurePolicyOnPodConditionsPatternApplyConfiguration{}
case batchv1.SchemeGroupVersion.WithKind("PodFailurePolicyRule"):
return &applyconfigurationsbatchv1.PodFailurePolicyRuleApplyConfiguration{}
case batchv1.SchemeGroupVersion.WithKind("SuccessPolicy"):
return &applyconfigurationsbatchv1.SuccessPolicyApplyConfiguration{}
case batchv1.SchemeGroupVersion.WithKind("SuccessPolicyRule"):
return &applyconfigurationsbatchv1.SuccessPolicyRuleApplyConfiguration{}
case batchv1.SchemeGroupVersion.WithKind("UncountedTerminatedPods"):
return &applyconfigurationsbatchv1.UncountedTerminatedPodsApplyConfiguration{}