Add nodepool host
Change-Id: Ib216bd400aa269ccdb17848b3870ab65400cf3d2
This commit is contained in:
parent
265f476629
commit
8222c6e00f
@ -75,7 +75,9 @@ node 'jenkins.openstack.org' {
|
|||||||
ssl_key_file_contents => hiera('jenkins_ssl_key_file_contents'),
|
ssl_key_file_contents => hiera('jenkins_ssl_key_file_contents'),
|
||||||
ssl_chain_file_contents => hiera('jenkins_ssl_chain_file_contents'),
|
ssl_chain_file_contents => hiera('jenkins_ssl_chain_file_contents'),
|
||||||
sysadmins => hiera('sysadmins'),
|
sysadmins => hiera('sysadmins'),
|
||||||
zmq_event_receivers => ['logstash.openstack.org'],
|
zmq_event_receivers => ['logstash.openstack.org',
|
||||||
|
'nodepool.openstack.org',
|
||||||
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +89,9 @@ node 'jenkins01.openstack.org' {
|
|||||||
ssl_key_file_contents => hiera('jenkins01_ssl_key_file_contents'),
|
ssl_key_file_contents => hiera('jenkins01_ssl_key_file_contents'),
|
||||||
ssl_chain_file_contents => hiera('jenkins01_ssl_chain_file_contents'),
|
ssl_chain_file_contents => hiera('jenkins01_ssl_chain_file_contents'),
|
||||||
sysadmins => hiera('sysadmins'),
|
sysadmins => hiera('sysadmins'),
|
||||||
zmq_event_receivers => ['logstash.openstack.org'],
|
zmq_event_receivers => ['logstash.openstack.org',
|
||||||
|
'nodepool.openstack.org',
|
||||||
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +103,9 @@ node 'jenkins02.openstack.org' {
|
|||||||
ssl_key_file_contents => hiera('jenkins02_ssl_key_file_contents'),
|
ssl_key_file_contents => hiera('jenkins02_ssl_key_file_contents'),
|
||||||
ssl_chain_file_contents => hiera('jenkins02_ssl_chain_file_contents'),
|
ssl_chain_file_contents => hiera('jenkins02_ssl_chain_file_contents'),
|
||||||
sysadmins => hiera('sysadmins'),
|
sysadmins => hiera('sysadmins'),
|
||||||
zmq_event_receivers => ['logstash.openstack.org'],
|
zmq_event_receivers => ['logstash.openstack.org',
|
||||||
|
'nodepool.openstack.org',
|
||||||
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,6 +322,24 @@ node 'static.openstack.org' {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
node 'nodepool.openstack.org' {
|
||||||
|
class { 'openstack_project::nodepool':
|
||||||
|
mysql_password => hiera('nodepool_mysql_password'),
|
||||||
|
mysql_root_password => hiera('nodepool_mysql_root_password'),
|
||||||
|
nodepool_ssh_private_key => hiera('jenkins_ssh_private_key_contents'),
|
||||||
|
sysadmins => hiera('sysadmins'),
|
||||||
|
statsd_host => 'graphite.openstack.org',
|
||||||
|
jenkins_api_user => hiera('jenkins_api_user'),
|
||||||
|
jenkins_api_key => hiera('jenkins_api_key'),
|
||||||
|
rackspace_username => hiera('nodepool_rackspace_username'),
|
||||||
|
rackspace_password => hiera('nodepool_rackspace_password'),
|
||||||
|
rackspace_project => hiera('nodepool_rackspace_project'),
|
||||||
|
hpcloud_username => hiera('nodepool_hpcloud_username'),
|
||||||
|
hpcloud_password => hiera('nodepool_hpcloud_password'),
|
||||||
|
hpcloud_project => hiera('nodepool_hpcloud_project'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
node 'zuul.openstack.org' {
|
node 'zuul.openstack.org' {
|
||||||
class { 'openstack_project::zuul_prod':
|
class { 'openstack_project::zuul_prod':
|
||||||
gerrit_server => 'review.openstack.org',
|
gerrit_server => 'review.openstack.org',
|
||||||
|
44
modules/nodepool/files/logging.conf
Normal file
44
modules/nodepool/files/logging.conf
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
[loggers]
|
||||||
|
keys=root,nodepool,requests
|
||||||
|
|
||||||
|
[handlers]
|
||||||
|
keys=console,debug,normal
|
||||||
|
|
||||||
|
[formatters]
|
||||||
|
keys=simple
|
||||||
|
|
||||||
|
[logger_root]
|
||||||
|
level=WARNING
|
||||||
|
handlers=console
|
||||||
|
|
||||||
|
[logger_requests]
|
||||||
|
level=WARNING
|
||||||
|
handlers=debug,normal
|
||||||
|
qualname=requests
|
||||||
|
|
||||||
|
[logger_nodepool]
|
||||||
|
level=DEBUG
|
||||||
|
handlers=debug,normal
|
||||||
|
qualname=nodepool
|
||||||
|
|
||||||
|
[handler_console]
|
||||||
|
level=WARNING
|
||||||
|
class=StreamHandler
|
||||||
|
formatter=simple
|
||||||
|
args=(sys.stdout,)
|
||||||
|
|
||||||
|
[handler_debug]
|
||||||
|
level=DEBUG
|
||||||
|
class=logging.handlers.TimedRotatingFileHandler
|
||||||
|
formatter=simple
|
||||||
|
args=('/var/log/nodepool/debug.log', 'midnight', 1, 30,)
|
||||||
|
|
||||||
|
[handler_normal]
|
||||||
|
level=INFO
|
||||||
|
class=logging.handlers.TimedRotatingFileHandler
|
||||||
|
formatter=simple
|
||||||
|
args=('/var/log/nodepool/nodepool.log', 'midnight', 1, 30,)
|
||||||
|
|
||||||
|
[formatter_simple]
|
||||||
|
format=%(asctime)s %(levelname)s %(name)s: %(message)s
|
||||||
|
datefmt=
|
158
modules/nodepool/files/nodepool.init
Executable file
158
modules/nodepool/files/nodepool.init
Executable file
@ -0,0 +1,158 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: nodepool
|
||||||
|
# Required-Start: $remote_fs $syslog
|
||||||
|
# Required-Stop: $remote_fs $syslog
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: Nodepool
|
||||||
|
# Description: Trunk gating system
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# Do NOT "set -e"
|
||||||
|
|
||||||
|
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||||
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||||
|
DESC="Nodepool"
|
||||||
|
NAME=nodepool
|
||||||
|
DAEMON=/usr/local/bin/nodepool
|
||||||
|
PIDFILE=/var/run/$NAME/$NAME.pid
|
||||||
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
|
USER=nodepool
|
||||||
|
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
|
# Read configuration variable file if it is present
|
||||||
|
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||||
|
|
||||||
|
# Load the VERBOSE setting and other rcS variables
|
||||||
|
. /lib/init/vars.sh
|
||||||
|
|
||||||
|
# Define LSB log_* functions.
|
||||||
|
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||||
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that starts the daemon/service
|
||||||
|
#
|
||||||
|
do_start()
|
||||||
|
{
|
||||||
|
# Return
|
||||||
|
# 0 if daemon has been started
|
||||||
|
# 1 if daemon was already running
|
||||||
|
# 2 if daemon could not be started
|
||||||
|
|
||||||
|
mkdir -p /var/run/$NAME
|
||||||
|
chown $USER /var/run/$NAME
|
||||||
|
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER --exec $DAEMON --test > /dev/null \
|
||||||
|
|| return 1
|
||||||
|
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER --exec $DAEMON -- \
|
||||||
|
$DAEMON_ARGS \
|
||||||
|
|| return 2
|
||||||
|
# Add code here, if necessary, that waits for the process to be ready
|
||||||
|
# to handle requests from services started subsequently which depend
|
||||||
|
# on this one. As a last resort, sleep for some time.
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that stops the daemon/service
|
||||||
|
#
|
||||||
|
do_stop()
|
||||||
|
{
|
||||||
|
# Return
|
||||||
|
# 0 if daemon has been stopped
|
||||||
|
# 1 if daemon was already stopped
|
||||||
|
# 2 if daemon could not be stopped
|
||||||
|
# other if a failure occurred
|
||||||
|
start-stop-daemon --stop --signal 9 --pidfile $PIDFILE
|
||||||
|
RETVAL="$?"
|
||||||
|
[ "$RETVAL" = 2 ] && return 2
|
||||||
|
rm -f /var/run/$NAME/*
|
||||||
|
return "$RETVAL"
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that stops the daemon/service
|
||||||
|
#
|
||||||
|
do_graceful_stop()
|
||||||
|
{
|
||||||
|
PID=`cat $PIDFILE`
|
||||||
|
kill -USR1 $PID
|
||||||
|
|
||||||
|
# wait until really stopped
|
||||||
|
if [ -n "${PID:-}" ]; then
|
||||||
|
i=0
|
||||||
|
while kill -0 "${PID:-}" 2> /dev/null; do
|
||||||
|
if [ $i -eq '0' ]; then
|
||||||
|
echo -n " ... waiting "
|
||||||
|
else
|
||||||
|
echo -n "."
|
||||||
|
fi
|
||||||
|
i=$(($i+1))
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f /var/run/$NAME/*
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that sends a SIGHUP to the daemon/service
|
||||||
|
#
|
||||||
|
do_reload() {
|
||||||
|
#
|
||||||
|
# If the daemon can reload its configuration without
|
||||||
|
# restarting (for example, when it is sent a SIGHUP),
|
||||||
|
# then implement that here.
|
||||||
|
#
|
||||||
|
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||||
|
do_start
|
||||||
|
case "$?" in
|
||||||
|
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||||
|
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||||
|
do_stop
|
||||||
|
case "$?" in
|
||||||
|
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||||
|
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
|
;;
|
||||||
|
reload|force-reload)
|
||||||
|
#
|
||||||
|
# If do_reload() is not implemented then leave this commented out
|
||||||
|
# and leave 'force-reload' as an alias for 'restart'.
|
||||||
|
#
|
||||||
|
log_daemon_msg "Reloading $DESC" "$NAME"
|
||||||
|
do_reload
|
||||||
|
log_end_msg $?
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
#
|
||||||
|
# If the "reload" option is implemented then remove the
|
||||||
|
# 'force-reload' alias
|
||||||
|
#
|
||||||
|
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||||
|
do_graceful_stop
|
||||||
|
do_start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
|
||||||
|
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||||
|
exit 3
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
:
|
3
modules/nodepool/files/ssh.config
Normal file
3
modules/nodepool/files/ssh.config
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
UserKnownHostsFile=/dev/null
|
||||||
|
StrictHostKeyChecking=no
|
||||||
|
LogLevel=ERROR
|
158
modules/nodepool/manifests/init.pp
Normal file
158
modules/nodepool/manifests/init.pp
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
# Copyright 2012-2013 Hewlett-Packard Development Company, L.P.
|
||||||
|
# Copyright 2012 Antoine "hashar" Musso
|
||||||
|
# Copyright 2012 Wikimedia Foundation Inc.
|
||||||
|
# Copyright 2013 OpenStack Foundation
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
# == Class: nodepool
|
||||||
|
#
|
||||||
|
class nodepool (
|
||||||
|
$mysql_root_password,
|
||||||
|
$mysql_password,
|
||||||
|
$nodepool_ssh_private_key = '',
|
||||||
|
$git_source_repo = 'https://git.openstack.org/openstack-infra/nodepool',
|
||||||
|
$revision = 'master',
|
||||||
|
$statsd_host = ''
|
||||||
|
) {
|
||||||
|
|
||||||
|
class { 'mysql::server':
|
||||||
|
config_hash => {
|
||||||
|
'root_password' => $mysql_root_password,
|
||||||
|
'default_engine' => 'InnoDB',
|
||||||
|
'bind_address' => '127.0.0.1',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include mysql::server::account_security
|
||||||
|
include mysql::python
|
||||||
|
|
||||||
|
mysql::db { 'nodepool':
|
||||||
|
user => 'nodepool',
|
||||||
|
password => $mysql_password,
|
||||||
|
host => 'localhost',
|
||||||
|
grant => ['all'],
|
||||||
|
charset => 'utf8',
|
||||||
|
require => [
|
||||||
|
Class['mysql::server'],
|
||||||
|
Class['mysql::server::account_security'],
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
user { 'nodepool':
|
||||||
|
ensure => present,
|
||||||
|
home => '/home/nodepool',
|
||||||
|
shell => '/bin/bash',
|
||||||
|
gid => 'nodepool',
|
||||||
|
managehome => true,
|
||||||
|
require => Group['nodepool'],
|
||||||
|
}
|
||||||
|
|
||||||
|
group { 'nodepool':
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
|
||||||
|
vcsrepo { '/opt/nodepool':
|
||||||
|
ensure => latest,
|
||||||
|
provider => git,
|
||||||
|
revision => $revision,
|
||||||
|
source => $git_source_repo,
|
||||||
|
}
|
||||||
|
|
||||||
|
exec { 'install_nodepool' :
|
||||||
|
command => 'python setup.py install',
|
||||||
|
cwd => '/opt/nodepool',
|
||||||
|
path => '/bin:/usr/bin',
|
||||||
|
refreshonly => true,
|
||||||
|
subscribe => Vcsrepo['/opt/nodepool'],
|
||||||
|
require => Class['pip'],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/nodepool':
|
||||||
|
ensure => directory,
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/default/nodepool':
|
||||||
|
ensure => present,
|
||||||
|
content => template('nodepool/nodepool.default.erb'),
|
||||||
|
mode => '0444',
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/var/log/nodepool':
|
||||||
|
ensure => directory,
|
||||||
|
mode => '0555',
|
||||||
|
owner => 'nodepool',
|
||||||
|
group => 'nodepool',
|
||||||
|
require => User['nodepool'],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/var/run/nodepool':
|
||||||
|
ensure => directory,
|
||||||
|
mode => '0555',
|
||||||
|
owner => 'nodepool',
|
||||||
|
group => 'nodepool',
|
||||||
|
require => User['nodepool'],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/home/nodepool/.ssh':
|
||||||
|
ensure => directory,
|
||||||
|
mode => '0500',
|
||||||
|
owner => 'nodepool',
|
||||||
|
group => 'nodepool',
|
||||||
|
require => User['nodepool'],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/home/nodepool/.ssh/id_rsa':
|
||||||
|
ensure => present,
|
||||||
|
content => $nodepool_ssh_private_key,
|
||||||
|
mode => '0400',
|
||||||
|
owner => 'nodepool',
|
||||||
|
group => 'nodepool',
|
||||||
|
require => File['/home/nodepool/.ssh'],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/home/nodepool/.ssh/config':
|
||||||
|
ensure => present,
|
||||||
|
source => 'puppet:///modules/nodepool/ssh.config',
|
||||||
|
mode => '0440',
|
||||||
|
owner => 'nodepool',
|
||||||
|
group => 'nodepool',
|
||||||
|
require => File['/home/nodepool/.ssh'],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/nodepool/logging.conf':
|
||||||
|
ensure => present,
|
||||||
|
mode => '0444',
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
source => 'puppet:///modules/nodepool/logging.conf',
|
||||||
|
notify => Service['nodepool'],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/init.d/nodepool':
|
||||||
|
ensure => present,
|
||||||
|
mode => '0555',
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
source => 'puppet:///modules/nodepool/nodepool.init',
|
||||||
|
}
|
||||||
|
|
||||||
|
service { 'nodepool':
|
||||||
|
name => 'nodepool',
|
||||||
|
enable => true,
|
||||||
|
hasrestart => true,
|
||||||
|
require => File['/etc/init.d/nodepool'],
|
||||||
|
}
|
||||||
|
}
|
6
modules/nodepool/templates/nodepool.default.erb
Normal file
6
modules/nodepool/templates/nodepool.default.erb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<% if scope.lookupvar("nodepool::statsd_host") != "" %>
|
||||||
|
export STATSD_HOST=<%= scope.lookupvar("nodepool::statsd_host") %>
|
||||||
|
export STATSD_PORT=8125
|
||||||
|
<% end %>
|
||||||
|
DAEMON_ARGS="-c /etc/nodepool/nodepool.yaml -l /etc/nodepool/logging.conf"
|
||||||
|
|
118
modules/openstack_project/files/nodepool/scripts/devstack-cache.py
Executable file
118
modules/openstack_project/files/nodepool/scripts/devstack-cache.py
Executable file
@ -0,0 +1,118 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# Copyright (C) 2011-2013 OpenStack Foundation
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
#
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
DEVSTACK='~/workspace-cache/devstack'
|
||||||
|
|
||||||
|
def run_local(cmd, status=False, cwd='.', env={}):
|
||||||
|
print "Running:", cmd
|
||||||
|
newenv = os.environ
|
||||||
|
newenv.update(env)
|
||||||
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, cwd=cwd,
|
||||||
|
stderr=subprocess.STDOUT, env=newenv)
|
||||||
|
(out, nothing) = p.communicate()
|
||||||
|
if status:
|
||||||
|
return (p.returncode, out.strip())
|
||||||
|
return out.strip()
|
||||||
|
|
||||||
|
|
||||||
|
def git_branches():
|
||||||
|
branches = []
|
||||||
|
for branch in run_local(['git', 'branch', '-a'], cwd=DEVSTACK).split("\n"):
|
||||||
|
branch = branch.strip()
|
||||||
|
if not branch.startswith('remotes/origin'):
|
||||||
|
continue
|
||||||
|
branches.append(branch)
|
||||||
|
return branches
|
||||||
|
|
||||||
|
|
||||||
|
def tokenize(fn, tokens, distribution, comment=None):
|
||||||
|
for line in open(fn):
|
||||||
|
if 'dist:' in line and ('dist:%s' % distribution not in line):
|
||||||
|
continue
|
||||||
|
if 'qpid' in line:
|
||||||
|
continue # TODO: explain why this is here
|
||||||
|
if comment and comment in line:
|
||||||
|
line = line[:line.rfind(comment)]
|
||||||
|
line = line.strip()
|
||||||
|
if line and line not in tokens:
|
||||||
|
tokens.append(line)
|
||||||
|
|
||||||
|
|
||||||
|
def local_prep(distribution):
|
||||||
|
branches = []
|
||||||
|
for branch in git_branches():
|
||||||
|
# Ignore branches of the form 'somestring -> someotherstring'
|
||||||
|
# as this denotes a symbolic reference and the entire string
|
||||||
|
# as is cannot be checked out. We can do this safely as the
|
||||||
|
# reference will refer to one of the other branches returned
|
||||||
|
# by git_branches.
|
||||||
|
if ' -> ' in branch:
|
||||||
|
continue
|
||||||
|
branch_data = {'name': branch}
|
||||||
|
print 'Branch: ', branch
|
||||||
|
run_local(['git', 'checkout', branch], cwd=DEVSTACK)
|
||||||
|
run_local(['git', 'pull', '--ff-only', 'origin'], cwd=DEVSTACK)
|
||||||
|
|
||||||
|
debs = []
|
||||||
|
debdir = os.path.join(DEVSTACK, 'files', 'apts')
|
||||||
|
for fn in os.listdir(debdir):
|
||||||
|
fn = os.path.join(debdir, fn)
|
||||||
|
tokenize(fn, debs, distribution, comment='#')
|
||||||
|
branch_data['debs'] = debs
|
||||||
|
|
||||||
|
images = []
|
||||||
|
for line in open(os.path.join(DEVSTACK, 'stackrc')):
|
||||||
|
line = line.strip()
|
||||||
|
if line.startswith('IMAGE_URLS'):
|
||||||
|
if '#' in line:
|
||||||
|
line = line[:line.rfind('#')]
|
||||||
|
if line.endswith(';;'):
|
||||||
|
line = line[:-2]
|
||||||
|
line = line.split('=', 1)[1].strip()
|
||||||
|
if line.startswith('${IMAGE_URLS:-'):
|
||||||
|
line = line[len('${IMAGE_URLS:-'):]
|
||||||
|
if line.endswith('}'):
|
||||||
|
line = line[:-1]
|
||||||
|
if line[0] == line[-1] == '"':
|
||||||
|
line = line[1:-1]
|
||||||
|
images += [x.strip() for x in line.split(',')]
|
||||||
|
branch_data['images'] = images
|
||||||
|
branches.append(branch_data)
|
||||||
|
return branches
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
distribution = sys.argv[1]
|
||||||
|
|
||||||
|
branches = local_prep(distribution)
|
||||||
|
image_filenames = {}
|
||||||
|
for branch_data in branches:
|
||||||
|
if branch_data['debs']:
|
||||||
|
run_local(['sudo', 'apt-get', '-y', '-d', 'install'] +
|
||||||
|
branch_data['debs'])
|
||||||
|
|
||||||
|
for url in branch_data['images']:
|
||||||
|
fname = url.split('/')[-1]
|
||||||
|
if fname in image_filenames:
|
||||||
|
continue
|
||||||
|
run_local(['wget', '-nv', '-c', url,
|
||||||
|
'-O', '~/cache/files/%s' % fname])
|
63
modules/openstack_project/files/nodepool/scripts/prepare_devstack.sh
Executable file
63
modules/openstack_project/files/nodepool/scripts/prepare_devstack.sh
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
#!/bin/bash -xe
|
||||||
|
|
||||||
|
# Copyright (C) 2011-2013 OpenStack Foundation
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
#
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
mkdir -p ~/cache/files
|
||||||
|
mkdir -p ~/cache/pip
|
||||||
|
sudo DEBIAN_FRONTEND=noninteractive apt-get \
|
||||||
|
--option "Dpkg::Options::=--force-confold" \
|
||||||
|
--assume-yes install build-essential python-dev \
|
||||||
|
linux-headers-virtual linux-headers-`uname -r`
|
||||||
|
|
||||||
|
rm -rf ~/workspace-cache
|
||||||
|
mkdir -p ~/workspace-cache
|
||||||
|
|
||||||
|
pushd ~/workspace-cache
|
||||||
|
git clone https://review.openstack.org/p/openstack-dev/devstack
|
||||||
|
git clone https://review.openstack.org/p/openstack-dev/grenade
|
||||||
|
git clone https://review.openstack.org/p/openstack-dev/pbr
|
||||||
|
git clone https://review.openstack.org/p/openstack-infra/devstack-gate
|
||||||
|
git clone https://review.openstack.org/p/openstack-infra/jeepyb
|
||||||
|
git clone https://review.openstack.org/p/openstack/ceilometer
|
||||||
|
git clone https://review.openstack.org/p/openstack/cinder
|
||||||
|
git clone https://review.openstack.org/p/openstack/glance
|
||||||
|
git clone https://review.openstack.org/p/openstack/heat
|
||||||
|
git clone https://review.openstack.org/p/openstack/horizon
|
||||||
|
git clone https://review.openstack.org/p/openstack/keystone
|
||||||
|
git clone https://review.openstack.org/p/openstack/neutron
|
||||||
|
git clone https://review.openstack.org/p/openstack/nova
|
||||||
|
git clone https://review.openstack.org/p/openstack/oslo.config
|
||||||
|
git clone https://review.openstack.org/p/openstack/oslo.messaging
|
||||||
|
git clone https://review.openstack.org/p/openstack/python-ceilometerclient
|
||||||
|
git clone https://review.openstack.org/p/openstack/python-cinderclient
|
||||||
|
git clone https://review.openstack.org/p/openstack/python-glanceclient
|
||||||
|
git clone https://review.openstack.org/p/openstack/python-heatclient
|
||||||
|
git clone https://review.openstack.org/p/openstack/python-keystoneclient
|
||||||
|
git clone https://review.openstack.org/p/openstack/python-neutronclient
|
||||||
|
git clone https://review.openstack.org/p/openstack/python-novaclient
|
||||||
|
git clone https://review.openstack.org/p/openstack/python-openstackclient
|
||||||
|
git clone https://review.openstack.org/p/openstack/python-swiftclient
|
||||||
|
git clone https://review.openstack.org/p/openstack/requirements
|
||||||
|
git clone https://review.openstack.org/p/openstack/swift
|
||||||
|
git clone https://review.openstack.org/p/openstack/tempest
|
||||||
|
popd
|
||||||
|
|
||||||
|
. /etc/lsb-release
|
||||||
|
python ./devstack-cache.py $DISTRIB_CODENAME
|
||||||
|
|
||||||
|
sync
|
||||||
|
sleep 5
|
33
modules/openstack_project/files/nodepool/scripts/prepare_node.sh
Executable file
33
modules/openstack_project/files/nodepool/scripts/prepare_node.sh
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash -xe
|
||||||
|
|
||||||
|
# Copyright (C) 2011-2013 OpenStack Foundation
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
#
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
HOSTNAME=$1
|
||||||
|
|
||||||
|
sudo hostname $1
|
||||||
|
wget https://raw.github.com/openstack-infra/config/master/install_puppet.sh
|
||||||
|
sudo bash -xe install_puppet.sh
|
||||||
|
sudo git clone https://review.openstack.org/p/openstack-infra/config.git \
|
||||||
|
/root/config
|
||||||
|
sudo /bin/bash /root/config/install_modules.sh
|
||||||
|
if [ -z $NODEPOOL_SSH_KEY ] ; then
|
||||||
|
sudo puppet apply --modulepath=/root/config/modules:/etc/puppet/modules \
|
||||||
|
-e "class {'openstack_project::slave_template': }"
|
||||||
|
else
|
||||||
|
sudo puppet apply --modulepath=/root/config/modules:/etc/puppet/modules \
|
||||||
|
-e "class {'openstack_project::slave_template': install_users => false, ssh_key => '$NODEPOOL_SSH_KEY', }"
|
||||||
|
fi
|
22
modules/openstack_project/files/nodepool/scripts/prepare_node_devstack.sh
Executable file
22
modules/openstack_project/files/nodepool/scripts/prepare_node_devstack.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash -xe
|
||||||
|
|
||||||
|
# Copyright (C) 2011-2013 OpenStack Foundation
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
#
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
HOSTNAME=$1
|
||||||
|
|
||||||
|
./prepare_node.sh $HOSTNAME
|
||||||
|
./prepare_devstack.sh $HOSTNAME
|
51
modules/openstack_project/manifests/nodepool.pp
Normal file
51
modules/openstack_project/manifests/nodepool.pp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# == Class: openstack_project::nodepool
|
||||||
|
#
|
||||||
|
class openstack_project::nodepool(
|
||||||
|
$mysql_root_password,
|
||||||
|
$mysql_password,
|
||||||
|
$nodepool_ssh_private_key = '',
|
||||||
|
$sysadmins = [],
|
||||||
|
$statsd_host = '',
|
||||||
|
$jenkins_api_user ='',
|
||||||
|
$jenkins_api_key ='',
|
||||||
|
$rackspace_username ='',
|
||||||
|
$rackspace_password ='',
|
||||||
|
$rackspace_project ='',
|
||||||
|
$hpcloud_username ='',
|
||||||
|
$hpcloud_password ='',
|
||||||
|
$hpcloud_project ='',
|
||||||
|
) {
|
||||||
|
class { 'openstack_project::server':
|
||||||
|
sysadmins => $sysadmins,
|
||||||
|
}
|
||||||
|
|
||||||
|
class { '::nodepool':
|
||||||
|
mysql_root_password => $mysql_root_password,
|
||||||
|
mysql_password => $mysql_password,
|
||||||
|
nodepool_ssh_private_key => $nodepool_ssh_private_key,
|
||||||
|
statsd_host => $statsd_host,
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/nodepool/nodepool.yaml':
|
||||||
|
ensure => present,
|
||||||
|
owner => 'nodepool',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0400',
|
||||||
|
content => template('openstack_project/nodepool/nodepool.yaml.erb'),
|
||||||
|
require => [
|
||||||
|
File['/etc/nodepool'],
|
||||||
|
User['nodepool'],
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/nodepool/scripts':
|
||||||
|
ensure => directory,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
recurse => true,
|
||||||
|
require => File['/etc/nodepool'],
|
||||||
|
source => 'puppet:///modules/openstack_project/nodepool/scripts',
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
112
modules/openstack_project/templates/nodepool/nodepool.yaml.erb
Normal file
112
modules/openstack_project/templates/nodepool/nodepool.yaml.erb
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
script-dir: /etc/nodepool/scripts
|
||||||
|
dburi: 'mysql://nodepool:<%= mysql_password %>@localhost/nodepool'
|
||||||
|
|
||||||
|
cron:
|
||||||
|
cleanup: '27 */6 * * *'
|
||||||
|
update-image: '14 2 * * *'
|
||||||
|
|
||||||
|
zmq-publishers:
|
||||||
|
- tcp://jenkins01.openstack.org:8888
|
||||||
|
- tcp://jenkins02.openstack.org:8888
|
||||||
|
|
||||||
|
providers:
|
||||||
|
- name: rax-dfw
|
||||||
|
region-name: 'DFW'
|
||||||
|
service-type: 'compute'
|
||||||
|
service-name: 'cloudServersOpenStack'
|
||||||
|
username: '<%= rackspace_username %>'
|
||||||
|
password: '<%= rackspace_password %>'
|
||||||
|
project-id: '<%= rackspace_project %>'
|
||||||
|
auth-url: 'https://identity.api.rackspacecloud.com/v2.0/'
|
||||||
|
max-servers: 60
|
||||||
|
images:
|
||||||
|
- name: devstack-precise
|
||||||
|
base-image: 'Ubuntu 12.04 LTS (Precise Pangolin)'
|
||||||
|
min-ram: 8192
|
||||||
|
setup: prepare_node_devstack.sh
|
||||||
|
- name: rax-ord
|
||||||
|
region-name: 'ORD'
|
||||||
|
service-type: 'compute'
|
||||||
|
service-name: 'cloudServersOpenStack'
|
||||||
|
username: '<%= rackspace_username %>'
|
||||||
|
password: '<%= rackspace_password %>'
|
||||||
|
project-id: '<%= rackspace_project %>'
|
||||||
|
auth-url: 'https://identity.api.rackspacecloud.com/v2.0/'
|
||||||
|
max-servers: 60
|
||||||
|
images:
|
||||||
|
- name: devstack-precise
|
||||||
|
base-image: 'Ubuntu 12.04 LTS (Precise Pangolin)'
|
||||||
|
min-ram: 8192
|
||||||
|
setup: prepare_node_devstack.sh
|
||||||
|
- name: hpcloud-az1
|
||||||
|
region-name: 'az-1.region-a.geo-1'
|
||||||
|
service-type: 'compute'
|
||||||
|
service-name: 'Compute'
|
||||||
|
username: '<%= hpcloud_username %>'
|
||||||
|
password: '<%= hpcloud_password %>'
|
||||||
|
project-id: '<%= hpcloud_project %>'
|
||||||
|
auth-url: 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0'
|
||||||
|
max-servers: 96
|
||||||
|
images:
|
||||||
|
- name: devstack-precise
|
||||||
|
base-image: 'Ubuntu Precise 12.04 LTS Server 64-bit 20121026 (b)'
|
||||||
|
min-ram: 8192
|
||||||
|
setup: prepare_node_devstack.sh
|
||||||
|
- name: hpcloud-az2
|
||||||
|
region-name: 'az-2.region-a.geo-1'
|
||||||
|
service-type: 'compute'
|
||||||
|
service-name: 'Compute'
|
||||||
|
username: '<%= hpcloud_username %>'
|
||||||
|
password: '<%= hpcloud_password %>'
|
||||||
|
project-id: '<%= hpcloud_project %>'
|
||||||
|
auth-url: 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0'
|
||||||
|
max-servers: 96
|
||||||
|
images:
|
||||||
|
- name: devstack-precise
|
||||||
|
base-image: 'Ubuntu Precise 12.04 LTS Server 64-bit 20121026 (b)'
|
||||||
|
min-ram: 8192
|
||||||
|
setup: prepare_node_devstack.sh
|
||||||
|
- name: hpcloud-az3
|
||||||
|
region-name: 'az-3.region-a.geo-1'
|
||||||
|
service-type: 'compute'
|
||||||
|
service-name: 'Compute'
|
||||||
|
username: '<%= hpcloud_username %>'
|
||||||
|
password: '<%= hpcloud_password %>'
|
||||||
|
project-id: '<%= hpcloud_project %>'
|
||||||
|
auth-url: 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0'
|
||||||
|
max-servers: 96
|
||||||
|
images:
|
||||||
|
- name: devstack-precise
|
||||||
|
base-image: 'Ubuntu Precise 12.04 LTS Server 64-bit 20121026 (b)'
|
||||||
|
min-ram: 8192
|
||||||
|
setup: prepare_node_devstack.sh
|
||||||
|
|
||||||
|
targets:
|
||||||
|
- name: jenkins01
|
||||||
|
jenkins:
|
||||||
|
url: 'https://jenkins01.openstack.org/'
|
||||||
|
user: '<%= jenkins_api_user %>'
|
||||||
|
apikey: '<%= jenkins_api_key %>'
|
||||||
|
images:
|
||||||
|
- name: devstack-precise
|
||||||
|
providers:
|
||||||
|
- name: hpcloud-az1
|
||||||
|
min-ready: 1
|
||||||
|
- name: hpcloud-az2
|
||||||
|
min-ready: 1
|
||||||
|
- name: hpcloud-az3
|
||||||
|
min-ready: 1
|
||||||
|
- name: jenkins02
|
||||||
|
jenkins:
|
||||||
|
url: 'https://jenkins02.openstack.org/'
|
||||||
|
user: '<%= jenkins_api_user %>'
|
||||||
|
apikey: '<%= jenkins_api_key %>'
|
||||||
|
images:
|
||||||
|
- name: devstack-precise
|
||||||
|
providers:
|
||||||
|
- name: hpcloud-az1
|
||||||
|
min-ready: 1
|
||||||
|
- name: hpcloud-az2
|
||||||
|
min-ready: 1
|
||||||
|
- name: hpcloud-az3
|
||||||
|
min-ready: 1
|
Loading…
x
Reference in New Issue
Block a user