Class: Porkadot::Cmd::Render::Certs::Cli

Inherits:
SubCommandBase show all
Includes:
Utils
Defined in:
lib/porkadot/cmd/render/certs.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils

#config, #logger

Methods inherited from SubCommandBase

banner

Constructor Details

#initialize(*arg) ⇒ Cli

Returns a new instance of Cli.



7
8
9
# File 'lib/porkadot/cmd/render/certs.rb', line 7

def initialize(*arg)
  super
end

Class Method Details

.subcommand_prefixObject



64
65
66
# File 'lib/porkadot/cmd/render/certs.rb', line 64

def self.subcommand_prefix
  'render certs'
end

Instance Method Details

#allObject



13
14
15
16
# File 'lib/porkadot/cmd/render/certs.rb', line 13

def all
  invoke :etcd
  invoke :kubernetes
end

#etcdObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/porkadot/cmd/render/certs.rb', line 19

def etcd
  logger.info "Generating etcd certificates"
  certs = Porkadot::Assets::Certs.new(config).etcd
  logger.info "--> CA key and certs"
  certs.ca_key
  certs.ca_cert(true)
  logger.info "--> Client key and certs"
  certs.client_key
  certs.client_cert(true)
  ''
end

#kubernetesObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/porkadot/cmd/render/certs.rb', line 32

def kubernetes
  logger.info "Generating kubernetes certificates"
  certs = Porkadot::Assets::Certs.new(config).kubernetes
  logger.info "--> CA key and certs"
  certs.ca_key
  certs.ca_cert(true)
  logger.info "--> API server key and certs"
  certs.apiserver_key
  certs.apiserver_cert(true)
  logger.info "--> Kubelet client key and certs"
  certs.kubelet_client_key
  certs.kubelet_client_cert(true)
  # logger.info "--> Bootstrap client key and certs"
  # bootstrap_client_key = self.private_key(self.assets.k8s_bootstrap_key_path)
  # self.client_cert(self.assets.k8s_bootstrap_cert_path, '/O=porkadot:node-bootstrappers/CN=node-bootstrapper', bootstrap_client_key, ca_cert, ca_key)
  logger.info "--> Admin client key and certs"
  certs.client_key
  certs.client_cert(true)
  logger.info "--> Private key for signing service account tokens"
  certs.sa_private_key
  certs.sa_public_key

  front_proxy_certs = Porkadot::Assets::Certs.new(config).front_proxy
  logger.info "--> Front-proxy CA key and certs"
  front_proxy_certs.ca_key
  front_proxy_certs.ca_cert(true)
  logger.info "--> Front-proxy client key and certs"
  front_proxy_certs.client_key
  front_proxy_certs.client_cert(true)
  ''
end