Module: Dapp::Kube::Dapp::Command::Common
- Included in:
- Dapp
- Defined in:
- lib/dapp/kube/dapp/command/common.rb
Instance Method Summary collapse
- #kube_check_helm! ⇒ Object
- #kube_namespace ⇒ Object
- #kube_release_name ⇒ Object
- #kubernetes ⇒ Object
- #secret ⇒ Object
- #secret_key_not_found_in ⇒ Object
- #secret_key_should_exist! ⇒ Object
Instance Method Details
#kube_check_helm! ⇒ Object
6 7 8 |
# File 'lib/dapp/kube/dapp/command/common.rb', line 6 def kube_check_helm! raise Error::Command, code: :helm_not_found if shellout('which helm').exitstatus == 1 end |
#kube_namespace ⇒ Object
14 15 16 |
# File 'lib/dapp/kube/dapp/command/common.rb', line 14 def kube_namespace kubernetes.namespace end |
#kube_release_name ⇒ Object
10 11 12 |
# File 'lib/dapp/kube/dapp/command/common.rb', line 10 def kube_release_name "#{name}-#{kube_namespace}" end |
#kubernetes ⇒ Object
48 49 50 51 52 53 |
# File 'lib/dapp/kube/dapp/command/common.rb', line 48 def kubernetes @kubernetes ||= begin namespace = [:namespace].nil? ? nil : [:namespace].tr('_', '-') Client.new(namespace: namespace) end end |
#secret ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/dapp/kube/dapp/command/common.rb', line 25 def secret @secret ||= begin unless secret_key = ENV['DAPP_SECRET_KEY'] secret_key_not_found_in << '`DAPP_SECRET_KEY`' if dappfile_exists? file_path = path('.dapp_secret_key') if file_path.file? secret_key = path('.dapp_secret_key').read.chomp else secret_key_not_found_in << "`#{file_path}`" end end end Secret.new(secret_key) if secret_key end end |
#secret_key_not_found_in ⇒ Object
44 45 46 |
# File 'lib/dapp/kube/dapp/command/common.rb', line 44 def secret_key_not_found_in @secret_key_not_found_in ||= [] end |