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 +4 -4
- data/README.md +8 -2
- data/lib/vagrant-rke2/config.rb +3 -3
- data/lib/vagrant-rke2/provisioner.rb +11 -22
- data/lib/vagrant-rke2/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd355a21d5666ca9a6a8183e7b810aacb99bd465447adf542d5cb322366fd2e0
|
4
|
+
data.tar.gz: caf3c0730b34d67be647971f5930a8c4a7db91c606f51fedf0a9394ab04a3f1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
#
|
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.
|
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"
|
data/lib/vagrant-rke2/config.rb
CHANGED
@@ -55,7 +55,7 @@ module VagrantPlugins
|
|
55
55
|
|
56
56
|
# Defaults to true
|
57
57
|
# @return [Boolean]
|
58
|
-
attr_accessor :
|
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
|
-
@
|
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
|
-
@
|
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
|
data/lib/vagrant-rke2/version.rb
CHANGED
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.
|
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-
|
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:
|