make a gentoo nodepool image

Depends-On: I17202de3016616ce34c8cbead7d0fb047a64e96b

Change-Id: Icf5e7e8bc4f005111cd2492d3c1a2c492b8a7a96
This commit is contained in:
Matthew Thode 2017-09-15 16:30:13 -05:00
parent 1b71c1dd2b
commit 56929e4639
No known key found for this signature in database
GPG Key ID: 64A37BEAAE19A4E8
12 changed files with 80 additions and 14 deletions

View File

@ -22,6 +22,9 @@ set -e
packages='tox' packages='tox'
for package in $packages ; do # non-system root installed packages can interfere with things
pip install $package if [ "${DISTRO_NAME}" != "gentoo" ]; then
done for package in $packages ; do
pip install $package
done
fi

View File

@ -32,3 +32,4 @@ centos-release-openstack-ocata:
redhat-rpm-config: redhat-rpm-config:
redhat-lsb-core: redhat-lsb-core:
curl: curl:
tox:

View File

@ -11,9 +11,15 @@
"build-essential": "", "build-essential": "",
"cron": "sys-process/cronie", "cron": "sys-process/cronie",
"curl": "net-misc/curl", "curl": "net-misc/curl",
"dnsutils": "net-dns/bind-tools",
"git": "dev-vcs/git",
"iptables": "net-firewall/iptables",
"iputils-ping": "net-misc/iputils",
"ntp": "net-misc/ntp", "ntp": "net-misc/ntp",
"ntpdate": "net-misc/ntp",
"python-dev": "", "python-dev": "",
"python3-dev": "", "python3-dev": "",
"tox": "dev-python/tox",
"traceroute": "net-analyzer/traceroute", "traceroute": "net-analyzer/traceroute",
"uuid-runtime": "" "uuid-runtime": ""
}, },
@ -57,6 +63,7 @@
"redhat-rpm-config": "", "redhat-rpm-config": "",
"redhat-lsb-core": "", "redhat-lsb-core": "",
"python-xml": "", "python-xml": "",
"python3": "" "python3": "",
"tox": ""
} }
} }

View File

@ -15,9 +15,7 @@ case "$DIB_INIT_SYSTEM" in
systemctl enable haveged.service systemctl enable haveged.service
;; ;;
openrc) openrc)
# TODO(pabelanger): Make sure we support gentoo if we bring images rc-update add haveged default
# online for nodepool.o.o.
exit 0
;; ;;
sysv) sysv)
exit 0 exit 0

View File

@ -19,8 +19,8 @@ case "$DIB_INIT_SYSTEM" in
fi fi
;; ;;
openrc) openrc)
# let dib-init-system's postinstall handle enabling init scripts rc-update add ntp-client default
exit 0 rc-update add acpid default
;; ;;
sysv) sysv)
# ntp is enabled by default, nothing to do # ntp is enabled by default, nothing to do

View File

@ -0,0 +1,15 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# needed for unbound
if [ "${DISTRO_NAME}" == "gentoo" ]; then
mkdir -p /etc/portage/package.use
echo "dev-libs/openssl static-libs -bindist" >> /etc/portage/package.use/openssl
echo "net-misc/openssh -bindist" >> /etc/portage/package.use/openssh
echo "sys-libs/zlib static-libs" >> /etc/portage/package.use/zlib
fi

View File

@ -33,7 +33,7 @@ if [ ! -f $_pub_key ]; then
die "Can not find Jenkins public key!" die "Can not find Jenkins public key!"
fi fi
mkdir /home/jenkins/.ssh mkdir -p /home/jenkins/.ssh
chmod 700 /home/jenkins/.ssh chmod 700 /home/jenkins/.ssh
cp $_pub_key /home/jenkins/.ssh/authorized_keys cp $_pub_key /home/jenkins/.ssh/authorized_keys

View File

@ -53,6 +53,10 @@ echo "$UNBOUND_LOGGING_CONF" > /tmp/unbound-logging.conf
if [[ "$DISTRO_NAME" =~ (centos|fedora|opensuse) ]] ; then if [[ "$DISTRO_NAME" =~ (centos|fedora|opensuse) ]] ; then
UNBOUND_CONFD=/etc/unbound/conf.d UNBOUND_CONFD=/etc/unbound/conf.d
elif [[ "$DISTRO_NAME" =~ 'gentoo' ]] ; then
UNBOUND_CONFD=/etc/unbound/conf.d
mkdir -p $UNBOUND_CONFD
echo "include: \"$UNBOUND_CONFD\"" >> /etc/unbound/unbound.conf
else else
UNBOUND_CONFD=/etc/unbound/unbound.conf.d UNBOUND_CONFD=/etc/unbound/unbound.conf.d
fi fi
@ -67,6 +71,8 @@ chmod 0644 /var/log/unbound.log
if [[ "$DISTRO_NAME" =~ (opensuse) ]] ; then if [[ "$DISTRO_NAME" =~ (opensuse) ]] ; then
rclocal=/etc/init.d/boot.local rclocal=/etc/init.d/boot.local
elif [[ "${DISTRO_NAME}" =~ "gentoo" ]]; then
rclocal=/etc/local.d/unbound.start
else else
# You'd think rc.local would be simple ... # You'd think rc.local would be simple ...
# #
@ -147,7 +153,7 @@ fi
dhcp_file='' dhcp_file=''
if [[ "$DISTRO_NAME" =~ (centos|rhel7|fedora) ]] ; then if [[ "$DISTRO_NAME" =~ (centos|rhel7|fedora) ]] ; then
dhcp_file=/etc/dhcp/dhclient-eth0.conf dhcp_file=/etc/dhcp/dhclient-eth0.conf
elif [[ "$DISTRO_NAME" =~ (debian|ubuntu) ]] ; then elif [[ "$DISTRO_NAME" =~ (debian|ubuntu|gentoo) ]] ; then
dhcp_file=/etc/dhcp/dhclient.conf dhcp_file=/etc/dhcp/dhclient.conf
fi fi
if [ -n "$dhcp_file" ] ; then if [ -n "$dhcp_file" ] ; then
@ -170,7 +176,7 @@ case "$DIB_INIT_SYSTEM" in
systemctl enable unbound.service systemctl enable unbound.service
;; ;;
openrc) openrc)
# let dib-init-system's postinstall handle enabling init scripts rc-update add unbound default
;; ;;
sysv) sysv)
# nothing to do # nothing to do

View File

@ -32,6 +32,10 @@ elif [[ "$DISTRO_NAME" =~ 'opensuse' ]] ; then
rules_dir=/etc/sysconfig rules_dir=/etc/sysconfig
ipv4_rules=${rules_dir}/iptables ipv4_rules=${rules_dir}/iptables
ipv6_rules=${rules_dir}/ip6tables ipv6_rules=${rules_dir}/ip6tables
elif [[ "$DISTRO_NAME" =~ 'gentoo' ]] ; then
rules_dir=/var/lib/iptables # not needed, part of the package install
ipv4_rules=/var/lib/iptables/rules-save
ipv6_rules=/var/lib/ip6tables/rules-save
else else
echo "Unsupported operating system $DISTRO_NAME" echo "Unsupported operating system $DISTRO_NAME"
exit 1 exit 1
@ -96,5 +100,9 @@ fw_custom_after_finished() {
/usr/sbin/ip6tables-restore $ipv6_rules /usr/sbin/ip6tables-restore $ipv6_rules
} }
EOF EOF
fi
if [[ "$DISTRO_NAME" =~ 'gentoo' ]] ; then
/sbin/iptables-restore $ipv4_rules
/sbin/ip6tables-restore $ipv6_rules
fi fi

View File

@ -30,6 +30,10 @@ elif [[ "$DISTRO_NAME" =~ (centos|fedora) ]] ; then
service_name=iptables service_name=iptables
elif [[ "$DISTRO_NAME" == 'opensuse' ]] ; then elif [[ "$DISTRO_NAME" == 'opensuse' ]] ; then
service_name=SuSEfirewall2 service_name=SuSEfirewall2
elif [[ "$DISTRO_NAME" == 'gentoo' ]] ; then
service_name=iptables # for systemd
service_name1=iptables # for openrc
service_name2=ip6tables # for openrc
else else
echo "Unsupported operating system $DISTRO_NAME" echo "Unsupported operating system $DISTRO_NAME"
exit 1 exit 1
@ -45,6 +49,10 @@ case "$DIB_INIT_SYSTEM" in
systemctl enable ip6tables.service systemctl enable ip6tables.service
fi fi
;; ;;
openrc)
rc-update add ${service_name1} default
rc-update add ${service_name2} default
;;
*) *)
echo "Unsupported init system $DIB_INIT_SYSTEM" echo "Unsupported init system $DIB_INIT_SYSTEM"
exit 1 exit 1

View File

@ -30,7 +30,7 @@ if [ ! -f $_pub_key ]; then
die "Can not find Zuul public key!" die "Can not find Zuul public key!"
fi fi
mkdir /home/zuul/.ssh mkdir -p /home/zuul/.ssh
chmod 700 /home/zuul/.ssh chmod 700 /home/zuul/.ssh
cp $_pub_key /home/zuul/.ssh/authorized_keys cp $_pub_key /home/zuul/.ssh/authorized_keys

View File

@ -518,6 +518,26 @@ diskimages:
DIB_IMAGE_CACHE: /opt/dib_cache DIB_IMAGE_CACHE: /opt/dib_cache
QEMU_IMG_OPTIONS: compat=0.10 QEMU_IMG_OPTIONS: compat=0.10
DIB_GRUB_TIMEOUT: '0' DIB_GRUB_TIMEOUT: '0'
- name: gentoo
elements:
- gentoo
- vm
- simple-init
- openstack-repos
- nodepool-base
- growroot
- infra-package-needs
env-vars:
TMPDIR: /opt/dib_tmp
DIB_CHECKSUM: '1'
DIB_IMAGE_CACHE: /opt/dib_cache
QEMU_IMG_OPTIONS: compat=0.10
DIB_GRUB_TIMEOUT: '0'
GENTOO_PORTAGE_CLEANUP: 'True'
DIB_INSTALLTYPE_pip_and_virtualenv: 'package'
DIB_INSTALLTYPE_simple_init: 'repo'
GENTOO_PYTHON_TARGETS: 'python2_7 python3_5'
GENTOO_PYTHON_ACTIVE_VERSION: python3.5
- name: opensuse-423 - name: opensuse-423
elements: elements:
- opensuse-minimal - opensuse-minimal