From f268f30c97573e054bbd37403ce7b4a3e198f2f5 Mon Sep 17 00:00:00 2001 From: Beni Cherniavsky-Paskin Date: Thu, 13 Jul 2017 15:25:08 +0300 Subject: [PATCH] service/registry matching (BUG: last port only) --- .../kubernetes/container_manager/refresh_parser.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb b/app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb index cd82206e26..f72ed0b971 100644 --- a/app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb +++ b/app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb @@ -491,11 +491,18 @@ def get_endpoints_and_services_graph(inv) h[:container_project] = lazy_find_project(:name => h[:namespace]) # TODO: untested? + # TODO: with multiple ports, how can I match any of them to known registries, + # like https://github.com/ManageIQ/manageiq-providers-kubernetes/pull/57 ? + if h[:container_service_port_configs].any? + registry_port = h[:container_service_port_configs].last[:port] + h[:container_image_registry] = lazy_find_image_registry( + :host => h[:portal_ip], :port => registry_port + ) + end + custom_attrs = h.extract!(:labels, :selector_parts) children = h.extract!(:container_service_port_configs) - _container_image_registry = h.delete(:container_image_registry) # TODO: derive from container_service_port_configs - h[:container_groups] = cgs_by_namespace_and_name.fetch_path(h[:namespace], h[:name]) h.except!(:tags)