43de60caaf
Both kubetoolbox and magnum-conductor install 'kubectl'. In different versions. And only for x86-64. New macro knows how to handle other architectures. AArch64 binary is fetched properly, other architectures (ppc64le for now) gets info that there is no binary upstream. Also updated to v1.5.4 as this one is used by kube/* images. Change-Id: Ia491d6ec7156201742f28b5d1018f2794529b5b4 Partially-Implements: blueprint multiarch-and-arm64-containers
65 lines
2.3 KiB
Django/Jinja
65 lines
2.3 KiB
Django/Jinja
{% macro install_packages(packages) -%}
|
|
{% if packages is defined and packages|length > 0 -%}
|
|
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] -%}
|
|
RUN yum --setopt skip_missing_names_on_install=False -y install {{ packages | join(' ') }} && yum clean all
|
|
{%- elif base_distro in ['debian', 'ubuntu'] -%}
|
|
{#-
|
|
debian_package_install is a utility method to build up an appropriate
|
|
set of commands to install packages in a debian-based environment that
|
|
may include URL links to a .deb package (e.g, heka)
|
|
-#}
|
|
RUN {{ debian_package_install(packages) }}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
{%- endmacro %}
|
|
|
|
|
|
{% macro install_pip(packages, constraints = true) %}
|
|
{%- if packages is sequence and packages|length > 0 -%}
|
|
pip --no-cache-dir install --upgrade{{ ' ' }}
|
|
{%- if constraints %}-c requirements/upper-constraints.txt {% endif -%}
|
|
{{ packages | join(' ') }}
|
|
{%- else -%}
|
|
true
|
|
{%- endif -%}
|
|
{% endmacro %}
|
|
|
|
|
|
{% macro configure_user(name, groups=None, shell=None, homedir=None) %}
|
|
{% set user=users[name] %}
|
|
{%- if not homedir %}
|
|
{% set homedir='/var/lib/' + name %}
|
|
{%- endif %}
|
|
RUN usermod --append --home {{ homedir }} --groups kolla {{ name }} \
|
|
{%- if groups %}
|
|
&& usermod --append --groups {{ groups }} {{ name }} \
|
|
{%- endif %}
|
|
{%- if shell %}
|
|
&& chsh --shell {{ shell }} {{ name }} \
|
|
{%- endif %}
|
|
&& mkdir -p {{ homedir }} \
|
|
&& chown -R {{ user.uid }}:{{ user.gid }} {{ homedir }}
|
|
{% endmacro %}
|
|
|
|
{% macro debian_haproxy_existing_user_fix() %}
|
|
{# NOTE(SamYaple): The postinst script breaks if the user 'haproxy' already exists #}
|
|
RUN apt-get -y install --no-install-recommends haproxy \
|
|
|| sed -i '/^adduser/,+1 d' /var/lib/dpkg/info/haproxy.postinst \
|
|
&& apt-get -y install -f \
|
|
&& apt-get clean
|
|
{% endmacro %}
|
|
|
|
{% macro install_kubectl() %}
|
|
{% if base_arch == 'x86_64' %}
|
|
ENV KUBE_ARCH=amd64
|
|
{% elif base_arch == 'aarch64' %}
|
|
ENV KUBE_ARCH=arm64
|
|
{% else %}
|
|
RUN echo 'There is no "kubectl" binary for {{ base_arch }}' \
|
|
&& /bin/false
|
|
{% endif %}
|
|
|
|
RUN curl -o /usr/bin/kubectl http://storage.googleapis.com/kubernetes-release/release/v1.5.4/bin/linux/${KUBE_ARCH}/kubectl \
|
|
&& chmod 755 /usr/bin/kubectl
|
|
{% endmacro %}
|