skull_island 1.2.5 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +22 -0
- data/lib/skull_island/cli.rb +33 -0
- data/lib/skull_island/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aee1d0a664e3a03c0ef1139816708264a40d39a324b7698cec10e5ebe303972
|
4
|
+
data.tar.gz: af415232480d26cce9582d68f9e8384dcf0e8027efb7371ad1f9341a5fbd065c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc1cdf72aee4a83b61284f12da0c80112d7fe66e2ddeeafdaadfe55758228c410a23b3f400e0e3bdb5d2e107f370e2c3766508bc99676f135e7aaefbb30db903
|
7
|
+
data.tar.gz: b119e25b9a1557f5faffb204da95e86a20800dfbe0baec31ecdc816a9d39bd40c795b9010f7c832c1255e6c8cb8266c4cbbb662360b0b1da37a4de9e776c5e58
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -37,6 +37,8 @@ Commands:
|
|
37
37
|
skull_island help [COMMAND] # Describe available commands or one specific command
|
38
38
|
skull_island import [OPTIONS] [INPUT|-] # Import a configuration from INPUT
|
39
39
|
skull_island migrate [OPTIONS] [INPUT|-] [OUTPUT|-] # Migrate an older config from INPUT to OUTPUT
|
40
|
+
skull_island reset # Fully reset a gateway (removing all config)
|
41
|
+
skull_island version # Display the current installed version of skull_island
|
40
42
|
|
41
43
|
Options:
|
42
44
|
[--verbose], [--no-verbose]
|
@@ -138,6 +140,26 @@ If you don't have a previous export, you'll need to install an older version of
|
|
138
140
|
|
139
141
|
While it would be possible to make migration _automatic_ for the `import` command, `skull_island` intentionally doesn't do this to avoid the appearance that the config is losslessly compatible across versions. In reality, the newer config version has additional features (like tagging) that will likely be used heavily. It makes sense to this author to maintain the migration component and the normal functionality as distinct features to encourage the use of the newer capabilities in 1.1+.
|
140
142
|
|
143
|
+
### Reset A Gateway
|
144
|
+
|
145
|
+
Skull Island can completely clear the configuration from a Kong instance using the `reset` command. **THIS COMMAND WILL COMPLETELY CLEAR YOUR CONFIGURATION!** Since this is a pretty serious command, it requires you to include `--force`, otherwise it simply exits with an error.
|
146
|
+
|
147
|
+
Fully resetting a gateway looks like this:
|
148
|
+
|
149
|
+
```
|
150
|
+
skull_island reset --force
|
151
|
+
```
|
152
|
+
|
153
|
+
You can, of course, include `--verbose` to see `skull_island` do its work, though the output may be slightly misleading because of the cascading nature of deletions (e.g., deleting a Service will delete all Routes associated with it automatically).
|
154
|
+
|
155
|
+
You can also restrict the reset to just resources associated with a particular project using the `--project` flag:
|
156
|
+
|
157
|
+
```
|
158
|
+
skull_island reset --force --project foo
|
159
|
+
```
|
160
|
+
|
161
|
+
This assumes the project is called `foo`.
|
162
|
+
|
141
163
|
### Check Installed Version
|
142
164
|
|
143
165
|
If you're wondering what version of `skull_island` is installed, use:
|
data/lib/skull_island/cli.rb
CHANGED
@@ -102,6 +102,29 @@ module SkullIsland
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
+
desc('reset', 'Fully reset a gateway (removing all config)')
|
106
|
+
option :force, type: :boolean, desc: 'Force the reset (required)'
|
107
|
+
option :project, desc: 'Project identifier for metadata'
|
108
|
+
def reset
|
109
|
+
unless options['force']
|
110
|
+
puts '[ERR] Missing --force flag.'
|
111
|
+
exit 2
|
112
|
+
end
|
113
|
+
|
114
|
+
if options['project'] && options['verbose']
|
115
|
+
warn "[WARN] ! Resetting gateway for project '#{options['project']}'"
|
116
|
+
elsif options['verbose']
|
117
|
+
warn '[WARN] ! FULLY Resetting gateway'
|
118
|
+
end
|
119
|
+
[
|
120
|
+
Resources::Certificate,
|
121
|
+
Resources::Consumer,
|
122
|
+
Resources::Upstream,
|
123
|
+
Resources::Service,
|
124
|
+
Resources::Plugin
|
125
|
+
].each { |clname| reset_class(clname, options['project']) }
|
126
|
+
end
|
127
|
+
|
105
128
|
desc('version', 'Display the current installed version of skull_island')
|
106
129
|
def version
|
107
130
|
puts "SkullIsland Version: #{SkullIsland::VERSION}"
|
@@ -131,6 +154,16 @@ module SkullIsland
|
|
131
154
|
)
|
132
155
|
end
|
133
156
|
|
157
|
+
def reset_class(class_name, project)
|
158
|
+
warn "[WARN] ! Resetting #{class_name.route_key}" if options['verbose']
|
159
|
+
resources = project ? class_name.all.select { |r| r.project == project } : class_name.all
|
160
|
+
|
161
|
+
resources.each do |resource|
|
162
|
+
puts "[WARN] ! Removing #{class_name.name} (#{resource.id})"
|
163
|
+
resource.destroy
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
134
167
|
# Used to pull input from either STDIN or the specified file
|
135
168
|
def acquire_input(input_file, verbose = false)
|
136
169
|
if input_file == '-'
|
data/lib/skull_island/version.rb
CHANGED