Class: Porkadot::Assets::Bootstrap
- Inherits:
-
Object
- Object
- Porkadot::Assets::Bootstrap
- Includes:
- Porkadot::Assets
- Defined in:
- lib/porkadot/assets/bootstrap.rb
Constant Summary collapse
- TEMPLATE_DIR =
File.join(File.dirname(__FILE__), "bootstrap")
Instance Attribute Summary collapse
-
#certs_config ⇒ Object
readonly
Returns the value of attribute certs_config.
-
#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) ⇒ Bootstrap
constructor
A new instance of Bootstrap.
- #render ⇒ Object
- #render_manifests ⇒ Object
- #render_secrets ⇒ Object
Methods included from Porkadot::Assets
#render_erb, #render_secrets_erb
Constructor Details
#initialize(global_config) ⇒ Bootstrap
Returns a new instance of Bootstrap.
12 13 14 15 16 17 |
# File 'lib/porkadot/assets/bootstrap.rb', line 12 def initialize global_config @global_config = global_config @config = global_config.bootstrap @certs_config = global_config.certs @logger = global_config.logger end |
Instance Attribute Details
#certs_config ⇒ Object (readonly)
Returns the value of attribute certs_config.
9 10 11 |
# File 'lib/porkadot/assets/bootstrap.rb', line 9 def certs_config @certs_config end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/porkadot/assets/bootstrap.rb', line 8 def config @config end |
#global_config ⇒ Object (readonly)
Returns the value of attribute global_config.
7 8 9 |
# File 'lib/porkadot/assets/bootstrap.rb', line 7 def global_config @global_config end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
10 11 12 |
# File 'lib/porkadot/assets/bootstrap.rb', line 10 def logger @logger end |
Instance Method Details
#render ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/porkadot/assets/bootstrap.rb', line 19 def render logger.info "--> Rendering bootstrap manifests" unless File.directory?(config.bootstrap_path) FileUtils.mkdir_p(config.bootstrap_path) end render_secrets render_erb 'bootstrap/kubeconfig-bootstrap.yaml' render_erb 'bootstrap/kube-proxy-bootstrap.yaml' render_manifests render_erb 'install.sh' render_erb 'cleanup.sh' end |
#render_manifests ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/porkadot/assets/bootstrap.rb', line 40 def render_manifests unless File.directory?(config.manifests_path) FileUtils.mkdir_p(config.manifests_path) end render_erb 'manifests/kube-apiserver.bootstrap.yaml' render_erb 'manifests/kube-controller-manager.bootstrap.yaml' render_erb 'manifests/kube-scheduler.bootstrap.yaml' render_erb 'manifests/kube-proxy.bootstrap.yaml' end |
#render_secrets ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/porkadot/assets/bootstrap.rb', line 32 def render_secrets logger.info "----> Secrets" unless File.directory?(config.secrets_path) FileUtils.mkdir_p(config.secrets_path) end FileUtils.cp_r(Dir.glob(File.join(certs_config.certs_root_dir, '*')), config.secrets_path) end |