mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-25 12:17:52 +00:00
Plumb old pod spec into DropDisabledFields methods
This commit is contained in:
@@ -68,7 +68,7 @@ func (cronJobStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object)
|
||||
cronJob := obj.(*batch.CronJob)
|
||||
cronJob.Status = batch.CronJobStatus{}
|
||||
|
||||
pod.DropDisabledFields(&cronJob.Spec.JobTemplate.Spec.Template.Spec)
|
||||
pod.DropDisabledFields(&cronJob.Spec.JobTemplate.Spec.Template.Spec, nil)
|
||||
}
|
||||
|
||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
||||
@@ -77,8 +77,7 @@ func (cronJobStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Ob
|
||||
oldCronJob := old.(*batch.CronJob)
|
||||
newCronJob.Status = oldCronJob.Status
|
||||
|
||||
pod.DropDisabledFields(&newCronJob.Spec.JobTemplate.Spec.Template.Spec)
|
||||
pod.DropDisabledFields(&oldCronJob.Spec.JobTemplate.Spec.Template.Spec)
|
||||
pod.DropDisabledFields(&newCronJob.Spec.JobTemplate.Spec.Template.Spec, &oldCronJob.Spec.JobTemplate.Spec.Template.Spec)
|
||||
}
|
||||
|
||||
// Validate validates a new scheduled job.
|
||||
|
@@ -80,7 +80,7 @@ func (jobStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
|
||||
job.Spec.TTLSecondsAfterFinished = nil
|
||||
}
|
||||
|
||||
pod.DropDisabledFields(&job.Spec.Template.Spec)
|
||||
pod.DropDisabledFields(&job.Spec.Template.Spec, nil)
|
||||
}
|
||||
|
||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
||||
@@ -94,8 +94,7 @@ func (jobStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object
|
||||
oldJob.Spec.TTLSecondsAfterFinished = nil
|
||||
}
|
||||
|
||||
pod.DropDisabledFields(&newJob.Spec.Template.Spec)
|
||||
pod.DropDisabledFields(&oldJob.Spec.Template.Spec)
|
||||
pod.DropDisabledFields(&newJob.Spec.Template.Spec, &oldJob.Spec.Template.Spec)
|
||||
}
|
||||
|
||||
// Validate validates a new job.
|
||||
|
Reference in New Issue
Block a user