Merge changes Id57c2ca9,If4a6439b
* changes: Apply cgroups and ulimit to precise8. Add cgroup memory limits to jenkins_slave.
This commit is contained in:
commit
462bc1d8b8
@ -542,6 +542,28 @@ node /^ci-backup-.*\.openstack\.org$/ {
|
||||
#
|
||||
# Jenkins slaves:
|
||||
#
|
||||
|
||||
# Test cgroups and ulimits on precise8
|
||||
node 'precise8.slave.openstack.org' {
|
||||
include openstack_cron
|
||||
include openstack_jenkins_slave
|
||||
|
||||
package { "tox":
|
||||
ensure => latest, # okay to use latest for pip
|
||||
provider => pip,
|
||||
require => Package[python-pip],
|
||||
}
|
||||
|
||||
include ulimit
|
||||
ulimit::conf { 'limit_jenkins_procs':
|
||||
limit_domain => 'jenkins',
|
||||
limit_type => 'hard',
|
||||
limit_item => 'nproc',
|
||||
limit_value => '256'
|
||||
}
|
||||
include jenkins_slave::cgroups
|
||||
}
|
||||
|
||||
node /^.*\.slave\.openstack\.org$/ {
|
||||
include openstack_cron
|
||||
include openstack_jenkins_slave
|
||||
|
2
modules/jenkins_slave/files/cgroups/cgrules.conf
Normal file
2
modules/jenkins_slave/files/cgroups/cgrules.conf
Normal file
@ -0,0 +1,2 @@
|
||||
jenkins:jenkins memory /jenkins
|
||||
jenkins memory /jenkins/children
|
7
modules/jenkins_slave/lib/facter/memorytotalbytes.rb
Executable file
7
modules/jenkins_slave/lib/facter/memorytotalbytes.rb
Executable file
@ -0,0 +1,7 @@
|
||||
# memorytotalbytes.rb
|
||||
|
||||
Facter.add("memorytotalbytes") do
|
||||
setcode do
|
||||
Facter::Util::Resolution.exec('free -bo | sed -n \'s/^Mem:\W\+\([0-9]\+\).*$/\1/p\'')
|
||||
end
|
||||
end
|
37
modules/jenkins_slave/manifests/cgroups.pp
Normal file
37
modules/jenkins_slave/manifests/cgroups.pp
Normal file
@ -0,0 +1,37 @@
|
||||
class jenkins_slave::cgroups {
|
||||
|
||||
package { 'cgroup-bin':
|
||||
ensure => present
|
||||
}
|
||||
|
||||
file { '/etc/cgconfig.conf':
|
||||
ensure => present,
|
||||
replace => true,
|
||||
owner => root,
|
||||
mode => 0644,
|
||||
content => template('jenkins_slave/cgconfig.erb')
|
||||
}
|
||||
|
||||
file { '/etc/cgrules.conf':
|
||||
ensure => present,
|
||||
replace => true,
|
||||
owner => root,
|
||||
mode => 0644,
|
||||
source => 'puppet:///modules/jenkins_slave/cgroups/cgrules.conf'
|
||||
}
|
||||
|
||||
service { 'cgconfig':
|
||||
enable => true,
|
||||
ensure => running,
|
||||
require => Package['cgroup-bin'],
|
||||
subscribe => File['/etc/cgconfig.conf']
|
||||
}
|
||||
|
||||
service { 'cgred':
|
||||
enable => true,
|
||||
ensure => running,
|
||||
require => Package['cgroup-bin'],
|
||||
subscribe => File['/etc/cgrules.conf']
|
||||
}
|
||||
|
||||
}
|
38
modules/jenkins_slave/templates/cgconfig.erb
Normal file
38
modules/jenkins_slave/templates/cgconfig.erb
Normal file
@ -0,0 +1,38 @@
|
||||
mount {
|
||||
cpu = /sys/fs/cgroup/cpu;
|
||||
cpuacct = /sys/fs/cgroup/cpuacct;
|
||||
devices = /sys/fs/cgroup/devices;
|
||||
memory = /sys/fs/cgroup/memory;
|
||||
freezer = /sys/fs/cgroup/freezer;
|
||||
}
|
||||
|
||||
group jenkins {
|
||||
perm {
|
||||
task {
|
||||
uid = jenkins;
|
||||
gid = jenkins;
|
||||
}
|
||||
admin {
|
||||
uid = root;
|
||||
gid = root;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group jenkins/children {
|
||||
perm {
|
||||
task {
|
||||
uid = jenkins;
|
||||
gid = jenkins;
|
||||
}
|
||||
admin {
|
||||
uid = root;
|
||||
gid = root;
|
||||
}
|
||||
}
|
||||
memory {
|
||||
memory.soft_limit_in_bytes = <%= (memorytotalbytes.to_f * 0.75).to_i %>;
|
||||
memory.limit_in_bytes = <%= (memorytotalbytes.to_f * 0.9).to_i %>;
|
||||
memory.memsw.limit_in_bytes = <%= (memorytotalbytes.to_f * 0.9).to_i %>;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user