diff --git a/magnum/api/controllers/v1/baymodel.py b/magnum/api/controllers/v1/baymodel.py index 8f4cdc5040..865c7bd642 100644 --- a/magnum/api/controllers/v1/baymodel.py +++ b/magnum/api/controllers/v1/baymodel.py @@ -101,6 +101,16 @@ class BayModel(base.APIBase): links = wsme.wsattr([link.Link], readonly=True) """A list containing a self link and associated baymodel links""" + http_proxy = wtypes.StringType(min_length=1, max_length=255) + """http_proxy for the bay """ + + https_proxy = wtypes.StringType(min_length=1, max_length=255) + """https_proxy for the bay """ + + no_proxy = wtypes.StringType(min_length=1, max_length=255) + """Its comma separated list of ip for which proxies should not + used in the bay""" + def __init__(self, **kwargs): self.fields = [] for field in objects.BayModel.fields: @@ -146,6 +156,9 @@ class BayModel(base.APIBase): cluster_distro='fedora-atomic', ssh_authorized_key='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB', coe='kubernetes', + http_proxy='http://proxy.com:123', + https_proxy='https://proxy.com:123', + no_proxy='192.168.0.1,192.168.0.2,192.168.0.3', created_at=datetime.datetime.utcnow(), updated_at=datetime.datetime.utcnow()) return cls._convert_with_links(sample, 'http://localhost:9511', expand) diff --git a/magnum/conductor/template_definition.py b/magnum/conductor/template_definition.py index 6ff3e2702c..c0750f8fac 100644 --- a/magnum/conductor/template_definition.py +++ b/magnum/conductor/template_definition.py @@ -324,6 +324,12 @@ class BaseTemplateDefinition(TemplateDefinition): baymodel_attr='dns_nameserver') self.add_parameter('fixed_network_cidr', baymodel_attr='fixed_network') + self.add_parameter('http_proxy', + baymodel_attr='http_proxy') + self.add_parameter('https_proxy', + baymodel_attr='https_proxy') + self.add_parameter('no_proxy', + baymodel_attr='no_proxy') @abc.abstractproperty def template_path(self): @@ -449,7 +455,6 @@ class AtomicSwarmTemplateDefinition(BaseTemplateDefinition): self.add_parameter('external_network', baymodel_attr='external_network_id', required=True) - self.add_output('swarm_manager', bay_attr='api_address') self.add_output('swarm_nodes_external', diff --git a/magnum/db/sqlalchemy/alembic/versions/966a99e70ff_add_proxy.py b/magnum/db/sqlalchemy/alembic/versions/966a99e70ff_add_proxy.py new file mode 100644 index 0000000000..e0b7494403 --- /dev/null +++ b/magnum/db/sqlalchemy/alembic/versions/966a99e70ff_add_proxy.py @@ -0,0 +1,34 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +"""add-proxy + +Revision ID: 966a99e70ff +Revises: 6f21dc998bb +Create Date: 2015-08-24 11:23:24.262921 + +""" + +# revision identifiers, used by Alembic. +revision = '966a99e70ff' +down_revision = '6f21dc998bb' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + op.add_column('baymodel', sa.Column('http_proxy', + sa.String(length=255), nullable=True)) + op.add_column('baymodel', sa.Column('https_proxy', + sa.String(length=255), nullable=True)) + op.add_column('baymodel', sa.Column('no_proxy', + sa.String(length=255), nullable=True)) diff --git a/magnum/db/sqlalchemy/models.py b/magnum/db/sqlalchemy/models.py index c74f014bcb..8d1e441c2f 100644 --- a/magnum/db/sqlalchemy/models.py +++ b/magnum/db/sqlalchemy/models.py @@ -173,6 +173,9 @@ class BayModel(Base): ssh_authorized_key = Column(Text) cluster_distro = Column(String(255)) coe = Column(String(255)) + http_proxy = Column(String(255)) + https_proxy = Column(String(255)) + no_proxy = Column(String(255)) class Container(Base): diff --git a/magnum/objects/baymodel.py b/magnum/objects/baymodel.py index 94f2f23f0b..4d2d87c79e 100644 --- a/magnum/objects/baymodel.py +++ b/magnum/objects/baymodel.py @@ -47,6 +47,9 @@ class BayModel(base.MagnumPersistentObject, base.MagnumObject, 'ssh_authorized_key': fields.StringField(nullable=True), 'cluster_distro': fields.StringField(nullable=True), 'coe': fields.StringField(nullable=True), + 'http_proxy': fields.StringField(nullable=True), + 'https_proxy': fields.StringField(nullable=True), + 'no_proxy': fields.StringField(nullable=True), } @staticmethod diff --git a/magnum/templates/docker-swarm/fragments/add-proxy.sh b/magnum/templates/docker-swarm/fragments/add-proxy.sh new file mode 100644 index 0000000000..b66012ee86 --- /dev/null +++ b/magnum/templates/docker-swarm/fragments/add-proxy.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +. /etc/sysconfig/heat-params + +if [ "$HTTP_PROXY" != "" ]; then + cat > /etc/systemd/system/docker.service.d/proxy.conf <> /etc/bashrc <> /etc/bashrc <> /etc/bashrc <> /etc/bashrc <