-
Notifications
You must be signed in to change notification settings - Fork 898
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
Use OpenShift API to control the Ansible container #15492
Changes from all commits
3774758
58d4fd9
463922e
ebace6f
02ef655
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class ContainerOrchestrator | ||
TOKEN_FILE = "/run/secrets/kubernetes.io/serviceaccount/token".freeze | ||
|
||
def scale(deployment_config_name, replicas) | ||
connection.patch_deployment_config(deployment_config_name, { :spec => { :replicas => replicas } }, ENV["MY_POD_NAMESPACE"]) | ||
end | ||
|
||
private | ||
|
||
def connection | ||
require 'kubeclient' | ||
|
||
@connection ||= | ||
Kubeclient::Client.new( | ||
manager_uri, | ||
:auth_options => { :bearer_token_file => TOKEN_FILE }, | ||
:ssl_options => { :verify_ssl => OpenSSL::SSL::VERIFY_NONE } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. friendly reminder: will need something better than VERIFY_NONE eventually :) This is to be used when MIQ runs inside the cluster, right? |
||
) | ||
end | ||
|
||
def manager_uri | ||
URI::HTTPS.build( | ||
:host => ENV["KUBERNETES_SERVICE_HOST"], | ||
:port => ENV["KUBERNETES_SERVICE_PORT"], | ||
:path => "/oapi" | ||
) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kill this blank line please. (You vim users and your leading blank lines )