diff --git a/pkg/registry/horizontalpodautoscaler/strategy.go b/pkg/registry/horizontalpodautoscaler/strategy.go index 623cf222441..3a8ade0794e 100644 --- a/pkg/registry/horizontalpodautoscaler/strategy.go +++ b/pkg/registry/horizontalpodautoscaler/strategy.go @@ -70,7 +70,7 @@ func (autoscalerStrategy) AllowCreateOnUpdate() bool { // PrepareForUpdate clears fields that are not allowed to be set by end users on update. func (autoscalerStrategy) PrepareForUpdate(obj, old runtime.Object) { newHPA := obj.(*extensions.HorizontalPodAutoscaler) - oldHPA := obj.(*extensions.HorizontalPodAutoscaler) + oldHPA := old.(*extensions.HorizontalPodAutoscaler) // Update is not allowed to set status newHPA.Status = oldHPA.Status } diff --git a/pkg/registry/persistentvolume/strategy.go b/pkg/registry/persistentvolume/strategy.go index 12eb72ce955..b8920c4708f 100644 --- a/pkg/registry/persistentvolume/strategy.go +++ b/pkg/registry/persistentvolume/strategy.go @@ -64,7 +64,7 @@ func (persistentvolumeStrategy) AllowCreateOnUpdate() bool { // PrepareForUpdate sets the Status fields which is not allowed to be set by an end user updating a PV func (persistentvolumeStrategy) PrepareForUpdate(obj, old runtime.Object) { newPv := obj.(*api.PersistentVolume) - oldPv := obj.(*api.PersistentVolume) + oldPv := old.(*api.PersistentVolume) newPv.Status = oldPv.Status } @@ -86,7 +86,7 @@ var StatusStrategy = persistentvolumeStatusStrategy{Strategy} // PrepareForUpdate sets the Spec field which is not allowed to be changed when updating a PV's Status func (persistentvolumeStatusStrategy) PrepareForUpdate(obj, old runtime.Object) { newPv := obj.(*api.PersistentVolume) - oldPv := obj.(*api.PersistentVolume) + oldPv := old.(*api.PersistentVolume) newPv.Spec = oldPv.Spec } diff --git a/pkg/registry/persistentvolumeclaim/strategy.go b/pkg/registry/persistentvolumeclaim/strategy.go index 8580c53b112..100ad6a4cbd 100644 --- a/pkg/registry/persistentvolumeclaim/strategy.go +++ b/pkg/registry/persistentvolumeclaim/strategy.go @@ -64,7 +64,7 @@ func (persistentvolumeclaimStrategy) AllowCreateOnUpdate() bool { // PrepareForUpdate sets the Status field which is not allowed to be set by end users on update func (persistentvolumeclaimStrategy) PrepareForUpdate(obj, old runtime.Object) { newPvc := obj.(*api.PersistentVolumeClaim) - oldPvc := obj.(*api.PersistentVolumeClaim) + oldPvc := old.(*api.PersistentVolumeClaim) newPvc.Status = oldPvc.Status } @@ -86,7 +86,7 @@ var StatusStrategy = persistentvolumeclaimStatusStrategy{Strategy} // PrepareForUpdate sets the Spec field which is not allowed to be changed when updating a PV's Status func (persistentvolumeclaimStatusStrategy) PrepareForUpdate(obj, old runtime.Object) { newPv := obj.(*api.PersistentVolumeClaim) - oldPv := obj.(*api.PersistentVolumeClaim) + oldPv := old.(*api.PersistentVolumeClaim) newPv.Spec = oldPv.Spec }