hasNetworkMismatch checks if the container is not connected to all expected networks.
(expected types.ServiceConfig, oc ObservedContainer)
| 600 | |
| 601 | // hasNetworkMismatch checks if the container is not connected to all expected networks. |
| 602 | func (r *reconciler) hasNetworkMismatch(expected types.ServiceConfig, oc ObservedContainer) bool { |
| 603 | for _, net := range sortedKeys(expected.Networks) { |
| 604 | expectedID := "" |
| 605 | if obs, ok := r.observed.Networks[net]; ok { |
| 606 | expectedID = obs.ID |
| 607 | } |
| 608 | if expectedID == "" || expectedID == "swarm" { |
| 609 | continue |
| 610 | } |
| 611 | found := false |
| 612 | for _, netID := range oc.ConnectedNetworks { |
| 613 | if netID == expectedID { |
| 614 | found = true |
| 615 | break |
| 616 | } |
| 617 | } |
| 618 | if !found { |
| 619 | return true |
| 620 | } |
| 621 | } |
| 622 | return false |
| 623 | } |
| 624 | |
| 625 | // hasVolumeMismatch checks if the container is missing any expected volume mounts. |
| 626 | func (r *reconciler) hasVolumeMismatch(expected types.ServiceConfig, oc ObservedContainer) bool { |
no test coverage detected