magnum/playbooks/container-builder.yaml
Thomas Hartland 25c0f46169 Build cluster autoscaler container images
Add Dockerfile and CI config for building cluster autoscaler
container images specifically for magnum.
The autoscaler is built with the build tag "magnum" so that
only the magnum provider is included in the binary. This cuts
the size of the image in half compared to building with all
cloud providers.
The container-build job in .zuul.yaml has to have its timeout
increased, as the build time was already close to the timeout.

Change-Id: Iecbae5866278afe1687a4533b71af60fce537a4a
2019-10-16 08:05:23 +00:00

121 lines
4.5 KiB
YAML

- hosts: all
tasks:
- include_vars: container-builder-vars.yaml
- name: "Build magnum images"
block:
- name: "Build {{ magnum_repository }}/{{ item.name }}:{{ item.tag }} image"
docker_image:
path: "{{ magnum_src_dir }}/dockerfiles/{{ item.name }}"
name: "{{ magnum_repository }}/{{ item.name }}"
tag: "{{ item.tag }}"
push: no
with_items: "{{ magnum_images }}"
retries: 10
- name: "Build kubernetes images v1.11"
block:
- name: "Build {{ magnum_repository }}/{{ item.name }}:{{ item.tag }} image"
docker_image:
path: "{{ magnum_src_dir }}/dockerfiles/{{ item.name }}"
name: "{{ magnum_repository }}/{{ item.name }}"
tag: "{{kubernetes_version_v1_11}}"
buildargs:
KUBE_VERSION: "{{kubernetes_version_v1_11}}"
ADD_KUBE_ALLOW_PRIV: "true"
push: no
with_items: "{{ kubernetes_images }}"
retries: 10
- name: "Build kubernetes images v1.12"
block:
- name: "Build {{ magnum_repository }}/{{ item.name }}:{{ item.tag }} image"
docker_image:
path: "{{ magnum_src_dir }}/dockerfiles/{{ item.name }}"
name: "{{ magnum_repository }}/{{ item.name }}"
tag: "{{kubernetes_version_v1_12}}"
buildargs:
KUBE_VERSION: "{{kubernetes_version_v1_12}}"
ADD_KUBE_ALLOW_PRIV: "true"
push: no
with_items: "{{ kubernetes_images }}"
retries: 10
- name: "Build kubernetes images v1.13"
block:
- name: "Build {{ magnum_repository }}/{{ item.name }}:{{ item.tag }} image"
docker_image:
path: "{{ magnum_src_dir }}/dockerfiles/{{ item.name }}"
name: "{{ magnum_repository }}/{{ item.name }}"
tag: "{{kubernetes_version_v1_13}}"
buildargs:
KUBE_VERSION: "{{kubernetes_version_v1_13}}"
ADD_KUBE_ALLOW_PRIV: "true"
push: no
with_items: "{{ kubernetes_images }}"
retries: 10
- name: "Build kubernetes images v1.14"
block:
- name: "Build {{ magnum_repository }}/{{ item.name }}:{{ item.tag }} image"
docker_image:
path: "{{ magnum_src_dir }}/dockerfiles/{{ item.name }}"
name: "{{ magnum_repository }}/{{ item.name }}"
tag: "{{kubernetes_version_v1_14}}"
buildargs:
KUBE_VERSION: "{{kubernetes_version_v1_14}}"
ADD_KUBE_ALLOW_PRIV: "true"
push: no
with_items: "{{ kubernetes_images }}"
retries: 10
- name: "Build kubernetes images v1.15"
block:
- name: "Build {{ magnum_repository }}/{{ item.name }}:{{ item.tag }} image"
docker_image:
path: "{{ magnum_src_dir }}/dockerfiles/{{ item.name }}"
name: "{{ magnum_repository }}/{{ item.name }}"
tag: "{{kubernetes_version_v1_15}}"
buildargs:
KUBE_VERSION: "{{kubernetes_version_v1_15}}"
push: no
with_items: "{{ kubernetes_images }}"
retries: 10
- name: "Build kubernetes images v1.16"
block:
- name: "Build {{ magnum_repository }}/{{ item.name }}:{{ item.tag }} image"
docker_image:
path: "{{ magnum_src_dir }}/dockerfiles/{{ item.name }}"
name: "{{ magnum_repository }}/{{ item.name }}"
tag: "{{kubernetes_version_v1_16}}"
buildargs:
KUBE_VERSION: "{{kubernetes_version_v1_16}}"
push: no
with_items: "{{ kubernetes_images }}"
retries: 10
- name: "Build helm-client image"
block:
- docker_image:
path: "{{ magnum_src_dir }}/dockerfiles/helm-client"
name: "{{ magnum_repository }}/helm-client"
tag: "{{ helm_version }}"
buildargs:
HELM_VERSION: "{{ helm_version }}"
push: no
retries: 10
- name: "Build cluster-autoscaler image"
block:
- name: "Build {{ magnum_repository }}/cluster-autoscaler:v{{ item.version }}"
docker_image:
path: "{{ magnum_src_dir }}/dockerfiles/cluster-autoscaler"
name: "{{ magnum_repository }}/cluster-autoscaler"
tag: "v{{ item.version }}"
buildargs:
AUTOSCALER_VERSION: "cluster-autoscaler-{{ item.version }}"
push: no
with_items: "{{ cluster_autoscaler_versions }}"
retries: 10