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

Enhance the the orchestrator to deal with more objects #15962

Merged
merged 6 commits into from
Oct 3, 2017

Conversation

carbonin
Copy link
Member

This puts the hash definitions of the API objects into definition methods which expose only a limited amount of customization.

The new create / delete methods on the main ContainerOrchestrator object now yield the definition before issuing the API call to allow for further changes.

This is mostly related to the re-architecture, but won't hurt anything if we merge it now ¯\_(ツ)_/¯

@miq-bot miq-bot added the wip label Sep 11, 2017
@carbonin carbonin force-pushed the enhance_container_orchestrator branch 5 times, most recently from 28e80dc to 89b77e4 Compare September 22, 2017 18:56
@carbonin carbonin removed the wip label Sep 22, 2017
@carbonin carbonin changed the title [WIP] Enhance the the orchestrator to deal with more objects Enhance the the orchestrator to deal with more objects Sep 22, 2017
@carbonin
Copy link
Member Author

I think this one is ready for review.

yield(definition) if block_given?
connection.create_deployment_config(definition)
rescue KubeException => e
raise unless e.message =~ /already exists/
Copy link
Member

Choose a reason for hiding this comment

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

Should we check it if already exists rather than rescuing the error?

Copy link
Member Author

Choose a reason for hiding this comment

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

Searching for a particular object that doesn't exist using the Kubeclient gem raises the same exception so I figured it was easier to go this way.

def default_environment
[
{:name => "GUID", :value => MiqServer.my_guid},
{:name => "DATABASE_SERVICE_NAME", :value => ENV["DATABASE_SERVICE_NAME"]},
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, can you sort these alphabetically?

Kubeclient::Client.new(
uri,
:auth_options => { :bearer_token_file => TOKEN_FILE },
:ssl_options => { :verify_ssl => OpenSSL::SSL::VERIFY_NONE }
Copy link
Member

Choose a reason for hiding this comment

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

Do we have the certificate? If so, can we VERIFY_SSL?

describe "#create_deployment_config" do
it "creates a deployment config with the given name and edits" do
expect(connection_stub).to receive(:create_deployment_config) do |definition|
expect(definition[:metadata][:name]).to eq("test")
Copy link
Member

Choose a reason for hiding this comment

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

definition.fetch_path(:metadata, :name)?

end

subject.create_deployment_config("test") do |spec|
spec[:spec][:template][:spec][:serviceAccount] = "test-account"
Copy link
Member

Choose a reason for hiding this comment

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

spec.store_path(:spec, :template, :spec, :serviceAccount, "test-account")?

end
end

it "dosn't raise an exception for an existing object" do
Copy link
Member

Choose a reason for hiding this comment

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

doesn't

This puts the hash definitions of the API objects into definition
methods which expose only a limited amount of customization.

The new create / delete methods on the main ContainerOrchestrator
object now yield the definition before issuing the API call to
allow for further changes.
This will allow easy productization while still specifying an
app name so that all of our objects can be referenced together.
@carbonin carbonin force-pushed the enhance_container_orchestrator branch from 89b77e4 to 0880821 Compare September 27, 2017 19:36
@miq-bot
Copy link
Member

miq-bot commented Sep 27, 2017

Checked commits carbonin/manageiq@f62374c~...0880821 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 0 offenses detected
Everything looks fine. 🏆

@Fryguy
Copy link
Member

Fryguy commented Oct 2, 2017

@bdunne You ok with this?

@bdunne bdunne merged commit 0c6e2ba into ManageIQ:master Oct 3, 2017
@bdunne bdunne added this to the Sprint 71 Ending Oct 16, 2017 milestone Oct 3, 2017
@bdunne bdunne added the fine/no label Oct 3, 2017
@bdunne bdunne assigned bdunne and unassigned gtanzillo Oct 3, 2017
@carbonin carbonin deleted the enhance_container_orchestrator branch October 13, 2017 19:34
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.

5 participants