Add REST PrepareForUpdate() hook

As per discussion with @snmarterclayton.  I implemented this for most
types in the "obvious" way.  I am not sure how to implement
this for a couple types, though.
This commit is contained in:
Tim Hockin
2015-03-25 17:03:30 -07:00
parent b2687c1a84
commit 0f36c68244
9 changed files with 76 additions and 1 deletions

View File

@@ -48,6 +48,14 @@ func (rcStrategy) PrepareForCreate(obj runtime.Object) {
controller.Status = api.ReplicationControllerStatus{}
}
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
func (rcStrategy) PrepareForUpdate(obj, old runtime.Object) {
// TODO: once RC has a status sub-resource we can enable this.
//newController := obj.(*api.ReplicationController)
//oldController := old.(*api.ReplicationController)
//newController.Status = oldController.Status
}
// Validate validates a new replication controller.
func (rcStrategy) Validate(obj runtime.Object) fielderrors.ValidationErrorList {
controller := obj.(*api.ReplicationController)