summaryrefslogtreecommitdiffstats
path: root/mcp/patches
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-07-09 13:25:28 +0200
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-07-09 14:29:44 +0200
commit3831d538436cbf7c033b560b76f554a1dfe28a4c (patch)
tree16717713610f1d7686c029e2a5275df4689a6990 /mcp/patches
parentb52c4df4061fd7a51aad94f144bb1326fa8a8b5a (diff)
[patch] MaaS: Switch to upstream fabric/vlan mgmt
Obsolete our out of tree patch in favor of upstream mechanisms for creating fabrics/VLANs/subnets. Change-Id: I57d6d59764a825b428f423d48c5d90af7f2e676f Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Diffstat (limited to 'mcp/patches')
-rw-r--r--mcp/patches/0001-maasng-Allow-fabric-ID-to-be-determined-from-CIDR.patch87
-rw-r--r--mcp/patches/patches.list1
2 files changed, 0 insertions, 88 deletions
diff --git a/mcp/patches/0001-maasng-Allow-fabric-ID-to-be-determined-from-CIDR.patch b/mcp/patches/0001-maasng-Allow-fabric-ID-to-be-determined-from-CIDR.patch
deleted file mode 100644
index 674813574..000000000
--- a/mcp/patches/0001-maasng-Allow-fabric-ID-to-be-determined-from-CIDR.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-: Copyright (c) 2018 Mirantis Inc., Enea AB and others.
-:
-: All rights reserved. This program and the accompanying materials
-: are made available under the terms of the Apache License, Version 2.0
-: which accompanies this distribution, and is available at
-: http://www.apache.org/licenses/LICENSE-2.0
-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
-Date: Fri, 29 Jun 2018 02:48:55 +0200
-Subject: [PATCH] maasng: Allow fabric ID to be determined from CIDR
-
-MaaS usually creates network resources (e.g. subnets, fabrics)
-automatically based on existing network interface definitions.
-However, the fabric naming is not guaranteed across deployments,
-so the same interface/subnet CIDR might end up as 'fabric-2' or
-'fabric-5' depending on non-deterministic factors.
-
-To allow configuring VLAN DHCP on such network segments we need a
-mechanism that does not hardcode the fabric ID in pillar data, but
-instead determines it at runtime based on subnet CIDR.
-
-maasng module: Fix 'name' arg in update_vlan
-
-name argument is silently overridden to use the state name if the
-value passed is not a string, leading to all kinds of breakage.
-
-While at it, default to using the VLAN ID as the name if not
-explicitly set.
-
-Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
----
- _modules/maasng.py | 7 ++++++-
- maas/region.sls | 15 ++++++++++++++-
- 3 files changed, 39 insertions(+), 3 deletions(-)
-
-diff --git a/_modules/maasng.py b/_modules/maasng.py
-index ce8e99e..706c0ec 100644
---- a/_modules/maasng.py
-+++ b/_modules/maasng.py
-@@ -966,7 +966,12 @@ def get_fabricid(fabric):
- try:
- return list_fabric()[fabric]['id']
- except KeyError:
-- return {"error": "Frabic not found on MaaS server"}
-+ # fabric might be specified as CIDR, try to find the actual fabric ID
-+ maas_subnets = list_subnet()
-+ for subnet in maas_subnets.keys():
-+ if maas_subnets[subnet]['cidr'] == fabric:
-+ return maas_subnets[subnet]['vlan']['fabric_id']
-+ return {"error": "Fabric not found on MaaS server"}
-
-
- def update_vlan(name, fabric, vid, description, primary_rack, dhcp_on=False):
-diff --git a/maas/region.sls b/maas/region.sls
-index f50b901..71bfefa 100644
---- a/maas/region.sls
-+++ b/maas/region.sls
-@@ -305,6 +305,19 @@ maas_create_subnet_{{ subnet_name }}:
- {%- endif %}
- {%- endfor %}
-
-+{%- for subnet_name, subnet in region.subnets.iteritems() %}
-+{%- for vid, vlan in subnet.get('vlan', {}).items() %}
-+maas_update_vlan_for_{{ subnet_name }}_{{ vid }}:
-+ maasng.update_vlan:
-+ - vid: {{ vid }}
-+ - fabric: {{ subnet.cidr }}
-+ - name: '{{ vlan.get('name', vid) }}'
-+ - description: {{ vlan.description }}
-+ - primary_rack: {{ region.maas_config.maas_name }}
-+ - dhcp_on: {{ vlan.get('dhcp','False') }}
-+{%- endfor %}
-+{%- endfor %}
-+
- {%- for subnet_name, subnet in region.subnets.iteritems() %}
- {%- if subnet.get('multiple') == True %}
- {%- for range_name, iprange in subnet.get('iprange',{}).items() %}
-@@ -375,7 +388,7 @@ maas_update_vlan_for_{{ fabric_name }}_{{ vid }}:
- maasng.update_vlan:
- - vid: {{ vid }}
- - fabric: {{ fabric_name }}
-- - name: {{ vlan.get('name','') }}
-+ - name: '{{ vlan.get('name', vid) }}'
- - description: {{ vlan.description }}
- - primary_rack: {{ region.maas_config.maas_name }}
- - dhcp_on: {{ vlan.get('dhcp','False') }}
diff --git a/mcp/patches/patches.list b/mcp/patches/patches.list
index 17573d95e..a17fd694c 100644
--- a/mcp/patches/patches.list
+++ b/mcp/patches/patches.list
@@ -5,7 +5,6 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-/usr/share/salt-formulas/env: 0001-maasng-Allow-fabric-ID-to-be-determined-from-CIDR.patch
/usr/share/salt-formulas/env: 0002-maas-region-skip-credentials-update.patch
/usr/share/salt-formulas/env: 0007-network.interface-Fix-ifup-OVS-port-with-route.patch
/usr/share/salt-formulas/env: 0008-Handle-extra-environment-variables.patch
er */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
heat_template_version: pike

description: >
  OpenStack Octavia service configured with Puppet

parameters:
  DockerNamespace:
    description: namespace
    default: 'tripleoupstream'
    type: string
  DockerOctaviaApiImage:
    description: image
    default: 'centos-binary-octavia-api:latest'
    type: string
  DockerOctaviaConfigImage:
    description: The container image to use for the octavia config_volume
    default: 'centos-binary-octavia-api:latest'
    type: string
  EndpointMap:
    default: {}
    description: Mapping of service endpoint -> protocol. Typically set
                 via parameter_defaults in the resource registry.
    type: json
  ServiceNetMap:
    default: {}
    description: Mapping of service_name -> network name. Typically set
                 via parameter_defaults in the resource registry.  This
                 mapping overrides those in ServiceNetMapDefaults.
    type: json
  DefaultPasswords:
    default: {}
    type: json
  RoleName:
    default: ''
    description: Role name on which the service is applied
    type: string
  RoleParameters:
    default: {}
    description: Parameters specific to the role
    type: json
  EnableInternalTLS:
    type: boolean
    default: false

conditions:

  internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}


resources:

  ContainersCommon:
    type: ./containers-common.yaml

  OctaviaApiPuppetBase:
    type: ../../puppet/services/octavia-api.yaml
    properties:
      EndpointMap: {get_param: EndpointMap}
      ServiceNetMap: {get_param: ServiceNetMap}
      DefaultPasswords: {get_param: DefaultPasswords}
      RoleName: {get_param: RoleName}
      RoleParameters: {get_param: RoleParameters}

outputs:
  role_data:
    description: Role data for the Octavia API role.
    value:
      service_name: {get_attr: [OctaviaApiPuppetBase, role_data, service_name]}
      config_settings: {get_attr: [OctaviaApiPuppetBase, role_data, config_settings]}
      step_config: &step_config
        get_attr: [OctaviaApiPuppetBase, role_data, step_config]
      service_config_settings: {get_attr: [OctaviaApiPuppetBase, role_data, service_config_settings]}
      # BEGIN DOCKER SETTINGS #
      puppet_config:
        config_volume: octavia
        puppet_tags: octavia_config
        step_config: *step_config
        config_image:
          list_join:
            - '/'
            - [ {get_param: DockerNamespace}, {get_param: DockerOctaviaConfigImage} ]
      kolla_config:
        /var/lib/kolla/config_files/octavia_api.json:
          command: /usr/bin/octavia-api --config-file /usr/share/octavia/octavia-dist.conf --config-file /etc/octavia/octavia.conf --log-file /var/log/octavia/api.log --config-dir /etc/octavia/conf.d/common --config-dir /etc/octavia/conf.d/octavia-api
        /var/lib/kolla/config_files/octavia_api_tls_proxy.json:
          command: /usr/sbin/httpd -DFOREGROUND
      docker_config:
        # Kolla_bootstrap/db_sync runs before permissions set by kolla_config
        step_2:
          octavia_api_init_dirs:
            start_order: 0
            image: &octavia_api_image
              list_join:
                - '/'
                - [ {get_param: DockerNamespace}, {get_param: DockerOctaviaApiImage} ]
            user: root
            volumes:
              - /var/lib/config-data/octavia/etc/octavia:/etc/octavia/
              - /var/log/containers/octavia:/var/log/octavia
            command: ['/bin/bash', '-c', 'mkdir -p /etc/octavia/conf.d/octavia-api; chown -R octavia:octavia /etc/octavia/conf.d/octavia-api; chown -R octavia:octavia /var/log/octavia']
        step_3:
          octavia_db_sync:
            start_order: 0
            image: *octavia_api_image
            net: host
            privileged: false
            detach: false
            user: root
            volumes: &octavia_volumes
              list_concat:
                - {get_attr: [ContainersCommon, volumes]}
                -
                  - /var/lib/kolla/config_files/octavia_api.json:/var/lib/kolla/config_files/config.json:ro
                  - /var/lib/config-data/octavia/etc/octavia/:/etc/octavia/:ro
                  - /var/log/containers/octavia:/var/log/octavia
            command: "/usr/bin/bootstrap_host_exec octavia_api su octavia -s /bin/bash -c '/usr/bin/octavia-db-manage upgrade head'"
        step_4:
          map_merge:
            - octavia_api:
                start_order: 2
                image: *octavia_api_image
                net: host
                privileged: false
                restart: always
                volumes: *octavia_volumes
                environment:
                  - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
            - if:
                - internal_tls_enabled
                - octavia_api_tls_proxy:
                    start_order: 2
                    image: *octavia_api_image
                    net: host
                    user: root
                    restart: always
                    volumes:
                      list_concat:
                        - {get_attr: [ContainersCommon, volumes]}
                        -
                          - /var/lib/kolla/config_files/octavia_api_tls_proxy.json:/var/lib/kolla/config_files/config.json:ro
                          - /var/lib/config-data/octavia/etc/httpd/:/etc/httpd/:ro
                          - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
                          - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
                    environment:
                      - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
                - {}
      host_prep_tasks:
        - name: create persistent logs directory
          file:
            path: /var/log/containers/octavia
            state: directory
      upgrade_tasks:
        - name: Stop and disable octavia_api service
          tags: step2
          service: name=openstack-octavia-api state=stopped enabled=no