Pass pod annotations into DropDisabledFields()

This commit is contained in:
Jordan Liggitt
2019-01-07 14:17:29 -05:00
parent 8dbda22587
commit 12dd768bee
11 changed files with 75 additions and 39 deletions

View File

@@ -80,9 +80,7 @@ func (rcStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
controller.Generation = 1
if controller.Spec.Template != nil {
pod.DropDisabledFields(&controller.Spec.Template.Spec, nil)
}
pod.DropDisabledTemplateFields(controller.Spec.Template, nil)
}
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
@@ -92,16 +90,7 @@ func (rcStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object)
// update is not allowed to set status
newController.Status = oldController.Status
var newSpec, oldSpec *api.PodSpec
if oldController.Spec.Template != nil {
oldSpec = &oldController.Spec.Template.Spec
}
if newController.Spec.Template != nil {
newSpec = &newController.Spec.Template.Spec
} else {
newSpec = &api.PodSpec{}
}
pod.DropDisabledFields(newSpec, oldSpec)
pod.DropDisabledTemplateFields(newController.Spec.Template, oldController.Spec.Template)
// Any changes to the spec increment the generation number, any changes to the
// status should reflect the generation number of the corresponding object. We push