mustRecreate decides whether oc must be recreated to match expected. The expectedHash and parentRecreated inputs are precomputed once per service by reconcileService — see expectedConfigHash and parentNamespaceRecreated for the rationale (issue #13878).
(expected types.ServiceConfig, expectedHash string, parentRecreated bool, oc ObservedContainer, policy string)
| 538 | // reconcileService — see expectedConfigHash and parentNamespaceRecreated for |
| 539 | // the rationale (issue #13878). |
| 540 | func (r *reconciler) mustRecreate(expected types.ServiceConfig, expectedHash string, parentRecreated bool, oc ObservedContainer, policy string) bool { |
| 541 | switch policy { |
| 542 | case api.RecreateNever: |
| 543 | return false |
| 544 | case api.RecreateForce: |
| 545 | return true |
| 546 | } |
| 547 | if parentRecreated { |
| 548 | return true |
| 549 | } |
| 550 | if oc.ConfigHash != expectedHash { |
| 551 | return true |
| 552 | } |
| 553 | if oc.ImageDigest != expected.CustomLabels[api.ImageDigestLabel] { |
| 554 | return true |
| 555 | } |
| 556 | if oc.State == container.StateRunning && r.hasNetworkMismatch(expected, oc) { |
| 557 | return true |
| 558 | } |
| 559 | return r.hasVolumeMismatch(expected, oc) |
| 560 | } |
| 561 | |
| 562 | // parentNamespaceRecreated reports whether any namespace- or volume-sharing |
| 563 | // parent of svc has at least one container scheduled for recreation. The |
no test coverage detected