updateSpec updates the spec field of a resource. It uses the spec from the passed resource and disregards its other fields.
(name *runtimev1.ResourceName, from *runtimev1.Resource)
| 316 | // updateSpec updates the spec field of a resource. |
| 317 | // It uses the spec from the passed resource and disregards its other fields. |
| 318 | func (c *catalogCache) updateSpec(name *runtimev1.ResourceName, from *runtimev1.Resource) error { |
| 319 | r, err := c.get(name, false, true) |
| 320 | if err != nil { |
| 321 | return err |
| 322 | } |
| 323 | c.unlink(r) |
| 324 | err = c.ctrl.reconciler(name.Kind).AssignSpec(from, r) |
| 325 | if err != nil { |
| 326 | return err |
| 327 | } |
| 328 | r.Meta.Version++ |
| 329 | r.Meta.SpecVersion++ |
| 330 | r.Meta.SpecUpdatedOn = timestamppb.Now() |
| 331 | c.link(r) |
| 332 | c.dirty[nameStr(r.Meta.Name)] = r.Meta.Name |
| 333 | c.addEvent(r.Meta.Name, r, runtimev1.ResourceEvent_RESOURCE_EVENT_WRITE) |
| 334 | return nil |
| 335 | } |
| 336 | |
| 337 | // updateState updates the state field of a resource. |
| 338 | // It uses the state from the passed resource and disregards its other fields. |
no test coverage detected