Support multiple base images with as little duplication of scripts as possible

Registered by Paul Bourke

Right now Kolla supports building images from different operating system base images. It does this by mirroring the set of images under a different directory tree, and updating the Dockerfiles.

While the Dockerfiles differ between base images, almost all the rest of the scripts do not. Thus it should be possible to simply maintain one set of containers and associated scripts, and multiple Dockerfiles from which to build these from.

e.g.

Current layout:

docker/
|-- centos
| |-- binary
| | |-- barbican
| | | |-- start.sh
| | | |-- Dockerfile
| | | |-- ...
| | |-- ceilometer
| | | |-- start.sh
| | | |-- Dockerfile
| | | |-- ...
|-- fedora
| |-- binary
| | |-- barbican
| | | |-- start.sh
| | | |-- Dockerfile
| | | |-- ...
| | |-- ceilometer
| | | |-- start.sh
| | | |-- Dockerfile
| | | |-- ...

Proposed layout:

docker/
|-- base-images
| |-- centos
| | |-- Dockerfile
| |-- fedora
| | |-- Dockerfile
|-- services
| |-- binary
| | |-- barbican
| | | |-- start.sh
| | | |-- ...
| | |-- ceilometer
| | | |-- start.sh
| | | |-- ...

Blueprint information

Status:
Complete
Approver:
Steven Dake
Priority:
High
Drafter:
Paul Bourke
Direction:
Approved
Assignee:
Paul Bourke
Definition:
Approved
Series goal:
Accepted for liberty
Implementation:
Implemented
Milestone target:
milestone icon liberty-1
Started by
Steven Dake
Completed by
Steven Dake

Related branches

Sprints

Whiteboard

This is sort of how it was originally structured. I am not opposed to this structure, but want to make sure the building from source and building from DEB packaging works correctly. Part of our current structure is to facilitate that operation. Thoughts on this point --sdake

pdb:
The goal is cut down the volume of duplication between images. If we fix a small bug in keystone's start.sh, we don't want to have to apply this to the same script for 10 different distros.

Currently, all images seem to have the following resources:
1) Dockerfile
2) start.sh
3) check.sh (not all yet)

Item 1) differs quite a bit between distros mainly due to different package managers, items 2) and 3) should differ very little. Hence the least invasive change may be to use the symlinking mechanism currently used for the build script for the shell scripts, but keep the directory structure largely the same. The benefit of this is that if a service for a certain distro happen to differ vastly from the same service in other distros, we can skip the symlink and have completely custom scripts there. We also keep the binary/source split to enable these options for each distro.

This leads to:

docker/
|-- base
| |-- keystone
| | |-- check.sh
| | `-- start.sh
| |-- kolla-common.sh
| `-- service_hosts.sh
|-- centos
| |-- binary
| | |-- keystone
| | | |-- Dockerfile
| | | |-- build -> ../../../../tools/build-docker-image
| | | |-- check.sh -> ../../../base/keystone/check.sh
| | | `-- start.sh -> ../../../base/keystone/start.sh
. . .

(bmace)
I think my main problem with the structure at this point and proposed is the distance between the links, conceptually. If someone is working on Keystone, for example and needs to add another library, I think it would be much simpler / faster / logical if the distro were broken out beneath the component, so keystone/base keystone/centos keystone/fedora keystone/ol keystone/ubuntu etc.

Much of the reason the current approach works reasonably well is because all images are from a common base, but once (if?) that deviates, with say a apt based distro like Debian / Ubuntu there ends up being far less in common / linkable to base. I think the flow / use of the alternate layout I suggest works fairly well even when a very different distro type is introduced. OpenStack component-centric vs. distro-centric.

LGTM - approving - sdake

Gerrit topic: https://review.openstack.org/#q,topic:bp/refactor-base-image-layout,n,z

Addressed by: https://review.openstack.org/190117
    Symlink all non Dockerfile resources in images

Addressed by: https://review.openstack.org/191486
    Add --prefix to override .buildconf

Addressed by: https://review.openstack.org/184222
    Separate base images into different folders

Addressed by: https://review.openstack.org/191071
    Create keystone user in start.sh if it doesn't exist

Gerrit topic: https://review.openstack.org/#q,topic:bp/add-optional-oraclelinux-images,n,z

Addressed by: https://review.openstack.org/193623
    Fix broken cinder/galera symlinks for fedora & rhel

Addressed by: https://review.openstack.org/193625
    Fix broken cinder symlinks for fedora

Addressed by: https://review.openstack.org/193870
    Unbreak the gate

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.