vagrant-rke2 0.1.2 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd355a21d5666ca9a6a8183e7b810aacb99bd465447adf542d5cb322366fd2e0
4
- data.tar.gz: caf3c0730b34d67be647971f5930a8c4a7db91c606f51fedf0a9394ab04a3f1f
3
+ metadata.gz: 0526f2fbff31513256c989075dccd7f7b9ea70528694ceb4030f58f09bace928
4
+ data.tar.gz: f7d2cd7ef9afc96625e2f2dc8c2b761582ceb1b7c00692c01e69b856ac93c398
5
5
  SHA512:
6
- metadata.gz: 6488eb32110071d61fe2dd5930b33de81bc2babf89781864b7a06f0902df1e3723182260e0189ac63a748d1b3ac6b1d36318b753067f10dab1fc8250b80ed0f2
7
- data.tar.gz: b42ae93ef0676d55b9ea9a4ee4ce00da471de6f5af0e5f9201016634dfa88921c880e04c011e71ce2c5be4193fdea4ef6fab94d30cc93ef3b796dd8090ee067d
6
+ metadata.gz: eaae709dc8f96ddc67ffad2d4ffb9ea49e7d6244160582fad9a7940ba9609c4429584333c92496e8a8737461be53ac3e18d853a7427efebb50b45450f7aa8e0e
7
+ data.tar.gz: b41aa7a464e9f6b77d7417105c9d6630c8d397f42353ed137f9269fc8b6ef3ebc51fffa4d006a571faf98bb65f2ffa3a1e68912237b09a4ccc708bdb950e401a
data/Gemfile.lock CHANGED
@@ -28,7 +28,7 @@ GIT
28
28
  PATH
29
29
  remote: .
30
30
  specs:
31
- vagrant-rke2 (0.1.1)
31
+ vagrant-rke2 (0.1.5)
32
32
 
33
33
  GEM
34
34
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Vagrant::RKE2
2
- This plugin was heavily inspired by the [vagrant-k3s](https://github.com/dweomer/vagrant-k3s) plugin. Check that out and give dweomer some stars.
2
+ This plugin is the companion to the [vagrant-k3s](https://github.com/k3s-io/vagrant-k3s) plugin. It makes deploying RKE2 on vagrant boxes much easier.
3
3
 
4
4
  ## Installation
5
5
 
@@ -44,6 +44,7 @@ Vagrant.configure("2") do |config|
44
44
  # config: config file content in yaml
45
45
  # type => String
46
46
  rke2.config = <<~YAML
47
+ write-kubeconfig-mode: '0644'
47
48
  disable:
48
49
  - local-storage
49
50
  - servicelb
@@ -58,6 +59,11 @@ Vagrant.configure("2") do |config|
58
59
  # type => Boolean
59
60
  # default => true
60
61
  rke2.install_path = false
62
+
63
+ # skip_start: install but don't start RKE2
64
+ # type => Boolean
65
+ # default => false
66
+ rke2.skip_start = true
61
67
  end
62
68
  end
63
69
  ```
@@ -90,6 +96,16 @@ Vagrant.configure("2") do |config|
90
96
  server: https://172.168.1.200:9345
91
97
  token: vagrant-rke2
92
98
  YAML
99
+
100
+ # install_path: QOL feature, add RKE2 to the PATH
101
+ # type => Boolean
102
+ # default => true
103
+ rke2.install_path = false
104
+
105
+ # skip_start: install but don't start RKE2
106
+ # type => Boolean
107
+ # default => false
108
+ rke2.skip_start = true
93
109
  end
94
110
  end
95
111
  ```
@@ -0,0 +1,5 @@
1
+ Write-Host "Creating RKE2 environment variables..."
2
+ $env:PATH+=";C:\var\lib\rancher\rke2\bin;c:\usr\local\bin"
3
+ [Environment]::SetEnvironmentVariable("Path",
4
+ [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine) + ";C:\var\lib\rancher\rke2\bin;c:\usr\local\bin",
5
+ [EnvironmentVariableTarget]::Machine)
@@ -11,12 +11,6 @@ Set-Content -Path !!CONFIG_PATH!! -Value @"
11
11
  Write-Host "Installing RKE2 as an agent..."
12
12
  ./install.ps1 !!ENV!!
13
13
 
14
- Write-Host "Creating RKE2 environment variables..."
15
- $env:PATH+=";C:\var\lib\rancher\rke2\bin;c:\usr\local\bin"
16
- [Environment]::SetEnvironmentVariable("Path",
17
- [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine) + ";C:\var\lib\rancher\rke2\bin;c:\usr\local\bin",
18
- [EnvironmentVariableTarget]::Machine)
19
-
20
14
  Write-Host "Open ports for RKE2 and Calico in firewall..."
21
15
  netsh advfirewall firewall add rule name= "RKE2-kubelet" dir=in action=allow protocol=TCP localport=10250
22
16
  netsh advfirewall firewall add rule name= "RKE2-agent" dir=in action=allow protocol=TCP localport=4789
@@ -57,6 +57,11 @@ module VagrantPlugins
57
57
  # @return [Boolean]
58
58
  attr_accessor :install_path
59
59
 
60
+ # Defaults to false
61
+ # @return [Boolean]
62
+ attr_accessor :skip_start
63
+
64
+
60
65
  def initialize
61
66
  @config = UNSET_VALUE
62
67
  @config_mode = UNSET_VALUE
@@ -68,6 +73,7 @@ module VagrantPlugins
68
73
  @env_path = UNSET_VALUE
69
74
  @installer_url = UNSET_VALUE
70
75
  @install_path = UNSET_VALUE
76
+ @skip_start = UNSET_VALUE
71
77
  end
72
78
 
73
79
  def finalize!
@@ -81,6 +87,7 @@ module VagrantPlugins
81
87
  @env_path = DEFAULT_ENV_PATH if @env_path == UNSET_VALUE
82
88
  @installer_url = DEFAULT_INSTALLER_URL_LINUX if @installer_url == UNSET_VALUE
83
89
  @install_path = true if @install_path == UNSET_VALUE
90
+ @skip_start = false if @skip_start == UNSET_VALUE
84
91
  end
85
92
 
86
93
  def validate(machine)
@@ -80,19 +80,6 @@ module VagrantPlugins
80
80
  end
81
81
  end
82
82
 
83
- @machine.ui.info "Starting RKE2 service..."
84
- if !service.empty?
85
- @machine.communicate.sudo("systemctl enable rke2-#{service}.service")
86
- @machine.communicate.sudo("systemctl start rke2-#{service}.service") do |type, line|
87
- @machine.ui.detail line, :color => :yellow
88
- end
89
- else
90
- @machine.communicate.sudo("systemctl enable rke2-server.service")
91
- @machine.communicate.sudo("systemctl start rke2-server.service") do |type, line|
92
- @machine.ui.detail line, :color => :yellow
93
- end
94
- end
95
-
96
83
  if config.install_path
97
84
  @machine.ui.info "Adding RKE2 to PATH and KUBECONFIG"
98
85
  outputs, handler = build_outputs
@@ -103,6 +90,21 @@ module VagrantPlugins
103
90
  outputs.values.map(&:close)
104
91
  end
105
92
  end
93
+
94
+ @machine.ui.info "Starting RKE2 service..."
95
+ if !service.empty?
96
+ @machine.communicate.sudo("systemctl enable rke2-#{service}.service")
97
+ @machine.communicate.sudo("systemctl start rke2-#{service}.service") do |type, line|
98
+ @machine.ui.detail line, :color => :yellow
99
+ end
100
+ else
101
+ @machine.communicate.sudo("systemctl enable rke2-server.service")
102
+ if !config.skip_start
103
+ @machine.communicate.sudo("systemctl start rke2-server.service") do |type, line|
104
+ @machine.ui.detail line, :color => :yellow
105
+ end
106
+ end
107
+ end
106
108
  end
107
109
 
108
110
  def provisionWindows
@@ -146,15 +148,26 @@ module VagrantPlugins
146
148
  @machine.ui.detail line.chomp, :color => :yellow
147
149
  end
148
150
 
151
+ if config.install_path
152
+ setupPath = "setup-path.ps1"
153
+ @machine.ui.info "Invoking: #{setupPath}"
154
+ command = File.read(scriptDir + setupPath)
155
+ @machine.communicate.execute(command, {shell: :powershell, elevated: true}) do |type, line|
156
+ @machine.ui.detail line.chomp, :color => :yellow
157
+ end
158
+ end
159
+
149
160
  @machine.ui.info "Checking RKE2 version:"
150
161
  @machine.communicate.test("Get-Command rke2", {shell: :powershell})
151
- @machine.communicate.execute("rke2 --version", {shell: :powershell}) do |type, line|
162
+ @machine.communicate.execute('C:\usr\local\bin\rke2.exe --version', {shell: :powershell}) do |type, line|
152
163
  @machine.ui.detail line, :color => :yellow
153
164
  end
154
165
 
155
166
  @machine.ui.info "Starting RKE2 agent:"
156
- @machine.communicate.execute("rke2.exe agent service --add", {shell: :powershell, elevated: true} )
157
- @machine.communicate.execute("Start-Service -Name 'rke2'", {shell: :powershell, elevated: true} )
167
+ @machine.communicate.execute('C:\usr\local\bin\rke2.exe agent service --add', {shell: :powershell, elevated: true} )
168
+ if !config.skip_start
169
+ @machine.communicate.execute("Start-Service -Name 'rke2'", {shell: :powershell, elevated: true} )
170
+ end
158
171
 
159
172
  end
160
173
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Rke2
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-rke2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Nola
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-07 00:00:00.000000000 Z
11
+ date: 2022-05-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Manage RKE2 installations on Vagrant guests
14
14
  email:
@@ -31,6 +31,7 @@ files:
31
31
  - lib/vagrant-rke2/cap/linux/curl_installed.rb
32
32
  - lib/vagrant-rke2/cap/linux/rke2_installed.rb
33
33
  - lib/vagrant-rke2/cap/windows/scripts/install-containers-feature.ps1
34
+ - lib/vagrant-rke2/cap/windows/scripts/setup-path.ps1
34
35
  - lib/vagrant-rke2/cap/windows/scripts/setup-rke2.ps1
35
36
  - lib/vagrant-rke2/config.rb
36
37
  - lib/vagrant-rke2/plugin.rb
@@ -58,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
59
  - !ruby/object:Gem::Version
59
60
  version: '0'
60
61
  requirements: []
61
- rubygems_version: 3.1.2
62
+ rubygems_version: 3.3.5
62
63
  signing_key:
63
64
  specification_version: 4
64
65
  summary: Manage RKE2 installations on Vagrant guests