Merge pull request 'Add CSI support for nomad
.' (#95) from nomad-csi-support into master
Reviewed-on: #95
This commit is contained in:
commit
e340adfdcd
@ -5,6 +5,7 @@ node.reverse_merge!({
|
||||
'nomad' => {
|
||||
'manager' => false,
|
||||
'client' => false,
|
||||
'lokiendpoint' => 'loki.service.consul:3100'
|
||||
'lokiendpoint' => 'loki.service.consul:3100',
|
||||
'synology' => '192.168.10.200'
|
||||
}
|
||||
})
|
||||
|
61
cookbooks/nomad/csi.rb
Normal file
61
cookbooks/nomad/csi.rb
Normal file
@ -0,0 +1,61 @@
|
||||
SYNOLOGY = node['nomad']['synology']
|
||||
|
||||
# 前提パッケージのインストール・セットアップ
|
||||
%w( open-iscsi lsscsi sg3-utils multipath-tools scsitools ).each do |p|
|
||||
package p
|
||||
end
|
||||
|
||||
execute "iscsiadm -m discoverydb -t st -p #{SYNOLOGY} --discover" do
|
||||
user 'root'
|
||||
end
|
||||
|
||||
remote_file "/etc/multipath.conf" do
|
||||
user 'root'
|
||||
group 'root'
|
||||
mode '0644'
|
||||
|
||||
notifies :restart, 'service[multipath-tools]'
|
||||
end
|
||||
|
||||
%w( multipath-tools open-iscsi).each do |s|
|
||||
service s do
|
||||
action [:enable, :restart]
|
||||
end
|
||||
end
|
||||
|
||||
# CNIプラグインのデプロイ・セットアップ
|
||||
directory '/opt/cni/bin' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
|
||||
mode '0755'
|
||||
end
|
||||
|
||||
%w( bandwidth bridge dhcp firewall host-device host-local ipvlan loopback macvlan portmap ptp sbr static tuning vlan vrf ).each do |f|
|
||||
remote_file "/opt/cni/bin/#{f}" do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
|
||||
mode '0775'
|
||||
end
|
||||
end
|
||||
|
||||
directory '/etc/cni' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0755'
|
||||
end
|
||||
|
||||
remote_file '/etc/cni/nomad.conflist' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0644'
|
||||
end
|
||||
|
||||
remote_file '/etc/nomad.d/csi.hcl' do
|
||||
owner 'nomad'
|
||||
group 'nomad'
|
||||
mode '0664'
|
||||
|
||||
notifies :restart, 'service[nomad]'
|
||||
end
|
@ -4,6 +4,7 @@ include_recipe './install.rb'
|
||||
|
||||
if node['nomad']['manager'] || node['nomad']['client']
|
||||
include_recipe './setup.rb'
|
||||
include_recipe './csi.rb'
|
||||
|
||||
include_recipe './shared_dir.rb'
|
||||
end
|
||||
|
23
cookbooks/nomad/files/etc/cni/nomad.conflist
Normal file
23
cookbooks/nomad/files/etc/cni/nomad.conflist
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"cniVersion": "0.3.1",
|
||||
"name": "nomad",
|
||||
"plugins": [
|
||||
{
|
||||
"type": "ptp",
|
||||
"ipMasq": true,
|
||||
"ipam": {
|
||||
"type": "host-local",
|
||||
"subnet": "172.16.30.0/24",
|
||||
"routes": [
|
||||
{
|
||||
"dst": "0.0.0.0/0"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "portmap",
|
||||
"capabilities": { "portMappings": true }
|
||||
}
|
||||
]
|
||||
}
|
8
cookbooks/nomad/files/etc/multipath.conf
Normal file
8
cookbooks/nomad/files/etc/multipath.conf
Normal file
@ -0,0 +1,8 @@
|
||||
defaults {
|
||||
user_friendly_names yes
|
||||
find_multipaths yes
|
||||
}
|
||||
|
||||
blacklist {
|
||||
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st|sda)[0-9]*"
|
||||
}
|
@ -1,13 +1,3 @@
|
||||
# /etc/nomad.d/server.hcl
|
||||
|
||||
client {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
plugin "docker" {
|
||||
config {
|
||||
volumes {
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
enabled = true
|
||||
}
|
||||
|
14
cookbooks/nomad/files/etc/nomad.d/csi.hcl
Normal file
14
cookbooks/nomad/files/etc/nomad.d/csi.hcl
Normal file
@ -0,0 +1,14 @@
|
||||
client {
|
||||
cni_path = "/opt/cni/bin"
|
||||
cni_config_dir = "/etc/cni/"
|
||||
}
|
||||
|
||||
plugin "docker" {
|
||||
config {
|
||||
volumes {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
allow_privileged = true
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
# /etc/nomad.d/server.hcl
|
||||
|
||||
# data_dir tends to be environment specific.
|
||||
data_dir = "/opt/nomad/data/"
|
@ -2,3 +2,6 @@ server {
|
||||
enabled = true
|
||||
bootstrap_expect = 3
|
||||
}
|
||||
|
||||
# data_dir tends to be environment specific.
|
||||
data_dir = "/opt/nomad/data/"
|
||||
|
BIN
cookbooks/nomad/files/opt/cni/bin/bandwidth
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/bandwidth
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/bridge
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/bridge
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/dhcp
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/dhcp
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/firewall
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/firewall
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/host-device
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/host-device
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/host-local
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/host-local
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/ipvlan
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/ipvlan
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/loopback
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/loopback
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/macvlan
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/macvlan
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/portmap
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/portmap
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/ptp
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/ptp
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/sbr
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/sbr
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/static
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/static
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/tuning
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/tuning
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/vlan
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/vlan
Normal file
Binary file not shown.
BIN
cookbooks/nomad/files/opt/cni/bin/vrf
Normal file
BIN
cookbooks/nomad/files/opt/cni/bin/vrf
Normal file
Binary file not shown.
@ -12,14 +12,6 @@ file '/etc/nomad.d/nomad.hcl' do
|
||||
action :delete
|
||||
end
|
||||
|
||||
remote_file '/etc/nomad.d/datadir.hcl' do
|
||||
owner 'nomad'
|
||||
group 'nomad'
|
||||
mode '664'
|
||||
|
||||
notifies :restart, 'service[nomad]'
|
||||
end
|
||||
|
||||
if node['nomad']['manager']
|
||||
%w( server.hcl acl.hcl ).each do |conf|
|
||||
remote_file "/etc/nomad.d/#{conf}" do
|
||||
@ -33,7 +25,7 @@ if node['nomad']['manager']
|
||||
end
|
||||
|
||||
if node['nomad']['client']
|
||||
%w( /etc/nomad.d/client.hcl /etc/nomad.d/docker-registry.hcl ).each do |conf|
|
||||
%w( /etc/nomad.d/client.hcl ).each do |conf|
|
||||
remote_file conf do
|
||||
owner 'nomad'
|
||||
group 'nomad'
|
||||
|
Loading…
Reference in New Issue
Block a user