Merge "Update docker compute environment to use json config"
This commit is contained in:
commit
338a2bcfb3
@ -67,8 +67,24 @@ resources:
|
|||||||
config: {get_resource: CopyEtcConfig}
|
config: {get_resource: CopyEtcConfig}
|
||||||
servers: {get_param: servers}
|
servers: {get_param: servers}
|
||||||
|
|
||||||
|
CopyJsonConfig:
|
||||||
|
type: OS::Heat::SoftwareConfig
|
||||||
|
properties:
|
||||||
|
group: script
|
||||||
|
outputs:
|
||||||
|
- name: result
|
||||||
|
config: {get_file: ./generate_json_config.sh}
|
||||||
|
|
||||||
|
CopyJsonDeployment:
|
||||||
|
type: OS::Heat::SoftwareDeployments
|
||||||
|
depends_on: CopyEtcDeployment
|
||||||
|
properties:
|
||||||
|
config: {get_resource: CopyJsonConfig}
|
||||||
|
servers: {get_param: servers}
|
||||||
|
|
||||||
NovaComputeContainersDeploymentOVS:
|
NovaComputeContainersDeploymentOVS:
|
||||||
type: OS::Heat::StructuredDeployments
|
type: OS::Heat::StructuredDeployments
|
||||||
|
depends_on: CopyJsonDeployment
|
||||||
properties:
|
properties:
|
||||||
config: {get_resource: NovaComputeContainersConfigOVS}
|
config: {get_resource: NovaComputeContainersConfigOVS}
|
||||||
servers: {get_param: servers}
|
servers: {get_param: servers}
|
||||||
@ -87,8 +103,9 @@ resources:
|
|||||||
volumes:
|
volumes:
|
||||||
- /run:/run
|
- /run:/run
|
||||||
- /lib/modules:/lib/modules:ro
|
- /lib/modules:/lib/modules:ro
|
||||||
|
- /var/lib/etc-data/json-config/ovs-vswitchd.json:/var/lib/kolla/config_files/config.json
|
||||||
environment:
|
environment:
|
||||||
- KOLLA_CONFIG_STRATEGY=CONFIG_EXTERNAL_COPY_ALWAYS
|
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
|
||||||
|
|
||||||
openvswitchdb:
|
openvswitchdb:
|
||||||
image: {get_param: DockerOpenvswitchDBImage}
|
image: {get_param: DockerOpenvswitchDBImage}
|
||||||
@ -97,8 +114,9 @@ resources:
|
|||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- /run:/run
|
- /run:/run
|
||||||
|
- /var/lib/etc-data/json-config/ovs-dbserver.json:/var/lib/kolla/config_files/config.json
|
||||||
environment:
|
environment:
|
||||||
- KOLLA_CONFIG_STRATEGY=CONFIG_EXTERNAL_COPY_ALWAYS
|
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
|
||||||
|
|
||||||
NovaComputeContainersDeploymentNetconfig:
|
NovaComputeContainersDeploymentNetconfig:
|
||||||
type: OS::Heat::SoftwareDeployments
|
type: OS::Heat::SoftwareDeployments
|
||||||
@ -122,7 +140,7 @@ resources:
|
|||||||
|
|
||||||
LibvirtContainersDeployment:
|
LibvirtContainersDeployment:
|
||||||
type: OS::Heat::StructuredDeployments
|
type: OS::Heat::StructuredDeployments
|
||||||
depends_on: [CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig]
|
depends_on: [CopyJsonDeployment, CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig]
|
||||||
properties:
|
properties:
|
||||||
config: {get_resource: LibvirtContainersConfig}
|
config: {get_resource: LibvirtContainersConfig}
|
||||||
servers: {get_param: servers}
|
servers: {get_param: servers}
|
||||||
@ -135,6 +153,9 @@ resources:
|
|||||||
computedata:
|
computedata:
|
||||||
image: {get_param: DockerComputeDataImage}
|
image: {get_param: DockerComputeDataImage}
|
||||||
container_name: computedata
|
container_name: computedata
|
||||||
|
volumes:
|
||||||
|
- /var/lib/nova/instances
|
||||||
|
- /var/lib/libvirt
|
||||||
|
|
||||||
libvirt:
|
libvirt:
|
||||||
image: {get_param: DockerLibvirtImage}
|
image: {get_param: DockerLibvirtImage}
|
||||||
@ -146,16 +167,16 @@ resources:
|
|||||||
volumes:
|
volumes:
|
||||||
- /run:/run
|
- /run:/run
|
||||||
- /lib/modules:/lib/modules:ro
|
- /lib/modules:/lib/modules:ro
|
||||||
- /var/lib/etc-data/libvirt/libvirtd.conf:/opt/kolla/libvirtd/libvirtd.conf
|
- /var/lib/etc-data/json-config/nova-libvirt.json:/var/lib/kolla/config_files/config.json
|
||||||
- /var/lib/nova/instances:/var/lib/nova/instances
|
- /var/lib/etc-data/libvirt/libvirtd.conf:/var/lib/kolla/config_files/libvirtd.conf
|
||||||
environment:
|
environment:
|
||||||
- KOLLA_CONFIG_STRATEGY=CONFIG_EXTERNAL_COPY_ALWAYS
|
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
|
||||||
volumes_from:
|
volumes_from:
|
||||||
- computedata
|
- computedata
|
||||||
|
|
||||||
NovaComputeContainersDeployment:
|
NovaComputeContainersDeployment:
|
||||||
type: OS::Heat::StructuredDeployments
|
type: OS::Heat::StructuredDeployments
|
||||||
depends_on: [CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig, LibvirtContainersDeployment]
|
depends_on: [CopyJsonDeployment, CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig, LibvirtContainersDeployment]
|
||||||
properties:
|
properties:
|
||||||
config: {get_resource: NovaComputeContainersConfig}
|
config: {get_resource: NovaComputeContainersConfig}
|
||||||
servers: {get_param: servers}
|
servers: {get_param: servers}
|
||||||
@ -174,15 +195,15 @@ resources:
|
|||||||
volumes:
|
volumes:
|
||||||
- /run:/run
|
- /run:/run
|
||||||
- /lib/modules:/lib/modules:ro
|
- /lib/modules:/lib/modules:ro
|
||||||
|
- /var/lib/etc-data/json-config/neutron-openvswitch-agent.json:/var/lib/kolla/config_files/config.json
|
||||||
- /var/lib/etc-data/neutron/neutron.conf:/etc/kolla/neutron-openvswitch-agent/:ro
|
- /var/lib/etc-data/neutron/neutron.conf:/etc/kolla/neutron-openvswitch-agent/:ro
|
||||||
- /var/lib/etc-data/neutron/plugins/ml2/ml2_conf.ini:/etc/kolla/neutron-openvswitch-agent/:ro
|
- /var/lib/etc-data/neutron/plugins/ml2/ml2_conf.ini:/var/lib/kolla/config_files/ml2_conf.ini:ro
|
||||||
|
- /var/lib/etc-data/neutron/neutron.conf:/var/lib/kolla/config_files/neutron.conf:ro
|
||||||
environment:
|
environment:
|
||||||
- KOLLA_CONFIG_STRATEGY=CONFIG_EXTERNAL_COPY_ALWAYS
|
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
|
||||||
volumes_from:
|
volumes_from:
|
||||||
- computedata
|
- computedata
|
||||||
# FIXME: Kolla now uses a JSON model to run custom commands. We rebuilt a custom container to read in KOLLA_COMMAND_ARGS
|
|
||||||
|
|
||||||
# FIXME: Here we're subjugating kolla's start scripts because we want our custom run command
|
|
||||||
neutronagent:
|
neutronagent:
|
||||||
image: {get_param: DockerOpenvswitchImage}
|
image: {get_param: DockerOpenvswitchImage}
|
||||||
container_name: neutronagent
|
container_name: neutronagent
|
||||||
@ -193,12 +214,11 @@ resources:
|
|||||||
volumes:
|
volumes:
|
||||||
- /run:/run
|
- /run:/run
|
||||||
- /lib/modules:/lib/modules:ro
|
- /lib/modules:/lib/modules:ro
|
||||||
- /var/lib/etc-data/neutron/neutron.conf:/etc/neutron/neutron.conf:ro
|
- /var/lib/etc-data/json-config/neutron-agent.json:/var/lib/kolla/config_files/config.json
|
||||||
- /var/lib/etc-data/neutron/plugins/ml2/openvswitch_agent.ini:/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini:ro
|
- /var/lib/etc-data/neutron/plugins/ml2/openvswitch_agent.ini:/var/lib/kolla/config_files/ovs_neutron_plugin.ini:ro
|
||||||
|
- /var/lib/etc-data/neutron/neutron.conf:/var/lib/kolla/config_files/neutron.conf:ro
|
||||||
environment:
|
environment:
|
||||||
- KOLLA_CONFIG_STRATEGY=CONFIG_EXTERNAL_COPY_ALWAYS
|
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
|
||||||
# FIXME: Kolla now uses a JSON model to run custom commands. We rebuilt a custom container to read in KOLLA_COMMAND_ARGS
|
|
||||||
- KOLLA_COMMAND_ARGS=--config-file /usr/share/neutron/neutron-dist.conf --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
|
|
||||||
volumes_from:
|
volumes_from:
|
||||||
- computedata
|
- computedata
|
||||||
|
|
||||||
@ -212,14 +232,12 @@ resources:
|
|||||||
- /run:/run
|
- /run:/run
|
||||||
- /sys/fs/cgroup:/sys/fs/cgroup
|
- /sys/fs/cgroup:/sys/fs/cgroup
|
||||||
- /lib/modules:/lib/modules:ro
|
- /lib/modules:/lib/modules:ro
|
||||||
- /var/lib/etc-data/:/etc/:ro
|
- /var/lib/etc-data/json-config/nova-compute.json:/var/lib/kolla/config_files/config.json
|
||||||
- /var/lib/nova/instances:/var/lib/nova/instances
|
- /var/lib/etc-data/nova/nova.conf:/var/lib/kolla/config_files/nova.conf:ro
|
||||||
|
environment:
|
||||||
|
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
|
||||||
volumes_from:
|
volumes_from:
|
||||||
- computedata
|
- computedata
|
||||||
# FIXME: this skips the kolla start.sh script and just starts Nova
|
|
||||||
# Ideally we'd have an environment that switched the kolla container
|
|
||||||
# to be externally configured.
|
|
||||||
command: /usr/bin/nova-compute
|
|
||||||
|
|
||||||
ExtraConfig:
|
ExtraConfig:
|
||||||
depends_on: NovaComputeContainersDeployment
|
depends_on: NovaComputeContainersDeployment
|
||||||
|
@ -7,7 +7,7 @@ if ! hostname | grep compute &>/dev/null; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p /var/lib/etc-data/ #FIXME: this should be a docker data container
|
mkdir -p /var/lib/etc-data/json-config #FIXME: this should be a docker data container
|
||||||
|
|
||||||
# heat-docker-agents service
|
# heat-docker-agents service
|
||||||
cat <<EOF > /etc/systemd/system/heat-docker-agents.service
|
cat <<EOF > /etc/systemd/system/heat-docker-agents.service
|
||||||
@ -43,9 +43,6 @@ EOF
|
|||||||
/sbin/setenforce 0
|
/sbin/setenforce 0
|
||||||
/sbin/modprobe ebtables
|
/sbin/modprobe ebtables
|
||||||
|
|
||||||
# Create /var/lib/etc-data for now. FIXME: This should go into a data container.
|
|
||||||
#mkdir -p /var/lib/etc-data
|
|
||||||
|
|
||||||
echo nameserver 8.8.8.8 > /etc/resolv.conf
|
echo nameserver 8.8.8.8 > /etc/resolv.conf
|
||||||
|
|
||||||
# We need hostname -f to return in a centos container for the puppet hook
|
# We need hostname -f to return in a centos container for the puppet hook
|
||||||
|
96
docker/generate_json_config.sh
Normal file
96
docker/generate_json_config.sh
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
KOLLA_DEST=/var/lib/kolla/config_files
|
||||||
|
JSON_DEST=/var/lib/etc-data/json-config
|
||||||
|
|
||||||
|
# For more config file generation, simply define a new SERVICE_DATA_
|
||||||
|
# prefixed variable. The command string is quoted to include config-file
|
||||||
|
# arguments. Note that the variable name following SERVICE_DATA_ will be
|
||||||
|
# the filename the JSON config is written to.
|
||||||
|
|
||||||
|
# [EXAMPLE]: SERVICE_DATA_<SERVICE_NAME>=(<command> <source> <dest> <owner> <perms>)
|
||||||
|
|
||||||
|
SERVICE_DATA_NOVA_LIBVIRT=("/usr/sbin/libvirtd" libvirtd.conf /etc/libvirt/libvirtd.conf root 0644)
|
||||||
|
SERVICE_DATA_NOVA_COMPUTE=("/usr/bin/nova-compute" nova.conf /etc/nova/nova.conf nova 0600)
|
||||||
|
SERVICE_DATA_NEUTRON_OPENVSWITCH_AGENT=("/usr/bin/neutron-openvswitch-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini" neutron.conf /etc/neutron/neutron.conf neutron 0600 ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini neutron 0600)
|
||||||
|
SERVICE_DATA_NEUTRON_AGENT=("/usr/bin/neutron-openvswitch-agent --config-file /usr/share/neutron/neutron-dist.conf --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini" neutron.conf /etc/neutron/neutron.conf neutron 0600 ovs_neutron_plugin.ini /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini neutron 0600)
|
||||||
|
SERVICE_DATA_OVS_VSWITCHD=("/usr/sbin/ovs-vswitchd unix:/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --log-file=/var/log/openvswitch/ovs-vswitchd.log")
|
||||||
|
SERVICE_DATA_OVS_DBSERVER=("/usr/sbin/ovsdb-server /etc/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/run/openvswitch/db.sock --log-file=/var/log/openvswitch/ovsdb-server.log")
|
||||||
|
|
||||||
|
function create_json_header() {
|
||||||
|
local command=$1
|
||||||
|
|
||||||
|
echo "\
|
||||||
|
{
|
||||||
|
\"command\": \"${command[@]}\","
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_config_file_header() {
|
||||||
|
echo " \"config_files\": ["
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_config_file_block() {
|
||||||
|
local source=$KOLLA_DEST/$1
|
||||||
|
local dest=$2
|
||||||
|
local owner=$3
|
||||||
|
local perm=$4
|
||||||
|
|
||||||
|
printf "\
|
||||||
|
\t{
|
||||||
|
\t \"source\": \"$source\",
|
||||||
|
\t \"dest\": \"$dest\",
|
||||||
|
\t \"owner\": \"$owner\",
|
||||||
|
\t \"perm\": \"$perm\"
|
||||||
|
\t}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_trailing_comma() {
|
||||||
|
printf ", \n"
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_config_file_trailer() {
|
||||||
|
echo -e "\n ]"
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_json_trailer() {
|
||||||
|
echo "}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_json_data() {
|
||||||
|
local config_data=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
create_json_header "$config_data"
|
||||||
|
create_config_file_header
|
||||||
|
while [ "$1" ]; do
|
||||||
|
create_config_file_block "$@"
|
||||||
|
shift 4
|
||||||
|
if [ "$1" ]; then
|
||||||
|
add_trailing_comma
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
create_config_file_trailer
|
||||||
|
create_json_trailer
|
||||||
|
}
|
||||||
|
|
||||||
|
function write_json_data() {
|
||||||
|
|
||||||
|
local name=$1[@]
|
||||||
|
local service_data=("${!name}")
|
||||||
|
|
||||||
|
local service_name=${1#SERVICE_DATA_} # chop SERVICE_DATA_ prefix
|
||||||
|
service_name=${service_name//_/-} # switch underscore to dash
|
||||||
|
service_name=${service_name,,} # change to lowercase
|
||||||
|
|
||||||
|
echo "Creating JSON file ${service_name}"
|
||||||
|
create_json_data "${service_data[@]}" > "$JSON_DEST/$service_name.json"
|
||||||
|
}
|
||||||
|
|
||||||
|
function process_configs() {
|
||||||
|
for service in ${!SERVICE_DATA_*}; do
|
||||||
|
write_json_data "${service}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
process_configs
|
@ -7,11 +7,12 @@ resource_registry:
|
|||||||
parameters:
|
parameters:
|
||||||
NovaImage: atomic-image
|
NovaImage: atomic-image
|
||||||
|
|
||||||
|
# FIXME: When Kolla cuts liberty tag we can use kollaglue registry
|
||||||
parameter_defaults:
|
parameter_defaults:
|
||||||
DockerComputeImage: rthallisey/centos-binary-nova-compute:liberty
|
DockerComputeImage: rthallisey/centos-binary-nova-compute:liberty
|
||||||
DockerComputeDataImage: kollaglue/centos-rdo-nova-compute-data:liberty2
|
DockerComputeDataImage: rthallisey/centos-binary-data:liberty
|
||||||
DockerLibvirtImage: kollaglue/centos-rdo-nova-libvirt:liberty2
|
DockerLibvirtImage: rthallisey/centos-binary-nova-libvirt:liberty
|
||||||
DockerNeutronAgentImage: kollaglue/centos-rdo-neutron-agents:liberty2
|
DockerNeutronAgentImage: rthallisey/centos-binary-neutron-agents:liberty
|
||||||
DockerOpenvswitchImage: rthallisey/centos-rdo-neutron-openvswitch-agent:latest
|
DockerOpenvswitchImage: rthallisey/centos-binary-neutron-openvswitch-agent:liberty
|
||||||
DockerOvsVswitchdImage: kollaglue/centos-rdo-ovs-vswitchd:liberty2
|
DockerOvsVswitchdImage: rthallisey/centos-binary-openvswitch-vswitchd:liberty
|
||||||
DockerOpenvswitchDBImage: kollaglue/centos-rdo-ovs-db-server:liberty2
|
DockerOpenvswitchDBImage: rthallisey/centos-binary-openvswitch-db-server:liberty
|
||||||
|
Loading…
Reference in New Issue
Block a user