mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 13:12:20 +00:00
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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user