Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh service catalog entities #276

Merged
merged 9 commits into from
Aug 27, 2018

Conversation

Ladas
Copy link
Contributor

@Ladas Ladas commented Aug 23, 2018

@Ladas
Copy link
Contributor Author

Ladas commented Aug 23, 2018

cc @gtanzillo

Cleanup entities iterator and use it for every collection
end

def pods
@pods ||= connection.get_pods
Copy link
Contributor Author

@Ladas Ladas Aug 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agrare hm, you are memoizing this because you then fetch the collection.,resourceVersion from it, right?

Would it make sense to just memoize resourceVersion value? Because I would like this to be an iterator doing paginated query later

Memoize the collections for now, since we are getting the
resourceVersion from it later.
end

def pods
@pods ||= connection.get_pods
@pods ||= entities_iterator(connection, :pods)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agrare we'll need to figure out how it works when we have paginated query and we would want the collection resourceVersion

I think for now, we should have e.g. attr_accessor :namespaces_resource_version and just write to that in the entities_iterator, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting.
A slightly open question in kubeclient iterator interface was how it should expose whole-collection resource_version (and other metadata). Should iterator yield it with every item, or return it at the end?
With streaming parse (ManageIQ/kubeclient#254), this depends on order of json. k8s puts items last, so version is known by time we start yielding; this is unlikely to change but I feel weird hardcoding this assumption...
For chunking (ManageIQ/kubeclient#283), we'll have metadata in each chunk, so either API works. Chunking also brings risk of getting 410 Gone if we wait too long, not sure how to handle that.

@cben cben added the inventory label Aug 23, 2018
@@ -68,6 +68,15 @@ def kubernetes_auth_options(options)
def kubernetes_version
'v1'
end

def kubernetes_service_catalog_connect(hostname, port, options)
options = {:path => '/apis/servicecatalog.k8s.io', :version => service_catalog_api_version}.merge(options)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have too many ways to connect, what with ems.connect(:service => ...), also I think supporting ems.connect(:path => ...), and code somewhere I can't find now deriving path & version dynamically.

Nothing wrong with this method however 👍. Just wish I had time to clean up some of the other ways...

def entities_iterator(client, entity)
# TODO(lsmola) change to iterator, that will fetch paginated response from the server, never fetching everything
# at once
client.send("get_#{entity}")
Copy link
Contributor

@cben cben Aug 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it's important here that entity is plural, e.g. :pods not :pod, but this is unobvious looking at an arg named entity.

@Ladas Ladas force-pushed the refresh_service_catalog_entities branch 2 times, most recently from e0155fb to 623a825 Compare August 27, 2018 09:48
@Ladas Ladas force-pushed the refresh_service_catalog_entities branch from b8b4678 to a9937e2 Compare August 27, 2018 12:57
@miq-bot
Copy link
Member

miq-bot commented Aug 27, 2018

Some comments on commits Ladas/manageiq-providers-kubernetes@4f97cdb~...a9937e2

app/models/manageiq/providers/kubernetes/inventory/collector/container_manager.rb

  • ⚠️ - 7 - Detected puts. Remove all debugging statements.

@miq-bot
Copy link
Member

miq-bot commented Aug 27, 2018

Checked commits Ladas/manageiq-providers-kubernetes@4f97cdb~...a9937e2 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
6 files checked, 0 offenses detected
Everything looks fine. 🍰

@agrare agrare closed this Aug 27, 2018
@agrare agrare reopened this Aug 27, 2018
@Ladas Ladas merged commit 59e4feb into ManageIQ:master Aug 27, 2018
@Ladas
Copy link
Contributor Author

Ladas commented Aug 27, 2018

@agrare ugh, I've miss clicked, wanted to merge your AWS PR :-/

@agrare
Copy link
Member

agrare commented Aug 27, 2018

@Ladas no worries, LGTM was going to merge it when I saw it was green anyway

@Ladas Ladas added this to the Sprint 93 Ending Aug 27, 2018 milestone Aug 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants