aboutsummaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
Diffstat (limited to 'docker')
-rw-r--r--docker/compute-post.yaml62
-rw-r--r--docker/firstboot/start_docker_agents.sh5
-rw-r--r--docker/generate_json_config.sh96
3 files changed, 137 insertions, 26 deletions
diff --git a/docker/compute-post.yaml b/docker/compute-post.yaml
index 0d049ebc..2a37b62c 100644
--- a/docker/compute-post.yaml
+++ b/docker/compute-post.yaml
@@ -67,8 +67,24 @@ resources:
config: {get_resource: CopyEtcConfig}
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:
type: OS::Heat::StructuredDeployments
+ depends_on: CopyJsonDeployment
properties:
config: {get_resource: NovaComputeContainersConfigOVS}
servers: {get_param: servers}
@@ -87,8 +103,9 @@ resources:
volumes:
- /run:/run
- /lib/modules:/lib/modules:ro
+ - /var/lib/etc-data/json-config/ovs-vswitchd.json:/var/lib/kolla/config_files/config.json
environment:
- - KOLLA_CONFIG_STRATEGY=CONFIG_EXTERNAL_COPY_ALWAYS
+ - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
openvswitchdb:
image: {get_param: DockerOpenvswitchDBImage}
@@ -97,8 +114,9 @@ resources:
restart: always
volumes:
- /run:/run
+ - /var/lib/etc-data/json-config/ovs-dbserver.json:/var/lib/kolla/config_files/config.json
environment:
- - KOLLA_CONFIG_STRATEGY=CONFIG_EXTERNAL_COPY_ALWAYS
+ - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
NovaComputeContainersDeploymentNetconfig:
type: OS::Heat::SoftwareDeployments
@@ -122,7 +140,7 @@ resources:
LibvirtContainersDeployment:
type: OS::Heat::StructuredDeployments
- depends_on: [CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig]
+ depends_on: [CopyJsonDeployment, CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig]
properties:
config: {get_resource: LibvirtContainersConfig}
servers: {get_param: servers}
@@ -135,6 +153,9 @@ resources:
computedata:
image: {get_param: DockerComputeDataImage}
container_name: computedata
+ volumes:
+ - /var/lib/nova/instances
+ - /var/lib/libvirt
libvirt:
image: {get_param: DockerLibvirtImage}
@@ -146,16 +167,16 @@ resources:
volumes:
- /run:/run
- /lib/modules:/lib/modules:ro
- - /var/lib/etc-data/libvirt/libvirtd.conf:/opt/kolla/libvirtd/libvirtd.conf
- - /var/lib/nova/instances:/var/lib/nova/instances
+ - /var/lib/etc-data/json-config/nova-libvirt.json:/var/lib/kolla/config_files/config.json
+ - /var/lib/etc-data/libvirt/libvirtd.conf:/var/lib/kolla/config_files/libvirtd.conf
environment:
- - KOLLA_CONFIG_STRATEGY=CONFIG_EXTERNAL_COPY_ALWAYS
+ - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
volumes_from:
- computedata
NovaComputeContainersDeployment:
type: OS::Heat::StructuredDeployments
- depends_on: [CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig, LibvirtContainersDeployment]
+ depends_on: [CopyJsonDeployment, CopyEtcDeployment, ComputePuppetDeployment, NovaComputeContainersDeploymentNetconfig, LibvirtContainersDeployment]
properties:
config: {get_resource: NovaComputeContainersConfig}
servers: {get_param: servers}
@@ -174,15 +195,15 @@ resources:
volumes:
- /run:/run
- /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/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:
- - KOLLA_CONFIG_STRATEGY=CONFIG_EXTERNAL_COPY_ALWAYS
+ - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
volumes_from:
- 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:
image: {get_param: DockerOpenvswitchImage}
container_name: neutronagent
@@ -193,12 +214,11 @@ resources:
volumes:
- /run:/run
- /lib/modules:/lib/modules:ro
- - /var/lib/etc-data/neutron/neutron.conf:/etc/neutron/neutron.conf:ro
- - /var/lib/etc-data/neutron/plugins/ml2/openvswitch_agent.ini:/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini: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:/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:
- - KOLLA_CONFIG_STRATEGY=CONFIG_EXTERNAL_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
+ - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
volumes_from:
- computedata
@@ -212,14 +232,12 @@ resources:
- /run:/run
- /sys/fs/cgroup:/sys/fs/cgroup
- /lib/modules:/lib/modules:ro
- - /var/lib/etc-data/:/etc/:ro
- - /var/lib/nova/instances:/var/lib/nova/instances
+ - /var/lib/etc-data/json-config/nova-compute.json:/var/lib/kolla/config_files/config.json
+ - /var/lib/etc-data/nova/nova.conf:/var/lib/kolla/config_files/nova.conf:ro
+ environment:
+ - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
volumes_from:
- 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:
depends_on: NovaComputeContainersDeployment
diff --git a/docker/firstboot/start_docker_agents.sh b/docker/firstboot/start_docker_agents.sh
index caf511bd..cb7c57ff 100644
--- a/docker/firstboot/start_docker_agents.sh
+++ b/docker/firstboot/start_docker_agents.sh
@@ -7,7 +7,7 @@ if ! hostname | grep compute &>/dev/null; then
exit 0
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
cat <<EOF > /etc/systemd/system/heat-docker-agents.service
@@ -43,9 +43,6 @@ EOF
/sbin/setenforce 0
/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
# We need hostname -f to return in a centos container for the puppet hook
diff --git a/docker/generate_json_config.sh b/docker/generate_json_config.sh
new file mode 100644
index 00000000..5cf49226
--- /dev/null
+++ b/docker/generate_json_config.sh
@@ -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