diff --git a/docker/elasticsearch/Dockerfile.j2 b/docker/elasticsearch/Dockerfile.j2 index b677f64c6c..f7deb92e91 100644 --- a/docker/elasticsearch/Dockerfile.j2 +++ b/docker/elasticsearch/Dockerfile.j2 @@ -21,15 +21,7 @@ ENV JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk/ 'elasticsearch', ] %} -{% if base_arch == 'x86_64' %} -ENV java_arch=amd64 -{% elif base_arch == 'aarch64' %} -ENV java_arch=arm64 -{% else %} -ENV java_arch={{ base_arch }} -{% endif %} - -ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-${java_arch}/ +ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-{{debian_arch}}/ {% endif %} diff --git a/docker/helm-repository/Dockerfile.j2 b/docker/helm-repository/Dockerfile.j2 index 4faa76c31f..dc20229b81 100644 --- a/docker/helm-repository/Dockerfile.j2 +++ b/docker/helm-repository/Dockerfile.j2 @@ -46,20 +46,12 @@ RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ RUN {{ macros.install_pip(helm_repository_pip_packages | customizable("pip_packages"), constraints = false) }} -{% if base_arch == 'x86_64' %} -ENV helm_arch=amd64 -{% elif base_arch == 'aarch64' %} -ENV helm_arch=arm64 -{% else %} -ENV helm_arch={{ base_arch }} -{% endif %} - {% block helm_repository_install_kubernetes_helm %} # TODO(mandre) check for file integrity instead of downloading from an HTTPS source -RUN curl -Lo /tmp/helm-v${helm_version}-linux-${helm_arch}.tar.gz https://storage.googleapis.com/kubernetes-helm/helm-v${helm_version}-linux-${helm_arch}.tar.gz \ - && sudo tar --strip-components 1 -C /usr/bin linux-${helm_arch}/helm -zxvf /tmp/helm-v${helm_version}-linux-${helm_arch}.tar.gz \ +RUN curl -Lo /tmp/helm-v${helm_version}-linux-{{debian_arch}}.tar.gz https://storage.googleapis.com/kubernetes-helm/helm-v${helm_version}-linux-{{debian_arch}}.tar.gz \ + && sudo tar --strip-components 1 -C /usr/bin linux-{{debian_arch}}/helm -zxvf /tmp/helm-v${helm_version}-linux-{{debian_arch}}.tar.gz \ && sudo chmod 755 /usr/bin/helm \ - && rm /tmp/helm-v${helm_version}-linux-${helm_arch}.tar.gz + && rm /tmp/helm-v${helm_version}-linux-{{debian_arch}}.tar.gz {% endblock %} RUN useradd --user-group --create-home --home-dir /home/helm helm \ diff --git a/docker/kube/kube-base/Dockerfile.j2 b/docker/kube/kube-base/Dockerfile.j2 index d0dc32fa3e..02449df2e2 100644 --- a/docker/kube/kube-base/Dockerfile.j2 +++ b/docker/kube/kube-base/Dockerfile.j2 @@ -3,16 +3,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build ENV KUBERNETES_VERSION=v1.11.1 -{% if base_arch == 'x86_64' %} -ENV KUBE_ARCH=amd64 -{% elif base_arch == 'aarch64' %} -ENV KUBE_ARCH=arm64 -{% else %} -RUN echo 'Kubernetes images not yet available for {{ base_arch }}' \ -&& /bin/false -{% endif %} - -ENV KUBERNETES_DOWNLOAD_ROOT=https://storage.googleapis.com/kubernetes-release/release/${KUBERNETES_VERSION}/bin/linux/${KUBE_ARCH} +ENV KUBERNETES_DOWNLOAD_ROOT=https://storage.googleapis.com/kubernetes-release/release/${KUBERNETES_VERSION}/bin/linux/{{debian_arch}} {% block kube_base_header %}{% endblock %} diff --git a/docker/logstash/Dockerfile.j2 b/docker/logstash/Dockerfile.j2 index 61094da7ce..36d62676ee 100644 --- a/docker/logstash/Dockerfile.j2 +++ b/docker/logstash/Dockerfile.j2 @@ -20,15 +20,7 @@ ENV JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk/ 'logrotate' ] %} -{% if base_arch == 'x86_64' %} -ARG java_arch=amd64 -{% elif base_arch == 'aarch64' %} -ARG java_arch=arm64 -{% else %} -ARG java_arch={{ base_arch }} -{% endif %} - -ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-${java_arch}/ +ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-{{debian_arch}}/ {% endif %} diff --git a/docker/macros.j2 b/docker/macros.j2 index 1115721403..171d9564c2 100644 --- a/docker/macros.j2 +++ b/docker/macros.j2 @@ -75,21 +75,11 @@ RUN apt-get update \ {% 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 %} - # TODO(mandre) check for file integrity instead of downloading from an HTTPS source - RUN curl -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.5.4/bin/linux/${KUBE_ARCH}/kubectl \ + RUN curl -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.5.4/bin/linux/{{debian_arch}}/kubectl \ && chmod 755 /usr/bin/kubectl {% endmacro %} - {% macro install_fluent_plugins(plugins) -%} {% if plugins is defined and plugins|length > 0 -%} {% if base_distro in ['centos', 'oraclelinux', 'rhel'] -%} diff --git a/docker/monasca/monasca-thresh/Dockerfile.j2 b/docker/monasca/monasca-thresh/Dockerfile.j2 index 10170fb467..6897996002 100644 --- a/docker/monasca/monasca-thresh/Dockerfile.j2 +++ b/docker/monasca/monasca-thresh/Dockerfile.j2 @@ -29,15 +29,7 @@ ENV JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk/ 'maven', ] %} -{% if base_arch == 'x86_64' %} -ARG java_arch=amd64 -{% elif base_arch == 'aarch64' %} -ARG java_arch=arm64 -{% else %} -ARG java_arch={{ base_arch }} -{% endif %} - -ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-${java_arch}/ +ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-{{debian_arch}}/ {% endif %} diff --git a/docker/prometheus/prometheus-alertmanager/Dockerfile.j2 b/docker/prometheus/prometheus-alertmanager/Dockerfile.j2 index 341e0fe063..626b77837d 100644 --- a/docker/prometheus/prometheus-alertmanager/Dockerfile.j2 +++ b/docker/prometheus/prometheus-alertmanager/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV prometheus_alertmanager_version=0.14.0 {% endblock %} {% block prometheus_alertmanager_install %} -RUN curl -sSL -o /tmp/prometheus_alertmanager.tar.gz https://github.com/prometheus/alertmanager/releases/download/v${prometheus_alertmanager_version}/alertmanager-${prometheus_alertmanager_version}.linux-${prometheus_arch}.tar.gz \ +RUN curl -sSL -o /tmp/prometheus_alertmanager.tar.gz https://github.com/prometheus/alertmanager/releases/download/v${prometheus_alertmanager_version}/alertmanager-${prometheus_alertmanager_version}.linux-{{debian_arch}}.tar.gz \ && tar xvf /tmp/prometheus_alertmanager.tar.gz -C /opt/ \ && rm -f /tmp/prometheus_alertmanager.tar.gz \ && ln -s /opt/alertmanager* /opt/prometheus_alertmanager diff --git a/docker/prometheus/prometheus-base/Dockerfile.j2 b/docker/prometheus/prometheus-base/Dockerfile.j2 index 93da382392..8bb86e2273 100644 --- a/docker/prometheus/prometheus-base/Dockerfile.j2 +++ b/docker/prometheus/prometheus-base/Dockerfile.j2 @@ -7,14 +7,6 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {{ macros.configure_user(name='prometheus') }} -{% if base_arch == 'x86_64' %} -ENV prometheus_arch=amd64 -{% elif base_arch == 'aarch64' %} -ENV prometheus_arch=arm64 -{% else %} -ENV prometheus_arch={{ base_arch }} -{% endif %} - COPY extend_start.sh /usr/local/bin/kolla_extend_start RUN chmod 755 /usr/local/bin/kolla_extend_start diff --git a/docker/prometheus/prometheus-blackbox-exporter/Dockerfile.j2 b/docker/prometheus/prometheus-blackbox-exporter/Dockerfile.j2 index 66bc7666f8..8ca5867596 100644 --- a/docker/prometheus/prometheus-blackbox-exporter/Dockerfile.j2 +++ b/docker/prometheus/prometheus-blackbox-exporter/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV blackbox_exporter_version=0.12.0 {% endblock %} {% block prometheus_blackbox_exporter_install %} -RUN curl -sSL -o /tmp/blackbox_exporter.tar.gz https://github.com/prometheus/blackbox_exporter/releases/download/v${blackbox_exporter_version}/blackbox_exporter-${blackbox_exporter_version}.linux-${prometheus_arch}.tar.gz \ +RUN curl -sSL -o /tmp/blackbox_exporter.tar.gz https://github.com/prometheus/blackbox_exporter/releases/download/v${blackbox_exporter_version}/blackbox_exporter-${blackbox_exporter_version}.linux-{{debian_arch}}.tar.gz \ && tar xvf /tmp/blackbox_exporter.tar.gz -C /opt/ \ && rm -f /tmp/blackbox_exporter.tar.gz \ && ln -s /opt/blackbox_exporter* /opt/blackbox_exporter diff --git a/docker/prometheus/prometheus-haproxy-exporter/Dockerfile.j2 b/docker/prometheus/prometheus-haproxy-exporter/Dockerfile.j2 index 621faa0957..5dbdd8fc94 100644 --- a/docker/prometheus/prometheus-haproxy-exporter/Dockerfile.j2 +++ b/docker/prometheus/prometheus-haproxy-exporter/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV haproxy_exporter_version=0.7.1 {% endblock %} {% block haproxy_exporter_install %} -RUN curl -sSL -o /tmp/haproxy_exporter.tar.gz https://github.com/prometheus/haproxy_exporter/releases/download/v${haproxy_exporter_version}/haproxy_exporter-${haproxy_exporter_version}.linux-${prometheus_arch}.tar.gz \ +RUN curl -sSL -o /tmp/haproxy_exporter.tar.gz https://github.com/prometheus/haproxy_exporter/releases/download/v${haproxy_exporter_version}/haproxy_exporter-${haproxy_exporter_version}.linux-{{debian_arch}}.tar.gz \ && tar xvf /tmp/haproxy_exporter.tar.gz -C /opt/ \ && rm -f /tmp/haproxy_exporter.tar.gz \ && ln -s /opt/haproxy_exporter* /opt/haproxy_exporter diff --git a/docker/prometheus/prometheus-memcached-exporter/Dockerfile.j2 b/docker/prometheus/prometheus-memcached-exporter/Dockerfile.j2 index 65fe5d0b07..d3cc78d845 100644 --- a/docker/prometheus/prometheus-memcached-exporter/Dockerfile.j2 +++ b/docker/prometheus/prometheus-memcached-exporter/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV memcached_exporter_version=0.4.1 {% endblock %} {% block prometheus_memcached_exporter_install %} -RUN curl -sSL -o /tmp/memcached_exporter.tar.gz https://github.com/prometheus/memcached_exporter/releases/download/v${memcached_exporter_version}/memcached_exporter-${memcached_exporter_version}.linux-${prometheus_arch}.tar.gz \ +RUN curl -sSL -o /tmp/memcached_exporter.tar.gz https://github.com/prometheus/memcached_exporter/releases/download/v${memcached_exporter_version}/memcached_exporter-${memcached_exporter_version}.linux-{{debian_arch}}.tar.gz \ && tar xvf /tmp/memcached_exporter.tar.gz -C /opt/ \ && rm -f /tmp/memcached_exporter.tar.gz \ && ln -s /opt/memcached_exporter* /opt/memcached_exporter diff --git a/docker/prometheus/prometheus-mysqld-exporter/Dockerfile.j2 b/docker/prometheus/prometheus-mysqld-exporter/Dockerfile.j2 index e9f6773a25..d9bc7e7752 100644 --- a/docker/prometheus/prometheus-mysqld-exporter/Dockerfile.j2 +++ b/docker/prometheus/prometheus-mysqld-exporter/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV mysqld_exporter_version=0.10.0 {% endblock %} {% block mysqld_exporter_install %} -RUN curl -ssL -o /tmp/mysqld_exporter.tar.gz https://github.com/prometheus/mysqld_exporter/releases/download/v${mysqld_exporter_version}/mysqld_exporter-${mysqld_exporter_version}.linux-${prometheus_arch}.tar.gz \ +RUN curl -ssL -o /tmp/mysqld_exporter.tar.gz https://github.com/prometheus/mysqld_exporter/releases/download/v${mysqld_exporter_version}/mysqld_exporter-${mysqld_exporter_version}.linux-{{debian_arch}}.tar.gz \ && tar xvf /tmp/mysqld_exporter.tar.gz -C /opt/ \ && rm -f /tmp/mysqld_exporter.tar.gz \ && ln -s /opt/mysqld_exporter* /opt/mysqld_exporter diff --git a/docker/prometheus/prometheus-node-exporter/Dockerfile.j2 b/docker/prometheus/prometheus-node-exporter/Dockerfile.j2 index 1738285ba5..59f6b3223e 100644 --- a/docker/prometheus/prometheus-node-exporter/Dockerfile.j2 +++ b/docker/prometheus/prometheus-node-exporter/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV node_exporter_version=0.14.0 {% endblock %} {% block node_exporter_install %} -RUN curl -sSL -o /tmp/node_exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v${node_exporter_version}/node_exporter-${node_exporter_version}.linux-${prometheus_arch}.tar.gz \ +RUN curl -sSL -o /tmp/node_exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v${node_exporter_version}/node_exporter-${node_exporter_version}.linux-{{debian_arch}}.tar.gz \ && tar xvf /tmp/node_exporter.tar.gz -C /opt/ \ && rm -f /tmp/node_exporter.tar.gz \ && ln -s /opt/node_exporter* /opt/node_exporter diff --git a/docker/prometheus/prometheus-openstack-exporter/Dockerfile.j2 b/docker/prometheus/prometheus-openstack-exporter/Dockerfile.j2 index 6b7ec1b694..f300fd807d 100644 --- a/docker/prometheus/prometheus-openstack-exporter/Dockerfile.j2 +++ b/docker/prometheus/prometheus-openstack-exporter/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV prometheus_openstack_exporter_version=0.0.5 {% endblock %} {% block prometheus_openstack_exporter_install %} -RUN curl -sSL -o /tmp/prometheus_openstack_exporter.tar.gz https://github.com/Linaro/openstack-exporter/releases/download/v${prometheus_openstack_exporter_version}/openstack-exporter-${prometheus_openstack_exporter_version}.linux-${prometheus_arch}.tar.gz \ +RUN curl -sSL -o /tmp/prometheus_openstack_exporter.tar.gz https://github.com/Linaro/openstack-exporter/releases/download/v${prometheus_openstack_exporter_version}/openstack-exporter-${prometheus_openstack_exporter_version}.linux-{{debian_arch}}.tar.gz \ && tar xvf /tmp/prometheus_openstack_exporter.tar.gz -C /opt/ \ && rm -f /tmp/prometheus_openstack_exporter.tar.gz \ && ln -s /opt/openstack-exporter* /opt/openstack-exporter diff --git a/docker/prometheus/prometheus-server/Dockerfile.j2 b/docker/prometheus/prometheus-server/Dockerfile.j2 index 686ac3b250..cf9d2bfefc 100644 --- a/docker/prometheus/prometheus-server/Dockerfile.j2 +++ b/docker/prometheus/prometheus-server/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV prometheus_version=1.7.1 {% endblock %} {% block prometheus_server_install %} -RUN curl -sSL -o /tmp/prometheus.tar.gz https://github.com/prometheus/prometheus/releases/download/v${prometheus_version}/prometheus-${prometheus_version}.linux-${prometheus_arch}.tar.gz \ +RUN curl -sSL -o /tmp/prometheus.tar.gz https://github.com/prometheus/prometheus/releases/download/v${prometheus_version}/prometheus-${prometheus_version}.linux-{{debian_arch}}.tar.gz \ && tar xvf /tmp/prometheus.tar.gz -C /opt/ \ && rm -f /tmp/prometheus.tar.gz \ && ln -s /opt/prometheus* /opt/prometheus \ diff --git a/kolla/image/build.py b/kolla/image/build.py index eb5512dc06..b3ed5e5c27 100755 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -679,6 +679,11 @@ class KollaWorker(object): self.install_type = conf.install_type self.tag = conf.tag self.base_arch = conf.base_arch + self.debian_arch = self.base_arch + if self.base_arch == 'aarch64': + self.debian_arch = 'arm64' + elif self.base_arch == 'x86_64': + self.debian_arch = 'amd64' self.images = list() rpm_setup_config = ([repo_file for repo_file in conf.rpm_setup_config if repo_file is not None]) @@ -900,6 +905,7 @@ class KollaWorker(object): 'base_distro_tag': self.base_tag, 'base_arch': self.base_arch, 'base_package_type': self.base_package_type, + 'debian_arch': self.debian_arch, 'supported_distro_release': supported_distro_release, 'install_metatype': self.install_metatype, 'image_prefix': self.image_prefix, diff --git a/releasenotes/notes/add-debian_arch-variable-9559ac31809afaca.yaml b/releasenotes/notes/add-debian_arch-variable-9559ac31809afaca.yaml new file mode 100644 index 0000000000..7f8a26f161 --- /dev/null +++ b/releasenotes/notes/add-debian_arch-variable-9559ac31809afaca.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Add `debian_arch` variable which can be used in Dockerfile.j2 files instead + of checking architecture names. For 'x86-64' it goes for 'amd64' and uses + 'arm64' on 'aarch64' architecture. This is handy for fetching external + release files.