nodepool-builder: deploy from container
This deploys the nodepool-builder container and verifies it has started in testinfra. Change-Id: I8a717d06f1291a4112b2753641ff88f074cf0b31
This commit is contained in:
parent
b2b0cc1c83
commit
1979d6b160
@ -849,6 +849,7 @@
|
||||
- playbooks/group_vars/nodepool-builder.yaml
|
||||
- playbooks/group_vars/nodepool-launcher.yaml
|
||||
- playbooks/roles/configure-openstacksdk/
|
||||
- playbooks/roles/nodepool.*
|
||||
- playbooks/templates/clouds/
|
||||
- testinfra/test_nodepool.py
|
||||
|
||||
|
@ -1 +1,6 @@
|
||||
nodepool_base_install_zookeeper: False
|
||||
nodepool_base_install_zookeeper: False
|
||||
|
||||
# Keep these in sync with the container uid's so containers can write
|
||||
# to local bits and pieces.
|
||||
nodepool_base_nodepool_uid: 10001
|
||||
nodepool_base_nodepool_gid: 10001
|
@ -2,6 +2,7 @@
|
||||
group:
|
||||
name: nodepool
|
||||
state: present
|
||||
gid: '{{ nodepool_base_nodepool_gid }}'
|
||||
|
||||
- name: Add the nodepool user
|
||||
user:
|
||||
@ -10,6 +11,7 @@
|
||||
home: /home/nodepool
|
||||
create_home: yes
|
||||
shell: /bin/bash
|
||||
uid: '{{ nodepool_base_nodepool_uid }}'
|
||||
|
||||
- name: Install zookeeper
|
||||
include_role:
|
||||
|
8
playbooks/roles/nodepool-builder/README.rst
Normal file
8
playbooks/roles/nodepool-builder/README.rst
Normal file
@ -0,0 +1,8 @@
|
||||
Deploy nodepool-builder container
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: nodepool_builder_container_tag
|
||||
:default: unset
|
||||
|
||||
Override tag for container deployment
|
0
playbooks/roles/nodepool-builder/defaults/main.yaml
Normal file
0
playbooks/roles/nodepool-builder/defaults/main.yaml
Normal file
37
playbooks/roles/nodepool-builder/tasks/main.yaml
Normal file
37
playbooks/roles/nodepool-builder/tasks/main.yaml
Normal file
@ -0,0 +1,37 @@
|
||||
- name: Ensure dib directories
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ item }}'
|
||||
mode: 0755
|
||||
owner: nodepool
|
||||
group: nodepool
|
||||
loop:
|
||||
- '/opt/dib_tmp'
|
||||
- '/opt/nodepool_dib'
|
||||
- '/var/log/nodepool/builds'
|
||||
|
||||
- name: Ensure /etc/nodepool-builder-compose directory
|
||||
file:
|
||||
state: directory
|
||||
path: /etc/nodepool-builder-compose
|
||||
mode: 0755
|
||||
|
||||
- name: Put docker-compose file in place
|
||||
template:
|
||||
src: docker-compose.yaml.j2
|
||||
dest: /etc/nodepool-builder-compose/docker-compose.yaml
|
||||
mode: 0644
|
||||
|
||||
- name: Install podman-compose
|
||||
pip:
|
||||
name: podman-compose
|
||||
state: latest
|
||||
# NOTE(mordred) Cannot use full path to pip3 here because it is
|
||||
# different on zuul test nodes and in production. This is, of
|
||||
# course, not stellar.
|
||||
executable: pip3
|
||||
|
||||
- name: Run podman-compose up
|
||||
shell:
|
||||
cmd: podman-compose up -d
|
||||
chdir: /etc/nodepool-builder-compose/
|
@ -0,0 +1,28 @@
|
||||
version: '3.0'
|
||||
services:
|
||||
nodepool-builder:
|
||||
image: docker.io/zuul/nodepool-builder:{{ nodepool_builder_container_tag|default('latest') }}
|
||||
user: nodepool
|
||||
network_mode: host
|
||||
restart: always
|
||||
|
||||
privileged: true
|
||||
|
||||
environment:
|
||||
- DEBUG=1
|
||||
|
||||
volumes:
|
||||
# NOTE(ianw): for non-containerised builds the base roles
|
||||
# (configure-openstacksdk) have always deployed the cloud config
|
||||
# in ~nodepool/.config.
|
||||
- /home/nodepool/.config/openstack:/etc/openstack:ro
|
||||
# nodepool config
|
||||
- /etc/nodepool:/etc/nodepool:ro
|
||||
# project-config
|
||||
- /opt/project-config:/opt/project-config:ro
|
||||
# dib temporary storage; see config in project-config
|
||||
- /opt/dib_tmp:/opt/dib_tmp:rw
|
||||
# dib image output; see config in project-config
|
||||
- /opt/nodepool_dib:/opt/nodepool_dib:rw
|
||||
# logs (builder + dib build logs under /build)
|
||||
- /var/log/nodepool:/var/log/nodepool:rw
|
@ -10,8 +10,12 @@
|
||||
name: "Configure nodepool builders"
|
||||
strategy: free
|
||||
roles:
|
||||
- pip3
|
||||
- install-podman
|
||||
- nodepool-base
|
||||
- configure-openstacksdk
|
||||
- nodepool-builder
|
||||
|
||||
|
||||
# TODO(ianw) 2020-03-03 : watch this space...
|
||||
#- hosts: nodepool-launcher_opendev:!disabled
|
||||
|
@ -12,8 +12,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import pytest
|
||||
|
||||
testinfra_hosts = ['nl01.openstack.org', 'nb01.openstack.org']
|
||||
testinfra_hosts = ['nl01.openstack.org', 'nb01.openstack.org',
|
||||
'nb01-test.opendev.org']
|
||||
|
||||
|
||||
def test_clouds_yaml(host):
|
||||
@ -22,9 +24,17 @@ def test_clouds_yaml(host):
|
||||
|
||||
assert b'password' in clouds_yaml.content
|
||||
|
||||
|
||||
def test_kube_config(host):
|
||||
if not host.backend.get_hostname().endswith('openstack.org'):
|
||||
pytest.skip()
|
||||
kubeconfig = host.file('/home/nodepool/.kube/config')
|
||||
assert kubeconfig.exists
|
||||
|
||||
assert b'nodepool_k8s_key' in kubeconfig.content
|
||||
|
||||
def test_builder_container_running(host):
|
||||
if host.backend.get_hostname() != 'nb01-test.opendev.org':
|
||||
pytest.skip()
|
||||
|
||||
cmd = host.run("podman ps -a --format '{{ .Names }}'")
|
||||
assert 'nodepool-builder-compose_nodepool-builder_1' in cmd.stdout
|
||||
|
Loading…
Reference in New Issue
Block a user