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