Merge "Provide ability to specify proxy"

This commit is contained in:
Zuul 2018-03-14 14:10:57 +00:00 committed by Gerrit Code Review
commit f461e53e52
8 changed files with 69 additions and 3 deletions

View File

@ -35,7 +35,28 @@
# CNI_VERSION: "{{ version.cni }}"
# HELM_VERSION: "{{ version.helm }}"
# CHARTS: "calico,flannel,tiller,kube-dns"
- name: Kubeadm-AIO image build path with proxy
when: proxy.http is defined and (proxy.http | trim != "")
shell: |-
set -e
docker build \
--network host \
--force-rm \
--tag "{{ images.kubernetes.kubeadm_aio }}" \
--file tools/images/kubeadm-aio/Dockerfile \
--build-arg KUBE_VERSION="{{ version.kubernetes }}" \
--build-arg CNI_VERSION="{{ version.cni }}" \
--build-arg HELM_VERSION="{{ version.helm }}" \
--build-arg CHARTS="calico,flannel,tiller,kube-dns" \
--build-arg HTTP_PROXY="{{ proxy.http }}" \
--build-arg HTTPS_PROXY="{{ proxy.https }}" \
--build-arg NO_PROXY="{{ proxy.noproxy }}" \
.
args:
chdir: "{{ kubeadm_aio_path.stdout }}/"
executable: /bin/bash
- name: Kubeadm-AIO image build path
when: proxy.http is undefined or (proxy.http | trim == "")
shell: |-
set -e
docker build \
@ -50,4 +71,4 @@
.
args:
chdir: "{{ kubeadm_aio_path.stdout }}/"
executable: /bin/bash
executable: /bin/bash

View File

@ -38,6 +38,20 @@
dest: /etc/systemd/system/docker.service
mode: 0640
# NOTE: (lamt) Setting up the proxy before installing docker
- name: ensure docker.service.d directory exists
when: proxy.http is defined and (proxy.http | trim != "")
file:
path: /etc/systemd/system/docker.service.d
state: directory
- name: proxy | moving proxy systemd unit into place
when: ( need_docker | failed ) and ( proxy.http is defined and (proxy.http | trim != "") )
template:
src: http-proxy.conf.j2
dest: /etc/systemd/system/docker.service.d/http-proxy.conf
mode: 0640
- name: deploy docker packages
when: need_docker | failed
include_role:

View File

@ -0,0 +1,4 @@
[Service]
Environment="HTTP_PROXY={{ proxy.http }}"
Environment="HTTPS_PROXY={{ proxy.https }}"
Environment="NO_PROXY={{ proxy.noproxy }}"

View File

@ -15,6 +15,10 @@
- name: managing pip packages
become: true
become_user: root
environment:
http_proxy: "{{ proxy.http }}"
https_proxy: "{{ proxy.https }}"
no_proxy: "{{ proxy.noproxy }}"
vars:
state: present
pip:

View File

@ -39,6 +39,10 @@
- name: ensuring pip is the latest version
become: true
become_user: root
environment:
http_proxy: "{{ proxy.http }}"
https_proxy: "{{ proxy.https }}"
no_proxy: "{{ proxy.noproxy }}"
pip:
name: pip
state: latest

View File

@ -17,6 +17,11 @@ version:
helm: v2.7.2
cni: v0.6.0
proxy:
http: null
https: null
noproxy: null
images:
kubernetes:
kubeadm_aio: openstackhelm/kubeadm-aio:dev

View File

@ -28,6 +28,18 @@ ENV HELM_VERSION ${HELM_VERSION}
ARG CHARTS="calico,flannel,tiller,kube-dns"
ENV CHARTS ${CHARTS}
ARG HTTP_PROXY=""
ENV HTTP_PROXY ${HTTP_PROXY}
ENV http_proxy ${HTTP_PROXY}
ARG HTTPS_PROXY=""
ENV HTTPS_PROXY ${HTTPS_PROXY}
ENV https_proxy ${HTTPS_PROXY}
ARG NO_PROXY="127.0.0.1,localhost,.svc.cluster.local"
ENV NO_PROXY ${NO_PROXY}
ENV no_proxy ${NO_PROXY}
ENV container="docker" \
DEBIAN_FRONTEND="noninteractive" \
CNI_BIN_DIR="/opt/cni/bin"

View File

@ -1,7 +1,9 @@
- name: "installing python {{ package }}"
become: true
become_user: root
environment:
http_proxy: "{{ proxy.http }}"
https_proxy: "{{ proxy.https }}"
no_proxy: "{{ proxy.noproxy }}"
pip:
name: "{{ package }}"