k8sflow 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/k8sflow/command/image.rb +25 -22
- data/lib/k8sflow/command/pg/backup.rb +26 -0
- data/lib/k8sflow/command/pg/copy.rb +26 -0
- data/lib/k8sflow/command/pg/dump.rb +26 -0
- data/lib/k8sflow/command/pg/kill.rb +25 -0
- data/lib/k8sflow/command/pg/killall.rb +26 -0
- data/lib/k8sflow/command/pg/pg_base.rb +122 -0
- data/lib/k8sflow/command/pg/pg_topic.rb +13 -0
- data/lib/k8sflow/command/pg/ps.rb +46 -0
- data/lib/k8sflow/command/pg/psql.rb +18 -0
- data/lib/k8sflow/command/pg/restore.rb +23 -0
- data/lib/k8sflow/command.rb +1 -1
- data/lib/k8sflow/version.rb +53 -1
- data/lib/k8sflow.rb +1 -0
- data/spec/spec_helper.rb +143 -0
- metadata +56 -21
- data/spec/kubeflow_spec.rb +0 -6
- data/spec/topic_spec.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71dd84258b2faf5e407b1e7ab7f573984f071d0c
|
4
|
+
data.tar.gz: 6194f078a482c03ab906f781b63a478a644057c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ba661c7870beccb6ecca3ce049a325483f8426327ae32735fdc6db6621eb2226dc8dcc0931212442149d1ecf1847ef7839758cb6a2f87433cee715dc4edf8d7
|
7
|
+
data.tar.gz: f9f4c749019a479eb8348747dea1ada48ad8a12489caf4c93bbc188456f2758afcae0ad6ffeed3306d83723a9d47727c40d921ee7d3d718cf0d747e2bdf0b2e6
|
@@ -19,13 +19,6 @@ module K8sflow
|
|
19
19
|
def vars
|
20
20
|
if @vars.nil?
|
21
21
|
@vars = {}
|
22
|
-
if !options[:build_vars].nil?
|
23
|
-
if options[:build_vars].is_a?(Hash)
|
24
|
-
@vars = options[:build_vars]
|
25
|
-
else
|
26
|
-
@vars = kv_parse(options[:build_vars])
|
27
|
-
end
|
28
|
-
end
|
29
22
|
if !options[:vars].nil?
|
30
23
|
if options[:vars].is_a?(Hash)
|
31
24
|
@vars.merge!(options[:vars])
|
@@ -41,12 +34,14 @@ module K8sflow
|
|
41
34
|
|
42
35
|
def files
|
43
36
|
f = []
|
44
|
-
options
|
45
|
-
|
46
|
-
|
37
|
+
if @options.has_key?(:files)
|
38
|
+
@options[:files].each do |file|
|
39
|
+
if !file.start_with?("/")
|
40
|
+
file = "#{@options[:path]}/#{file}"
|
41
|
+
end
|
42
|
+
file_list = Dir.glob(file)
|
43
|
+
f << file_list
|
47
44
|
end
|
48
|
-
file_list = Dir.glob(file)
|
49
|
-
f << file_list
|
50
45
|
end
|
51
46
|
return f
|
52
47
|
end
|
@@ -105,9 +100,16 @@ module K8sflow
|
|
105
100
|
|
106
101
|
option :registry, '-r', '--registry DOCKER_REPO', 'Docker registry to pull/fetch images'
|
107
102
|
option :path, '-p', '--path DOCKERFILE PATH', 'dockerfiles source directory to'
|
108
|
-
option :build_vars, "--build-vars key=value,key=value" , Array, "Default variables"
|
109
103
|
option :docker_api, "-H", "--host", "docker api endpoint", default: "tcp://localhost:4243"
|
110
|
-
option :tag, '-t', '--tag TAG', "Image tag", default: '
|
104
|
+
option :tag, '-t', '--tag TAG', "Image tag", default: 'lateb'
|
105
|
+
|
106
|
+
#dockerfile templates
|
107
|
+
option :files, "-f", "--files FILE1,FILE2", Array, "List files to copy in dockerfile directory, i.e 'files/*',/etc/conf.cfg'"
|
108
|
+
option :tpl, "-l", "--tpl=Dockerfile", "The Dockerfile Template", default: 'Dockerfile.tpl'
|
109
|
+
option :vars, "-x", "--vars=VARS", Array, "Variables required by the dockerfile"
|
110
|
+
|
111
|
+
#docker build options
|
112
|
+
option :build_opts, "--build OPTS", "docker build options"
|
111
113
|
end
|
112
114
|
|
113
115
|
|
@@ -117,12 +119,8 @@ module K8sflow
|
|
117
119
|
description: 'Generate a dockerfile with templated vars .',
|
118
120
|
topic: 'image'
|
119
121
|
|
120
|
-
option :files, "-f", "--files FILE1,FILE2", Array, "List files to copy in dockerfile directory, i.e 'files/*',/etc/conf.cfg'"
|
121
|
-
option :tpl, "-l", "--tpl=Dockerfile", "The Dockerfile Template", default: 'Dockerfile.tpl'
|
122
|
-
option :vars, "-x", "--vars=VARS", Array, "Variables required by the dockerfile"
|
123
|
-
option :tag, '-t', '--tag TAG', "Image tag", default: 'master'
|
124
|
-
|
125
122
|
def self.call
|
123
|
+
puts @options
|
126
124
|
create_dockerfile
|
127
125
|
end
|
128
126
|
end
|
@@ -133,8 +131,10 @@ module K8sflow
|
|
133
131
|
banner: 'image:build [OPTIONS]',
|
134
132
|
topic: 'image'
|
135
133
|
|
136
|
-
option :
|
134
|
+
option :skip_dockerfile, "--skip-dockerfile", "-s", "Skip Create dockerfile"
|
137
135
|
def self.call
|
136
|
+
puts @options
|
137
|
+
create_dockerfile unless @options[:skip_dockerfile]
|
138
138
|
dockerbuild
|
139
139
|
end
|
140
140
|
end
|
@@ -145,13 +145,16 @@ module K8sflow
|
|
145
145
|
banner: 'image:push [OPTIONS]',
|
146
146
|
topic: 'image'
|
147
147
|
|
148
|
-
option :
|
148
|
+
option :skip_build, "--skip-build", "skip docker build"
|
149
|
+
option :skip_dockerfile, "--skip-dockerfile", "skip create dockerfile"
|
149
150
|
def self.call
|
150
|
-
|
151
|
+
create_dockerfile unless @options[:skip_dockerfile]
|
152
|
+
dockerbuild unless @options[:skip_build]
|
151
153
|
dockerpush
|
152
154
|
end
|
153
155
|
end
|
154
156
|
|
157
|
+
|
155
158
|
class List < Clitopic::Command::Base
|
156
159
|
register name: 'list',
|
157
160
|
description: 'List available tags in a registry',
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require_relative 'pg_base'
|
3
|
+
|
4
|
+
module K8sflow
|
5
|
+
module Pg
|
6
|
+
|
7
|
+
|
8
|
+
class Backup < PgBase
|
9
|
+
register name: 'backup',
|
10
|
+
description: 'Create a database backup and send it to a [remote] directory',
|
11
|
+
topic: 'pg'
|
12
|
+
|
13
|
+
option :src, "--src=file", "Dump to store"
|
14
|
+
option :aws_access_id, "--aws-access-id", "Aws S3 access id"
|
15
|
+
option :aws_secret, "--aws-secret", "Aws S3 secret"
|
16
|
+
option :bucket, "--bucket", "Aws bucket"
|
17
|
+
option :dest, "--dest", "File name"
|
18
|
+
|
19
|
+
def self.call
|
20
|
+
echo "store to aws"
|
21
|
+
echo "Upload the file #{@options[:src]} to #{options[:bucket]}/#{options[:dest]}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require_relative 'pg_base'
|
3
|
+
|
4
|
+
module K8sflow
|
5
|
+
module Pg
|
6
|
+
|
7
|
+
class Copy < PgBase
|
8
|
+
register name: 'copy',
|
9
|
+
description: 'Copy a source database to a Target database',
|
10
|
+
topic: 'pg'
|
11
|
+
|
12
|
+
option :source, "--source=database", "source database", required: true
|
13
|
+
option :ssl, "--ssl", "enable sslmode"
|
14
|
+
option :confirm, "--confirm CONFIRM", "Command line confirmation, no prompt"
|
15
|
+
|
16
|
+
def self.call
|
17
|
+
source_db = database(options[:source])
|
18
|
+
puts "env PGSSLMODE=#{ssl?} PGPASSWORD=#{source_db[:password]} pg_dump --host #{source_db[:host]} --port #{source_db[:port]} --username #{source_db[:user]} --verbose -Z 0 --clean --format=c --no-owner --no-acl #{source_db[:database]} | env PGSSLMODE=#{ssl?} PGPASSWORD=#{database[:password]} pg_restore --port #{database[:port]}--host #{database[:host]} --username #{database[:user]} --verbose --no-acl --no-owner -d #{database[:database]}"
|
19
|
+
confirm_command("on #{database[:host]} overwrite the database #{database[:database]}")
|
20
|
+
|
21
|
+
exec("env PGSSLMODE=#{ssl?} PGPASSWORD=#{source_db[:password]} pg_dump --host #{source_db[:host]} --port #{source_db[:port]} --username #{source_db[:user]} --verbose -Z 0 --clean --format=c --no-owner --no-acl #{source_db[:database]} | env PGSSLMODE=#{ssl?} PGPASSWORD=#{database[:password]} pg_restore --port #{database[:port]} --host #{database[:host]} --username #{database[:user]} --verbose --no-acl --no-owner -d #{database[:database]}")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require_relative 'pg_base'
|
3
|
+
|
4
|
+
module K8sflow
|
5
|
+
module Pg
|
6
|
+
|
7
|
+
class Dump < PgBase
|
8
|
+
register name: 'dump',
|
9
|
+
description: 'Create a database dump and store in a localfile',
|
10
|
+
topic: 'pg'
|
11
|
+
|
12
|
+
option :dest, "--dest=DIR", "dest directory", default: "/tmp"
|
13
|
+
option :ssl, "--ssl"
|
14
|
+
|
15
|
+
def self.call
|
16
|
+
file = File.new("#{options[:dest]}/#{database[:database]}_#{database[:host]}_#{Time.now.iso8601}.dump", 'wb')
|
17
|
+
|
18
|
+
puts "PGSSLMODE=#{ssl?} PGPASSWORD=**** pg_dump --host #{database[:host]} -p #{database[:port]} --username #{database[:user]} --verbose -Z 0 --clean --format=c --no-owner --no-acl #{database[:database]} > #{file.path}"
|
19
|
+
exec("PGSSLMODE=#{ssl?} PGPASSWORD=#{database[:password]} pg_dump -p #{database[:port]}--host #{database[:host]} --username #{database[:user]} --clean --format=c --no-owner --no-acl #{database[:database]} > #{file.path}")
|
20
|
+
|
21
|
+
file.close
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require_relative 'pg_base'
|
3
|
+
|
4
|
+
module K8sflow
|
5
|
+
module Pg
|
6
|
+
|
7
|
+
class Kill < PgBase
|
8
|
+
register name: 'kill',
|
9
|
+
description: 'kill a query',
|
10
|
+
topic: 'pg'
|
11
|
+
|
12
|
+
option :force, "--force", 'terminates the connection in addition to cancelling the query'
|
13
|
+
|
14
|
+
def self.call
|
15
|
+
output_with_bang "procpid to kill is required" unless @arguments[0] && @arguments[0].to_i != 0
|
16
|
+
procpid = @arguments[0]
|
17
|
+
procpid = procpid.to_i
|
18
|
+
cmd = options[:force] ? 'pg_terminate_backend' : 'pg_cancel_backend'
|
19
|
+
sql = %Q(SELECT #{cmd}(#{procpid});)
|
20
|
+
puts exec_sql(sql)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require_relative 'pg_base'
|
3
|
+
|
4
|
+
module K8sflow
|
5
|
+
module Pg
|
6
|
+
|
7
|
+
class KillAll < PgBase
|
8
|
+
register name: 'killall',
|
9
|
+
description: 'terminates ALL connections',
|
10
|
+
topic: 'pg'
|
11
|
+
|
12
|
+
|
13
|
+
def self.call
|
14
|
+
sql = %Q(
|
15
|
+
SELECT pg_terminate_backend(#{pid_column})
|
16
|
+
FROM pg_stat_activity
|
17
|
+
WHERE #{pid_column} <> pg_backend_pid()
|
18
|
+
AND #{query_column} <> '<insufficient privilege>'
|
19
|
+
)
|
20
|
+
|
21
|
+
puts exec_sql(sql)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'pg_topic'
|
2
|
+
|
3
|
+
module K8sflow
|
4
|
+
module Pg
|
5
|
+
|
6
|
+
class PgBase < Clitopic::Command::Base
|
7
|
+
class << self
|
8
|
+
include Clitopic::Helpers
|
9
|
+
def exec_sql(sql)
|
10
|
+
begin
|
11
|
+
ENV["PGPASSWORD"] = database[:password]
|
12
|
+
ENV["PGSSLMODE"] = (database[:host] == 'localhost' ? 'prefer' : 'require' )
|
13
|
+
user_part = database[:user] ? "-U #{database[:user]}" : ""
|
14
|
+
output = `#{psql_cmd} -c "#{sql}" #{user_part} -h #{database[:host]} -p #{database[:port] || 5432} #{database[:database]}`
|
15
|
+
if (! $?.success?) || output.nil? || output.empty?
|
16
|
+
raise "psql failed. exit status #{$?.to_i}, output: #{output.inspect}"
|
17
|
+
end
|
18
|
+
output
|
19
|
+
rescue Errno::ENOENT
|
20
|
+
Clitopic::Helpers.output_with_bang "The local psql command could not be located"
|
21
|
+
abort
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# @TODO INCLUDE THIS IN CLITOPIC
|
26
|
+
def kv_parse(list)
|
27
|
+
vars = {}
|
28
|
+
list.each do |e|
|
29
|
+
sp = e.split("=")
|
30
|
+
key = sp[0..-2].join("=")
|
31
|
+
value = sp[-1]
|
32
|
+
vars[key] = value
|
33
|
+
end
|
34
|
+
return vars
|
35
|
+
end
|
36
|
+
|
37
|
+
# @TODO INCLUDE THIS IN CLITOPIC
|
38
|
+
def hash_opt(opt)
|
39
|
+
return {} if opt.nil?
|
40
|
+
if opt.is_a?(Hash)
|
41
|
+
hash = opt
|
42
|
+
else
|
43
|
+
hash = kv_parse(options[opt])
|
44
|
+
end
|
45
|
+
return hash
|
46
|
+
end
|
47
|
+
|
48
|
+
def psql_cmd
|
49
|
+
'psql'
|
50
|
+
end
|
51
|
+
|
52
|
+
def version
|
53
|
+
return @version if defined? @version
|
54
|
+
result = exec_sql("select version();").match(/PostgreSQL (\d+\.\d+\.\d+) on/)
|
55
|
+
fail("Unable to determine Postgres version") unless result
|
56
|
+
@version = result[1]
|
57
|
+
end
|
58
|
+
|
59
|
+
def nine_two?
|
60
|
+
return @nine_two if defined? @nine_two
|
61
|
+
@nine_two = version.to_f >= 9.2
|
62
|
+
end
|
63
|
+
|
64
|
+
def pid_column
|
65
|
+
if nine_two?
|
66
|
+
'pid'
|
67
|
+
else
|
68
|
+
'procpid'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def query_column
|
73
|
+
if nine_two?
|
74
|
+
'query'
|
75
|
+
else
|
76
|
+
'current_query'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def parse_pg_uri(uri)
|
81
|
+
p = URI.parse(uri)
|
82
|
+
h = {
|
83
|
+
database: p.path[1..-1],
|
84
|
+
user: p.user,
|
85
|
+
password: p.password,
|
86
|
+
host: p.hostname || "localhost",
|
87
|
+
uri: uri,
|
88
|
+
port: p.port || 5432
|
89
|
+
}
|
90
|
+
return h
|
91
|
+
end
|
92
|
+
|
93
|
+
def databases
|
94
|
+
if @dbs.nil?
|
95
|
+
@dbs = {}
|
96
|
+
hash_opt(options[:databases]).each do |k,v|
|
97
|
+
h = parse_pg_uri(v)
|
98
|
+
@dbs[k] = h
|
99
|
+
end
|
100
|
+
end
|
101
|
+
return @dbs
|
102
|
+
end
|
103
|
+
|
104
|
+
def ssl?
|
105
|
+
options[:ssl] ? "require" : "prefer"
|
106
|
+
end
|
107
|
+
|
108
|
+
def database(db=nil)
|
109
|
+
db = options[:database] if db.nil?
|
110
|
+
uri = URI.parse(db)
|
111
|
+
if uri.scheme == "postgres"
|
112
|
+
parse_pg_uri(db)
|
113
|
+
elsif databases[db]
|
114
|
+
return databases[db]
|
115
|
+
else
|
116
|
+
raise Clitopic::Commands::CommandFailed.new ("No database #{db}")
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module K8sflow
|
2
|
+
module Pg
|
3
|
+
class PgTopic < Clitopic::Topic::Base
|
4
|
+
register name: 'pg',
|
5
|
+
description: 'Manage postgres actions'
|
6
|
+
|
7
|
+
option :databases, "--databases KEY=postgresql_URI,KEY2=postgresql_URI2", Array, "List of preconfigured databases"
|
8
|
+
|
9
|
+
option :database, '-d', '--database DATABASE', 'Database name or URI', required: true
|
10
|
+
option :ssl, "--ssl", "enable sslmode"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require_relative 'pg_base'
|
3
|
+
|
4
|
+
module K8sflow
|
5
|
+
module Pg
|
6
|
+
|
7
|
+
class Ps < PgBase
|
8
|
+
register name: 'ps',
|
9
|
+
description: 'view active queries with execution time',
|
10
|
+
topic: 'pg'
|
11
|
+
|
12
|
+
option :verbose, "--verbose", "also show idle connections"
|
13
|
+
|
14
|
+
def self.call
|
15
|
+
sql = %Q(
|
16
|
+
SELECT
|
17
|
+
#{pid_column},
|
18
|
+
#{"state," if nine_two?}
|
19
|
+
application_name AS source,
|
20
|
+
age(now(),xact_start) AS running_for,
|
21
|
+
waiting,
|
22
|
+
#{query_column} AS query
|
23
|
+
FROM pg_stat_activity
|
24
|
+
WHERE
|
25
|
+
#{query_column} <> '<insufficient privilege>'
|
26
|
+
#{
|
27
|
+
# Apply idle-backend filter appropriate to versions and options.
|
28
|
+
case
|
29
|
+
when options[:verbose]
|
30
|
+
''
|
31
|
+
when nine_two?
|
32
|
+
"AND state <> 'idle'"
|
33
|
+
else
|
34
|
+
"AND current_query <> '<IDLE>'"
|
35
|
+
end
|
36
|
+
}
|
37
|
+
AND #{pid_column} <> pg_backend_pid()
|
38
|
+
ORDER BY query_start DESC
|
39
|
+
)
|
40
|
+
|
41
|
+
puts exec_sql(sql)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require_relative 'pg_base'
|
3
|
+
|
4
|
+
module K8sflow
|
5
|
+
module Pg
|
6
|
+
|
7
|
+
class Psql < PgBase
|
8
|
+
register name: 'psql',
|
9
|
+
description: 'psql to the database',
|
10
|
+
topic: 'pg'
|
11
|
+
def self.call
|
12
|
+
puts "PGPASSWORD=**** psql -h #{database[:host]} -U #{database[:user]} -d #{database[:database]} -p #{database[:port]} #{@arguments.join(" ")}"
|
13
|
+
exec("PGSSLMODE=#{ssl?} PGPASSWORD=#{database[:password]} psql -p #{database[:port]} -h #{database[:host]} -U #{database[:user]} -d #{database[:database]} #{@arguments.join(" ")}")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require_relative 'pg_base'
|
3
|
+
|
4
|
+
module K8sflow
|
5
|
+
module Pg
|
6
|
+
|
7
|
+
class Restore < PgBase
|
8
|
+
register name: 'restore',
|
9
|
+
description: 'Restore a dump to target database',
|
10
|
+
topic: 'pg'
|
11
|
+
|
12
|
+
option :src, "--src=file", "Dump to store"
|
13
|
+
option :confirm, "--confirm CONFIRM", "Command line confirmation, no prompt"
|
14
|
+
|
15
|
+
def self.call
|
16
|
+
puts "PGSSLMODE=#{ssl?} PGPASSWORD=#{database[:password]} pg_restore --port #{database[:port]} --host #{database[:host]} --username #{database[:user]} --verbose --no-acl --no-owner -d #{database[:database]} < #{file.path}"
|
17
|
+
confirm_command("on #{database[:host]} overwrite the database #{database[:database]}")
|
18
|
+
exec("PGSSLMODE=#{ssl?} PGPASSWORD=#{database[:password]} pg_restore --port #{database[:port]} --host #{database[:host]} --username #{database[:user]} --verbose --no-acl --no-owner -d #{database[:database]} < #{file.path}")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/lib/k8sflow/command.rb
CHANGED
data/lib/k8sflow/version.rb
CHANGED
@@ -1,3 +1,55 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
module K8sflow
|
2
|
-
VERSION = '0.
|
3
|
+
VERSION = '0.11.0'
|
4
|
+
VERSION_NAMES = {1 => 'France II',
|
5
|
+
2 => 'R.C. Rickmers',
|
6
|
+
3 => 'Thomas W. Lawson',
|
7
|
+
4 => 'Preussen',
|
8
|
+
5 => 'Wyoming',
|
9
|
+
6 => 'Wind Star',
|
10
|
+
7 => 'Royal Clipper',
|
11
|
+
8 => 'Potosí',
|
12
|
+
9 => 'Maria Rickmers',
|
13
|
+
10 => 'København',
|
14
|
+
11 => 'France I',
|
15
|
+
12 => 'Viking',
|
16
|
+
13 => 'Amerigo Vespucci',
|
17
|
+
14 => 'Sedov',
|
18
|
+
15 => 'Great Republic',
|
19
|
+
16 => 'Krusenstern',
|
20
|
+
17 => 'Pamir',
|
21
|
+
18 => 'Juan Sebastián de Elcano',
|
22
|
+
19 => 'Esmeralda',
|
23
|
+
20 => 'Star Clipper',
|
24
|
+
21 => 'Star Flyer',
|
25
|
+
22 => 'Dar Młodzieży',
|
26
|
+
23 => 'Simon Bolivar',
|
27
|
+
24 => 'Cuauhtémoc',
|
28
|
+
25 => 'Gloria',
|
29
|
+
26 => 'Créole',
|
30
|
+
27 => 'Mir',
|
31
|
+
28 => 'Statsraad Lehmkuhl',
|
32
|
+
29 => 'Mircea',
|
33
|
+
30 => 'Seute Deern',
|
34
|
+
31 => 'Tovarishch',
|
35
|
+
32 => 'Falls of Clyde',
|
36
|
+
33 => 'Herzogin Cecilie',
|
37
|
+
34 => 'Kaiwo Maru',
|
38
|
+
35 => 'Kaiwo Maru II',
|
39
|
+
36 => 'Lawhill',
|
40
|
+
37 => 'Moshulu',
|
41
|
+
38 => 'Nippon Maru',
|
42
|
+
39 => 'Nippon Maru II',
|
43
|
+
40 => 'Passat',
|
44
|
+
41 => 'Palinuro',
|
45
|
+
42 => 'Peking',
|
46
|
+
43 => 'Pommern',
|
47
|
+
44 => 'Sea Cloud',
|
48
|
+
45 => 'Wind Surf',
|
49
|
+
46 => 'Eagle',
|
50
|
+
47 => 'Sagres II',
|
51
|
+
48 => 'Phocéa',
|
52
|
+
49 => 'Archibald Russell',
|
53
|
+
50 => 'Wind Spirit'}
|
54
|
+
|
3
55
|
end
|
data/lib/k8sflow.rb
CHANGED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
10
|
+
# a separate helper file that requires the additional dependencies and performs
|
11
|
+
# the additional setup, and require it from the spec files that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
require 'simplecov'
|
18
|
+
require "codeclimate-test-reporter"
|
19
|
+
CodeClimate::TestReporter.start
|
20
|
+
SimpleCov.start do
|
21
|
+
add_filter 'spec/'
|
22
|
+
add_filter 'lib/clitopic/helpers.rb'
|
23
|
+
add_group 'lib', 'lib'
|
24
|
+
add_group 'commands', 'lib/clitopic/command'
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
require 'clitopic'
|
29
|
+
require 'clitopic/cli'
|
30
|
+
require 'clitopic/command'
|
31
|
+
class TopicA < Clitopic::Topic::Base
|
32
|
+
register name: "a",
|
33
|
+
description: "describe a"
|
34
|
+
end
|
35
|
+
|
36
|
+
class TopicB < Clitopic::Topic::Base
|
37
|
+
register name: "b",
|
38
|
+
description: "describe b"
|
39
|
+
|
40
|
+
option :merge, "--[no-]merge", "Merge options with current file", default: true
|
41
|
+
end
|
42
|
+
|
43
|
+
class Topic < Clitopic::Topic::Base
|
44
|
+
end
|
45
|
+
|
46
|
+
class RootCmd < Clitopic::Command::Base
|
47
|
+
register name: 'root_cmd',
|
48
|
+
description: "descrption1",
|
49
|
+
banner: "banner1"
|
50
|
+
end
|
51
|
+
|
52
|
+
class TopicaCmd < Clitopic::Command::Base
|
53
|
+
register name: 'cmd',
|
54
|
+
description: "descrption_cmd",
|
55
|
+
banner: "banner_cmd",
|
56
|
+
topic: 'a'
|
57
|
+
end
|
58
|
+
|
59
|
+
class TopicaIndex < Clitopic::Command::Base
|
60
|
+
register name: 'index', topic: 'a'
|
61
|
+
end
|
62
|
+
|
63
|
+
class TopicbIndex < Clitopic::Command::Base
|
64
|
+
register name: 'index', topic: TopicB
|
65
|
+
end
|
66
|
+
|
67
|
+
class TopiccIndex < Clitopic::Command::Base
|
68
|
+
register name: 'index', topic: {name: 'c', description: 'topic c'}
|
69
|
+
end
|
70
|
+
|
71
|
+
RSpec.configure do |config|
|
72
|
+
# rspec-expectations config goes here. You can use an alternate
|
73
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
74
|
+
# assertions if you prefer.
|
75
|
+
config.expect_with :rspec do |expectations|
|
76
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
77
|
+
# and `failure_message` of custom matchers include text for helper methods
|
78
|
+
# defined using `chain`, e.g.:
|
79
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
80
|
+
# # => "be bigger than 2 and smaller than 4"
|
81
|
+
# ...rather than:
|
82
|
+
# # => "be bigger than 2"
|
83
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
84
|
+
end
|
85
|
+
|
86
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
87
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
88
|
+
config.mock_with :rspec do |mocks|
|
89
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
90
|
+
# a real object. This is generally recommended, and will default to
|
91
|
+
# `true` in RSpec 4.
|
92
|
+
mocks.verify_partial_doubles = true
|
93
|
+
end
|
94
|
+
|
95
|
+
# The settings below are suggested to provide a good initial experience
|
96
|
+
# with RSpec, but feel free to customize to your heart's content.
|
97
|
+
=begin
|
98
|
+
# These two settings work together to allow you to limit a spec run
|
99
|
+
# to individual examples or groups you care about by tagging them with
|
100
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
101
|
+
# get run.
|
102
|
+
config.filter_run :focus
|
103
|
+
config.run_all_when_everything_filtered = true
|
104
|
+
|
105
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
106
|
+
# For more details, see:
|
107
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
108
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
109
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
110
|
+
config.disable_monkey_patching!
|
111
|
+
|
112
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
113
|
+
# be too noisy due to issues in dependencies.
|
114
|
+
config.warnings = true
|
115
|
+
|
116
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
117
|
+
# file, and it's useful to allow more verbose output when running an
|
118
|
+
# individual spec file.
|
119
|
+
if config.files_to_run.one?
|
120
|
+
# Use the documentation formatter for detailed output,
|
121
|
+
# unless a formatter has already been configured
|
122
|
+
# (e.g. via a command-line flag).
|
123
|
+
config.default_formatter = 'doc'
|
124
|
+
end
|
125
|
+
|
126
|
+
# Print the 10 slowest examples and example groups at the
|
127
|
+
# end of the spec run, to help surface which specs are running
|
128
|
+
# particularly slow.
|
129
|
+
config.profile_examples = 10
|
130
|
+
|
131
|
+
# Run specs in random order to surface order dependencies. If you find an
|
132
|
+
# order dependency and want to debug it, you can fix the order by providing
|
133
|
+
# the seed, which is printed after each run.
|
134
|
+
# --seed 1234
|
135
|
+
config.order = :random
|
136
|
+
|
137
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
138
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
139
|
+
# test failures related to randomization by passing the same `--seed` value
|
140
|
+
# as the one that triggered the failure.
|
141
|
+
Kernel.srand config.seed
|
142
|
+
=end
|
143
|
+
end
|
metadata
CHANGED
@@ -1,43 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k8sflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antoine Legrand
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cli-topic
|
15
|
-
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.9'
|
20
|
-
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
23
21
|
requirements:
|
24
|
-
- - "
|
22
|
+
- - "~>"
|
25
23
|
- !ruby/object:Gem::Version
|
26
24
|
version: '0.9'
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: docker-api
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.22'
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
30
35
|
requirements:
|
31
|
-
- - "
|
36
|
+
- - "~>"
|
32
37
|
- !ruby/object:Gem::Version
|
33
38
|
version: '1.22'
|
39
|
+
prerelease: false
|
34
40
|
type: :runtime
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: heroku-api
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.3'
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.3'
|
35
53
|
prerelease: false
|
54
|
+
type: :runtime
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: netrc
|
36
57
|
version_requirements: !ruby/object:Gem::Requirement
|
37
58
|
requirements:
|
38
|
-
- - "
|
59
|
+
- - "~>"
|
39
60
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
61
|
+
version: '0.7'
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0.7'
|
67
|
+
prerelease: false
|
68
|
+
type: :runtime
|
41
69
|
description: Manage workflow from source to kubernetes deployement
|
42
70
|
email:
|
43
71
|
- ant.legrand@gmail.com
|
@@ -55,16 +83,25 @@ files:
|
|
55
83
|
- lib/k8sflow/command.rb
|
56
84
|
- lib/k8sflow/command/image.rb
|
57
85
|
- lib/k8sflow/command/maintenance.rb
|
86
|
+
- lib/k8sflow/command/pg/backup.rb
|
87
|
+
- lib/k8sflow/command/pg/copy.rb
|
88
|
+
- lib/k8sflow/command/pg/dump.rb
|
89
|
+
- lib/k8sflow/command/pg/kill.rb
|
90
|
+
- lib/k8sflow/command/pg/killall.rb
|
91
|
+
- lib/k8sflow/command/pg/pg_base.rb
|
92
|
+
- lib/k8sflow/command/pg/pg_topic.rb
|
93
|
+
- lib/k8sflow/command/pg/ps.rb
|
94
|
+
- lib/k8sflow/command/pg/psql.rb
|
95
|
+
- lib/k8sflow/command/pg/restore.rb
|
58
96
|
- lib/k8sflow/command/run.rb
|
59
97
|
- lib/k8sflow/utils/heroku.rb
|
60
98
|
- lib/k8sflow/version.rb
|
61
|
-
- spec/
|
62
|
-
- spec/topic_spec.rb
|
99
|
+
- spec/spec_helper.rb
|
63
100
|
homepage: http://gitlab.com/ant31
|
64
101
|
licenses:
|
65
102
|
- MIT
|
66
103
|
metadata: {}
|
67
|
-
post_install_message:
|
104
|
+
post_install_message:
|
68
105
|
rdoc_options: []
|
69
106
|
require_paths:
|
70
107
|
- lib
|
@@ -79,12 +116,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
116
|
- !ruby/object:Gem::Version
|
80
117
|
version: '0'
|
81
118
|
requirements: []
|
82
|
-
rubyforge_project:
|
83
|
-
rubygems_version: 2.4.
|
84
|
-
signing_key:
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 2.4.8
|
121
|
+
signing_key:
|
85
122
|
specification_version: 4
|
86
123
|
summary: Manage workflow from source to docker to kubernetes deployement
|
87
124
|
test_files:
|
88
|
-
- spec/
|
89
|
-
- spec/topic_spec.rb
|
90
|
-
has_rdoc:
|
125
|
+
- spec/spec_helper.rb
|
data/spec/kubeflow_spec.rb
DELETED