require 'kubeclient' module Kubeclient module Common # Hot fix for kubeclient should be going upstream # * https://github.com/abonas/kubeclient/pull/96 class Client def get_entities(entity_type, klass, options) params = {} if options[:label_selector] params['params'] = { labelSelector: options[:label_selector] } end ns_prefix = build_namespace_prefix(options[:namespace]) response = handle_exception do rest_client[ns_prefix + resource_name(entity_type)] .get(params.merge(@headers)) end result = JSON.parse(response) resource_version = result.fetch('resourceVersion', nil) if resource_version.nil? resource_version = result.fetch('metadata', {}).fetch('resourceVersion', nil) end collection = result['items'].map { |item| new_entity(item, klass) } EntityList.new(entity_type, resource_version, collection) end end end end