gate: utility container

Use a utility container for ipcalc on all platforms; this avoids
having to find the package on platforms where it's not easily
available and we avoid argument differences.

Change-Id: I6c6e719f8eeb8d4214ebb0111e9d8f8b659db396
This commit is contained in:
Chris Wedgwood 2018-01-29 20:20:55 +00:00 committed by Pete Birley
parent e12d626f9c
commit 00093f1b3f
5 changed files with 48 additions and 24 deletions

View File

@ -187,9 +187,14 @@ Alternatively, this step can be performed by running the script directly:
./tools/deployment/multinode/020-ingress.sh
Deploy Ceph
-----------
.. note::
The `./tools/deployment/multinode/kube-node-subnet.sh` script requires docker
to run.
.. literalinclude:: ../../../tools/deployment/multinode/030-ceph.sh
:language: shell
:lines: 1,17-

View File

@ -15,10 +15,11 @@
# under the License.
set -e
UTILS_IMAGE=docker.io/openstackhelm/gate-utils:v0.1.0
NODE_IPS=$(mktemp --suffix=.txt)
kubectl get nodes -o json | jq -r '.items[].status.addresses[] | select(.type=="InternalIP").address' | sort -V > $NODE_IPS
FIRST_IP_SUBNET=$(ipcalc "$(head -n 1 ${NODE_IPS})/24" | awk '/^Network/ { print $2 }')
LAST_IP_SUBNET=$(ipcalc "$(tail -n 1 ${NODE_IPS})/24" | awk '/^Network/ { print $2 }')
FIRST_IP_SUBNET=$(sudo docker run ${UTILS_IMAGE} ipcalc "$(head -n 1 ${NODE_IPS})/24" | awk '/^Network/ { print $2 }')
LAST_IP_SUBNET=$(sudo docker run ${UTILS_IMAGE} ipcalc "$(tail -n 1 ${NODE_IPS})/24" | awk '/^Network/ { print $2 }')
rm -f $NODE_IPS
function ip_diff {
echo $(($(echo $LAST_IP_SUBNET | awk -F '.' "{ print \$$1}") - $(echo $FIRST_IP_SUBNET | awk -F '.' "{ print \$$1}")))

View File

@ -14,28 +14,6 @@
- hosts: primary
tasks:
- name: installing ipcalc on Ubuntu
become: true
become_user: root
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
apt:
name: ipcalc
state: present
- name: installing ipcalc on CentOS
become: true
become_user: root
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
yum:
name: ipcalc
enablerepo: epel
state: present
- name: installing ipcalc on Fedora
become: true
become_user: root
when: ansible_distribution == 'Fedora'
dnf:
name: ipcalc
state: present
- name: Setup OS and K8s Clients
shell: |
set -xe;

View File

@ -0,0 +1,3 @@
FROM gcr.io/google-containers/debian-base-amd64:0.3
RUN /usr/local/bin/clean-install ipcalc

View File

@ -0,0 +1,37 @@
Gate Utils Container
====================
This container builds a small image with ipcalc for use in both the multinode
checks and development.
Instructions
------------
OS Specific Host setup:
~~~~~~~~~~~~~~~~~~~~~~~
Ubuntu:
^^^^^^^
From a freshly provisioned Ubuntu 16.04 LTS host run:
.. code:: bash
sudo apt-get update -y
sudo apt-get install -y \
docker.io \
git
Build the Gate Utils Image
~~~~~~~~~~~~~~~~~~~~~~~~~~
A known good image is published to dockerhub on a fairly regular basis, but if
you wish to build your own image, from the root directory of the OpenStack-Helm
repo run:
.. code:: bash
sudo docker build \
-t docker.io/openstackhelm/gate-utils:v0.1.0 \
tools/images/gate-utils
sudo docker push docker.io/openstackhelm/gate-utils:v0.1.0