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

kubernetes: verify endpoint api version #2696

Merged
merged 3 commits into from
May 7, 2015

Conversation

simon3z
Copy link
Contributor

@simon3z simon3z commented Apr 21, 2015

This PR is based on #2156 and it should be queued behind that. /cc @Fryguy

There are still a couple of things that I am working on and I still need to verify it (maybe there's an api_version name collision, etc... we'll see when #2156 will be merged).

@simon3z
Copy link
Contributor Author

simon3z commented Apr 21, 2015

@miq-bot add_label providers/containers

@miq-bot
Copy link
Member

miq-bot commented Apr 21, 2015

<gemfile_checker />@JPrause @jvlcek Gemfile changes detected in commit simon3z@2fafd53. Please review.

@miq-bot
Copy link
Member

miq-bot commented Apr 24, 2015

<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush.

@miq-bot
Copy link
Member

miq-bot commented Apr 24, 2015

<gemfile_checker />@JPrause @jvlcek Gemfile changes detected in commit simon3z@34be397. Please review.

@simon3z simon3z changed the title [wip] kubernetes: verify endpoint api version kubernetes: verify endpoint api version Apr 29, 2015
@miq-bot
Copy link
Member

miq-bot commented Apr 29, 2015

<gemfile_checker />@JPrause @jvlcek Gemfile changes detected in commit simon3z@ba66585. Please review.

@miq-bot
Copy link
Member

miq-bot commented Apr 29, 2015

<gemfile_checker />@JPrause @jvlcek Gemfile changes detected in commit simon3z@8ed2fb7. Please review.

@miq-bot
Copy link
Member

miq-bot commented Apr 29, 2015

<gemfile_checker />@JPrause @jvlcek Gemfile changes detected in commit simon3z@7fced07. Please review.

@simon3z
Copy link
Contributor Author

simon3z commented Apr 29, 2015

@Fryguy can you review/merge this?

# TODO: support real authentication using certificates
true
with_provider_connection(options) do |connection|
unless (connection.api['versions'] || []).include? api_version
Copy link
Member

Choose a reason for hiding this comment

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

So, again, this should not live here...it should be in the kubeclient gem itself in the api_valid? method, which I added there. kubeclient already knows what it "should" connect to, so it should be responsible for validating it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Fryguy kubeclient supports all the APIs, it's ManageIQ being picky on which one supports, so the validation should be here. For as much as the api_valid? method is involved... the api would be valid but ManageIQ wouldn't be able to parse the objects.

Copy link
Member

Choose a reason for hiding this comment

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

The reason I think it's kubeclient's responsibility is that it's passed as a parameter to Kubeclient.new. Therefore we are telling kubeclient which version we need, and it's own validator should verify that the version is available and accessible. Thus, if we hypothetically connected to a kubernetes instance that did not have the version we gave to kubeclient, then kubeclient should tell us that (ideally on the api_valid? method). If we were not passing the api_version in, then I'd agree with you.

@miq-bot
Copy link
Member

miq-bot commented Apr 30, 2015

<gemfile_checker />@JPrause @jvlcek Gemfile changes detected in commit simon3z@0eb4cdc. Please review.

end
with_provider_connection(options) do |connection|
unless (connection.api['versions'] || []).include? self.class.api_version
raise MiqException::MiqHostError, \
Copy link
Member

Choose a reason for hiding this comment

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

No need for the line continuator...in fact, please keep it on one line.

Fryguy and others added 2 commits May 5, 2015 15:09
This will prevent worker cycling when the Kubernetes endpoint is not
available.
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
true
end
with_provider_connection(options) do |connection|
unless (connection.api['versions'] || []).include? self.class.api_version
Copy link
Member

Choose a reason for hiding this comment

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

Prefer using Hash#fetch with default vs. || here.

unless connection.api.fetch('versions', []).include? self.class.api_version

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
@miq-bot
Copy link
Member

miq-bot commented May 6, 2015

Checked commits simon3z@51a2ddc .. simon3z@b5600d8 with rubocop 0.27.1
8 files checked, 6 offenses detected

vmdb/app/models/ems_kubernetes.rb

vmdb/spec/models/ext_management_system_spec.rb

@simon3z
Copy link
Contributor Author

simon3z commented May 6, 2015

@Fryguy this should be ready to be merged.

@simon3z
Copy link
Contributor Author

simon3z commented May 7, 2015

@blomquisg @Fryguy ping?

Fryguy added a commit that referenced this pull request May 7, 2015
kubernetes: verify endpoint api version
@Fryguy Fryguy merged commit 5eea9ce into ManageIQ:master May 7, 2015
@Fryguy Fryguy added this to the Sprint 23 Ending May 11, 2015 milestone May 7, 2015
@simon3z simon3z deleted the verify-endpoint-api branch June 9, 2015 18:55
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.

4 participants