sct 0.1.12 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.gitlab/merge_request_templates/DefinitionOfDone.md +14 -0
- data/.rspec +0 -0
- data/.travis.yml +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/Gemfile.lock +2 -6
- data/LICENSE.txt +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/sct/.DS_Store +0 -0
- data/lib/sct/ClassLevelInheritableAttributes.rb +0 -0
- data/lib/sct/command.rb +0 -0
- data/lib/sct/command_interface.rb +0 -0
- data/lib/sct/command_option.rb +0 -0
- data/lib/sct/commands/cluster.rb +224 -27
- data/lib/sct/commands/hostfile.rb +33 -59
- data/lib/sct/docker/php.rb +0 -0
- data/lib/sct/version.rb +1 -1
- data/resources/corefile.yml +45 -0
- data/sct.gemspec +1 -1
- metadata +17 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb3124f71d7225fc1c88fb1385b1de8c308b3cb9dcd3621c57d82c681b90ea10
|
4
|
+
data.tar.gz: bdc089394ec064af60751b213a57f491752bb3184e6eacdc11d8367ed65d7658
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8a45d11bc4c50a627a913a8a38cd602eadd4520c2064a14801b9c31bc5e3943f6cb0c2cf2487bc8e191096b81a9797f12790a73267e46758fb6403ea5c1cec3
|
7
|
+
data.tar.gz: 696c6ae0977971f48f9460113b11aca055a6687f884adb70606eab9d2d6822bfb37c33c8cc45bd66e8bc216b601b750fa24d45babef9a0e0c638bd32f8e17f31
|
data/.DS_Store
CHANGED
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
The Definition of a Done Code Review
|
2
|
+
====================================
|
3
|
+
| by _The Team_ |
|
4
|
+
|---------------------------------:|
|
5
|
+
|
6
|
+
- [ ] Verified if it worked on all operating systems.
|
7
|
+
- [ ] Windows
|
8
|
+
- [ ] Ubuntu
|
9
|
+
- [ ] MacOs
|
10
|
+
- [ ] Verified if it solved the problem.
|
11
|
+
- [ ] Verified if the help section is updated.
|
12
|
+
- [ ] Verified if it complied with Ruby code standards.
|
13
|
+
- [ ] Documentation is updated, 100% complete.
|
14
|
+
- [ ] SCT documentation.
|
data/.rspec
CHANGED
File without changes
|
data/.travis.yml
CHANGED
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/Gemfile.lock
CHANGED
@@ -1,25 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sct (0.1.
|
4
|
+
sct (0.1.15)
|
5
5
|
class_interface (~> 0.1.1)
|
6
6
|
colored (~> 1.2)
|
7
7
|
commander (~> 4.4.7)
|
8
8
|
highline (>= 1.7.2)
|
9
|
-
hosts (~> 0.1.1)
|
10
9
|
|
11
10
|
GEM
|
12
11
|
remote: https://rubygems.org/
|
13
12
|
specs:
|
14
|
-
class_interface (0.1.
|
13
|
+
class_interface (0.1.2)
|
15
14
|
colored (1.2)
|
16
15
|
commander (4.4.7)
|
17
16
|
highline (~> 2.0.0)
|
18
17
|
diff-lcs (1.3)
|
19
18
|
highline (2.0.3)
|
20
|
-
hosts (0.1.1)
|
21
|
-
linebreak (~> 2.0.1)
|
22
|
-
linebreak (2.0.1)
|
23
19
|
rake (10.5.0)
|
24
20
|
rspec (3.9.0)
|
25
21
|
rspec-core (~> 3.9.0)
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/lib/.DS_Store
CHANGED
File without changes
|
data/lib/sct/.DS_Store
CHANGED
File without changes
|
File without changes
|
data/lib/sct/command.rb
CHANGED
File without changes
|
File without changes
|
data/lib/sct/command_option.rb
CHANGED
File without changes
|
data/lib/sct/commands/cluster.rb
CHANGED
@@ -1,58 +1,255 @@
|
|
1
1
|
require 'sct/command_interface'
|
2
|
+
require 'terminal-table'
|
2
3
|
|
3
4
|
module Sct
|
4
5
|
|
5
6
|
class ClusterCommand
|
6
7
|
|
7
8
|
IS_PUBLIC_COMMAND = true
|
8
|
-
SYNTAX = 'sct cluster up | sct cluster down | sct cluster update-config'
|
9
|
-
SUMMARY = '
|
10
|
-
EXAMPLE = 'sct cluster up | sct cluster down | sct cluster update-config'
|
11
|
-
EXAMPLE_DESCRIPTION = '
|
12
|
-
DESCRIPTION = "
|
9
|
+
SYNTAX = 'sct cluster up | sct cluster down | sct cluster setup | sct cluster reset | sct cluster update-config | sct cluster delete-stalled-pods'
|
10
|
+
SUMMARY = 'Perform actions on the minikube cluster.'
|
11
|
+
EXAMPLE = 'sct cluster up | sct cluster down | sct cluster setup | sct cluster reset | sct cluster update-config | sct cluster delete-stalled-pods'
|
12
|
+
EXAMPLE_DESCRIPTION = 'Perform actions on the minikube cluster.'
|
13
|
+
DESCRIPTION = "sct cluster allows you to start, stop, setup/reset, update the config, or delete the stalled pods of the Spend Cloud minikube cluster."
|
13
14
|
|
14
15
|
OPTIONS = []
|
15
16
|
|
16
17
|
def execute(args, options)
|
17
18
|
return puts "SCT has not been initialized. Run 'sct init' first.".red unless Sct::Config.exists
|
18
19
|
|
19
|
-
if Sct::Helpers.operatingSystem == Sct::Helpers::WINDOWS
|
20
|
-
minikube = "minikube.exe"
|
21
|
-
else
|
22
|
-
minikube = "minikube"
|
23
|
-
end
|
24
|
-
|
25
20
|
case args[0]
|
26
21
|
when "up"
|
27
|
-
|
28
|
-
system("#{minikube} ssh -- 'sudo su -c \"echo 10048576 > /proc/sys/fs/inotify/max_user_watches\"'")
|
29
|
-
update_config
|
30
|
-
system("kubectl config use-context minikube")
|
31
|
-
system("kubectl delete pod -n kube-system $(kubectl get pods -n kube-system | grep registry-creds | awk '{print $1}')")
|
32
|
-
system("sudo sct hostfile")
|
33
|
-
puts "\n✔️ You can now visit your environment at 👉 https://spend-cloud.spend.cloud.local 👌"
|
22
|
+
up
|
34
23
|
when "down"
|
35
|
-
|
24
|
+
down
|
36
25
|
when "update-config"
|
37
26
|
update_config
|
27
|
+
when "setup", "reset"
|
28
|
+
reset
|
29
|
+
when "delete-stalled-pods"
|
30
|
+
delete_stalled_pods(feedback: true)
|
31
|
+
when "status"
|
32
|
+
status
|
38
33
|
else
|
39
|
-
puts "Unknown or missing argument. Please run 'sct cluster up','sct cluster down'
|
34
|
+
puts "Unknown or missing argument. Please run 'sct cluster up', 'sct cluster down', 'sct cluster setup', 'sct cluster reset', 'sct cluster update-config', or 'sct cluster delete-stalled-pods'.".red
|
40
35
|
end
|
41
36
|
end
|
42
37
|
|
38
|
+
def up
|
39
|
+
start
|
40
|
+
run_command "kubectl delete pod -n kube-system #{pods("kube-system").map { |pod| pod[:name] if pod[:name].start_with? "registry-creds" } .compact.join(" ")}"
|
41
|
+
run_command "kubectl rollout status -n kube-system deployment/registry-creds"
|
42
|
+
post_start
|
43
|
+
end
|
44
|
+
|
45
|
+
def down
|
46
|
+
run_command "#{minikube} stop"
|
47
|
+
end
|
48
|
+
|
49
|
+
def reset
|
50
|
+
run_command "#{minikube} delete"
|
51
|
+
start
|
52
|
+
create_secrets
|
53
|
+
run_command "#{minikube} addons enable registry-creds"
|
54
|
+
run_command "#{minikube} addons enable ingress"
|
55
|
+
run_command "kubectl rollout status -n kube-system deployment/registry-creds"
|
56
|
+
run_command "kubectl rollout status -n kube-system deployment/nginx-ingress-controller"
|
57
|
+
wait_for_gcr_secret
|
58
|
+
run_command "kubectl apply -f ~/development/spend-cloud/k8s/ingress.yml"
|
59
|
+
wait_for_ingress_ip
|
60
|
+
run_command "kubectl apply -f ~/development/spend-cloud/k8s/dependencies.yml"
|
61
|
+
wait_for_pods
|
62
|
+
run_command "kubectl apply -f ~/development/spend-cloud/k8s/"
|
63
|
+
post_start
|
64
|
+
end
|
65
|
+
|
43
66
|
def update_config
|
44
|
-
|
67
|
+
if Sct::Helpers.operatingSystem == Sct::Helpers::WINDOWS
|
68
|
+
windows_home_path = Sct::Helpers.windowsHomePath
|
69
|
+
kube_file_path = windows_home_path+"/.kube/config"
|
70
|
+
|
71
|
+
if !File.exists?(kube_file_path)
|
72
|
+
return puts "#{kube_file_path} doesn't exist".red
|
73
|
+
end
|
74
|
+
|
75
|
+
run_command "sed -e 's~\\\\~/~g' -e 's~C:~/mnt/c~g' < #{kube_file_path} > ~/.kube/minikube-config"
|
76
|
+
|
77
|
+
puts "#{kube_file_path} copied to ~/.kube/minikube-config".green
|
78
|
+
end
|
79
|
+
|
80
|
+
run_command "kubectl config use-context minikube"
|
81
|
+
|
82
|
+
run_command "kubectl replace -n kube-system -f #{File.expand_path('../../../resources/corefile.yml', __dir__)}"
|
83
|
+
run_command "kubectl delete pod -n kube-system #{pods("kube-system").map { |pod| pod[:name] if pod[:name].start_with? "coredns" } .compact.join(" ")}"
|
84
|
+
run_command "kubectl rollout status -n kube-system deployment/coredns"
|
85
|
+
end
|
86
|
+
|
87
|
+
def delete_stalled_pods(feedback: false)
|
88
|
+
stalled_pods = pods.select { |pod| pod[:stalled] }
|
89
|
+
|
90
|
+
if stalled_pods.empty?
|
91
|
+
puts "There are no stalled pods.".green if feedback
|
92
|
+
else
|
93
|
+
run_command "kubectl delete pods #{stalled_pods.map { |pod| pod[:name] } .join(" ")}"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def start
|
98
|
+
if Sct::Helpers.operatingSystem == Sct::Helpers::MAC_OS
|
99
|
+
run_command "#{minikube} start --cpus=$(sysctl -n hw.ncpu) --memory=8G"
|
100
|
+
else
|
101
|
+
run_command "#{minikube} start --cpus=$(cat /proc/cpuinfo | grep processor | wc -l) --memory=10G"
|
102
|
+
end
|
103
|
+
run_command "#{minikube} ssh -- 'sudo su -c \"echo 10048576 > /proc/sys/fs/inotify/max_user_watches\"'"
|
104
|
+
update_config
|
105
|
+
end
|
106
|
+
|
107
|
+
def post_start
|
108
|
+
wait_for_pods
|
109
|
+
run_command "sudo sct hostfile"
|
110
|
+
puts "\n✔️ You can visit your environment at 👉 https://spend-cloud.spend.cloud.local 👌"
|
111
|
+
end
|
112
|
+
|
113
|
+
def create_secrets
|
114
|
+
run_command "kubectl create secret generic gcloud-credentials --from-file=\"$(echo ~)/.config/gcloud/application_default_credentials.json\""
|
115
|
+
run_command "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"
|
116
|
+
run_command "kubectl patch secret -n kube-system registry-creds-dpr -p='{\"metadata\": {\"labels\": { \"app\": \"registry-creds\", \"cloud\": \"dpr\", \"kubernetes.io/minikube-addons\": \"registry-creds\"}}}'"
|
117
|
+
run_command "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"
|
118
|
+
run_command "kubectl patch secret -n kube-system registry-creds-ecr -p='{\"metadata\": {\"labels\": { \"app\": \"registry-creds\", \"cloud\": \"ecr\", \"kubernetes.io/minikube-addons\": \"registry-creds\"}}}'"
|
119
|
+
run_command "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\""
|
120
|
+
run_command "kubectl patch secret -n kube-system registry-creds-gcr -p='{\"metadata\": {\"labels\": { \"app\": \"registry-creds\", \"cloud\": \"gcr\", \"kubernetes.io/minikube-addons\": \"registry-creds\"}}}'"
|
121
|
+
run_command "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"
|
122
|
+
run_command "kubectl patch secret -n kube-system registry-creds-acr -p='{\"metadata\": {\"labels\": { \"app\": \"registry-creds\", \"cloud\": \"acr\", \"kubernetes.io/minikube-addons\": \"registry-creds\"}}}'"
|
123
|
+
end
|
124
|
+
|
125
|
+
def wait_for_gcr_secret
|
126
|
+
puts "Waiting for Google Cloud Registry secret to become available...".yellow
|
127
|
+
|
128
|
+
while ! `kubectl get secrets`.include? "gcr-secret"
|
129
|
+
sleep 5
|
130
|
+
end
|
131
|
+
|
132
|
+
puts "Google Cloud Registry secret is now available.".green
|
133
|
+
end
|
134
|
+
|
135
|
+
def wait_for_ingress_ip
|
136
|
+
puts "Waiting for ingress IP to become available...".yellow
|
45
137
|
|
46
|
-
|
47
|
-
|
138
|
+
while `kubectl describe ingress | grep "Address" | awk '{print $2}'`.empty?
|
139
|
+
sleep 5
|
140
|
+
end
|
141
|
+
|
142
|
+
puts "Ingress IP is now available.".green
|
143
|
+
end
|
144
|
+
|
145
|
+
def wait_for_pods
|
146
|
+
puts "Waiting for pods to become ready...".yellow
|
147
|
+
|
148
|
+
while ! pods.all? { |pod| pod[:status] == "Running" }
|
149
|
+
delete_stalled_pods
|
150
|
+
|
151
|
+
sleep 5
|
152
|
+
end
|
153
|
+
|
154
|
+
puts "Pods are now ready.".green
|
155
|
+
end
|
156
|
+
|
157
|
+
def status
|
158
|
+
minikube_status
|
159
|
+
pods_status
|
160
|
+
system_pods
|
161
|
+
current_contexts
|
162
|
+
end
|
163
|
+
|
164
|
+
def pods_status
|
165
|
+
rows = []
|
166
|
+
pods.map do |pod|
|
167
|
+
status = pod[:status] == "Running" ? pod[:status].green : pod[:status].red
|
168
|
+
rows << [pod[:name], status]
|
169
|
+
end
|
170
|
+
puts Terminal::Table.new :title => "Pods Status".green, :headings => ['Name', 'Status'], :rows => rows
|
171
|
+
end
|
172
|
+
|
173
|
+
def system_pods
|
174
|
+
rows = []
|
175
|
+
pods("kube-system").map do |pod|
|
176
|
+
status = pod[:status] == "Running" ? pod[:status].green : pod[:status].red
|
177
|
+
rows << [pod[:name], status]
|
178
|
+
end
|
179
|
+
puts Terminal::Table.new :title => "System pods Status".green, :headings => ['Name', 'Status'], :rows => rows
|
180
|
+
end
|
181
|
+
|
182
|
+
def current_contexts
|
183
|
+
output = `kubectl config get-contexts`
|
184
|
+
|
185
|
+
lines = output.split "\n"
|
186
|
+
lines = lines[1..-1]
|
187
|
+
|
188
|
+
rows = []
|
189
|
+
lines.map do |line|
|
190
|
+
columns = line.split(" ")
|
191
|
+
|
192
|
+
current_context = columns[0] == "*" ? "Yes".green : "No".red
|
193
|
+
rows << [columns[2], current_context]
|
194
|
+
end
|
195
|
+
puts Terminal::Table.new :title => "Contexts".green, :headings => ['Cluster', 'Using context'], :rows => rows
|
196
|
+
end
|
197
|
+
|
198
|
+
def minikube_status
|
199
|
+
output = `#{minikube} status`
|
200
|
+
|
201
|
+
lines = output.split "\n"
|
202
|
+
|
203
|
+
rows = []
|
204
|
+
lines.map do |line|
|
205
|
+
columns = line.split(" ")
|
206
|
+
|
207
|
+
rows << [columns[0], columns[1]]
|
208
|
+
end
|
209
|
+
puts Terminal::Table.new :title => "Minikube Status".green, :headings => ['Name', 'Status'], :rows => rows
|
210
|
+
end
|
48
211
|
|
49
|
-
|
50
|
-
|
212
|
+
def pods(namespace = nil)
|
213
|
+
if namespace
|
214
|
+
output = `kubectl get pods -n #{namespace}`
|
215
|
+
else
|
216
|
+
output = `kubectl get pods`
|
51
217
|
end
|
52
218
|
|
53
|
-
|
219
|
+
# split output lines
|
220
|
+
lines = output.split "\n"
|
221
|
+
|
222
|
+
# exclude first line (table header)
|
223
|
+
lines = lines[1..-1]
|
224
|
+
|
225
|
+
# get name and status of each pod
|
226
|
+
lines.map do |line|
|
227
|
+
columns = line.split(" ")
|
228
|
+
|
229
|
+
name = columns[0]
|
230
|
+
status = columns[2]
|
231
|
+
stalled = status == "ErrImagePull" || status == "ImagePullBackOff"
|
54
232
|
|
55
|
-
|
233
|
+
{
|
234
|
+
name: name,
|
235
|
+
status: status,
|
236
|
+
stalled: stalled
|
237
|
+
}
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def run_command command
|
242
|
+
if ! system command
|
243
|
+
raise command.red
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
def minikube
|
248
|
+
if Sct::Helpers.operatingSystem == Sct::Helpers::WINDOWS
|
249
|
+
return "minikube.exe"
|
250
|
+
else
|
251
|
+
return "minikube"
|
252
|
+
end
|
56
253
|
end
|
57
254
|
|
58
255
|
implements CommandInterface
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'hosts'
|
2
1
|
require 'sct/command_interface'
|
3
2
|
|
4
3
|
module Sct
|
@@ -25,6 +24,29 @@ module Sct
|
|
25
24
|
|
26
25
|
ingressAddress = Sct::Helpers.ingressAddress
|
27
26
|
|
27
|
+
entries = [
|
28
|
+
{
|
29
|
+
host: "spend.cloud.local",
|
30
|
+
comment: "The spend cloud ingress url"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
host: "mail.spend.cloud.local",
|
34
|
+
comment: "The spend cloud mail url"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
host: "config.spend.cloud.local",
|
38
|
+
comment: "The spend cloud config url"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
host: "spend-cloud.spend.cloud.local",
|
42
|
+
comment: "The spend cloud web app url"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
host: "docs.spend.cloud.local",
|
46
|
+
comment: "The spend cloud documentation url"
|
47
|
+
}
|
48
|
+
]
|
49
|
+
|
28
50
|
if options.path
|
29
51
|
hosts_paths = [options.path]
|
30
52
|
else
|
@@ -36,70 +58,22 @@ module Sct
|
|
36
58
|
end
|
37
59
|
|
38
60
|
hosts_paths.each do |hosts_path|
|
39
|
-
|
40
|
-
|
41
|
-
if ([ingressAddress].any? { |ip| hosts.to_s =~ /#{ip}/ })
|
42
|
-
puts "Skipped patching #{hosts_path} (already up to date)".green
|
43
|
-
else
|
44
|
-
validate_if_exist(hosts)
|
45
|
-
add_entry(ingressAddress, hosts)
|
46
|
-
hosts.write
|
47
|
-
puts "Patched #{hosts_path} with #{ingressAddress}".green
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
61
|
+
line_ending = hosts_path == "/mnt/c/Windows/System32/drivers/etc/hosts" ? "\r\n" : "\n"
|
51
62
|
|
52
|
-
|
53
|
-
spend = Hosts::Entry.new(
|
54
|
-
url,
|
55
|
-
'spend.cloud.local',
|
56
|
-
:comment => 'The spend cloud ingress url'
|
57
|
-
)
|
58
|
-
|
59
|
-
mail = Hosts::Entry.new(
|
60
|
-
url,
|
61
|
-
'mail.spend.cloud.local',
|
62
|
-
:comment => 'The spend cloud mail url'
|
63
|
-
)
|
64
|
-
|
65
|
-
config = Hosts::Entry.new(
|
66
|
-
url,
|
67
|
-
'config.spend.cloud.local',
|
68
|
-
:comment => 'The spend cloud config url'
|
69
|
-
)
|
70
|
-
|
71
|
-
spend_cloud = Hosts::Entry.new(
|
72
|
-
url,
|
73
|
-
'spend-cloud.spend.cloud.local',
|
74
|
-
:comment => 'The spend cloud web app url'
|
75
|
-
)
|
76
|
-
|
77
|
-
docs = Hosts::Entry.new(
|
78
|
-
url,
|
79
|
-
'docs.spend.cloud.local',
|
80
|
-
:comment => 'The spend cloud documentation url'
|
81
|
-
)
|
82
|
-
|
83
|
-
hosts.elements << spend
|
84
|
-
hosts.elements << mail
|
85
|
-
hosts.elements << config
|
86
|
-
hosts.elements << spend_cloud
|
87
|
-
hosts.elements << docs
|
63
|
+
lines = File.readlines hosts_path
|
88
64
|
|
89
|
-
|
65
|
+
# select the lines that do not include any entry
|
66
|
+
lines = lines.select { |line| ! entries.any? { |entry| line.include? entry[:host] } }
|
90
67
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
array.to_s.each_line.with_index do |line, index|
|
95
|
-
|
96
|
-
if (line =~ /(?:spend\.cloud\.local)./)
|
97
|
-
rejectArray.push(index)
|
68
|
+
# add entries
|
69
|
+
entries.each do |entry|
|
70
|
+
lines << "#{ingressAddress} #{entry[:host]} # #{entry[:comment]}#{line_ending}"
|
98
71
|
end
|
99
72
|
|
100
|
-
|
73
|
+
File.write hosts_path, lines.join
|
101
74
|
|
102
|
-
|
75
|
+
puts "Patched #{hosts_path} with #{ingressAddress}".green
|
76
|
+
end
|
103
77
|
|
104
78
|
end
|
105
79
|
|
data/lib/sct/docker/php.rb
CHANGED
File without changes
|
data/lib/sct/version.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
apiVersion: v1
|
2
|
+
data:
|
3
|
+
Corefile: |
|
4
|
+
.:53 {
|
5
|
+
errors
|
6
|
+
health {
|
7
|
+
lameduck 5s
|
8
|
+
}
|
9
|
+
ready
|
10
|
+
kubernetes cluster.local in-addr.arpa ip6.arpa {
|
11
|
+
pods insecure
|
12
|
+
fallthrough in-addr.arpa ip6.arpa
|
13
|
+
ttl 30
|
14
|
+
}
|
15
|
+
prometheus :9153
|
16
|
+
forward . 8.8.8.8
|
17
|
+
cache 30
|
18
|
+
loop
|
19
|
+
reload
|
20
|
+
loadbalance
|
21
|
+
}
|
22
|
+
Corefile-backup: |
|
23
|
+
.:53 {
|
24
|
+
errors
|
25
|
+
health {
|
26
|
+
lameduck 5s
|
27
|
+
}
|
28
|
+
ready
|
29
|
+
kubernetes cluster.local in-addr.arpa ip6.arpa {
|
30
|
+
pods insecure
|
31
|
+
fallthrough in-addr.arpa ip6.arpa
|
32
|
+
ttl 30
|
33
|
+
}
|
34
|
+
prometheus :9153
|
35
|
+
forward . /etc/resolv.conf
|
36
|
+
cache 30
|
37
|
+
loop
|
38
|
+
reload
|
39
|
+
loadbalance
|
40
|
+
}
|
41
|
+
kind: ConfigMap
|
42
|
+
metadata:
|
43
|
+
creationTimestamp: null
|
44
|
+
name: coredns
|
45
|
+
selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
|
data/sct.gemspec
CHANGED
@@ -30,9 +30,9 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
spec.add_dependency "class_interface", "~> 0.1.1"
|
32
32
|
spec.add_dependency "colored", "~> 1.2"
|
33
|
-
spec.add_dependency "hosts", "~> 0.1.1"
|
34
33
|
spec.add_dependency "commander", "~> 4.4.7"
|
35
34
|
spec.add_dependency "highline", ">= 1.7.2"
|
35
|
+
spec.add_dependency "terminal-table", "~> 1.8"
|
36
36
|
|
37
37
|
spec.add_development_dependency "bundler", "~> 2.0"
|
38
38
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reshad Farid
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: class_interface
|
@@ -39,47 +39,47 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: commander
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 4.4.7
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 4.4.7
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: highline
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.7.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.7.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: terminal-table
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: '1.8'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: '1.8'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,6 +133,7 @@ extra_rdoc_files: []
|
|
133
133
|
files:
|
134
134
|
- ".DS_Store"
|
135
135
|
- ".gitignore"
|
136
|
+
- ".gitlab/merge_request_templates/DefinitionOfDone.md"
|
136
137
|
- ".rspec"
|
137
138
|
- ".travis.yml"
|
138
139
|
- CODE_OF_CONDUCT.md
|
@@ -165,6 +166,7 @@ files:
|
|
165
166
|
- lib/sct/docker/yarn.rb
|
166
167
|
- lib/sct/setup/helpers.rb
|
167
168
|
- lib/sct/version.rb
|
169
|
+
- resources/corefile.yml
|
168
170
|
- sct.gemspec
|
169
171
|
homepage: https://gitlab.com/proactive-software/packages/sct
|
170
172
|
licenses:
|