Remove fuel-dockerctl package

Closes-bug: #1552737
Implements blueprint: get-rid-docker-containers

Change-Id: I60e2a4bf43e12149a813427a9237c37d31d198c7
This commit is contained in:
Sergey Kulanov 2016-03-03 16:43:34 +02:00
parent 1a581bf00f
commit 187d235254
7 changed files with 27 additions and 1372 deletions

View File

@ -1,121 +0,0 @@
#!/bin/bash
# Copyright 2015 Mirantis, Inc.
#
# 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.
. "/usr/share/dockerctl/functions"
DEBUG=true
# Sets var nonopts
declare -a nonopts
parse_options "$@"
set -- "${nonopts[@]}"
# Parse config
confdir="/etc/dockerctl"
. "$confdir/config"
if [ -z "$1" ] || [ "$1" = "help" ]; then
echo "Please specify a command."
show_usage
exit 1
fi
if [ -z "$2" ] || [ "$2" = "all" ]; then
container="all"
else
container=$2
fi
container_seq=$CONTAINER_SEQUENCE
case "$1" in
build)
if [[ "$container" == 'storage' ]]; then
build_storage_containers
run_storage_containers
elif [[ "$container" == 'all' ]]; then
# Step 1: prepare storage containers
build_storage_containers
run_storage_containers
# Step 2: launch all in order, checking each one
for service in $container_seq; do
start_container $service
check_ready $service
done
else
start_container $container
fi ;;
check)
if [[ "$container" == 'all' ]];then
exit_code=0
for service in $container_seq; do
check_ready $service || exit_code=1
done
exit $exit_code
else
check_ready $container
fi ;;
create)
create_container $container;;
start)
if [[ "$container" == 'all' ]]; then
for service in $container_seq; do
start_container $service
check_ready $service
sleep 4
done
else
shift 2
start_container $container $@
if [[ ! "$@" =~ "--attach" ]]; then
check_ready $container
fi
fi ;;
post_start_hooks)
shift 2
post_start_hooks $container $@ ;;
list)
shift
list_containers "$@" ;;
shell)
shift 2
shell_container $container "$@" ;;
copy)
shift 1
copy_files "$@" ;;
restart|stop|revert|destroy)
cmd=$1
shift 2
${cmd}_container $container $@ ;;
restore|backup)
cmd=$1
shift
$cmd "$@" ;;
logs|inspect)
if [[ $2 == 'all' ]]; then
echo "You need to specify valid container name."
echo "Use 'dockerctl list' to see available containers."
exit 1
fi
cmd=$1
shift
$cmd "$@" ;;
*)
echo 'Invalid selection.'
show_usage
esac

View File

@ -1,2 +0,0 @@
alias cobbler='dockerctl shell cobbler cobbler'
alias mco='dockerctl shell astute mco'

View File

@ -1,148 +0,0 @@
#!/bin/bash
### Container information
#Paths
DOCKER_ROOT="/var/www/nailgun/docker"
IMAGE_DIR="${DOCKER_ROOT}/images"
SOURCE_DIR="${DOCKER_ROOT}/sources"
ASTUTE_YAML="/etc/fuel/astute.yaml"
FUEL_RELEASE_FILE="/etc/fuel_release"
DOCKER_ENGINE="native"
ADMIN_IP="10.20.0.2"
LOCAL_IP="127.0.0.1"
SYSTEMCTL="/usr/bin/systemctl"
# Version of Fuel to deploy
VERSION=${VERSION_OVERRIDE:-$(cat $FUEL_RELEASE_FILE)}
if [ -z "$VERSION" ]; then
VERSION="_VERSION_"
fi
SYSTEMD="false"
IMAGE_PREFIX="fuel"
# busybox image for storage containers
BUSYBOX_IMAGE="busybox.tar.gz"
# base centos image for all containers
BASE_IMAGE="centos.tar.gz"
# Order in which to start all containers
CONTAINER_SEQUENCE="postgres rabbitmq keystone rsync astute rsyslog nailgun ostf nginx cobbler mcollective"
# storage container names
PREFIX_STORAGE="fuel-core-${VERSION}-volume-"
# app container names
declare -A CONTAINER_NAMES
prefix="fuel-core-${VERSION}-"
CONTAINER_NAMES['cobbler']="${prefix}cobbler"
CONTAINER_NAMES['postgres']="${prefix}postgres"
CONTAINER_NAMES['rabbitmq']="${prefix}rabbitmq"
CONTAINER_NAMES['rsync']="${prefix}rsync"
CONTAINER_NAMES['astute']="${prefix}astute"
CONTAINER_NAMES['nailgun']="${prefix}nailgun"
CONTAINER_NAMES['ostf']="${prefix}ostf"
CONTAINER_NAMES['nginx']="${prefix}nginx"
CONTAINER_NAMES['rsyslog']="${prefix}rsyslog"
CONTAINER_NAMES['mcollective']="${prefix}mcollective"
CONTAINER_NAMES['keystone']="${prefix}keystone"
# app container options
declare -A CONTAINER_OPTIONS
base_opts="-t --net=host"
FOREGROUND="-i"
BACKGROUND="-d"
BIND_ALL=""
BIND_ADMIN="${ADMIN_IP}:"
BIND_LOCAL="${LOCAL_IP}:"
CONTAINER_OPTIONS["cobbler"]="-p ${BIND_ALL}53:53/udp -p ${BIND_ALL}69:69/udp -p ${BIND_ALL}80:80 -p ${BIND_ALL}443:443 --privileged $base_opts"
CONTAINER_OPTIONS["postgres"]="-p ${BIND_ADMIN}5432:5432 -p ${BIND_LOCAL}5432:5432 $base_opts"
CONTAINER_OPTIONS["rabbitmq"]="-p ${BIND_ADMIN}5672:5672 -p ${BIND_LOCAL}5672:5672 -p ${BIND_ADMIN}4369:4369 -p ${BIND_LOCAL}4369:4369 -p ${BIND_ADMIN}15672:15672 -p ${BIND_LOCAL}15672:15672 -p ${BIND_ADMIN}61613:61613 -p ${BIND_LOCAL}61613:61613 $base_opts"
CONTAINER_OPTIONS["rsync"]="-p ${BIND_ADMIN}873:873 -p ${BIND_LOCAL}873:873 $base_opts"
CONTAINER_OPTIONS["astute"]="$base_opts"
CONTAINER_OPTIONS["nailgun"]="--privileged -p ${BIND_ADMIN}8001:8001 -p ${BIND_LOCAL}8001:8001 $base_opts"
CONTAINER_OPTIONS["ostf"]="-p ${BIND_ADMIN}8777:8777 -p ${BIND_LOCAL}8777:8777 $base_opts"
CONTAINER_OPTIONS["nginx"]="-p ${BIND_ALL}8000:8000 -p ${BIND_ALL}8080:8080 $base_opts"
CONTAINER_OPTIONS["rsyslog"]="--privileged -p ${BIND_ADMIN}514:514 -p ${BIND_LOCAL}514:514 -p ${BIND_ADMIN}514:514/udp -p ${BIND_LOCAL}514:514/udp -p ${BIND_ADMIN}25150:25150 -p ${BIND_LOCAL}25150:25150 $base_opts"
CONTAINER_OPTIONS["mcollective"]="--privileged $base_opts"
CONTAINER_OPTIONS["keystone"]="-p ${BIND_ALL}5000:5000 -p ${BIND_ALL}35357:35357 $base_opts"
######
#Dependency of volumes for deployment
#####
#Host volumes
declare -A HOST_VOL
HOST_VOL['repo']="-v /var/www/nailgun:/var/www/nailgun:rw"
HOST_VOL['puppet']="-v /etc/puppet:/etc/puppet:ro"
HOST_VOL['sshkey']="-v /root/.ssh:/root/.ssh:ro"
HOST_VOL['astuteyaml']="-v /etc/fuel:/etc/fuel:ro"
HOST_VOL['logs']="-v /var/log/docker-logs:/var/log"
HOST_VOL['keys']="-v /var/lib/fuel/keys:/var/lib/fuel/keys:rw"
HOST_VOL['ibp']="-v /var/lib/fuel/ibp:/var/lib/fuel/ibp:rw"
HOST_VOL['fuel_bootstrap_cli']="-v /etc/fuel-bootstrap-cli:/etc/fuel-bootstrap-cli:rw"
HOST_VOL['logs_dump']="-v /var/log/dump:/var/dump:rw"
#Persistent directories for container data
HOST_VOL['astute_data']="-v /var/lib/fuel/container_data/$VERSION/astute:/var/lib/astute"
HOST_VOL['cobbler_data']="-v /var/lib/fuel/container_data/$VERSION/cobbler:/var/lib/cobbler"
HOST_VOL['postgres_data']="-v /var/lib/fuel/container_data/$VERSION/postgres:/var/lib/pgsql"
HOST_VOL['dnsmasq']="-v /var/lib/fuel/container_data/$VERSION/dnsmasq:/etc/dnsmasq.d"
HOST_VOL['mcollective_data']="-v /var/lib/fuel/container_data/$VERSION/mcollective:/etc/hiera"
#Storage container volume mounts
declare -A CONTAINER_VOLUMES
#Format: CONTAINER_VOLUMES[$FOO_CNT]="${HOST_VOL['foo']}"
#Storage container volumes
#Format: FOO_VOL="--volumes-from $FOO_CNT"
#Nailgun static files are in nailgun container
NAILGUN_VOL="--volumes-from ${CONTAINER_NAMES['nailgun']}"
COBBLER_VOL="--volumes-from ${CONTAINER_NAMES['cobbler']}"
ASTUTE_VOL="--volumes-from ${CONTAINER_NAMES['astute']}"
#App container volume mounts
###requirements cheat sheet
###ALL: astuteyaml repo logs
###puppet: rsync
###sshkey: nailgun cobbler astute mcollective ostf
###repo: nginx mcollective
###nailgun: nginx
###cobbler: mcollective
###astute: mcollective
declare -A REQS
REQS["${HOST_VOL['astuteyaml']}"]="cobbler postgres rabbitmq rsync astute nailgun ostf nginx rsyslog mcollective keystone"
REQS["${HOST_VOL['keys']}"]="mcollective astute"
REQS["${HOST_VOL['repo']}"]="cobbler postgres rabbitmq rsync astute nailgun ostf nginx rsyslog mcollective keystone"
REQS["${HOST_VOL['logs']}"]="cobbler postgres rabbitmq rsync astute nailgun ostf nginx rsyslog mcollective keystone"
#Most containers work from local integrated puppet, but rsync needs to serve host puppet
REQS["${HOST_VOL['puppet']}"]="rsync"
#Uncomment to enable host puppet manifests
#REQS["${HOST_VOL['puppet']}"]="cobbler postgres rabbitmq rsync astute nailgun ostf nginx rsyslog mcollective keystone"
REQS["${HOST_VOL['astute_data']}"]="astute"
REQS["${HOST_VOL['cobbler_data']}"]="cobbler"
REQS["${HOST_VOL['dnsmasq']}"]="cobbler mcollective"
REQS["${HOST_VOL['postgres_data']}"]="postgres"
REQS["${HOST_VOL['mcollective_data']}"]="mcollective"
REQS["${HOST_VOL['sshkey']}"]="nailgun cobbler astute mcollective ostf"
REQS["${HOST_VOL['ibp']}"]="mcollective"
REQS["$NAILGUN_VOL"]="nginx"
REQS["$COBBLER_VOL"]="mcollective"
REQS["$ASTUTE_VOL"]="mcollective"
REQS["${HOST_VOL['fuel_bootstrap_cli']}"]="mcollective"
REQS["${HOST_VOL['logs_dump']}"]="mcollective nginx"
#assemble requirements
for requirement in "${!REQS[@]}"; do
for container in ${REQS["$requirement"]}; do
CONTAINER_VOLUMES["$container"]+="${requirement} "
done
done
#backup settings
SYSTEM_DIRS="/etc/fuel /var/lib/fuel /root/.ssh /var/www/nailgun/plugins"
FULL_BACKUP_DIRS="/etc/puppet /var/www/nailgun"
BACKUP_ROOT="/var/backup/fuel"
# number of retries for "docker check"
CHECK_RETRIES=240

View File

@ -1,38 +0,0 @@
#!/usr/bin/python
# Copyright 2014 Mirantis, Inc.
#
# 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 sys
import yaml
astuteyaml = sys.argv[1]
data = yaml.load(open(astuteyaml))
def traverse(data, head=''):
if isinstance(data, dict):
for key, value in data.iteritems():
new_head = "{head}_{tail}".format(head=head, tail=key).lstrip('_')
traverse(value, new_head)
elif isinstance(data, (unicode, str)):
if "'" in data:
print("#Skipped because value contains single quote")
print("#{head}='{value}'".format(head=head, value=data))
print("{head}='{value}'".format(head=head, value=data))
elif isinstance(data, list):
for i, item in enumerate(data):
new_head = "{head}_{tail}".format(head=head, tail=i).lstrip('_')
traverse(item, new_head)
traverse(data)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
#!/bin/bash
# Copyright 2016 Mirantis, Inc.
#
# 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.
deprecation_message="Deprecation Warning:
*$(basename $0)* command is deprecated and will be removed in next major release.
We are not using docker containers any more.
Please use *fuel-utils* command, for basic services check
"
echo "${deprecation_message}"

View File

@ -23,7 +23,6 @@ BuildRequires: rubygem-librarian-puppet-simple
Requires: fuel-misc python-fuelclient
%define files_source %{_builddir}/%{name}-%{version}/files
%define dockerctl_source %{files_source}/fuel-docker-utils
%define fuel_utils_source %{files_source}/fuel-utils
%define openstack_version liberty-%{fuel_release}
%define predefined_upstream_modules %{_sourcedir}/upstream_modules.tar.gz
@ -37,8 +36,6 @@ This package contains deployment manifests and code to execute provisioning of m
%prep
%setup -cq
sed -i %{dockerctl_source}/dockerctl_config -e 's:_VERSION_:%{fuel_release}:'
sed -i deployment/puppet/docker/templates/dockerctl_config.erb -e 's:_VERSION_:%{fuel_release}:'
%build
if test -s %{predefined_upstream_modules}; then
@ -49,10 +46,6 @@ else
fi
fi
%check
grep -qv "_VERSION_" %{dockerctl_source}/dockerctl_config
grep -qv "_VERSION_" deployment/puppet/docker/templates/dockerctl_config.erb
%install
mkdir -p %{buildroot}/etc/puppet/%{openstack_version}/modules/
mkdir -p %{buildroot}/etc/puppet/%{openstack_version}/manifests/
@ -60,12 +53,10 @@ mkdir -p %{buildroot}/etc/fuel/
mkdir -p %{buildroot}/etc/monit.d/
mkdir -p %{buildroot}/etc/profile.d/
mkdir -p %{buildroot}/etc/init.d/
mkdir -p %{buildroot}/etc/dockerctl
mkdir -p %{buildroot}/etc/fuel-utils
mkdir -p %{buildroot}/usr/bin/
mkdir -p %{buildroot}/usr/sbin/
mkdir -p %{buildroot}/usr/lib/
mkdir -p %{buildroot}/usr/share/dockerctl
mkdir -p %{buildroot}/usr/share/fuel-utils
mkdir -p %{buildroot}/sbin/
mkdir -p %{buildroot}/sbin/
@ -73,14 +64,9 @@ cp -fr %{_builddir}/%{name}-%{version}/deployment/puppet/* %{buildroot}/etc/pupp
#LP1515988
find %{buildroot}/etc/puppet/%{openstack_version}/modules -maxdepth 2 -type d \( -name .git -or -name spec \) -exec rm -rf '{}' +
cp -f %{_builddir}/%{name}-%{version}/deployment/Puppetfile %{buildroot}/etc/puppet/%{openstack_version}/modules/
#FUEL DOCKERCTL UTILITY
install -m 0644 %{dockerctl_source}/dockerctl-alias.sh %{buildroot}/etc/profile.d/dockerctl.sh
install -m 0755 %{dockerctl_source}/dockerctl %{buildroot}/usr/bin
install -m 0755 %{dockerctl_source}/fuel_get_service_credentials %{buildroot}/usr/bin
install -m 0644 %{dockerctl_source}/dockerctl_config %{buildroot}/etc/dockerctl/config
install -m 0644 %{dockerctl_source}/functions.sh %{buildroot}/usr/share/dockerctl/functions
#fuel-utils
install -m 0755 %{fuel_utils_source}/fuel-utils %{buildroot}/usr/bin
install -m 0755 %{fuel_utils_source}/dockerctl %{buildroot}/usr/bin
install -m 0755 %{fuel_utils_source}/flat_yaml.py %{buildroot}/usr/bin
install -m 0644 %{fuel_utils_source}/config %{buildroot}/etc/fuel-utils/config
install -m 0644 %{fuel_utils_source}/functions.sh %{buildroot}/usr/share/fuel-utils/functions.sh
@ -168,36 +154,14 @@ fi
/etc/puppet/%{openstack_version}/modules/
/etc/puppet/%{openstack_version}/manifests/
%package -n fuel-dockerctl
Summary: Fuel project utilities for Docker container management tool
Version: %{version}
Release: %{release}
Group: System Environment/Libraries
License: GPLv2
Provides: fuel-docker-utils
URL: http://github.com/openstack/fuel-library
BuildArch: noarch
BuildRoot: %{_tmppath}/fuel-library-%{version}-%{release}
%description -n fuel-dockerctl
This package contains a set of helpers to manage docker containers
during Fuel All-in-One deployment toolkit installation
%files -n fuel-dockerctl
/etc/profile.d/dockerctl.sh
/usr/bin/dockerctl
/usr/bin/fuel_get_service_credentials
/usr/share/dockerctl/functions
%config(noreplace) /etc/dockerctl/config
%package -n fuel-utils
Summary: Fuel project utilities
Version: %{version}
Release: %{release}
Group: System Environment/Libraries
License: GPLv2
Provides: fuel-utils
Obsoletes: fuel-dockerctl <= %{version}
Provides: fuel-utils = %{version}
URL: http://github.com/openstack/fuel-library
BuildArch: noarch
BuildRoot: %{_tmppath}/fuel-library-%{version}-%{release}
@ -206,6 +170,7 @@ BuildRoot: %{_tmppath}/fuel-library-%{version}-%{release}
This package contains a set of helpers to maintain Fuel services
%files -n fuel-utils
/usr/bin/dockerctl
/usr/bin/fuel-utils
/usr/bin/flat_yaml.py
/usr/share/fuel-utils/functions.sh