kplay 0.2.0 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 515860b760fb32f630f8de69febfae4d21a1b682fd7b7930390656c9cab9a927
4
- data.tar.gz: 39e66a13e481351ab4b9e0b232de6469d1600c9f2a7443a390a41f4b5ac31f27
2
+ SHA1:
3
+ metadata.gz: e33ce504a8556db68e6a1d1527a6c0acae9d76b8
4
+ data.tar.gz: ed304d74a3784d09568fd8f171db18cc1be3cd25
5
5
  SHA512:
6
- metadata.gz: 7783d816fb7bece2a39ac02697a26d165ff5fc9e09cb38c32df6174d6663d6d7ce3f9a6775217a3b0a2dabbea15f43d3454c277418c34e16a5f3a1826e76e89f
7
- data.tar.gz: 85c90bdebec4dab9bb3a0cbf0d38e5581e6e8f6fec652b1e11535313d93c80fccb16e2bd6e1e1175aee0862dc8e9c1ffb58ff6c384e82c1f46c0b2b94db21bcc
6
+ metadata.gz: 7025d7487f8cbe6fb77f5f573581c11383599538a531b23a26a9bfc24dd2b63a5386b3e85664c9bc628eab5f199635b24527c7bec7e7129d3ad91acf8ab1f7c7
7
+ data.tar.gz: acef8a5a62e71fb839bcb1d283b9dd13cbad99b6ef957dab9a0812b6fe9dbac82655a33de1040a609627782fd67beb911783217b113646542500229d4da83cf7
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /vendor/
10
11
 
11
12
  /.kplay
12
13
 
@@ -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!
@@ -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
@@ -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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kplay
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
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.2.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-04-04 00:00:00.000000000 Z
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.7.6
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