Class: Porkadot::Install::Kubernetes
- Inherits:
-
Object
- Object
- Porkadot::Install::Kubernetes
- Includes:
- SSHKit::DSL
- Defined in:
- lib/porkadot/install/kubernetes.rb
Constant Summary collapse
- KUBE_TEMP =
File.join(Porkadot::Install::KUBE_TEMP, 'kubernetes')
- KUBE_SECRETS_TEMP =
File.join(Porkadot::Install::KUBE_TEMP, '.kubernetes')
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#global_config ⇒ Object
readonly
Returns the value of attribute global_config.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(global_config) ⇒ Kubernetes
constructor
A new instance of Kubernetes.
- #install(host, target = '') ⇒ Object
Constructor Details
#initialize(global_config) ⇒ Kubernetes
Returns a new instance of Kubernetes.
10 11 12 13 14 |
# File 'lib/porkadot/install/kubernetes.rb', line 10 def initialize global_config @global_config = global_config @config = global_config.kubernetes @logger = global_config.logger end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/porkadot/install/kubernetes.rb', line 7 def config @config end |
#global_config ⇒ Object (readonly)
Returns the value of attribute global_config.
6 7 8 |
# File 'lib/porkadot/install/kubernetes.rb', line 6 def global_config @global_config end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
8 9 10 |
# File 'lib/porkadot/install/kubernetes.rb', line 8 def logger @logger end |
Instance Method Details
#install(host, target = '') ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/porkadot/install/kubernetes.rb', line 16 def install host, target='' # global_config = self.global_config config = self.config on(host) do |host| execute(:mkdir, '-p', Porkadot::Install::KUBE_TEMP) if test("[ -d #{KUBE_TEMP} ]") execute(:rm, '-rf', KUBE_TEMP) execute(:rm, '-rf', KUBE_SECRETS_TEMP) end upload! config.target_path, KUBE_TEMP, recursive: true upload! config.target_secrets_path, KUBE_SECRETS_TEMP, recursive: true # as user: 'root' do with KUBE_TARGET: target do with KUBECONFIG: File.join(KUBE_SECRETS_TEMP, 'kubeconfig.yaml') do execute(:bash, File.join(KUBE_SECRETS_TEMP, 'install.secrets.sh')) # execute(:bash, File.join(KUBE_TEMP, 'install.sh'), interaction_handler: SSHKit::MappingInteractionHandler.new({}, :info)) info capture(:bash, File.join(KUBE_TEMP, 'install.sh')) end end end end |