Class: Seira::Setup
- Inherits:
-
Object
- Object
- Seira::Setup
- Defined in:
- lib/seira/setup.rb
Constant Summary collapse
- SUMMARY =
"Set up your local CLI with the right project and cluster configuration.".freeze
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(target:, args:, settings:) ⇒ Setup
constructor
A new instance of Setup.
-
#run ⇒ Object
This script should be all that’s needed to fully set up gcloud and kubectl cli, fully configured, on a development machine.
Constructor Details
#initialize(target:, args:, settings:) ⇒ Setup
Returns a new instance of Setup.
10 11 12 13 14 |
# File 'lib/seira/setup.rb', line 10 def initialize(target:, args:, settings:) @target = target @args = args @settings = settings end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
8 9 10 |
# File 'lib/seira/setup.rb', line 8 def args @args end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
8 9 10 |
# File 'lib/seira/setup.rb', line 8 def settings @settings end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
8 9 10 |
# File 'lib/seira/setup.rb', line 8 def target @target end |
Instance Method Details
#run ⇒ Object
This script should be all that’s needed to fully set up gcloud and kubectl cli, fully configured, on a development machine.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/seira/setup.rb', line 18 def run ensure_software_installed if target == 'status' run_status exit(0) elsif target == 'all' puts "We will now set up gcloud and kubectl for each project. Each cluster is specified in .seira.yml." settings.valid_cluster_names.each do |cluster| setup_cluster(cluster) end elsif settings.valid_cluster_names.include?(target) puts "We will now set up gcloud and kubectl for #{target}" setup_cluster(target) else puts "Please specify a valid cluster name or 'all'. Got #{target}" exit(1) end puts "You have now configured all of your configurations. Please note that 'gcloud' and 'kubectl' are two separate command line tools." puts "gcloud: For manipulating GCP entities such as sql databases and kubernetes clusters themselves" puts "kubectl: For working within a kubernetes cluster, such as listing pods and deployment statuses" puts "Always remember to update both by using 'seira <cluster>', such as 'seira staging'." puts "Except for special circumstances, you should be able to always use 'seira' tool and avoid `gcloud` and `kubectl` directly." puts "All set!" end |