kplay 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/lib/kplay/cli.rb +9 -0
- data/lib/kplay/minikube.rb +16 -0
- data/lib/kplay/pod.rb +16 -2
- data/lib/kplay/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e33ce504a8556db68e6a1d1527a6c0acae9d76b8
|
4
|
+
data.tar.gz: ed304d74a3784d09568fd8f171db18cc1be3cd25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7025d7487f8cbe6fb77f5f573581c11383599538a531b23a26a9bfc24dd2b63a5386b3e85664c9bc628eab5f199635b24527c7bec7e7129d3ad91acf8ab1f7c7
|
7
|
+
data.tar.gz: acef8a5a62e71fb839bcb1d283b9dd13cbad99b6ef957dab9a0812b6fe9dbac82655a33de1040a609627782fd67beb911783217b113646542500229d4da83cf7
|
data/.gitignore
CHANGED
data/lib/kplay/cli.rb
CHANGED
@@ -30,6 +30,15 @@ module Kplay
|
|
30
30
|
puts config.to_h.to_yaml
|
31
31
|
end
|
32
32
|
|
33
|
+
desc 'pod_config', 'Displays the pod config'
|
34
|
+
option :image, aliases: :i, desc: 'Image to use'
|
35
|
+
def pod_config
|
36
|
+
Kplay.assert_requirements!
|
37
|
+
pod = Kplay::Pod.new(Dir.pwd, Kplay::Config.local, options)
|
38
|
+
puts pod.configuration
|
39
|
+
end
|
40
|
+
|
41
|
+
|
33
42
|
desc 'status', 'Displays the cluster and container (pod) status'
|
34
43
|
def status
|
35
44
|
Kplay.assert_requirements!
|
data/lib/kplay/minikube.rb
CHANGED
@@ -43,5 +43,21 @@ module Kplay
|
|
43
43
|
end
|
44
44
|
Pathname.new(path_host.to_s.sub(hostfolder_host.to_s, hostfolder_vm.to_s))
|
45
45
|
end
|
46
|
+
|
47
|
+
|
48
|
+
# Returns true if SSH agent forwarding can be enabled
|
49
|
+
# (socket resides in VM mounted folders)
|
50
|
+
#
|
51
|
+
def self.ssh_forwarding_available?
|
52
|
+
!!ssh_forwarding_socket_vm
|
53
|
+
end
|
54
|
+
|
55
|
+
# Returns path to SSH agent forwarding socket in a VM
|
56
|
+
#
|
57
|
+
def self.ssh_forwarding_socket_vm
|
58
|
+
socket_path = ENV['SSH_AUTH_SOCK']
|
59
|
+
return nil unless socket_path
|
60
|
+
Minikube.host_path_in_vm(socket_path) rescue nil
|
61
|
+
end
|
46
62
|
end # module Minikube
|
47
63
|
end # module Kplay
|
data/lib/kplay/pod.rb
CHANGED
@@ -38,7 +38,7 @@ module Kplay
|
|
38
38
|
ip, *hostnames = host.strip.split(' ')
|
39
39
|
{ 'ip' => ip, 'hostnames' => hostnames }
|
40
40
|
end
|
41
|
-
{
|
41
|
+
c = {
|
42
42
|
'apiVersion' => 'v1',
|
43
43
|
'kind' => 'Pod',
|
44
44
|
'metadata' => { 'name' => name },
|
@@ -49,8 +49,12 @@ module Kplay
|
|
49
49
|
'name' => name,
|
50
50
|
'image' => options[:image] || config[:image],
|
51
51
|
'imagePullPolicy' => 'IfNotPresent',
|
52
|
+
'env' => [
|
53
|
+
# { 'name' => ..., 'value' => ... }
|
54
|
+
],
|
52
55
|
'volumeMounts' => [
|
53
|
-
{ 'mountPath' => config[:mount_path], 'name' => volume_name }
|
56
|
+
{ 'mountPath' => config[:mount_path], 'name' => volume_name },
|
57
|
+
# <-- ssh forwarding socket should be mounted a CONTAINER here
|
54
58
|
]
|
55
59
|
}
|
56
60
|
],
|
@@ -59,9 +63,19 @@ module Kplay
|
|
59
63
|
'name' => volume_name,
|
60
64
|
'hostPath' => { 'path' => path_host }
|
61
65
|
}
|
66
|
+
# <-- ssh forwarding socket in VM mounted here
|
62
67
|
]
|
63
68
|
}
|
64
69
|
}
|
70
|
+
return c unless Kplay::Minikube.ssh_forwarding_available?
|
71
|
+
# enable SSH forwarding
|
72
|
+
c['spec']['containers'].first['env'] <<
|
73
|
+
{ 'name' => 'SSH_AUTH_SOCK', 'value' => Kplay::Minikube.ssh_forwarding_socket_vm }
|
74
|
+
c['spec']['containers'].first['volumeMounts'] <<
|
75
|
+
{ 'name' => 'ssh_auth_sock', 'mountPath' => Kplay::Minikube.ssh_forwarding_socket_vm }
|
76
|
+
c['spec']['volumes'] <<
|
77
|
+
{ 'name' => 'ssh_auth_sock', 'hostPath' => { 'path' => Kplay::Minikube.ssh_forwarding_socket_vm } }
|
78
|
+
c
|
65
79
|
end
|
66
80
|
|
67
81
|
# Returns Kubernetes pod configuration in YAML
|
data/lib/kplay/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kplay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Kukushkin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.
|
148
|
+
rubygems_version: 2.5.2
|
149
149
|
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: Starts your project within a container in minikube
|