From 902f77a4aeedd5a09d91a364c22ee714c36a13c7 Mon Sep 17 00:00:00 2001 From: Michal Jura Date: Tue, 15 Nov 2016 14:07:00 +0100 Subject: [PATCH] [suse] Build openSUSE Leap 42.1 OpenStack Magnum image Add information on how to build openSUSE Leap 42.1 image for OpenStack Magnum with Kubernetes packages. Change-Id: Ia53b79f14cb5f70b10d81bc13cae32232adca2a9 Partial-Bug: #1622949 --- .../drivers/k8s_opensuse_v1/image/README.md | 39 +++++ .../drivers/k8s_opensuse_v1/image/config.sh | 119 +++++++++++++ .../drivers/k8s_opensuse_v1/image/images.sh | 39 +++++ ...ap-42.1-JeOS-for-OpenStack-Magnum-K8s.kiwi | 160 ++++++++++++++++++ 4 files changed, 357 insertions(+) create mode 100644 contrib/drivers/k8s_opensuse_v1/image/README.md create mode 100644 contrib/drivers/k8s_opensuse_v1/image/config.sh create mode 100644 contrib/drivers/k8s_opensuse_v1/image/images.sh create mode 100644 contrib/drivers/k8s_opensuse_v1/image/openSUSE-Leap-42.1-JeOS-for-OpenStack-Magnum-K8s.kiwi diff --git a/contrib/drivers/k8s_opensuse_v1/image/README.md b/contrib/drivers/k8s_opensuse_v1/image/README.md new file mode 100644 index 0000000000..7b56ec03b3 --- /dev/null +++ b/contrib/drivers/k8s_opensuse_v1/image/README.md @@ -0,0 +1,39 @@ +Build openSUSE Leap 42.1 image for OpenStack Magnum +=================================================== + +This instruction describes how to build manually openSUSE Leap 42.1 image +for OpenStack Magnum with Kubernetes packages. + +Link to the image: + http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-JeOS-for-OpenStack-Magnum-K8s.x86_64.qcow2 + +## Requirements + +Please install openSUSE (https://www.opensuse.org/) on physical or virtual machine. + +## Install packages + +Install `kiwi` package on openSUSE node, where do you want to build your image + +`zypper install kiwi` + +Create destination directory, where image will be build + +`mkdir /tmp/openSUSE-Leap-42.1-JeOS-for-OpenStack-Magnum-K8s` + +## Build image + +Run in current directory with `openSUSE-Leap-42.1-JeOS-for-OpenStack-Magnum-K8s` kiwi template + +`kiwi --verbose 3 --logfile terminal --build . --destdir /tmp/openSUSE-Leap-42.1-JeOS-for-OpenStack-Magnum-K8s` + +## Get image + +After `kiwi` will finish, image can be found in `/tmp/openSUSE-Leap-42.1-JeOS-for-OpenStack-Magnum-K8s` +directory with name `openSUSE-Leap-42.1-JeOS-for-OpenStack-Magnum-K8s.x86_64-1.1.1.qcow2`. + +Full path + +`/tmp/openSUSE-Leap-42.1-JeOS-for-OpenStack-Magnum-K8s/openSUSE-Leap-42.1-JeOS-for-OpenStack-Magnum-K8s.x86_64-1.1.1.qcow2` + +Have fun !!! diff --git a/contrib/drivers/k8s_opensuse_v1/image/config.sh b/contrib/drivers/k8s_opensuse_v1/image/config.sh new file mode 100644 index 0000000000..82c5437769 --- /dev/null +++ b/contrib/drivers/k8s_opensuse_v1/image/config.sh @@ -0,0 +1,119 @@ +#!/bin/bash +#================ +# FILE : config.sh +#---------------- +# PROJECT : openSUSE KIWI Image System +# COPYRIGHT : (c) 2006 SUSE LINUX Products GmbH. All rights reserved +# : +# AUTHOR : Marcus Schaefer +# : +# BELONGS TO : Operating System images +# : +# DESCRIPTION : configuration script for SUSE based +# : operating systems +# : +# : +# STATUS : BETA +#---------------- +#====================================== +# Functions... +#-------------------------------------- +test -f /.kconfig && . /.kconfig +test -f /.profile && . /.profile + +mkdir /var/lib/misc/reconfig_system + +#====================================== +# Greeting... +#-------------------------------------- +echo "Configure image: [$name]..." + +#====================================== +# add missing fonts +#-------------------------------------- +CONSOLE_FONT="lat9w-16.psfu" + +#====================================== +# prepare for setting root pw, timezone +#-------------------------------------- +echo ** "reset machine settings" +sed -i 's/^root:[^:]*:/root:*:/' /etc/shadow +rm /etc/machine-id +rm /etc/localtime +rm /var/lib/zypp/AnonymousUniqueId +rm /var/lib/systemd/random-seed + +#====================================== +# SuSEconfig +#-------------------------------------- +echo "** Running suseConfig..." +suseConfig + +echo "** Running ldconfig..." +/sbin/ldconfig + +#====================================== +# Setup baseproduct link +#-------------------------------------- +suseSetupProduct + +#====================================== +# Specify default runlevel +#-------------------------------------- +baseSetRunlevel 3 + +#====================================== +# Add missing gpg keys to rpm +#-------------------------------------- +suseImportBuildKey + +#====================================== +# Firewall Configuration +#-------------------------------------- +echo '** Configuring firewall...' +chkconfig SuSEfirewall2_init on +chkconfig SuSEfirewall2_setup on + +#====================================== +# Enable sshd +#-------------------------------------- +chkconfig sshd on + +#====================================== +# Remove doc files +#-------------------------------------- +baseStripDocs + +#====================================== +# remove rpms defined in config.xml in the image type=delete section +#-------------------------------------- +baseStripRPM + +#====================================== +# Sysconfig Update +#-------------------------------------- +echo '** Update sysconfig entries...' +baseUpdateSysConfig /etc/sysconfig/SuSEfirewall2 FW_CONFIGURATIONS_EXT sshd +baseUpdateSysConfig /etc/sysconfig/console CONSOLE_FONT "$CONSOLE_FONT" +# baseUpdateSysConfig /etc/sysconfig/snapper SNAPPER_CONFIGS root +if [[ "${kiwi_iname}" != *"OpenStack"* ]]; then + baseUpdateSysConfig /etc/sysconfig/network/dhcp DHCLIENT_SET_HOSTNAME yes +fi + +# true +#====================================== +# SSL Certificates Configuration +#-------------------------------------- +echo '** Rehashing SSL Certificates...' +update-ca-certificates + +if [ ! -s /var/log/zypper.log ]; then + > /var/log/zypper.log +fi + +# only for debugging +#systemctl enable debug-shell.service + +baseCleanMount + +exit 0 diff --git a/contrib/drivers/k8s_opensuse_v1/image/images.sh b/contrib/drivers/k8s_opensuse_v1/image/images.sh new file mode 100644 index 0000000000..e37aba7349 --- /dev/null +++ b/contrib/drivers/k8s_opensuse_v1/image/images.sh @@ -0,0 +1,39 @@ +#!/bin/bash +#================ +# FILE : image.sh +#---------------- +# PROJECT : openSUSE KIWI Image System +# COPYRIGHT : (c) 2006 SUSE LINUX Products GmbH. All rights reserved +# : +# AUTHOR : Marcus Schaefer +# : +# BELONGS TO : Operating System images +# : +# DESCRIPTION : configuration script for SUSE based +# : operating systems +# : +# : +# STATUS : BETA +#---------------- + +test -f /.kconfig && . /.kconfig +test -f /.profile && . /.profile + +if [[ "${kiwi_iname}" = *"OpenStack"* ]]; then + # disable jeos-firstboot service + # We need to install it because it provides files required in the + # overlay for the image. However, the service itself is something that + # requires interaction on boot, which is not good for OpenStack, and the + # interaction actually doesn't bring any benefit in OpenStack. + systemctl mask jeos-firstboot.service + + # enable cloud-init services + suseInsertService cloud-init-local + suseInsertService cloud-init + suseInsertService cloud-config + suseInsertService cloud-final + + echo '*** adjusting cloud.cfg for openstack' + sed -i -e '/mount_default_fields/{adatasource_list: [ NoCloud, OpenStack, None ] + }' /etc/cloud/cloud.cfg +fi diff --git a/contrib/drivers/k8s_opensuse_v1/image/openSUSE-Leap-42.1-JeOS-for-OpenStack-Magnum-K8s.kiwi b/contrib/drivers/k8s_opensuse_v1/image/openSUSE-Leap-42.1-JeOS-for-OpenStack-Magnum-K8s.kiwi new file mode 100644 index 0000000000..a36c252934 --- /dev/null +++ b/contrib/drivers/k8s_opensuse_v1/image/openSUSE-Leap-42.1-JeOS-for-OpenStack-Magnum-K8s.kiwi @@ -0,0 +1,160 @@ + + + + SUSE Containers Team + docker-devel@suse.de + Kubernetes openSUSE Leap 42.1 image for OpenStack Magnum + + + 1.1.1 + zypper + openSUSE + openSUSE + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +