Juju Charm - Glance Simplestreams Sync
Go to file
Dmitrii Shcherbakov 009c8a7b92 Dynamically generate proxy settings for image syncs
sstream-mirror-glance has several endpoints it needs to talk to:

* Image mirrors - typically, public Internet endpoints;
* Keystone - typically, a directly reachable endpoint;
* Glance - typically, a directly reachable endpoint;
* Object store (Swift) - typically, a directly reachable endpoint but
  sometimes it may be deployed externally and added to the region
  catalog in Keystone (in which case it might be accessible via a proxy
  only).

While sstream-mirror-glance does not support specifying proxy settings
for individual directions, since we know all of them based on the
Keystone catalog, a list of endpoints to add to NO_PROXY environment
variable can be generated dynamically.

The complication is that image syncs are periodically done via a cron
job so a juju-run invocation is needed to retrieve relevant proxy
settings from model-config at each invocation of the synchronization
script.

Additionally, the charm is long-lived so there may be some environments
that rely on legacy proxy settings. This change accounts for that and
acts both on juju-prefixed (new) and unprefixed (legacy) proxy settings.

Whether to use proxy settings for connections to the object store API
is controlled by a charm option which the script is made to react to.
Proxy settings are ignored for object store connections by default.

Closes-Bug: #1843486
Change-Id: Ib1fc5d2eebf43d5f98bb8ee405a3799802c8b8dc
2021-07-22 21:14:03 +03:00
actions Switch to using snap for simplestreams tools 2020-06-18 08:50:02 +01:00
charmhelpers c-h sync - restore proxy env vars for add-apt-repository 2021-05-13 08:46:33 -04:00
files Dynamically generate proxy settings for image syncs 2021-07-22 21:14:03 +03:00
hooks Dynamically generate proxy settings for image syncs 2021-07-22 21:14:03 +03:00
lib Update tox, requirements, add initial func tests framework 2018-04-06 22:06:49 +00:00
templates Dynamically generate proxy settings for image syncs 2021-07-22 21:14:03 +03:00
tests Test bundles for focal-wallaby and hirsute-wallaby 2021-05-06 10:11:27 +00:00
unit_tests Dynamically generate proxy settings for image syncs 2021-07-22 21:14:03 +03:00
.gitignore Update series metadata, test combos and readme 2018-04-10 14:33:49 +00:00
.gitreview OpenDev Migration Patch 2019-04-19 19:40:14 +00:00
.stestr.conf Replace ostestr with stestr in testing framework. 2019-03-07 17:11:21 -05:00
.zuul.yaml Switch to Ussuri jobs 2019-12-03 16:54:34 +08:00
actions.yaml Switch to using snap for simplestreams tools 2020-06-18 08:50:02 +01:00
charm-helpers-hooks.yaml Updates to flip all libraries back to master 2021-05-03 16:04:42 +01:00
config.yaml Dynamically generate proxy settings for image syncs 2021-07-22 21:14:03 +03:00
copyright Update copyright date 2018-05-08 12:37:36 -05:00
HACKING.md Add doc pointing contributors to charm-guide 2019-07-16 09:42:57 +02:00
LICENSE Relicense to Apache2 2018-05-08 12:30:29 -05:00
Makefile Migrate from Amulet to Zaza 2019-09-12 22:41:32 +12:00
metadata.yaml Add impish to metadata.yaml 2021-06-03 11:12:16 +02:00
osci.yaml Forward returncode from sync program 2021-05-26 20:47:29 +02:00
README.md Update README 2020-08-11 16:03:23 -04:00
requirements.txt Dynamically generate proxy settings for image syncs 2021-07-22 21:14:03 +03:00
setup.cfg Initial baseline from bzr 2017-04-10 09:00:27 +01:00
test-requirements.txt Dynamically generate proxy settings for image syncs 2021-07-22 21:14:03 +03:00
tox.ini Dynamically generate proxy settings for image syncs 2021-07-22 21:14:03 +03:00

Overview

The glance-simplestreams-sync charm keeps OpenStack cloud images (in Glance) synchronised with the latest available images from a Simplestreams mirror(s). It uses Cron to do this.

The charm places simplestreams metadata in Object storage for future use by Juju. It then publishes the URL for that metadata as the endpoints of a new OpenStack service called 'product-streams'.

The charm installs Simplestreams from a snap.

Usage

Configuration

This section covers common and/or important configuration options. See file config.yaml for the full list of options, along with their descriptions and default values. See the Juju documentation for details on configuring applications.

run

The run option enables the synchronisation cron script. This option accepts Boolean values ('true' or 'false') with the default value being 'false'. Changing the value from 'false' to 'true' will immediately schedule an image sync.

Note

: Enabling this option at cloud deploy time may cause a race condition with the set up of a possible storage backend for Glance.

frequency

The frequency option controls how often the sync cron job is run. It is used to link the cron script into /etc/cron.<frequency>. Valid string values are: 'hourly', 'daily', and 'weekly'. The default is 'daily'.

region

The region option states the OpenStack region to operate in. The default value is 'RegionOne'.

mirror_list

The mirror_list option is a YAML-formatted list of Simplestreams mirrors and their configuration properties. The default behaviour is to download images from https://cloud-images.ubuntu.com.

ssl_ca

The ssl_ca option verifies (optionally) the certificates when in SSL mode for Keystone and Glance. This should be provided as a base64 encoded PEM certificate.

Deployment

To deploy to an existing OpenStack cloud (that already includes Glance, Object storage, and Keystone):

juju deploy glance-simplestreams-sync
juju add-relation glance-simplestreams-sync:identity-service keystone:identity-service

Note

: Charmed OpenStack commonly employs Ceph-backed Object storage (see the ceph-radosgw charm). Otherwise, a vanilla Swift-based solution can be used (see the swift-proxy charm).

Actions

Juju actions allow specific operations to be performed on a per-unit basis. This charm supports the single action sync-images, which allows for a one-time image sync from the currently configured mirror list.

Bugs

Please report bugs on Launchpad.

For general charm questions refer to the OpenStack Charm Guide.