Add proxy for mesos

Change-Id: I507f3adffbc90b277705dc553b0fd906e3276cc8
Implements: blueprint add-proxy-mesos
This commit is contained in:
wangqun 2016-01-07 05:58:11 +00:00
parent 29270bd430
commit 97634d564b
4 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,38 @@
#!/bin/sh
. /etc/sysconfig/heat-params
DOCKER_PROXY_CONF=/etc/default/docker
BASH_RC=/etc/bash.bashrc
if [ -n "$HTTP_PROXY" ]; then
echo "export http_proxy=$HTTP_PROXY" >> $DOCKER_PROXY_CONF
if [ -f "$BASH_RC" ]; then
echo "export http_proxy=$HTTP_PROXY" >> $BASH_RC
else
echo "File $BASH_RC does not exist, not setting http_proxy"
fi
fi
if [ -n "$HTTPS_PROXY" ]; then
echo "export https_proxy=$HTTPS_PROXY" >> $DOCKER_PROXY_CONF
if [ -f $BASH_RC ]; then
echo "export https_proxy=$HTTPS_PROXY" >> $BASH_RC
else
echo "File $BASH_RC does not exist, not setting https_proxy"
fi
fi
if [ -n "$HTTP_PROXY" -o -n $HTTPS_PROXY ]; then
service docker restart
fi
if [ -f "$BASH_RC" ]; then
if [ -n "$NO_PROXY" ]; then
echo "export no_proxy=$NO_PROXY" >> $BASH_RC
fi
else
echo "File $BASH_RC does not exist, not setting no_proxy"
fi

View File

@ -7,3 +7,6 @@ write_files:
content: |
MESOS_MASTERS_IPS="$MESOS_MASTERS_IPS"
EXECUTOR_REGISTRATION_TIMEOUT="$EXECUTOR_REGISTRATION_TIMEOUT"
HTTP_PROXY="$HTTP_PROXY"
HTTPS_PROXY="$HTTPS_PROXY"
NO_PROXY="$NO_PROXY"

View File

@ -69,6 +69,21 @@ parameters:
description: how many mesos masters to spawn initially
default: 1
http_proxy:
type: string
description: http proxy address for docker
default: ""
https_proxy:
type: string
description: https proxy address for docker
default: ""
no_proxy:
type: string
description: no proxies for docker
default: ""
resources:
######################################################################
@ -268,6 +283,9 @@ resources:
wait_condition_timeout: {get_param: wait_condition_timeout}
executor_registration_timeout: {get_param: executor_registration_timeout}
secgroup_base_id: {get_resource: secgroup_base}
http_proxy: {get_param: http_proxy}
https_proxy: {get_param: https_proxy}
no_proxy: {get_param: no_proxy}
outputs:

View File

@ -39,6 +39,21 @@ parameters:
considering it hung and shutting it down
default: 5mins
http_proxy:
type: string
description: http proxy address for docker
default: ""
https_proxy:
type: string
description: https proxy address for docker
default: ""
no_proxy:
type: string
description: no proxies for docker
default: ""
# The following are all generated in the parent template.
mesos_masters_ips:
type: string
@ -89,6 +104,9 @@ resources:
params:
"$MESOS_MASTERS_IPS": {get_param: mesos_masters_ips}
"$EXECUTOR_REGISTRATION_TIMEOUT": {get_param: executor_registration_timeout}
"$HTTP_PROXY": {get_param: http_proxy}
"$HTTPS_PROXY": {get_param: https_proxy}
"$NO_PROXY": {get_param: no_proxy}
configure_mesos_slave:
type: OS::Heat::SoftwareConfig
@ -113,6 +131,12 @@ resources:
wc_notify --data-binary '{"status": "SUCCESS"}'
params:
wc_notify: {get_attr: [slave_wait_handle, curl_cli]}
add_proxy:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config: {get_file: fragments/add-proxy.sh}
mesos_slave_init:
type: OS::Heat::MultipartMime
@ -120,6 +144,7 @@ resources:
parts:
- config: {get_resource: write_heat_params}
- config: {get_resource: configure_mesos_slave}
- config: {get_resource: add_proxy}
- config: {get_resource: start_services}
- config: {get_resource: slave_wc_notify}