vagrant-rke2 0.1.1 → 0.1.2

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: 3cf49d824ed2271d901c4f58c230a6f071146545615ab847f099a01725e81286
4
- data.tar.gz: 2bbfe012a5180f083cc8b09c91f7e11d200744de497120d9de65a57759cd8875
3
+ metadata.gz: cd355a21d5666ca9a6a8183e7b810aacb99bd465447adf542d5cb322366fd2e0
4
+ data.tar.gz: caf3c0730b34d67be647971f5930a8c4a7db91c606f51fedf0a9394ab04a3f1f
5
5
  SHA512:
6
- metadata.gz: 972ff4e827f656951d83b61abef0c670fa25e49083031f1a760bf756d08770c74c32c0e3e387d1d01ecea29d5897f89e456e54086d105a15557de9b44c923202
7
- data.tar.gz: '04043292575ed63d8655e0a9433484774cbf96bd14ef40f08293dac8c90758ceb1e7401ac47866c20bb0167d48146d1767f24d2dc432bd07a45f46561fdc3819'
6
+ metadata.gz: 6488eb32110071d61fe2dd5930b33de81bc2babf89781864b7a06f0902df1e3723182260e0189ac63a748d1b3ac6b1d36318b753067f10dab1fc8250b80ed0f2
7
+ data.tar.gz: b42ae93ef0676d55b9ea9a4ee4ce00da471de6f5af0e5f9201016634dfa88921c880e04c011e71ce2c5be4193fdea4ef6fab94d30cc93ef3b796dd8090ee067d
data/README.md CHANGED
@@ -3,6 +3,8 @@ This plugin was heavily inspired by the [vagrant-k3s](https://github.com/dweomer
3
3
 
4
4
  ## Installation
5
5
 
6
+ Vagrant must be >= v2.2.17
7
+
6
8
  ```shell
7
9
  vagrant plugin install vagrant-rke2
8
10
  vagrant up --provider=<your favorite provider>
@@ -10,8 +12,11 @@ vagrant up --provider=<your favorite provider>
10
12
 
11
13
  ## Usage
12
14
 
15
+ See the [Vagrantfile](./test/Vagrantfile) for a working example.
16
+
13
17
  ### Linux VMs
14
18
  ```ruby
19
+ Vagrant.require_version ">= 2.2.17"
15
20
  Vagrant.configure("2") do |config|
16
21
  config.vm.box = 'generic/ubuntu2004'
17
22
 
@@ -49,10 +54,10 @@ Vagrant.configure("2") do |config|
49
54
  rke2.config_mode = '0644' # side-step https://github.com/k3s-io/k3s/issues/4321
50
55
  rke2.config_owner = 'root:root' #default
51
56
 
52
- # install_kubectl: QOL feature, installs latest version of kubectl
57
+ # install_path: QOL feature, add RKE2 to the PATH and points the KUBECONFIG to rke2.yaml
53
58
  # type => Boolean
54
59
  # default => true
55
- rke2.install_kubectl = false
60
+ rke2.install_path = false
56
61
  end
57
62
  end
58
63
  ```
@@ -60,6 +65,7 @@ end
60
65
  ### Windows VMs
61
66
  Windows setup is much more restricted. See https://docs.rke2.io/install/install_options/windows_agent_config/ for more info
62
67
  ```ruby
68
+ Vagrant.require_version ">= 2.2.17"
63
69
  Vagrant.configure("2") do |config|
64
70
  config.vm.box = "StefanScherer/windows_2019"
65
71
  config.vm.communicator = "winrm"
@@ -55,7 +55,7 @@ module VagrantPlugins
55
55
 
56
56
  # Defaults to true
57
57
  # @return [Boolean]
58
- attr_accessor :install_kubectl
58
+ attr_accessor :install_path
59
59
 
60
60
  def initialize
61
61
  @config = UNSET_VALUE
@@ -67,7 +67,7 @@ module VagrantPlugins
67
67
  @env_owner = UNSET_VALUE
68
68
  @env_path = UNSET_VALUE
69
69
  @installer_url = UNSET_VALUE
70
- @install_kubectl = UNSET_VALUE
70
+ @install_path = UNSET_VALUE
71
71
  end
72
72
 
73
73
  def finalize!
@@ -80,7 +80,7 @@ module VagrantPlugins
80
80
  @env_owner = DEFAULT_ENV_OWNER if @env_owner == UNSET_VALUE
81
81
  @env_path = DEFAULT_ENV_PATH if @env_path == UNSET_VALUE
82
82
  @installer_url = DEFAULT_INSTALLER_URL_LINUX if @installer_url == UNSET_VALUE
83
- @install_kubectl = true if @install_kubectl == UNSET_VALUE
83
+ @install_path = true if @install_path == UNSET_VALUE
84
84
  end
85
85
 
86
86
  def validate(machine)
@@ -65,28 +65,6 @@ module VagrantPlugins
65
65
  @machine.communicate.sudo("chmod +x #{prv_file} && #{prv_file}", :error_key => :ssh_bad_exit_status_muted) do |type, line|
66
66
  @machine.ui.detail line, :color => :yellow
67
67
  end
68
- # outputs, handler = build_outputs
69
- # begin
70
- # @machine.communicate.sudo("chmod +x #{prv_file} && #{prv_file}", error_key: :ssh_bad_exit_status_muted, &handler)
71
- # ensure
72
- # outputs.values.map(&:close)
73
- # end
74
-
75
- if config.install_kubectl
76
- kube_file = "/vagrant/kubectl-install.sh"
77
- kube_text = <<~EOF
78
- curl -L "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -o /usr/local/bin/kubectl
79
- chmod +x /usr/local/bin/kubectl
80
- EOF
81
- file_upload("kubectl-install.sh", kube_file, kube_text)
82
- @machine.ui.info "Invoking: #{kube_file}"
83
- outputs, handler = build_outputs
84
- begin
85
- @machine.communicate.sudo("chmod +x #{kube_file} && #{kube_file}", &handler)
86
- ensure
87
- outputs.values.map(&:close)
88
- end
89
- end
90
68
 
91
69
  begin
92
70
  exe = "rke2"
@@ -114,6 +92,17 @@ module VagrantPlugins
114
92
  @machine.ui.detail line, :color => :yellow
115
93
  end
116
94
  end
95
+
96
+ if config.install_path
97
+ @machine.ui.info "Adding RKE2 to PATH and KUBECONFIG"
98
+ outputs, handler = build_outputs
99
+ begin
100
+ @machine.communicate.sudo("echo 'export KUBECONFIG=/etc/rancher/rke2/rke2.yaml PATH=$PATH:/var/lib/rancher/rke2/bin' >> /home/vagrant/.bashrc", &handler)
101
+ @machine.communicate.sudo("echo 'export KUBECONFIG=/etc/rancher/rke2/rke2.yaml PATH=$PATH:/var/lib/rancher/rke2/bin' >> /root/.bashrc", &handler)
102
+ ensure
103
+ outputs.values.map(&:close)
104
+ end
105
+ end
117
106
  end
118
107
 
119
108
  def provisionWindows
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Rke2
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
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.1
4
+ version: 0.1.2
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-01-18 00:00:00.000000000 Z
11
+ date: 2022-02-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Manage RKE2 installations on Vagrant guests
14
14
  email: