vagrant-k3s 0.3.1 → 0.5.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 +4 -4
- data/Gemfile.lock +43 -48
- data/README.md +34 -0
- data/lib/vagrant-k3s/config.rb +38 -0
- data/lib/vagrant-k3s/provisioner.rb +9 -2
- data/lib/vagrant-k3s/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ae9d2997564c4d9a4a5806b118f26d76ebcc811056a9ca0b20409a00350b94ca
|
|
4
|
+
data.tar.gz: 859e3267612b2d433574d92cfc3402f1ff5aade8ff2f8bed43f04a05238b1013
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c94413c475822b32003b9947fee8bd4ca6ee952866ab947745c6786dfec06a173143d995c2142140116b1d0705900cfa3760724d6956c9c4f8d48b50ec90b128
|
|
7
|
+
data.tar.gz: ee403d1d28344f9c840cee4e820da0705f4937436522d6822e4d3f3529b2cd56a3c04c7556dc60dd46115de408a2b75fab875b1db3524c3b9bf95abcf665ba96
|
data/Gemfile.lock
CHANGED
|
@@ -1,46 +1,14 @@
|
|
|
1
|
-
GIT
|
|
2
|
-
remote: https://github.com/hashicorp/vagrant.git
|
|
3
|
-
revision: c70e8ab32cd3505637e3ada6de589758bf4fbf92
|
|
4
|
-
specs:
|
|
5
|
-
vagrant (2.4.8.dev)
|
|
6
|
-
base64 (~> 0.2.0)
|
|
7
|
-
bcrypt_pbkdf (~> 1.1)
|
|
8
|
-
childprocess (~> 5.1)
|
|
9
|
-
csv (~> 3.3)
|
|
10
|
-
ed25519 (~> 1.3.0)
|
|
11
|
-
erubi
|
|
12
|
-
hashicorp-checkpoint (~> 0.1.5)
|
|
13
|
-
i18n (~> 1.12)
|
|
14
|
-
ipaddr (>= 1.2.4)
|
|
15
|
-
listen (~> 3.7)
|
|
16
|
-
log4r (~> 1.1.9, < 1.1.11)
|
|
17
|
-
logger (~> 1.0)
|
|
18
|
-
mime-types (~> 3.3)
|
|
19
|
-
net-ftp (~> 0.2)
|
|
20
|
-
net-scp (~> 4.0)
|
|
21
|
-
net-sftp (~> 4.0)
|
|
22
|
-
net-ssh (~> 7.0)
|
|
23
|
-
ostruct (~> 0.6.0)
|
|
24
|
-
rb-kqueue (~> 0.2.0)
|
|
25
|
-
rexml (~> 3.2)
|
|
26
|
-
rubyzip (~> 2.3.2)
|
|
27
|
-
vagrant_cloud (~> 3.1.2)
|
|
28
|
-
wdm (~> 0.2.0)
|
|
29
|
-
winrm (>= 2.3.9, < 3.0)
|
|
30
|
-
winrm-elevated (>= 1.2.3, < 2.0)
|
|
31
|
-
winrm-fs (>= 1.3.5, < 2.0)
|
|
32
|
-
|
|
33
1
|
PATH
|
|
34
2
|
remote: .
|
|
35
3
|
specs:
|
|
36
|
-
vagrant-k3s (0.
|
|
4
|
+
vagrant-k3s (0.5.0)
|
|
37
5
|
|
|
38
6
|
GEM
|
|
39
7
|
remote: https://rubygems.org/
|
|
40
8
|
specs:
|
|
41
9
|
base64 (0.2.0)
|
|
42
10
|
bcrypt_pbkdf (1.1.1)
|
|
43
|
-
bigdecimal (3.2.
|
|
11
|
+
bigdecimal (3.2.3)
|
|
44
12
|
builder (3.3.0)
|
|
45
13
|
childprocess (5.1.0)
|
|
46
14
|
logger (~> 1.5)
|
|
@@ -50,9 +18,9 @@ GEM
|
|
|
50
18
|
diff-lcs (1.5.0)
|
|
51
19
|
ed25519 (1.3.0)
|
|
52
20
|
erubi (1.13.1)
|
|
53
|
-
excon (1.
|
|
21
|
+
excon (1.3.0)
|
|
54
22
|
logger
|
|
55
|
-
faraday (2.13.
|
|
23
|
+
faraday (2.13.4)
|
|
56
24
|
faraday-net_http (>= 2.0, < 3.5)
|
|
57
25
|
json
|
|
58
26
|
logger
|
|
@@ -71,8 +39,8 @@ GEM
|
|
|
71
39
|
i18n (1.14.7)
|
|
72
40
|
concurrent-ruby (~> 1.0)
|
|
73
41
|
ipaddr (1.2.7)
|
|
74
|
-
json (2.
|
|
75
|
-
jwt (3.
|
|
42
|
+
json (2.14.1)
|
|
43
|
+
jwt (3.1.2)
|
|
76
44
|
base64
|
|
77
45
|
listen (3.9.0)
|
|
78
46
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
@@ -86,8 +54,8 @@ GEM
|
|
|
86
54
|
mime-types (3.7.0)
|
|
87
55
|
logger
|
|
88
56
|
mime-types-data (~> 3.2025, >= 3.2025.0507)
|
|
89
|
-
mime-types-data (3.2025.
|
|
90
|
-
multi_json (1.
|
|
57
|
+
mime-types-data (3.2025.0916)
|
|
58
|
+
multi_json (1.17.0)
|
|
91
59
|
multi_xml (0.7.2)
|
|
92
60
|
bigdecimal (~> 3.1)
|
|
93
61
|
mutex_m (0.3.0)
|
|
@@ -105,23 +73,23 @@ GEM
|
|
|
105
73
|
net-ssh (7.3.0)
|
|
106
74
|
nori (2.7.1)
|
|
107
75
|
bigdecimal
|
|
108
|
-
oauth2 (2.0.
|
|
76
|
+
oauth2 (2.0.17)
|
|
109
77
|
faraday (>= 0.17.3, < 4.0)
|
|
110
78
|
jwt (>= 1.0, < 4.0)
|
|
111
79
|
logger (~> 1.2)
|
|
112
80
|
multi_xml (~> 0.5)
|
|
113
81
|
rack (>= 1.2, < 4)
|
|
114
82
|
snaky_hash (~> 2.0, >= 2.0.3)
|
|
115
|
-
version_gem (
|
|
116
|
-
ostruct (0.6.
|
|
117
|
-
rack (3.1
|
|
83
|
+
version_gem (~> 1.1, >= 1.1.9)
|
|
84
|
+
ostruct (0.6.3)
|
|
85
|
+
rack (3.2.1)
|
|
118
86
|
rake (13.0.6)
|
|
119
87
|
rb-fsevent (0.11.2)
|
|
120
88
|
rb-inotify (0.11.1)
|
|
121
89
|
ffi (~> 1.0)
|
|
122
90
|
rb-kqueue (0.2.8)
|
|
123
91
|
ffi (>= 0.5.0)
|
|
124
|
-
rexml (3.4.
|
|
92
|
+
rexml (3.4.4)
|
|
125
93
|
rspec (3.12.0)
|
|
126
94
|
rspec-core (~> 3.12.0)
|
|
127
95
|
rspec-expectations (~> 3.12.0)
|
|
@@ -145,12 +113,39 @@ GEM
|
|
|
145
113
|
date
|
|
146
114
|
timeout (0.4.3)
|
|
147
115
|
uri (1.0.3)
|
|
116
|
+
vagrant (2.4.9)
|
|
117
|
+
base64 (~> 0.2.0)
|
|
118
|
+
bcrypt_pbkdf (~> 1.1)
|
|
119
|
+
childprocess (~> 5.1)
|
|
120
|
+
csv (~> 3.3)
|
|
121
|
+
ed25519 (~> 1.3.0)
|
|
122
|
+
erubi
|
|
123
|
+
hashicorp-checkpoint (~> 0.1.5)
|
|
124
|
+
i18n (~> 1.12)
|
|
125
|
+
ipaddr (>= 1.2.4)
|
|
126
|
+
listen (~> 3.7)
|
|
127
|
+
log4r (~> 1.1.9, < 1.1.11)
|
|
128
|
+
logger (~> 1.0)
|
|
129
|
+
mime-types (~> 3.3)
|
|
130
|
+
net-ftp (~> 0.2)
|
|
131
|
+
net-scp (~> 4.0)
|
|
132
|
+
net-sftp (~> 4.0)
|
|
133
|
+
net-ssh (~> 7.0)
|
|
134
|
+
ostruct (~> 0.6.0)
|
|
135
|
+
rb-kqueue (~> 0.2.0)
|
|
136
|
+
rexml (~> 3.2)
|
|
137
|
+
rubyzip (~> 2.3.2)
|
|
138
|
+
vagrant_cloud (~> 3.1.2)
|
|
139
|
+
wdm (~> 0.2.0)
|
|
140
|
+
winrm (>= 2.3.9, < 3.0)
|
|
141
|
+
winrm-elevated (>= 1.2.3, < 2.0)
|
|
142
|
+
winrm-fs (>= 1.3.5, < 2.0)
|
|
148
143
|
vagrant_cloud (3.1.3)
|
|
149
144
|
excon (~> 1.0)
|
|
150
145
|
log4r (~> 1.1)
|
|
151
146
|
oauth2 (~> 2.0)
|
|
152
147
|
rexml (~> 3.3)
|
|
153
|
-
version_gem (1.1.
|
|
148
|
+
version_gem (1.1.9)
|
|
154
149
|
wdm (0.2.0)
|
|
155
150
|
winrm (2.3.9)
|
|
156
151
|
builder (>= 2.1.2)
|
|
@@ -177,8 +172,8 @@ PLATFORMS
|
|
|
177
172
|
|
|
178
173
|
DEPENDENCIES
|
|
179
174
|
rake (>= 13.0)
|
|
180
|
-
rspec (
|
|
181
|
-
vagrant
|
|
175
|
+
rspec (>= 3.11)
|
|
176
|
+
vagrant (>= 2.4.0)
|
|
182
177
|
vagrant-k3s!
|
|
183
178
|
|
|
184
179
|
BUNDLED WITH
|
data/README.md
CHANGED
|
@@ -75,6 +75,40 @@ Vagrant.configure("2") do |config|
|
|
|
75
75
|
# default => `/etc/rancher/k3s/config.yaml`
|
|
76
76
|
k3s.config_path = '/etc/rancher/k3s/config.yaml'
|
|
77
77
|
|
|
78
|
+
# registries: private registry configuration content in yaml
|
|
79
|
+
# see https://docs.k3s.io/installation/private-registry
|
|
80
|
+
# type => String || Hash
|
|
81
|
+
k3s.registries = {
|
|
82
|
+
:mirrors => {
|
|
83
|
+
'docker.io' => {
|
|
84
|
+
:endpoint => %w[https://registry.example.com:5000]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
# or
|
|
89
|
+
k3s.registries = <<~YAML
|
|
90
|
+
mirrors:
|
|
91
|
+
docker.io:
|
|
92
|
+
endpoint:
|
|
93
|
+
- https://registry.example.com:5000
|
|
94
|
+
configs:
|
|
95
|
+
registry.example.com:5000:
|
|
96
|
+
auth:
|
|
97
|
+
username: user
|
|
98
|
+
password: secret
|
|
99
|
+
YAML
|
|
100
|
+
# registries_mode: registries file permissions
|
|
101
|
+
# type => String
|
|
102
|
+
# default => `0600`
|
|
103
|
+
k3s.registries_mode = '0600' # default
|
|
104
|
+
k3s.registries_owner = 'root:root' # default
|
|
105
|
+
|
|
106
|
+
# registries_path: where to write the registries yaml.
|
|
107
|
+
# if you override this be sure to let k3s know, e.g.
|
|
108
|
+
# k3s.config = { 'private-registry' => '/some/other/registries.yaml' }
|
|
109
|
+
# default => `/etc/rancher/k3s/registries.yaml`
|
|
110
|
+
k3s.registries_path = '/etc/rancher/k3s/registries.yaml'
|
|
111
|
+
|
|
78
112
|
# skip_start: install but don't start K3s
|
|
79
113
|
# type => Boolean
|
|
80
114
|
# default => false
|
data/lib/vagrant-k3s/config.rb
CHANGED
|
@@ -12,6 +12,9 @@ module VagrantPlugins
|
|
|
12
12
|
DEFAULT_ENV_OWNER = DEFAULT_FILE_OWNER
|
|
13
13
|
DEFAULT_ENV_PATH = '/etc/rancher/k3s/install.env'
|
|
14
14
|
DEFAULT_INSTALLER_URL = 'https://get.k3s.io'
|
|
15
|
+
DEFAULT_REGISTRIES_MODE = DEFAULT_FILE_MODE
|
|
16
|
+
DEFAULT_REGISTRIES_OWNER = DEFAULT_FILE_OWNER
|
|
17
|
+
DEFAULT_REGISTRIES_PATH = '/etc/rancher/k3s/registries.yaml'
|
|
15
18
|
|
|
16
19
|
# string or array
|
|
17
20
|
# @return [Array<String>]
|
|
@@ -53,6 +56,22 @@ module VagrantPlugins
|
|
|
53
56
|
# @return [String]
|
|
54
57
|
attr_accessor :installer_url
|
|
55
58
|
|
|
59
|
+
# string (.yaml) or hash
|
|
60
|
+
# @return [Hash]
|
|
61
|
+
attr_accessor :registries
|
|
62
|
+
|
|
63
|
+
# Defaults to `0600`
|
|
64
|
+
# @return [String]
|
|
65
|
+
attr_accessor :registries_mode
|
|
66
|
+
|
|
67
|
+
# Defaults to `root:root`
|
|
68
|
+
# @return [String]
|
|
69
|
+
attr_accessor :registries_owner
|
|
70
|
+
|
|
71
|
+
# Defaults to `/etc/rancher/k3s/registries.yaml`
|
|
72
|
+
# @return [String]
|
|
73
|
+
attr_accessor :registries_path
|
|
74
|
+
|
|
56
75
|
# Defaults to false
|
|
57
76
|
# @return [Boolean]
|
|
58
77
|
attr_accessor :skip_start
|
|
@@ -112,6 +131,10 @@ module VagrantPlugins
|
|
|
112
131
|
@env_owner = UNSET_VALUE
|
|
113
132
|
@env_path = UNSET_VALUE
|
|
114
133
|
@installer_url = UNSET_VALUE
|
|
134
|
+
@registries = UNSET_VALUE
|
|
135
|
+
@registries_mode = UNSET_VALUE
|
|
136
|
+
@registries_owner = UNSET_VALUE
|
|
137
|
+
@registries_path = UNSET_VALUE
|
|
115
138
|
@skip_start = UNSET_VALUE
|
|
116
139
|
@skip_complete = UNSET_VALUE
|
|
117
140
|
end
|
|
@@ -127,6 +150,10 @@ module VagrantPlugins
|
|
|
127
150
|
@env_owner = DEFAULT_ENV_OWNER if @env_owner == UNSET_VALUE
|
|
128
151
|
@env_path = DEFAULT_ENV_PATH if @env_path == UNSET_VALUE
|
|
129
152
|
@installer_url = DEFAULT_INSTALLER_URL if @installer_url == UNSET_VALUE
|
|
153
|
+
@registries = "" if @registries == UNSET_VALUE
|
|
154
|
+
@registries_mode = @registries_mode == UNSET_VALUE ? DEFAULT_REGISTRIES_MODE : @registries_mode.to_s
|
|
155
|
+
@registries_owner = @registries_owner == UNSET_VALUE ? DEFAULT_REGISTRIES_OWNER : @registries_owner.to_s
|
|
156
|
+
@registries_path = @registries_path == UNSET_VALUE ? DEFAULT_REGISTRIES_PATH : @registries_path.to_s
|
|
130
157
|
@skip_start = false if @skip_start == UNSET_VALUE
|
|
131
158
|
@skip_complete = false if @skip_complete == UNSET_VALUE
|
|
132
159
|
|
|
@@ -150,6 +177,10 @@ module VagrantPlugins
|
|
|
150
177
|
errors << "K3s provisioner `env` must be an array, hash, or string."
|
|
151
178
|
end
|
|
152
179
|
|
|
180
|
+
unless registries_valid?
|
|
181
|
+
errors << "K3s provisioner `registries` must be a hash or string (yaml)."
|
|
182
|
+
end
|
|
183
|
+
|
|
153
184
|
{ "k3s provisioner" => errors }
|
|
154
185
|
end
|
|
155
186
|
|
|
@@ -173,6 +204,13 @@ module VagrantPlugins
|
|
|
173
204
|
false
|
|
174
205
|
end
|
|
175
206
|
|
|
207
|
+
def registries_valid?
|
|
208
|
+
return true unless registries
|
|
209
|
+
return true if registries.is_a?(String)
|
|
210
|
+
return true if registries.is_a?(Hash)
|
|
211
|
+
false
|
|
212
|
+
end
|
|
213
|
+
|
|
176
214
|
def env_valid?
|
|
177
215
|
return true unless env
|
|
178
216
|
return true if env.is_a?(String)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'vagrant'
|
|
4
4
|
require 'vagrant/errors'
|
|
5
|
+
require 'json'
|
|
5
6
|
require 'yaml'
|
|
6
7
|
|
|
7
8
|
module VagrantPlugins
|
|
@@ -36,6 +37,10 @@ module VagrantPlugins
|
|
|
36
37
|
cfg_yaml = config.config.is_a?(String) ? config.config : config.config.transform_keys(&:to_s).to_yaml
|
|
37
38
|
file_upload "k3s-config.yaml", cfg_file, cfg_yaml
|
|
38
39
|
|
|
40
|
+
reg_file = config.registries_path.to_s
|
|
41
|
+
reg_yaml = config.registries.is_a?(String) ? config.registries : JSON.parse(config.registries.to_json).to_yaml
|
|
42
|
+
file_upload "k3s-registries.yaml", reg_file, reg_yaml
|
|
43
|
+
|
|
39
44
|
env_file = config.env_path.to_s
|
|
40
45
|
env_text = ""
|
|
41
46
|
if config.env.is_a?(String)
|
|
@@ -51,7 +56,7 @@ module VagrantPlugins
|
|
|
51
56
|
|
|
52
57
|
skip_env = ""
|
|
53
58
|
if config.skip_start
|
|
54
|
-
skip_env = "INSTALL_K3S_SKIP_ENABLE=true"
|
|
59
|
+
skip_env = "INSTALL_K3S_SKIP_ENABLE=true INSTALL_K3S_SKIP_START=true"
|
|
55
60
|
end
|
|
56
61
|
|
|
57
62
|
prv_file = "/vagrant/k3s-provisioner.sh"
|
|
@@ -62,6 +67,8 @@ module VagrantPlugins
|
|
|
62
67
|
chmod #{config.config_mode} #{config.config_path}
|
|
63
68
|
chown #{config.env_owner} #{config.env_path}
|
|
64
69
|
chmod #{config.env_mode} #{config.env_path}
|
|
70
|
+
chown #{config.registries_owner} #{config.registries_path}
|
|
71
|
+
chmod #{config.registries_mode} #{config.registries_path}
|
|
65
72
|
set -o allexport
|
|
66
73
|
source #{config.env_path}
|
|
67
74
|
set +o allexport
|
|
@@ -81,7 +88,7 @@ module VagrantPlugins
|
|
|
81
88
|
outputs, handler = build_outputs
|
|
82
89
|
begin
|
|
83
90
|
@machine.ui.info 'Enabling K3s autocompletion ...'
|
|
84
|
-
@machine.communicate.sudo("k3s completion -i
|
|
91
|
+
@machine.communicate.sudo("k3s completion bash -i", error_key: :ssh_bad_exit_status_muted, &handler)
|
|
85
92
|
rescue Vagrant::Errors::VagrantError => e
|
|
86
93
|
@machine.ui.detail "#{e.extra_data[:stderr].chomp}", :color => :yellow
|
|
87
94
|
ensure
|
data/lib/vagrant-k3s/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vagrant-k3s
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Derek Nola
|
|
8
8
|
- Jacob Blain Christen
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Manage k3s installations on Vagrant guests.
|
|
14
14
|
email:
|
|
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
62
|
version: 3.0.0
|
|
63
63
|
requirements: []
|
|
64
|
-
rubygems_version: 3.6.
|
|
64
|
+
rubygems_version: 3.6.7
|
|
65
65
|
specification_version: 4
|
|
66
66
|
summary: Manage k3s installations on Vagrant guests.
|
|
67
67
|
test_files: []
|