Using local registry in devstack.

This patch runs a registry container during the installation of
devstack

Change-Id: I5e5a89cd9c65d1ea5b47fece985dbc044bfdec5e
This commit is contained in:
wu.chunyang 2022-11-21 22:45:57 +08:00
parent 1d8231d31f
commit 1f1e2becfe
5 changed files with 47 additions and 6 deletions

View File

@ -1 +1,2 @@
libxslt1-dev # testonly
docker.io

View File

@ -1 +1,2 @@
libxslt-devel # testonly
docker

View File

@ -274,6 +274,8 @@ function configure_trove {
iniset $TROVE_GUESTAGENT_CONF mysql docker_image ${TROVE_DATABASE_IMAGE_MYSQL}
iniset $TROVE_GUESTAGENT_CONF mysql backup_docker_image ${TROVE_DATABASE_BACKUP_IMAGE_MYSQL}
iniset $TROVE_GUESTAGENT_CONF mariadb docker_image ${TROVE_DATABASE_IMAGE_MARIADB}
iniset $TROVE_GUESTAGENT_CONF mariadb backup_docker_image ${TROVE_DATABASE_BACKUP_IMAGE_MARIADB}
iniset $TROVE_GUESTAGENT_CONF postgresql docker_image ${TROVE_DATABASE_IMAGE_POSTGRES}
iniset $TROVE_GUESTAGENT_CONF postgresql backup_docker_image ${TROVE_DATABASE_BACKUP_IMAGE_POSTGRES}
@ -501,6 +503,20 @@ function create_guest_image {
fi
}
function create_registry_container {
# running a docker registry container
echo "Running a docker registry container..."
container=$(sudo docker ps -a --format "{{.Names}}" --filter name=registry)
if [ -z $container ]; then
sudo docker run -d --net=host -e REGISTRY_HTTP_ADDR=0.0.0.0:4000 --restart=always -v /opt/trove_registry/:/var/lib/registry --name registry registry:2
trove_agent_datastore_url=https://tarballs.opendev.org/openstack/trove/images/trove-datastore-registry-master.tar.gz
curl -o trove-datastore-registry-master.tar.gz $trove_agent_datastore_url
sudo tar -zxvf trove-datastore-registry-master.tar.gz -C /opt/trove_registry/
rm -rf trove-datastore-registry-master.tar.gz
fi
iniset $TROVE_CONF DEFAULT docker_insecure_registries "$TROVE_HOST_GATEWAY:4000"
}
# Set up Trove management network and make configuration change.
function config_trove_network {
echo "Finalizing Neutron networking for Trove"
@ -639,6 +655,9 @@ if is_service_enabled trove; then
config_mgmt_security_group
config_trove_network
create_guest_image
if [ "$TROVE_ENABLE_LOCAL_REGISTRY" == "True" ] ; then
create_registry_container
fi
echo_summary "Starting Trove"
start_trove

View File

@ -5,6 +5,8 @@
TROVE_DIR=${TROVE_DIR:-${DEST}/trove}
TROVE_REPO=${TROVE_REPO:-${GIT_BASE}/openstack/trove.git}
TROVE_BRANCH=${TROVE_BRANCH:-master}
# Default is set to False
TROVE_ENABLE_LOCAL_REGISTRY=${TROVE_ENABLE_LOCAL_REGISTRY:-False}
TROVE_CLIENT_DIR=${TROVE_CLIENT_DIR:-${TROVECLIENT_DIR:-${DEST}/python-troveclient}}
TROVE_CLIENT_REPO=${TROVE_CLIENT_REPO:-${TROVECLIENT_REPO:-${GIT_BASE}/openstack/python-troveclient.git}}
@ -87,7 +89,16 @@ TROVE_ENABLE_IMAGE_BUILD=${TROVE_ENABLE_IMAGE_BUILD:-"true"}
TROVE_NON_DEV_IMAGE_URL=${TROVE_NON_DEV_IMAGE_URL:-""}
# Customized database container images
TROVE_DATABASE_IMAGE_MYSQL=${TROVE_DATABASE_IMAGE_MYSQL:-"catalystcloud/mysql"}
TROVE_DATABASE_IMAGE_POSTGRES=${TROVE_DATABASE_IMAGE_POSTGRES:-"catalystcloud/postgres"}
TROVE_DATABASE_BACKUP_IMAGE_MYSQL=${TROVE_DATABASE_BACKUP_IMAGE_MYSQL:-"catalystcloud/db-backup-mysql:1.1.0"}
TROVE_DATABASE_BACKUP_IMAGE_POSTGRES=${TROVE_DATABASE_BACKUP_IMAGE_POSTGRES:-"catalystcloud/db-backup-postgresql:1.1.2"}
if [ "$TROVE_ENABLE_LOCAL_REGISTRY" == "True" ] ; then
TROVE_DATABASE_IMAGE_MYSQL=${TROVE_DATABASE_IMAGE_MYSQL:-"$TROVE_HOST_GATEWAY:4000/trove-datastores/mysql"}
TROVE_DATABASE_IMAGE_MARIADB=${TROVE_DATABASE_IMAGE_MARIAD:-"$TROVE_HOST_GATEWAY:4000/trove-datastores/mariadb"}
TROVE_DATABASE_IMAGE_POSTGRES=${TROVE_DATABASE_IMAGE_POSTGRES:-"$TROVE_HOST_GATEWAY:4000/trove-datastores/postgres"}
TROVE_DATABASE_BACKUP_IMAGE_MYSQL=${TROVE_DATABASE_BACKUP_IMAGE_MYSQL:-"$TROVE_HOST_GATEWAY:4000/trove-datastores/db-backup-mysql:1.1.0"}
TROVE_DATABASE_BACKUP_IMAGE_MARIADB=${TROVE_DATABASE_BACKUP_IMAGE_MARIADB:-"$TROVE_HOST_GATEWAY:4000/trove-datastores/db-backup-mariadb:1.1.0"}
TROVE_DATABASE_BACKUP_IMAGE_POSTGRES=${TROVE_DATABASE_BACKUP_IMAGE_POSTGRES:-"$TROVE_HOST_GATEWAY:4000/trove-datastores/db-backup-postgresql:1.1.2"}
else
TROVE_DATABASE_IMAGE_MYSQL=${TROVE_DATABASE_IMAGE_MYSQL:-"catalystcloud/mysql"}
TROVE_DATABASE_IMAGE_POSTGRES=${TROVE_DATABASE_IMAGE_POSTGRES:-"catalystcloud/postgres"}
TROVE_DATABASE_BACKUP_IMAGE_MYSQL=${TROVE_DATABASE_BACKUP_IMAGE_MYSQL:-"catalystcloud/db-backup-mysql:1.1.0"}
TROVE_DATABASE_BACKUP_IMAGE_POSTGRES=${TROVE_DATABASE_BACKUP_IMAGE_POSTGRES:-"catalystcloud/db-backup-postgresql:1.1.2"}
fi

View File

@ -46,6 +46,8 @@
Q_PLUGIN: ml2
Q_ML2_TENANT_NETWORK_TYPE: vxlan
Q_ML2_PLUGIN_MECHANISM_DRIVERS: openvswitch
TROVE_ENABLE_LOCAL_REGISTRY: True
TROVE_DATASTORE_VERSION: 5.7
run: playbooks/trove-devstack-base.yaml
irrelevant-files:
- ^.*\.rst$
@ -290,11 +292,17 @@
Q_PLUGIN: ml2
Q_ML2_TENANT_NETWORK_TYPE: vxlan
Q_ML2_PLUGIN_MECHANISM_DRIVERS: openvswitch
TROVE_ENABLE_LOCAL_REGISTRY: True
TROVE_DATASTORE_VERSION: 5.7
devstack_local_conf:
post-config:
$TROVE_CONF:
DEFAULT:
usage_timeout: 1800
test-config:
$TEMPEST_CONFIG:
database:
default_datastore_versions: mysql:5.7
devstack_plugins:
trove: https://opendev.org/openstack/trove.git
devstack_services:
@ -356,7 +364,8 @@
Q_ML2_TENANT_NETWORK_TYPE: vxlan
Q_ML2_PLUGIN_MECHANISM_DRIVERS: openvswitch
TROVE_DATASTORE_TYPE: postgresql
TROVE_DATASTORE_VERSION: 12.4
TROVE_DATASTORE_VERSION: 12
TROVE_ENABLE_LOCAL_REGISTRY: True
devstack_local_conf:
post-config:
$TROVE_CONF:
@ -366,7 +375,7 @@
$TEMPEST_CONFIG:
database:
enabled_datastores: "postgresql"
default_datastore_versions: "postgresql:12.4"
default_datastore_versions: "postgresql:12"
devstack_plugins:
trove: https://opendev.org/openstack/trove.git
devstack_services: