formatPublishers parses and returns docker-compatible []PortPublisher from label map. If an error happens, an empty slice is returned.
(portMappings []cni.PortMapping)
| 346 | // formatPublishers parses and returns docker-compatible []PortPublisher from |
| 347 | // label map. If an error happens, an empty slice is returned. |
| 348 | func formatPublishers(portMappings []cni.PortMapping) []PortPublisher { |
| 349 | mapper := func(pm cni.PortMapping) PortPublisher { |
| 350 | return PortPublisher{ |
| 351 | URL: pm.HostIP, |
| 352 | TargetPort: int(pm.ContainerPort), |
| 353 | PublishedPort: int(pm.HostPort), |
| 354 | Protocol: pm.Protocol, |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | var dockerPorts []PortPublisher |
| 359 | for _, p := range portMappings { |
| 360 | dockerPorts = append(dockerPorts, mapper(p)) |
| 361 | } |
| 362 | return dockerPorts |
| 363 | } |
| 364 | |
| 365 | // statusForFilter returns the status value to be matched with the 'status' filter |
| 366 | func statusForFilter(ctx context.Context, c containerd.Container) string { |
no outgoing calls
no test coverage detected
searching dependent graphs…