sct 0.1.14 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/bin/sct +3 -4
  3. data/{.DS_Store → cluster/lib/.DS_Store} +0 -0
  4. data/cluster/lib/cluster.rb +6 -0
  5. data/cluster/lib/cluster/commands_generator.rb +95 -0
  6. data/cluster/lib/cluster/module.rb +7 -0
  7. data/cluster/lib/cluster/runner.rb +239 -0
  8. data/{lib → sct/lib}/.DS_Store +0 -0
  9. data/sct/lib/sct.rb +17 -0
  10. data/sct/lib/sct/.DS_Store +0 -0
  11. data/sct/lib/sct/cli_tools_distributor.rb +46 -0
  12. data/{lib → sct/lib}/sct/command.rb +0 -0
  13. data/sct/lib/sct/commands/hostfile.rb +68 -0
  14. data/sct/lib/sct/commands/init.rb +37 -0
  15. data/sct/lib/sct/commands/mysqlproxy.rb +20 -0
  16. data/sct/lib/sct/commands_generator.rb +56 -0
  17. data/sct/lib/sct/tools.rb +12 -0
  18. data/sct/lib/sct/version.rb +3 -0
  19. data/sct_core/lib/.DS_Store +0 -0
  20. data/sct_core/lib/sct_core.rb +13 -0
  21. data/{lib/sct → sct_core/lib/sct_core}/.DS_Store +0 -0
  22. data/sct_core/lib/sct_core/command_executor.rb +104 -0
  23. data/{lib/sct → sct_core/lib/sct_core}/config.rb +3 -3
  24. data/sct_core/lib/sct_core/core_ext/string.rb +9 -0
  25. data/{lib/sct/setup/helpers.rb → sct_core/lib/sct_core/helper.rb} +2 -2
  26. data/sct_core/lib/sct_core/module.rb +0 -0
  27. data/sct_core/lib/sct_core/sct_pty.rb +53 -0
  28. data/sct_core/lib/sct_core/ui/implementations/shell.rb +129 -0
  29. data/sct_core/lib/sct_core/ui/interface.rb +120 -0
  30. data/sct_core/lib/sct_core/ui/ui.rb +26 -0
  31. data/shell/README.md +0 -0
  32. data/shell/lib/shell.rb +3 -0
  33. data/{lib/sct → shell/lib/shell}/ClassLevelInheritableAttributes.rb +0 -0
  34. data/shell/lib/shell/commands_generator.rb +14 -0
  35. data/{lib/sct → shell/lib/shell}/docker/composer.rb +4 -3
  36. data/{lib/sct → shell/lib/shell}/docker/docker.rb +7 -10
  37. data/{lib/sct → shell/lib/shell}/docker/php.rb +3 -2
  38. data/{lib/sct → shell/lib/shell}/docker/yarn.rb +4 -3
  39. data/shell/lib/shell/module.rb +9 -0
  40. data/shell/lib/shell/runner.rb +34 -0
  41. data/shell/lib/shell/tools.rb +7 -0
  42. metadata +92 -54
  43. data/.gitignore +0 -12
  44. data/.rspec +0 -3
  45. data/.travis.yml +0 -7
  46. data/CODE_OF_CONDUCT.md +0 -74
  47. data/Gemfile +0 -4
  48. data/Gemfile.lock +0 -48
  49. data/LICENSE.txt +0 -21
  50. data/README.md +0 -134
  51. data/Rakefile +0 -6
  52. data/lib/sct.rb +0 -61
  53. data/lib/sct/command_interface.rb +0 -18
  54. data/lib/sct/command_option.rb +0 -14
  55. data/lib/sct/commands/cluster.rb +0 -121
  56. data/lib/sct/commands/composer.rb +0 -29
  57. data/lib/sct/commands/hostfile.rb +0 -125
  58. data/lib/sct/commands/init.rb +0 -51
  59. data/lib/sct/commands/mysqlproxy.rb +0 -38
  60. data/lib/sct/commands/php.rb +0 -37
  61. data/lib/sct/commands/yarn.rb +0 -26
  62. data/lib/sct/version.rb +0 -3
  63. data/sct.gemspec +0 -40
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- .idea/
10
-
11
- # rspec failure tracking
12
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.2
7
- before_install: gem install bundler -v 2.0.2
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at reshad@proactive.nl. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in sct.gemspec
4
- gemspec
@@ -1,48 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- sct (0.1.3)
5
- class_interface (~> 0.1.1)
6
- colored (~> 1.2)
7
- commander (~> 4.4.7)
8
- highline (>= 1.7.2)
9
- hosts (~> 0.1.1)
10
-
11
- GEM
12
- remote: https://rubygems.org/
13
- specs:
14
- class_interface (0.1.1)
15
- colored (1.2)
16
- commander (4.4.7)
17
- highline (~> 2.0.0)
18
- diff-lcs (1.3)
19
- highline (2.0.3)
20
- hosts (0.1.1)
21
- linebreak (~> 2.0.1)
22
- linebreak (2.0.1)
23
- rake (10.5.0)
24
- rspec (3.9.0)
25
- rspec-core (~> 3.9.0)
26
- rspec-expectations (~> 3.9.0)
27
- rspec-mocks (~> 3.9.0)
28
- rspec-core (3.9.1)
29
- rspec-support (~> 3.9.1)
30
- rspec-expectations (3.9.0)
31
- diff-lcs (>= 1.2.0, < 2.0)
32
- rspec-support (~> 3.9.0)
33
- rspec-mocks (3.9.1)
34
- diff-lcs (>= 1.2.0, < 2.0)
35
- rspec-support (~> 3.9.0)
36
- rspec-support (3.9.2)
37
-
38
- PLATFORMS
39
- ruby
40
-
41
- DEPENDENCIES
42
- bundler (~> 2.0)
43
- rake (~> 10.0)
44
- rspec (~> 3.0)
45
- sct!
46
-
47
- BUNDLED WITH
48
- 2.1.4
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020 Reshad Farid
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/README.md DELETED
@@ -1,134 +0,0 @@
1
- # SCT
2
- The **SCT** command line tool helps developers set up and maintain a Kubernetes (k8s) cluster on their development machine which closely resembles the production setup.
3
-
4
- The tool is geared towards the implementation of a local development environment in compliance with the [*Visma Cloud Delivery Model*](https://www.visma.com/blog/our-large-scale-devops-transformation/) (SCT) to be deployed on *Google Cloud Services*.
5
-
6
- The SCT tool is a collection of commands that can be run from your local development environment. These commands will take care of some steps necessary to initialize the development environment, but also of some recurring tasks to keep this environment going on a daily base.
7
-
8
- This README will provide an installation guide, an overview of the available commands and a brief guide for developers that need to contribute to the **SCT** CLI tool.
9
-
10
- The tool is written in Ruby and is meant to run on *Windows, Linux and Mac* environments.
11
-
12
- ## Installation
13
-
14
- 1) Open a terminal or bash window and make sure [**Ruby**](https://www.ruby-lang.org/en/documentation/installation/) is installed on your machine with _version >= 2.6.*_
15
-
16
- $ which ruby
17
- $ ruby --version
18
-
19
- 2) As this Ruby Gem is not yet published, you will need to install the *SCT* tool from this repository and use Ruby [**bundler**](https://bundler.io/) to manage dependencies.
20
-
21
- $ gem install bundler
22
-
23
- 3) Navigate to a (new) folder where you want the SCT code, and clone this repository:
24
-
25
- $ git clone https://github.com/reshadf/sct.git
26
-
27
- 4) Then let **bundler** manage the dependencies:
28
-
29
- $ bundle
30
-
31
- 5) And let **gem** create a binary:
32
-
33
- $ gem install sct
34
-
35
- 6) Now, the **sct** tool is available anywhere from the command line
36
-
37
- $ sct --help
38
-
39
-
40
- ## Usage
41
-
42
- SCT offers a number of commands to help developers set up a local development environment for Visma Cloud To get an overview of what **sct** can do, run
43
-
44
- $ sct --help
45
-
46
- To initialize a **sct** configuration file
47
-
48
- $ sct init
49
-
50
- To patch the hostfile with the local IP of the k8s cluster:
51
-
52
- $ sct hostfile
53
-
54
- To add the secret for the MySQL proxy:
55
-
56
- $ sct mysql_proxy
57
-
58
-
59
- ## Development
60
-
61
- For development of the **sct** tool, the installation needs to be a bit different.
62
-
63
- Repeat steps 1-3 from the installation instruction above.
64
-
65
- 4) We will use [**rake**](https://github.com/ruby/rake) as a Ruby develoment tool for running tests and generating binaries:
66
-
67
- $ gem install rake
68
-
69
- 5) Use the setup script from the repo to install dependencies:
70
-
71
- $ bin/setup
72
-
73
- 5) Do tests to make sure everything works fine before you start:
74
-
75
- $ rake spec
76
-
77
- 6) Install dependency gems:
78
-
79
- $ bundle exec rake install
80
-
81
- 7) Your development environment is now ready. After you have made edits to the code, you can generate a new binary to test the code like this:
82
-
83
- $ rake install
84
-
85
- 8) You can then run the binary directly from the command line:
86
-
87
- $ sct --help
88
-
89
- ### Development tips
90
-
91
- - To release a new version, update the version number in `version.rb`, and then run:
92
-
93
- $ bundle exec rake release
94
-
95
- This will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
96
-
97
- ### Adding commands
98
-
99
- Adding a new command is as simple as adding a new 'Command' Class to the *lib/sct/commands* folder. As long as you implement the constants and methods of *lib/sct/command_interface.rb*, your new Command will automatically appear in the CLI Help and can be called. Use the *lib/sct/command_option.rb* to define command options. Examples of Command Classes can be found inside the *lib/sct/commands* folder.
100
-
101
-
102
- ## Contributing
103
-
104
- Bug reports and pull requests are welcome on GitHub at https://gitlab.com/proactive-software/packages/sct. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
105
-
106
- ## Releasing
107
-
108
- #### Ownership
109
- Owners of the Ruby Gem project are able to release a new version. You can check the ownership status at https://rubygems.org/gems/sct. If you are an owner you can continue with the following steps. If not you may request to become an owner, or ask an existing owner to do the release for you.
110
-
111
- #### Authentication
112
- Owners should update their credentials once before they can actually release new versions. The steps to do this are:
113
- ```$bash
114
- curl -u [YOUR-RUBYGEM-USERNAME] https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials
115
- chmod 0600 ~/.gem/credentials
116
- ```
117
-
118
- ### Release steps
119
- #### Update version
120
- Before releasing you are required to update the version of the new release. You can do this manually by incrementing the value in the file `./sct/lib/sct/version.rb`. After this you need to commit this change and push it to the master branch.
121
-
122
- #### Release
123
- You are now ready to release. You can do this with a simple command in the SCT repository's root directory:
124
- ```$xslt
125
- rake release
126
- ```
127
-
128
- ## License
129
-
130
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
131
-
132
- ## Code of Conduct
133
-
134
- Everyone interacting in the Sct project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/proactive-software/packages/sct/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
data/lib/sct.rb DELETED
@@ -1,61 +0,0 @@
1
- require 'sct'
2
- require "sct/config"
3
- require 'sct/command'
4
- require "sct/version"
5
- require 'colored'
6
- require 'commander'
7
-
8
- module Sct
9
- class SctCore
10
-
11
- program :name, 'sct'
12
- program :version, Sct::VERSION
13
- program :summary, 'CLI helper tool for local SCT development'
14
- program :description, 'SCT is a CLI tool for developers using the Visma Continuous Deployment Model in conjunction with the Google Cloud Platform (GCP). It provides multiple command to set up and maintain a kubernetes cluster on a machine for local development'
15
-
16
- def self.take_off(cmds)
17
- self.new.run
18
- cmds.each { |cmd| registerCommand(cmd) }
19
- end
20
-
21
- def run
22
-
23
- end
24
-
25
- def self.registerCommand(cmd)
26
- # validate Command Class
27
- if cmd.class != Class ||
28
- !cmd.name.end_with?('Command')
29
- return
30
- end
31
-
32
- # validate if Command is meant to be public
33
- if !cmd::IS_PUBLIC_COMMAND
34
- return
35
- end
36
-
37
- # register public Commands as CLI command
38
- command self.deduceCommandNameFromClass(cmd) do |c|
39
- c.syntax = cmd::SYNTAX
40
- c.summary = cmd::SUMMARY
41
- c.description = cmd::DESCRIPTION
42
- c.example cmd::EXAMPLE_DESCRIPTION, cmd::EXAMPLE
43
- cmd::OPTIONS.each { |option| c.option option.name, option.type, option.description }
44
- c.action do |args, options|
45
- cmd.new.execute(args, options)
46
- end
47
- end
48
- end
49
-
50
- # retrieves cli command-name from Command's full Class name
51
- def self.deduceCommandNameFromClass(c)
52
- name = c.name
53
- if name.include?('::')
54
- name = name.partition('::')[2]
55
- end
56
- # TODO replace camel-case capitals with '-'
57
- return name.chomp('Command').downcase
58
- end
59
-
60
- end
61
- end
@@ -1,18 +0,0 @@
1
- require 'class_interface'
2
-
3
- class CommandInterface
4
- IS_PUBLIC_COMMAND = true | false
5
- SYNTAX = String
6
- SUMMARY = String
7
- DESCRIPTION = String
8
- EXAMPLE = String
9
- EXAMPLE_DESCRIPTION = String
10
- OPTIONS = Array
11
-
12
- def initialize
13
- end
14
-
15
- def execute(args, options)
16
- end
17
-
18
- end
@@ -1,14 +0,0 @@
1
- module Sct
2
-
3
- class CommandOption
4
- attr_reader :name, :type, :description
5
-
6
- def initialize(name, type, description)
7
- @name = name
8
- @type = type
9
- @description = description
10
- end
11
-
12
- end
13
-
14
- end
@@ -1,121 +0,0 @@
1
- require 'sct/command_interface'
2
-
3
- module Sct
4
-
5
- class ClusterCommand
6
-
7
- IS_PUBLIC_COMMAND = true
8
- SYNTAX = 'sct cluster up | sct cluster down | sct cluster reset | sct cluster update-config'
9
- SUMMARY = 'Starts/stops/resets or updates the config of the minikube cluster.'
10
- EXAMPLE = 'sct cluster up | sct cluster down | sct cluster reset | sct cluster update-config'
11
- EXAMPLE_DESCRIPTION = 'Starts/stops/resets or updates the config of the minikube cluster.'
12
- DESCRIPTION = "sct cluster allows you to start, stop, reset or update the config of the Spend Cloud minikube cluster."
13
-
14
- OPTIONS = []
15
-
16
- def execute(args, options)
17
- return puts "SCT has not been initialized. Run 'sct init' first.".red unless Sct::Config.exists
18
-
19
- case args[0]
20
- when "up"
21
- up
22
- when "down"
23
- down
24
- when "update-config"
25
- update_config
26
- when "reset"
27
- reset
28
- else
29
- puts "Unknown or missing argument. Please run 'sct cluster up','sct cluster down' or 'sct cluster update-config'".red
30
- end
31
- end
32
-
33
- def up
34
- start
35
- system "kubectl delete pod -n kube-system $(kubectl get pods -n kube-system | grep registry-creds | awk '{print $1}')"
36
- system "kubectl rollout status -n kube-system deployment/registry-creds"
37
- post_start
38
- end
39
-
40
- def down
41
- system "#{minikube} stop"
42
- end
43
-
44
- def update_config
45
- if Sct::Helpers.operatingSystem == Sct::Helpers::WINDOWS
46
- windows_home_path = Sct::Helpers.windowsHomePath
47
- kube_file_path = windows_home_path+"/.kube/config"
48
-
49
- if !File.exists?(kube_file_path)
50
- return puts "#{kube_file_path} doesn't exist".red
51
- end
52
-
53
- system("sed -e 's~\\\\~/~g' -e 's~C:~/mnt/c~g' < #{kube_file_path} > ~/.kube/minikube-config")
54
-
55
- puts "#{kube_file_path} copied to ~/.kube/minikube-config".green
56
- end
57
-
58
- system "kubectl config use-context minikube"
59
- end
60
-
61
- def reset
62
- system "#{minikube} delete"
63
- start
64
- system "kubectl create secret generic gcloud-credentials --from-file=\"$(echo ~)/.config/gcloud/application_default_credentials.json\""
65
- system "kubectl create secret generic -n kube-system registry-creds-dpr --from-literal DOCKER_PRIVATE_REGISTRY_PASSWORD=changeme --from-literal DOCKER_PRIVATE_REGISTRY_SERVER=changeme --from-literal DOCKER_PRIVATE_REGISTRY_USER=changeme"
66
- system "kubectl patch secret -n kube-system registry-creds-dpr -p='{\"metadata\": {\"labels\": { \"app\": \"registry-creds\", \"cloud\": \"dpr\", \"kubernetes.io/minikube-addons\": \"registry-creds\"}}}'"
67
- system "kubectl create secret generic -n kube-system registry-creds-ecr --from-literal AWS_ACCESS_KEY_ID=changeme --from-literal AWS_SECRET_ACCESS_KEY=changeme --from-literal AWS_SESSION_TOKEN=\"\" --from-literal aws-account=changeme --from-literal aws-assume-role=changeme --from-literal aws-region=changeme"
68
- system "kubectl patch secret -n kube-system registry-creds-ecr -p='{\"metadata\": {\"labels\": { \"app\": \"registry-creds\", \"cloud\": \"ecr\", \"kubernetes.io/minikube-addons\": \"registry-creds\"}}}'"
69
- system "kubectl create secret generic -n kube-system registry-creds-gcr --from-file=\"$(echo ~)/.config/gcloud/application_default_credentials.json\" --from-literal=gcrurl=\"https://eu.gcr.io\""
70
- system "kubectl patch secret -n kube-system registry-creds-gcr -p='{\"metadata\": {\"labels\": { \"app\": \"registry-creds\", \"cloud\": \"gcr\", \"kubernetes.io/minikube-addons\": \"registry-creds\"}}}'"
71
- system "kubectl create secret generic -n kube-system registry-creds-acr --from-literal ACR_PASSWORD=changeme --from-literal ACR_CLIENT_ID=changeme --from-literal ACR_URL=changeme"
72
- system "kubectl patch secret -n kube-system registry-creds-acr -p='{\"metadata\": {\"labels\": { \"app\": \"registry-creds\", \"cloud\": \"acr\", \"kubernetes.io/minikube-addons\": \"registry-creds\"}}}'"
73
- system "#{minikube} addons enable registry-creds"
74
- system "#{minikube} addons enable ingress"
75
- system "kubectl rollout status -n kube-system deployment/registry-creds"
76
- system "kubectl rollout status -n kube-system deployment/nginx-ingress-controller"
77
- wait_for_gcr_secret
78
- system "kubectl apply -f ~/development/spend-cloud/k8s/"
79
- post_start
80
- end
81
-
82
- def start
83
- system "#{minikube} start --cpus=$(cat /proc/cpuinfo | grep processor | wc -l) --memory=16G"
84
- system "#{minikube} ssh -- 'sudo su -c \"echo 10048576 > /proc/sys/fs/inotify/max_user_watches\"'"
85
- update_config
86
- end
87
-
88
- def post_start
89
- system "kubectl rollout status deployment/spend-cloud-api"
90
- system "sudo sct hostfile"
91
- puts "\n✔️ You can visit your environment at 👉 https://spend-cloud.spend.cloud.local 👌 (might still take a few minutes)"
92
- end
93
-
94
- def wait_for_gcr_secret
95
- puts "Waiting for Google Cloud Registry secret to become available...".yellow
96
-
97
- while true
98
- secrets = `kubectl get secrets`
99
-
100
- if secrets.include? "gcr-secret"
101
- puts "Google Cloud Registry secret is now available.".green
102
- break
103
- else
104
- sleep 1
105
- end
106
- end
107
- end
108
-
109
- def minikube
110
- if Sct::Helpers.operatingSystem == Sct::Helpers::WINDOWS
111
- return "minikube.exe"
112
- else
113
- return "minikube"
114
- end
115
- end
116
-
117
- implements CommandInterface
118
-
119
- end
120
-
121
- end