hetzner-k3s 0.3.3 → 0.3.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: 4f45064341000a4cf3a3ec6aef60c2b26eb95758e3c0e1d16c87740b8e549834
4
- data.tar.gz: 0ec683973e5c27811c8f9a2d82804ce3721d9a93137c46d15087f8e06a9fe4b2
3
+ metadata.gz: bb3b106422fe5e298a81ffe6b913593ff20a7cdbc7e658012f31f707b1f5732e
4
+ data.tar.gz: 5face1d08a752c26c93da8c5638c947b711d9fff4428c98f163f78bc3e206de8
5
5
  SHA512:
6
- metadata.gz: 7ac95d48d017c7997c3e20b7dd3d5160bf5188a4bff9144efc382606bf2d83462221287b8ba9c16ff62b5f3687486f310f042add4c50f06228e0f2da4afb63db
7
- data.tar.gz: bd2caff255115cdd82582b5c143249ca92983d4232ab77ba03fe5d4719fc812dfb3af7b8617fc6adaa0c9093ef66c0b6f1cdbdee5f60c25e5f2f819fc6fa8f0b
6
+ metadata.gz: 389f431593261968ac05127c93c9f49e3aee71836e4240183e74ba5292daae53c5ab1a985bbcef3015fff54957b9072bb6bb99ce6837f78acacfe7915dbeed94
7
+ data.tar.gz: 4fd8bd35216ab0c1c9204295c7a8c6009989b0af452c743da808310de9367c5461d07eb1af50e1059ace49026e278c7c1c11aaeb9ad139cedfbbdf18ce1bf8ca
data/Dockerfile ADDED
@@ -0,0 +1,14 @@
1
+ FROM ruby:2.7.4-alpine
2
+
3
+ RUN apk update --no-cache \
4
+ && apk add build-base git openssh-client
5
+
6
+ COPY Gemfile Gemfile
7
+ COPY hetzner-k3s.gemspec hetzner-k3s.gemspec
8
+
9
+ RUN gem install hetzner-k3s
10
+
11
+ COPY entrypoint.sh /entrypoint.sh
12
+
13
+ ENTRYPOINT ["/entrypoint.sh"]
14
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hetzner-k3s (0.3.3)
4
+ hetzner-k3s (0.3.7)
5
5
  bcrypt_pbkdf
6
6
  ed25519
7
7
  http
data/README.md CHANGED
@@ -33,6 +33,16 @@ gem install hetzner-k3s
33
33
 
34
34
  This will install the `hetzner-k3s` executable in your PATH.
35
35
 
36
+ ### With Docker
37
+
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
+
40
+ ```bash
41
+ docker run --rm -it -v ${PWD}:/cluster -v ${HOME}/.ssh:/tmp/.ssh vitobotta/hetzner-k3s:v0.3.7 create-cluster --config-file /cluster/test.yaml
42
+ ```
43
+
44
+ Replace `test.yaml` with the name of your config file.
45
+
36
46
  ## Creating a cluster
37
47
 
38
48
  The tool requires a simple configuration file in order to create/upgrade/delete clusters, in the YAML format like in the example below:
@@ -60,6 +70,9 @@ worker_node_pools:
60
70
 
61
71
  It should hopefully be self explanatory; you can run `hetzner-k3s releases` to see a list of the available releases from the most recent to the oldest available.
62
72
 
73
+ If you are using Docker, then set `kubeconfig_path` to `/cluster/kubeconfig` so that the kubeconfig is created in the same directory where your config file is.
74
+
75
+
63
76
  If you set `masters.instance_count` to 1 then the tool will create a non highly available control plane; for production clusters you may want to set it to a number greater than 1. This number must be odd to avoid split brain issues with etcd and the recommended number is 3.
64
77
 
65
78
  You can specify any number of worker node pools for example to have mixed nodes with different specs for different workloads.
@@ -214,6 +227,18 @@ Once the cluster is ready you can create persistent volumes out of the box with
214
227
 
215
228
  ## changelog
216
229
 
230
+ - 0.3.7
231
+ - Ensure that the cluster name only contains lowercase letters, digits and dashes for compatibility with the cloud controller manager
232
+
233
+ - 0.3.6
234
+ - Retry SSH commands when IO errors occur
235
+
236
+ - 0.3.5
237
+ - Add descriptions for firewall rules
238
+
239
+ - 0.3.4
240
+ - Added Docker support
241
+
217
242
  - 0.3.3
218
243
  - Add some gems required on Linux
219
244
 
data/entrypoint.sh ADDED
@@ -0,0 +1,12 @@
1
+ #!/bin/sh
2
+
3
+ cp -R /tmp/.ssh /root/.ssh
4
+ chmod 700 /root/.ssh
5
+ chmod 600 /root/.ssh/*
6
+ chmod 644 /root/.ssh/*.pub
7
+
8
+ eval $(ssh-agent -s) 2&>1 > /dev/null
9
+
10
+ ssh-add ~/.ssh/* 2&>1 > /dev/null
11
+
12
+ hetzner-k3s "$@"
@@ -44,6 +44,7 @@ module Hetzner
44
44
  name: cluster_name,
45
45
  rules: [
46
46
  {
47
+ "description": "Allow port 22 (SSH)",
47
48
  "direction": "in",
48
49
  "protocol": "tcp",
49
50
  "port": "22",
@@ -54,6 +55,7 @@ module Hetzner
54
55
  "destination_ips": []
55
56
  },
56
57
  {
58
+ "description": "Allow ICMP (ping)",
57
59
  "direction": "in",
58
60
  "protocol": "icmp",
59
61
  "port": nil,
@@ -64,6 +66,7 @@ module Hetzner
64
66
  "destination_ips": []
65
67
  },
66
68
  {
69
+ "description": "Allow port 6443 (Kubernetes API server)",
67
70
  "direction": "in",
68
71
  "protocol": "tcp",
69
72
  "port": "6443",
@@ -74,6 +77,7 @@ module Hetzner
74
77
  "destination_ips": []
75
78
  },
76
79
  {
80
+ "description": "Allow all TCP traffic between nodes on the private network",
77
81
  "direction": "in",
78
82
  "protocol": "tcp",
79
83
  "port": "any",
@@ -83,6 +87,7 @@ module Hetzner
83
87
  "destination_ips": []
84
88
  },
85
89
  {
90
+ "description": "Allow all UDP traffic between nodes on the private network",
86
91
  "direction": "in",
87
92
  "protocol": "udp",
88
93
  "port": "any",
@@ -110,7 +110,8 @@ module Hetzner
110
110
  end
111
111
 
112
112
  def validate_cluster_name
113
- errors << "Cluster name is an invalid format" unless configuration["cluster_name"] =~ /\A([A-Za-z0-9\-\_]+)\Z/
113
+ errors << "Cluster name is an invalid format (only lowercase letters, digits and dashes are allowed)" unless configuration["cluster_name"] =~ /\A[a-z\d-]+\z/
114
+ errors << "Ensure that the cluster name starts with a normal letter" unless configuration["cluster_name"] =~ /\A[a-z]+.*\z/
114
115
  end
115
116
 
116
117
  def validate_kubeconfig_path
@@ -457,7 +457,7 @@ class Cluster
457
457
 
458
458
  puts "...server #{server_name} is now up."
459
459
  end
460
- rescue Errno::ENETUNREACH, Errno::EHOSTUNREACH, Timeout::Error
460
+ rescue Errno::ENETUNREACH, Errno::EHOSTUNREACH, Timeout::Error, IOError
461
461
  retry
462
462
  end
463
463
 
@@ -1,5 +1,5 @@
1
1
  module Hetzner
2
2
  module K3s
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hetzner-k3s
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vito Botta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-17 00:00:00.000000000 Z
11
+ date: 2021-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -121,6 +121,7 @@ files:
121
121
  - ".rspec"
122
122
  - ".travis.yml"
123
123
  - CODE_OF_CONDUCT.md
124
+ - Dockerfile
124
125
  - Gemfile
125
126
  - Gemfile.lock
126
127
  - LICENSE.txt
@@ -129,6 +130,7 @@ files:
129
130
  - bin/console
130
131
  - bin/setup
131
132
  - cluster_config.yaml.example
133
+ - entrypoint.sh
132
134
  - exe/hetzner-k3s
133
135
  - hetzner-k3s.gemspec
134
136
  - lib/hetzner.rb