func Rename(c client.ReplicationControllersNamespacer, rc *api.ReplicationController, newName string) error { oldName := rc.Name rc.Name = newName rc.ResourceVersion = "" _, err := c.ReplicationControllers(rc.Namespace).Create(rc) if err != nil { return err } err = c.ReplicationControllers(rc.Namespace).Delete(oldName) if err != nil && !errors.IsNotFound(err) { return err } return nil }