teamd-installer 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/teamd/installer/cli.rb +8 -7
- data/lib/teamd/installer/template_config.rb +20 -10
- data/lib/teamd/installer/version.rb +2 -2
- data/shared/dynamic-environment.service +10 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad4fdd931333d11aeecfbb8b21f010da15b54bbc
|
4
|
+
data.tar.gz: e51a1b288632021afeec890f22f77e6cfa120fed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c2e3166245028613aee61f7290a8d73e0a55a649db6288ca6ac6ef33cb8b57b9f77e650c32e9acc8b13a448ac33d7ddcd48f479d22bf3ae05e293a3025c52ec
|
7
|
+
data.tar.gz: 284dd02fee1356f31f6df916ef11d5875ed729ce0b161e57761f6393678019f9b35ced80ead1cb5989639b732b18ed1a163e4ff36602099fca1b4910cc16b424
|
data/lib/teamd/installer/cli.rb
CHANGED
@@ -21,13 +21,14 @@ module Teamd
|
|
21
21
|
@public_ipv4 ||= Interfaces.public_ipv4
|
22
22
|
@private_ipv4 ||= Interfaces.internal_ipv4 except: ["127.0.0.1",@public_ipv4]
|
23
23
|
@config = TemplateConfig.new
|
24
|
-
@config.etcd_discovery_id
|
25
|
-
@config.public_ipv4
|
26
|
-
@config.private_ipv4
|
27
|
-
@config.use_flannel
|
28
|
-
@config.docker_tcp
|
29
|
-
@config.sshd_port
|
30
|
-
@config
|
24
|
+
@config.etcd_discovery_id = @token
|
25
|
+
@config.public_ipv4 = @public_ipv4
|
26
|
+
@config.private_ipv4 = @private_ipv4
|
27
|
+
@config.use_flannel = true
|
28
|
+
@config.docker_tcp = true
|
29
|
+
@config.sshd_port = 2220
|
30
|
+
@config.dynamic_environment = true
|
31
|
+
@config = CloudConfig.new @config.to_h
|
31
32
|
File.write(options[:cloud_config],@config.to_yaml)
|
32
33
|
@installer = Script.download options[:installer_url]
|
33
34
|
@disk,@major,@minor = Disk.default
|
@@ -3,7 +3,9 @@ require "securerandom"
|
|
3
3
|
module Teamd
|
4
4
|
module Installer
|
5
5
|
class TemplateConfig
|
6
|
-
attr_accessor :etcd_discovery_id, :public_ipv4, :private_ipv4,
|
6
|
+
attr_accessor :etcd_discovery_id, :public_ipv4, :private_ipv4,
|
7
|
+
:public_ipv6, :private_ipv6, :use_flannel, :docker_tcp,
|
8
|
+
:sshd_port, :dynamic_environment
|
7
9
|
def to_h
|
8
10
|
output = {
|
9
11
|
"coreos" => {
|
@@ -41,15 +43,23 @@ module Teamd
|
|
41
43
|
"content" => "[Socket]\nListenStream=#{@sshd_port}\nAccept=yes",
|
42
44
|
}
|
43
45
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
"
|
50
|
-
|
51
|
-
|
52
|
-
|
46
|
+
unless @dynamic_environment
|
47
|
+
if @public_ipv4 or @private_ipv4
|
48
|
+
content = ""
|
49
|
+
content << "COREOS_PUBLIC_IPV4=#{@public_ipv4}\n" if @public_ipv4
|
50
|
+
content << "COREOS_PRIVATE_IPV4=#{@private_ipv4}\n" if @private_ipv4
|
51
|
+
output["write_files"] << {
|
52
|
+
"path" => "/etc/environment",
|
53
|
+
"permissions" => "0444",
|
54
|
+
"owner" => "root",
|
55
|
+
"content" => content
|
56
|
+
}
|
57
|
+
end
|
58
|
+
else
|
59
|
+
output["coreos"]["units"] << {
|
60
|
+
"name" => "dynamic-environment.service",
|
61
|
+
"command" => "start",
|
62
|
+
"content" => "[Unit]\nDescription=Teamd Dynamic Environment File\nDocumentation=https://teamd.stei.gr/environment\nRequires=network-online.target\nAfter=network-online.target\nBefore=etcd.service etcd2.service\n\n[Service]\nType=oneshot\nExecStart=/bin/sh -c 'a(){ ip -f inet -4 -o addr | grep -v -e \": lo\" -e \": docker\" -e \": flannel\" | awk \"{print \\$4}\" | cut -f1 -d/ | $1 -1;}; echo -n COREOS_PRIVATE_IPV4= > /tmp/ip_env; a tail >> /tmp/ip_env; grep $(a head) /tmp/ip_env || (echo -n COREOS_PUBLIC_IPV4= >> /tmp/ip_env; a head >> /tmp/ip_env; cat /etc/environment 2>/dev/null | grep -v -e COREOS_PUBLIC_IPV4= -e COREOS_PRIVATE_IPV4= >> /tmp/ip_env; cat /tmp/ip_env > /etc/environment)'",
|
53
63
|
}
|
54
64
|
end
|
55
65
|
if @use_flannel
|
@@ -0,0 +1,10 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=Teamd Dynamic Environment File
|
3
|
+
Documentation=https://teamd.stei.gr/environment
|
4
|
+
Requires=network-online.target
|
5
|
+
After=network-online.target
|
6
|
+
Before=etcd.service etcd2.service
|
7
|
+
|
8
|
+
[Service]
|
9
|
+
Type=oneshot
|
10
|
+
ExecStart=/bin/sh -c 'a(){ ip -f inet -4 -o addr | grep -v -e ": lo" -e ": docker" -e ": flannel" | awk "{print \$4}" | cut -f1 -d/ | $1 -1;}; echo -n COREOS_PRIVATE_IPV4= > /tmp/ip_env; a tail >> /tmp/ip_env; grep $(a head) /tmp/ip_env || (echo -n COREOS_PUBLIC_IPV4= >> /tmp/ip_env; a head >> /tmp/ip_env; cat /etc/environment 2>/dev/null | grep -v -e COREOS_PUBLIC_IPV4= -e COREOS_PRIVATE_IPV4= >> /tmp/ip_env; cat /tmp/ip_env > /etc/environment)'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teamd-installer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Kaufmann
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- lib/teamd/installer/template_config.rb
|
124
124
|
- lib/teamd/installer/token_provider.rb
|
125
125
|
- lib/teamd/installer/version.rb
|
126
|
+
- shared/dynamic-environment.service
|
126
127
|
- shared/teamd-discover.service
|
127
128
|
- teamd-installer.gemspec
|
128
129
|
homepage: https://teamd.stei.gr/installer
|