mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 19:23:40 +00:00
Merge pull request #119874 from kannon92/pod-replacement-policy-typos
fix typos for pod replacement policy
This commit is contained in:
commit
df493712e4
@ -78,7 +78,7 @@ var (
|
||||
string(api.ConditionTrue),
|
||||
string(api.ConditionUnknown))
|
||||
|
||||
supportedPodRecreationPolicy = sets.New(
|
||||
supportedPodReplacementPolicy = sets.New(
|
||||
string(batch.Failed),
|
||||
string(batch.TerminatingOrFailed))
|
||||
)
|
||||
@ -295,9 +295,9 @@ func validatePodReplacementPolicy(spec *batch.JobSpec, fldPath *field.Path) fiel
|
||||
if *spec.PodReplacementPolicy != batch.Failed {
|
||||
allErrs = append(allErrs, field.NotSupported(fldPath, *spec.PodReplacementPolicy, []string{string(batch.Failed)}))
|
||||
}
|
||||
// If PodFailurePolicy not specified we allow values in supportedPodRecreationPolicy.
|
||||
} else if !supportedPodRecreationPolicy.Has(string(*spec.PodReplacementPolicy)) {
|
||||
allErrs = append(allErrs, field.NotSupported(fldPath, *spec.PodReplacementPolicy, sets.List(supportedPodRecreationPolicy)))
|
||||
// If PodFailurePolicy not specified we allow values in supportedPodReplacementPolicy.
|
||||
} else if !supportedPodReplacementPolicy.Has(string(*spec.PodReplacementPolicy)) {
|
||||
allErrs = append(allErrs, field.NotSupported(fldPath, *spec.PodReplacementPolicy, sets.List(supportedPodReplacementPolicy)))
|
||||
}
|
||||
}
|
||||
return allErrs
|
||||
|
@ -1462,7 +1462,7 @@ func (jm *Controller) manageJob(ctx context.Context, job *batch.Job, jobCtx *syn
|
||||
|
||||
var terminating int32 = 0
|
||||
if onlyReplaceFailedPods(jobCtx.job) {
|
||||
// For PodFailurePolicy specified but PodRecreationPolicy disabled
|
||||
// For PodFailurePolicy specified but PodReplacementPolicy disabled
|
||||
// we still need to count terminating pods for replica counts
|
||||
// But we will not allow updates to status.
|
||||
if jobCtx.terminating == nil {
|
||||
@ -1870,8 +1870,8 @@ func countReadyPods(pods []*v1.Pod) int32 {
|
||||
return cnt
|
||||
}
|
||||
|
||||
// This checks if we should apply PodRecreationPolicy.
|
||||
// PodRecreationPolicy controls when we recreate pods if they are marked as terminating
|
||||
// This checks if we should apply PodReplacementPolicy.
|
||||
// PodReplacementPolicy controls when we recreate pods if they are marked as terminating
|
||||
// Failed means that we recreate only once the pod has terminated.
|
||||
func onlyReplaceFailedPods(job *batch.Job) bool {
|
||||
if feature.DefaultFeatureGate.Enabled(features.JobPodReplacementPolicy) && *job.Spec.PodReplacementPolicy == batch.Failed {
|
||||
|
@ -626,7 +626,7 @@ func TestControllerSyncJob(t *testing.T) {
|
||||
expectedActive: 2,
|
||||
expectedCreatedIndexes: sets.New(0, 1),
|
||||
},
|
||||
"indexed job with some pods deleted, podRecreationPolicy Failed": {
|
||||
"indexed job with some pods deleted, podReplacementPolicy Failed": {
|
||||
parallelism: 2,
|
||||
completions: 5,
|
||||
backoffLimit: 6,
|
||||
@ -639,7 +639,7 @@ func TestControllerSyncJob(t *testing.T) {
|
||||
terminatingPods: 1,
|
||||
expectedTerminating: pointer.Int32(1),
|
||||
},
|
||||
"indexed job with some pods deleted, podRecreationPolicy TerminatingOrFailed": {
|
||||
"indexed job with some pods deleted, podReplacementPolicy TerminatingOrFailed": {
|
||||
parallelism: 2,
|
||||
completions: 5,
|
||||
backoffLimit: 6,
|
||||
|
Loading…
Reference in New Issue
Block a user