hetzner-k3s 0.4.6 → 0.4.7

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: 60167b5a135a2932bff53b3d030b22940e3a7a943584ab9645d420fdfa2f59f4
4
- data.tar.gz: 6b36f71696ffb4f94d1dfde94b5215c46b9f92fc482c0da148ea84c0cfa5a56f
3
+ metadata.gz: 0e4c46ae74be52152443a9fab3b7b7dd00fa5e7cae5dffb99457b522646103ba
4
+ data.tar.gz: e2495e717211c2351c2e203bd2741d3079e84729c305e8c6ad7434c24cf3d989
5
5
  SHA512:
6
- metadata.gz: 73242160d8701cfb92332bf18aefcf7e2c15275493b2e4dedfc16d1e577367e91e338b2c57fc3d5731a5f68317751e1644b7d2be4d505371ee1543f04365685f
7
- data.tar.gz: 2da1c1ef1bf32b3c403868d47bc94fbeee1ad8479aa1272db9141c749b695e70489c85c19f8e891fd332a91de6deda000d273e959f1d1d6a1e88edf9efe4310f
6
+ metadata.gz: c82cd916cdde9cec408d0681dc7d46902309bd1246424c8267ed2164345aef54e8e6eca8730c668b146245129450e1daabe97a698e2aca165e7f2a63cb9e5b0d
7
+ data.tar.gz: 857abb763f92c64a65eeb2d484528708060db50aa121d7ccad847a5f6cbc2fec3c8d9a3873e8568ba2f03ea76ab53b529bc50267271d235b369d69e67d6c4f5a
data/README.md CHANGED
@@ -38,7 +38,7 @@ This will install the `hetzner-k3s` executable in your PATH.
38
38
  Alternatively, if you don't want to set up a Ruby runtime but have Docker installed, you can use a container. Run the following from inside the directory where you have the config file for the cluster (described in the next section):
39
39
 
40
40
  ```bash
41
- docker run --rm -it -v ${PWD}:/cluster -v ${HOME}/.ssh:/tmp/.ssh vitobotta/hetzner-k3s:v0.4.6 create-cluster --config-file /cluster/test.yaml
41
+ docker run --rm -it -v ${PWD}:/cluster -v ${HOME}/.ssh:/tmp/.ssh vitobotta/hetzner-k3s:v0.4.7 create-cluster --config-file /cluster/test.yaml
42
42
  ```
43
43
 
44
44
  Replace `test.yaml` with the name of your config file.
@@ -97,8 +97,20 @@ curl \
97
97
  'https://api.hetzner.cloud/v1/server_types'
98
98
  ```
99
99
 
100
+ By default, the image in use is Ubuntu 20.04, but you can specify an image to use with the `image` config option. This makes it also possible
101
+ to use a snapshot that you have already created from and existing server (for example to preinstall some tools). If you want to use a custom
102
+ snapshot you'll need to specify the **ID** of the snapshot/image, not the description you gave when you created the template server. To find
103
+ the ID of your custom image/snapshot, run:
100
104
 
101
- Note: the option `verify_host_key` is by default set to `false` to disable host key verification. This is because sometimes when creating new servers, Hetzner may assign IP addresses that were previously used by other servers you owned in the past. Therefore the host key verification would fail. If you set this option to `true` and this happens, the tool won't be able to continue creating the cluster until you resolve the issue with one of the suggestions it will give you.
105
+ ```bash
106
+ curl \
107
+ -H "Authorization: Bearer $API_TOKEN" \
108
+ 'https://api.hetzner.cloud/v1/images'
109
+ ```
110
+
111
+ Note that if you use a custom image, the creation of the servers may take longer than when using the default image.
112
+
113
+ Also note: the option `verify_host_key` is by default set to `false` to disable host key verification. This is because sometimes when creating new servers, Hetzner may assign IP addresses that were previously used by other servers you owned in the past. Therefore the host key verification would fail. If you set this option to `true` and this happens, the tool won't be able to continue creating the cluster until you resolve the issue with one of the suggestions it will give you.
102
114
 
103
115
  Finally, to create the cluster run:
104
116
 
@@ -242,7 +254,10 @@ I recommend that you create a separate Hetzner project for each cluster, because
242
254
 
243
255
  ## changelog
244
256
 
245
- - 0.4.5
257
+ - 0.4.7
258
+ - Made it possible to specify a custom image/snapshot for the servers
259
+
260
+ - 0.4.6
246
261
  - Added a check to abort gracefully when for some reason one or more servers are not created, for example due to temporary problems with the Hetzner API.
247
262
 
248
263
  - 0.4.5
data/bin/build.sh CHANGED
@@ -6,9 +6,9 @@ set -e
6
6
 
7
7
  IMAGE="vitobotta/hetzner-k3s"
8
8
 
9
- docker build -t ${IMAGE}:v0.4.6 \
9
+ docker build -t ${IMAGE}:v0.4.7 \
10
10
  --platform=linux/amd64 \
11
- --cache-from ${IMAGE}:v0.4.5 \
11
+ --cache-from ${IMAGE}:v0.4.6 \
12
12
  --build-arg BUILDKIT_INLINE_CACHE=1 .
13
13
 
14
- docker push vitobotta/hetzner-k3s:v0.4.6
14
+ docker push vitobotta/hetzner-k3s:v0.4.7
@@ -5,7 +5,7 @@ module Hetzner
5
5
  @cluster_name = cluster_name
6
6
  end
7
7
 
8
- def create(location:, instance_type:, instance_id:, firewall_id:, network_id:, ssh_key_id:, placement_group_id:)
8
+ def create(location:, instance_type:, instance_id:, firewall_id:, network_id:, ssh_key_id:, placement_group_id:, image:)
9
9
  puts
10
10
 
11
11
  server_name = "#{cluster_name}-#{instance_type}-#{instance_id}"
@@ -21,7 +21,7 @@ module Hetzner
21
21
  server_config = {
22
22
  name: server_name,
23
23
  location: location,
24
- image: "ubuntu-20.04",
24
+ image: image,
25
25
  firewalls: [
26
26
  { firewall: firewall_id }
27
27
  ],
@@ -120,7 +120,8 @@ class Cluster
120
120
  firewall_id: firewall_id,
121
121
  network_id: network_id,
122
122
  ssh_key_id: ssh_key_id,
123
- placement_group_id: placement_group_id
123
+ placement_group_id: placement_group_id,
124
+ image: image
124
125
  }
125
126
  end
126
127
 
@@ -144,7 +145,8 @@ class Cluster
144
145
  firewall_id: firewall_id,
145
146
  network_id: network_id,
146
147
  ssh_key_id: ssh_key_id,
147
- placement_group_id: placement_group_id
148
+ placement_group_id: placement_group_id,
149
+ image: image
148
150
  }
149
151
  end
150
152
  end
@@ -157,9 +159,8 @@ class Cluster
157
159
 
158
160
  threads.each(&:join) unless threads.empty?
159
161
 
160
- if server_configs.size != servers.size
161
- puts "Something went wrong while creating some servers, please try again."
162
- exit 1
162
+ while servers.size != server_configs.size
163
+ sleep 1
163
164
  end
164
165
 
165
166
  puts
@@ -656,4 +657,8 @@ class Cluster
656
657
  schedule_workloads_on_masters ? !!schedule_workloads_on_masters : false
657
658
  end
658
659
 
660
+ def image
661
+ configuration.dig("image") || "ubuntu-20.04"
662
+ end
663
+
659
664
  end
@@ -1,5 +1,5 @@
1
1
  module Hetzner
2
2
  module K3s
3
- VERSION = "0.4.6"
3
+ VERSION = "0.4.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hetzner-k3s
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vito Botta