Juju Charm - Neutron API
Go to file
Corey Bryant 8e708a76b7 Ensure openstack-release package is correct after install hook
The linked bug shows the install of the charm with openstack-origin set
to zed.  This happens because configure_installation_source() causes the
openstack-release package to be installed *before* the zed cloud archive
sources are configured into /etc/apt and an apt update done. This means
that the openstack-release package says "yoga" despite the zed packages
actually being installed.

Then, on the config-changed hook, it sees that the installed version is
showing as yoga and tries to do an upgrade.  This fails, as the charm
hasn't yet bootstrapped, and the charm tries to bootstrap after
upgrading the packages.

There's a few bugs here which are exposed, but the tactical fix is to
force the openstack-release to match the installed packages.

Closes-Bug: #1989538
Change-Id: Icaa2303d2dbbcfc883ea1cd44ce0a77af1ef7250
2022-10-04 19:38:01 +00:00
actions Sync libraries & common files prior to freeze 2020-09-28 09:52:17 +01:00
files MidoNet support up until Liberty 2016-01-22 16:14:59 +01:00
hooks Ensure openstack-release package is correct after install hook 2022-10-04 19:38:01 +00:00
lib Update tox.ini files from release-tools gold copy 2016-09-09 19:42:45 +00:00
templates Merge "Use AZLeastRoutersScheduler by default" 2021-01-05 18:51:11 +00:00
tests Add Kinetic and Zed support 2022-08-26 18:40:39 +00:00
unit_tests Option to enable network-segment-range support 2022-03-17 18:38:01 +09:00
.gitignore Remove the charm artifact from the repository 2022-03-16 11:15:01 +00:00
.gitreview OpenDev Migration Patch 2019-04-19 19:44:52 +00:00
.project Rationalize endpoint generation, rework tests, add support for multiple network support 2014-06-27 12:55:45 +01:00
.pydevproject Rationalize endpoint generation, rework tests, add support for multiple network support 2014-06-27 12:55:45 +01:00
.stestr.conf Replace ostestr with stestr in testing framework. 2019-03-07 17:12:09 -05:00
.zuul.yaml Add Kinetic and Zed support 2022-08-26 18:40:39 +00:00
actions.yaml Add security-checklist audit 2019-03-13 10:32:50 +01:00
bindep.txt Add Kinetic and Zed support 2022-08-26 18:40:39 +00:00
build-requirements.txt Update to classic charms to build using charmcraft in CI 2022-02-15 16:39:54 +00:00
charm-helpers-hooks.yaml Updates to enable jammy and finalise charmcraft builds 2022-04-07 12:20:45 +01:00
charmcraft.yaml Ensure that kinetic/22.10 is enabled 2022-08-31 20:18:28 +01:00
config.yaml Add Kinetic and Zed support 2022-08-26 18:40:39 +00:00
copyright Update http to https. 2018-12-11 14:33:34 +08:00
hardening.yaml Add hardening support 2016-03-31 10:40:23 +01:00
icon.svg Update charm icon 2017-08-02 18:19:28 +01:00
LICENSE Re-license charm as Apache-2.0 2016-07-03 17:47:52 +01:00
Makefile Enable Ussuri and Focal 2020-03-07 15:37:29 +01:00
metadata.yaml Ensure that kinetic/22.10 is enabled 2022-08-31 20:18:28 +01:00
osci.yaml Add Kinetic and Zed support 2022-08-26 18:40:39 +00:00
pip.sh Add xena bundles 2021-09-30 16:35:36 +00:00
README.md Update key for reverse DNS lookup in README 2022-09-20 14:53:20 +02:00
rename.sh Update to classic charms to build using charmcraft in CI 2022-02-15 16:39:54 +00:00
requirements.txt Add Kinetic and Zed support 2022-08-26 18:40:39 +00:00
setup.cfg setup.cfg: Replace dashes with underscores 2021-05-04 15:47:26 +08:00
test-requirements.txt Add Kinetic and Zed support 2022-08-26 18:40:39 +00:00
tox.ini Add Kinetic and Zed support 2022-08-26 18:40:39 +00:00

Overview

This principle charm provides the OpenStack Neutron API service which was previously provided by the nova-cloud-controller charm.

When this charm is related to the nova-cloud-controller charm the nova-cloud controller charm will shutdown its api service, de-register it from keystone and inform the compute nodes of the new neutron url.

Usage

To deploy (partial deployment only):

juju deploy neutron-api
juju deploy neutron-openvswitch

juju add-relation neutron-api mysql
juju add-relation neutron-api rabbitmq-server
juju add-relation neutron-api neutron-openvswitch
juju add-relation neutron-api nova-cloud-controller

This charm also supports scale out and high availability using the hacluster charm:

juju deploy hacluster neutron-hacluster
juju add-unit neutron-api
juju config neutron-api vip=<VIP FOR ACCESS>
juju add-relation neutron-hacluster neutron-api

High availability

When more than one unit is deployed with the hacluster application the charm will bring up an HA active/active cluster.

There are two mutually exclusive high availability options: using virtual IP(s) or DNS. In both cases the hacluster subordinate charm is used to provide the Corosync and Pacemaker backend HA functionality.

See OpenStack high availability in the OpenStack Charms Deployment Guide for details.

Restrictions

This charm only support deployment with OpenStack Icehouse or better.

Internal DNS for Cloud Guests

The charm supports enabling internal DNS resolution for cloud guests in accordance with the OpenStack DNS integration guide. To enable internal DNS resolution, the 'enable-ml2-dns' option must be set to True. When enabled, the domain name specified in the 'dns-domain' will be advertised as the nameserver search path by the DHCP agents.

The Nova compute service will leverage this functionality when enabled. When ports are allocated by the compute service, the dns_name of the port is populated with a DNS sanitized version of the instance's display name. The Neutron DHCP agents will then create host entries in the dnsmasq's configuration files matching the dns_name of the port to the IP address associated with the port.

Note that the DNS nameserver provided to the instance by the DHCP agent depends on the tenant's network setup. The Neutron DHCP agent only advertises itself as a nameserver when the Neutron subnet does not have nameservers configured. If additional nameservers are needed and internal DNS is desired, then the IP address of the DHCP port should be added to the subnet's list of configured nameservers.

For more information refer to the OpenStack documentation on DNS Integration.

External DNS for Cloud Guests

To add support for DNS record auto-generation when Neutron ports and floating IPs are created the charm needs a relation with designate charm:

juju deploy designate
juju add-relation neutron-api designate

In order to enable the creation of reverse lookup (PTR) records, enable "reverse-dns-lookup" charm option:

juju config neutron-api reverse-dns-lookup=True

and configure the following charm options:

juju config neutron-api ipv4-ptr-zone-prefix-size=<IPV4 PREFIX SIZE>
juju config neutron-api ipv6-ptr-zone-prefix-size=<IPV6 PREFIX SIZE>

For example, if prefix sizes of your IPv4 and IPv6 subnets are "24" (e.g. "192.168.0.0/24") and "64" (e.g. "fdcd:06ca:e498:216b::/64") respectively, configure the charm options as follows:

juju config neutron-api ipv4-ptr-zone-prefix-size=24
juju config neutron-api ipv6-ptr-zone-prefix-size=64

For more information refer to the OpenStack documentation on DNS Integration

Spaces

This charm supports the use of Juju Network Spaces, allowing the charm to be bound to network space configurations managed directly by Juju. This is only supported with Juju 2.0 and above.

API endpoints can be bound to distinct network spaces supporting the network separation of public, internal and admin endpoints.

Access to the underlying MySQL instance can also be bound to a specific space using the shared-db relation.

To use this feature, use the --bind option when deploying the charm:

juju deploy neutron-api --bind \
   "public=public-space \
    internal=internal-space \
    admin=admin-space \
    shared-db=internal-space"

Alternatively these can also be provided as part of a juju native bundle configuration:

    neutron-api:
      charm: cs:xenial/neutron-api
      num_units: 1
      bindings:
        public: public-space
        admin: admin-space
        internal: internal-space
        shared-db: internal-space

NOTE: Spaces must be configured in the underlying provider prior to attempting to use them.

NOTE: Existing deployments using os-*-network configuration options will continue to function; these options are preferred over any network space binding provided if set.

Additional Middleware Requests by Neutron Plugin Charms

Some neutron plugins may require additional middleware to be added to api-paste.ini. In order to support that a subordinate may pass extra_middleware via the neutron-plugin-api-subordinate relation.

Relation data to be set by subordinates: {'extra_middleware': [{ 'type': 'middleware_type', 'name': 'middleware_name', 'config': { 'setting_1': 'value_1', 'setting_2': 'value_2'}}]}

It would not be correct to do that from your own plugin as this requires the neutron-api service restart which should be handled in this charm.

The developer guide for Neutron contains a description of the startup process which makes it clear that api-paste.ini is parsed only once in neutron-api's lifetime (see the "WSGI Application" section):

https://opendev.org/openstack/neutron/src/branch/master/doc/source/contributor/internals/api_layer.rst

For the api-paste.ini format in general, please consult PasteDeploy repository docs/index.txt, "Config Format" section: https://github.com/Pylons/pastedeploy

Classes in loadwsgi.py contain config_prefixes that can be used for middleware types - these are the prefixes the charm code validates passed data against:

https://github.com/Pylons/pastedeploy/blob/master/paste/deploy/loadwsgi.py

Policy Overrides

Policy overrides is an advanced feature that allows an operator to override the default policy of an OpenStack service. The policies that the service supports, the defaults it implements in its code, and the defaults that a charm may include should all be clearly understood before proceeding.

Caution

: It is possible to break the system (for tenants and other services) if policies are incorrectly applied to the service.

Policy statements are placed in a YAML file. This file (or files) is then (ZIP) compressed into a single file and used as an application resource. The override is then enabled via a Boolean charm option.

Here are the essential commands (filenames are arbitrary):

zip overrides.zip override-file.yaml
juju attach-resource neutron-api policyd-override=overrides.zip
juju config neutron-api use-policyd-override=true

See appendix Policy Overrides in the OpenStack Charms Deployment Guide for a thorough treatment of this feature.

Bugs

Please report bugs on Launchpad.

For general charm questions refer to the OpenStack Charm Guide.