diff options
author | Adam King <adking@redhat.com> | 2024-10-21 17:06:51 +0200 |
---|---|---|
committer | Adam King <adking@redhat.com> | 2024-10-30 15:12:11 +0100 |
commit | 874f12451da7a9908843ab7a4856e6a7f67eccae (patch) | |
tree | abd978e085486b7088d3e9ff0835a4b1c7eacbc9 /src | |
parent | cephadm: add python-common/ceph to MYPYPATH and pytest PYTHONPATH (diff) | |
download | ceph-874f12451da7a9908843ab7a4856e6a7f67eccae.tar.xz ceph-874f12451da7a9908843ab7a4856e6a7f67eccae.zip |
cephadm: update default image imports to point to common location
Additionally, remove the image defaults from the two previous locations
and update the check for the number of instances of "quay" and "docker"
in these areas respectively.
Fixes: https://tracker.ceph.com/issues/68120
Signed-off-by: Adam King <adking@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/cephadm/cephadmlib/constants.py | 18 | ||||
-rw-r--r-- | src/cephadm/cephadmlib/container_types.py | 52 | ||||
-rw-r--r-- | src/cephadm/cephadmlib/daemons/ingress.py | 4 | ||||
-rw-r--r-- | src/cephadm/cephadmlib/daemons/mgmt_gateway.py | 2 | ||||
-rw-r--r-- | src/cephadm/cephadmlib/daemons/monitoring.py | 8 | ||||
-rw-r--r-- | src/cephadm/cephadmlib/daemons/nvmeof.py | 2 | ||||
-rw-r--r-- | src/cephadm/cephadmlib/daemons/oauth2_proxy.py | 3 | ||||
-rw-r--r-- | src/cephadm/cephadmlib/daemons/smb.py | 4 | ||||
-rw-r--r-- | src/cephadm/cephadmlib/daemons/snmp.py | 2 | ||||
-rw-r--r-- | src/cephadm/cephadmlib/daemons/tracing.py | 2 | ||||
-rw-r--r-- | src/cephadm/tox.ini | 2 | ||||
-rw-r--r-- | src/pybind/mgr/cephadm/module.py | 58 | ||||
-rw-r--r-- | src/pybind/mgr/tox.ini | 2 |
13 files changed, 47 insertions, 112 deletions
diff --git a/src/cephadm/cephadmlib/constants.py b/src/cephadm/cephadmlib/constants.py index c53e89438a8..215d207729d 100644 --- a/src/cephadm/cephadmlib/constants.py +++ b/src/cephadm/cephadmlib/constants.py @@ -4,24 +4,6 @@ DEFAULT_IMAGE = 'quay.ceph.io/ceph-ci/ceph:main' DEFAULT_IMAGE_IS_MAIN = True DEFAULT_IMAGE_RELEASE = 'squid' -DEFAULT_PROMETHEUS_IMAGE = 'quay.io/prometheus/prometheus:v2.51.0' -DEFAULT_LOKI_IMAGE = 'quay.io/ceph/loki:3.0.0' -DEFAULT_PROMTAIL_IMAGE = 'quay.io/ceph/promtail:3.0.0' -DEFAULT_NODE_EXPORTER_IMAGE = 'quay.io/prometheus/node-exporter:v1.7.0' -DEFAULT_ALERT_MANAGER_IMAGE = 'quay.io/prometheus/alertmanager:v0.27.0' -DEFAULT_GRAFANA_IMAGE = 'quay.io/ceph/grafana:10.4.8' -DEFAULT_HAPROXY_IMAGE = 'quay.io/ceph/haproxy:2.3' -DEFAULT_KEEPALIVED_IMAGE = 'quay.io/ceph/keepalived:2.2.4' -DEFAULT_NVMEOF_IMAGE = 'quay.io/ceph/nvmeof:1.3.3' -DEFAULT_SNMP_GATEWAY_IMAGE = 'quay.io/ceph/snmp-notifier:v1.2.1' -DEFAULT_ELASTICSEARCH_IMAGE = 'quay.io/omrizeneva/elasticsearch:6.8.23' -DEFAULT_JAEGER_COLLECTOR_IMAGE = 'quay.io/jaegertracing/jaeger-collector:1.29' -DEFAULT_JAEGER_AGENT_IMAGE = 'quay.io/jaegertracing/jaeger-agent:1.29' -DEFAULT_JAEGER_QUERY_IMAGE = 'quay.io/jaegertracing/jaeger-query:1.29' -DEFAULT_SMB_IMAGE = 'quay.io/samba.org/samba-server:devbuilds-centos-amd64' -DEFAULT_SMBMETRICS_IMAGE = 'quay.io/samba.org/samba-metrics:latest' -DEFAULT_NGINX_IMAGE = 'quay.io/ceph/nginx:sclorg-nginx-126' -DEFAULT_OAUTH2_PROXY_IMAGE = 'quay.io/oauth2-proxy/oauth2-proxy:v7.6.0' DEFAULT_REGISTRY = 'quay.io' # normalize unqualified digests to this # ------------------------------------------------------------------------------ diff --git a/src/cephadm/cephadmlib/container_types.py b/src/cephadm/cephadmlib/container_types.py index 791a545538a..f1e829cbdf7 100644 --- a/src/cephadm/cephadmlib/container_types.py +++ b/src/cephadm/cephadmlib/container_types.py @@ -8,28 +8,8 @@ import os from typing import Dict, List, Optional, Any, Union, Tuple, Iterable, cast from .call_wrappers import call, call_throws, CallVerbosity -from .constants import ( - DEFAULT_TIMEOUT, - # default container images - DEFAULT_ALERT_MANAGER_IMAGE, - DEFAULT_GRAFANA_IMAGE, - DEFAULT_LOKI_IMAGE, - DEFAULT_NODE_EXPORTER_IMAGE, - DEFAULT_PROMETHEUS_IMAGE, - DEFAULT_PROMTAIL_IMAGE, - DEFAULT_HAPROXY_IMAGE, - DEFAULT_KEEPALIVED_IMAGE, - DEFAULT_NVMEOF_IMAGE, - DEFAULT_SNMP_GATEWAY_IMAGE, - DEFAULT_ELASTICSEARCH_IMAGE, - DEFAULT_JAEGER_COLLECTOR_IMAGE, - DEFAULT_JAEGER_AGENT_IMAGE, - DEFAULT_JAEGER_QUERY_IMAGE, - DEFAULT_SMB_IMAGE, - DEFAULT_SMBMETRICS_IMAGE, - DEFAULT_NGINX_IMAGE, - DEFAULT_OAUTH2_PROXY_IMAGE, -) +from .constants import DEFAULT_TIMEOUT +import ceph.cephadm.images as default_images from .container_engines import Docker, Podman from .context import CephadmContext from .daemon_identity import DaemonIdentity, DaemonSubIdentity @@ -687,24 +667,12 @@ def get_mgr_images() -> dict: """Return dict of default mgr images""" mgr_prefix = 'mgr/cephadm/container_image_' mgr_images = {} - mgr_images[mgr_prefix + 'prometheus'] = DEFAULT_PROMETHEUS_IMAGE - mgr_images[mgr_prefix + 'alertmanager'] = DEFAULT_ALERT_MANAGER_IMAGE - mgr_images[mgr_prefix + 'graphana'] = DEFAULT_GRAFANA_IMAGE - mgr_images[mgr_prefix + 'loki'] = DEFAULT_LOKI_IMAGE - mgr_images[mgr_prefix + 'promtail'] = DEFAULT_PROMTAIL_IMAGE - mgr_images[mgr_prefix + 'node_exporter'] = DEFAULT_NODE_EXPORTER_IMAGE - mgr_images[mgr_prefix + 'haproxy'] = DEFAULT_HAPROXY_IMAGE - mgr_images[mgr_prefix + 'keepalived'] = DEFAULT_KEEPALIVED_IMAGE - mgr_images[mgr_prefix + 'nvmeof'] = DEFAULT_NVMEOF_IMAGE - mgr_images[mgr_prefix + 'snmp_gateway'] = DEFAULT_SNMP_GATEWAY_IMAGE - mgr_images[mgr_prefix + 'elasticsearch'] = DEFAULT_ELASTICSEARCH_IMAGE - mgr_images[ - mgr_prefix + 'jaeger_collector' - ] = DEFAULT_JAEGER_COLLECTOR_IMAGE - mgr_images[mgr_prefix + 'jaeger_agent'] = DEFAULT_JAEGER_AGENT_IMAGE - mgr_images[mgr_prefix + 'jaeger_query'] = DEFAULT_JAEGER_QUERY_IMAGE - mgr_images[mgr_prefix + 'smb'] = DEFAULT_SMB_IMAGE - mgr_images[mgr_prefix + 'smbmetrics'] = DEFAULT_SMBMETRICS_IMAGE - mgr_images[mgr_prefix + 'nginx'] = DEFAULT_NGINX_IMAGE - mgr_images[mgr_prefix + 'oauth2_proxy'] = DEFAULT_OAUTH2_PROXY_IMAGE + images = vars(default_images) + for key, value in images.items(): + if key.startswith('DEFAULT_') and key.endswith('_IMAGE'): + # flake8 and black disagree about spaces around ":" hence the noqa comment + suffix = key[ + len('DEFAULT_') : -len('_IMAGE') # noqa: E203 + ].lower() + mgr_images[mgr_prefix + suffix] = value return mgr_images diff --git a/src/cephadm/cephadmlib/daemons/ingress.py b/src/cephadm/cephadmlib/daemons/ingress.py index 6064cf538fb..8f4f6b08991 100644 --- a/src/cephadm/cephadmlib/daemons/ingress.py +++ b/src/cephadm/cephadmlib/daemons/ingress.py @@ -2,9 +2,11 @@ import os from typing import Dict, List, Optional, Tuple, Union -from ..constants import ( +from ceph.cephadm.images import ( DEFAULT_HAPROXY_IMAGE, DEFAULT_KEEPALIVED_IMAGE, +) +from ..constants import ( DATA_DIR_MODE, ) from ..container_daemon_form import ContainerDaemonForm, daemon_to_container diff --git a/src/cephadm/cephadmlib/daemons/mgmt_gateway.py b/src/cephadm/cephadmlib/daemons/mgmt_gateway.py index 01c68a83ba8..85f72495909 100644 --- a/src/cephadm/cephadmlib/daemons/mgmt_gateway.py +++ b/src/cephadm/cephadmlib/daemons/mgmt_gateway.py @@ -11,7 +11,7 @@ from ..context_getters import fetch_configs from ..daemon_form import register as register_daemon_form from ..daemon_identity import DaemonIdentity from ..deployment_utils import to_deployment_container -from ..constants import DEFAULT_NGINX_IMAGE +from ceph.cephadm.images import DEFAULT_NGINX_IMAGE from ..data_utils import dict_get, is_fsid from ..file_utils import populate_files, makedirs, recursive_chown from ..exceptions import Error diff --git a/src/cephadm/cephadmlib/daemons/monitoring.py b/src/cephadm/cephadmlib/daemons/monitoring.py index fca4da406e5..710093f0f46 100644 --- a/src/cephadm/cephadmlib/daemons/monitoring.py +++ b/src/cephadm/cephadmlib/daemons/monitoring.py @@ -3,13 +3,15 @@ import os from typing import Dict, List, Tuple from ..call_wrappers import call, CallVerbosity -from ..constants import ( - DEFAULT_ALERT_MANAGER_IMAGE, +from ceph.cephadm.images import ( + DEFAULT_ALERTMANAGER_IMAGE, DEFAULT_GRAFANA_IMAGE, DEFAULT_LOKI_IMAGE, DEFAULT_NODE_EXPORTER_IMAGE, DEFAULT_PROMETHEUS_IMAGE, DEFAULT_PROMTAIL_IMAGE, +) +from ..constants import ( UID_NOBODY, GID_NOGROUP, ) @@ -91,7 +93,7 @@ class Monitoring(ContainerDaemonForm): ], }, 'alertmanager': { - 'image': DEFAULT_ALERT_MANAGER_IMAGE, + 'image': DEFAULT_ALERTMANAGER_IMAGE, 'cpus': '2', 'memory': '2GB', 'args': [ diff --git a/src/cephadm/cephadmlib/daemons/nvmeof.py b/src/cephadm/cephadmlib/daemons/nvmeof.py index 9bce32201bb..2c20a900f45 100644 --- a/src/cephadm/cephadmlib/daemons/nvmeof.py +++ b/src/cephadm/cephadmlib/daemons/nvmeof.py @@ -8,7 +8,7 @@ from ..container_types import CephContainer from ..context_getters import fetch_configs, get_config_and_keyring from ..daemon_form import register as register_daemon_form from ..daemon_identity import DaemonIdentity -from ..constants import DEFAULT_NVMEOF_IMAGE +from ceph.cephadm.images import DEFAULT_NVMEOF_IMAGE from ..context import CephadmContext from ..data_utils import dict_get, is_fsid from ..deployment_utils import to_deployment_container diff --git a/src/cephadm/cephadmlib/daemons/oauth2_proxy.py b/src/cephadm/cephadmlib/daemons/oauth2_proxy.py index 2b61df9d2e7..14202111c14 100644 --- a/src/cephadm/cephadmlib/daemons/oauth2_proxy.py +++ b/src/cephadm/cephadmlib/daemons/oauth2_proxy.py @@ -11,7 +11,8 @@ from ..context_getters import fetch_configs from ..daemon_form import register as register_daemon_form from ..daemon_identity import DaemonIdentity from ..deployment_utils import to_deployment_container -from ..constants import DEFAULT_OAUTH2_PROXY_IMAGE, UID_NOBODY, GID_NOGROUP +from ceph.cephadm.images import DEFAULT_OAUTH2_PROXY_IMAGE +from ..constants import UID_NOBODY, GID_NOGROUP from ..data_utils import dict_get, is_fsid from ..file_utils import populate_files, makedirs, recursive_chown from ..exceptions import Error diff --git a/src/cephadm/cephadmlib/daemons/smb.py b/src/cephadm/cephadmlib/daemons/smb.py index 82f886e72ec..6b253054ede 100644 --- a/src/cephadm/cephadmlib/daemons/smb.py +++ b/src/cephadm/cephadmlib/daemons/smb.py @@ -13,7 +13,7 @@ from .. import data_utils from .. import deployment_utils from .. import file_utils from ..call_wrappers import call, CallVerbosity -from ..constants import DEFAULT_SMB_IMAGE +from ceph.cephadm.images import DEFAULT_SAMBA_IMAGE from ..container_daemon_form import ContainerDaemonForm, daemon_to_container from ..container_engines import Podman from ..container_types import ( @@ -418,7 +418,7 @@ class SMB(ContainerDaemonForm): daemon_type = 'smb' daemon_base = '/usr/sbin/smbd' - default_image = DEFAULT_SMB_IMAGE + default_image = DEFAULT_SAMBA_IMAGE @classmethod def for_daemon_type(cls, daemon_type: str) -> bool: diff --git a/src/cephadm/cephadmlib/daemons/snmp.py b/src/cephadm/cephadmlib/daemons/snmp.py index f334e5f7652..ab84a302f2c 100644 --- a/src/cephadm/cephadmlib/daemons/snmp.py +++ b/src/cephadm/cephadmlib/daemons/snmp.py @@ -5,7 +5,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union from urllib.error import HTTPError, URLError from urllib.request import urlopen -from ..constants import DEFAULT_SNMP_GATEWAY_IMAGE +from ceph.cephadm.images import DEFAULT_SNMP_GATEWAY_IMAGE from ..container_daemon_form import ContainerDaemonForm, daemon_to_container from ..container_types import CephContainer from ..context import CephadmContext diff --git a/src/cephadm/cephadmlib/daemons/tracing.py b/src/cephadm/cephadmlib/daemons/tracing.py index 365458a9c57..4cf74339455 100644 --- a/src/cephadm/cephadmlib/daemons/tracing.py +++ b/src/cephadm/cephadmlib/daemons/tracing.py @@ -2,7 +2,7 @@ import logging from typing import Any, Dict, List, Tuple -from ..constants import ( +from ceph.cephadm.images import ( DEFAULT_ELASTICSEARCH_IMAGE, DEFAULT_JAEGER_AGENT_IMAGE, DEFAULT_JAEGER_COLLECTOR_IMAGE, diff --git a/src/cephadm/tox.ini b/src/cephadm/tox.ini index 7658b3b31f9..b999a0f552b 100644 --- a/src/cephadm/tox.ini +++ b/src/cephadm/tox.ini @@ -58,7 +58,7 @@ deps = commands = flake8 --config=tox.ini {posargs:cephadm.py cephadmlib} bash -c 'test $(git ls-files 'cephadm.py' 'cephadmlib/*.py' | sort -u | xargs grep "docker.io" | wc -l) == 1' - bash -c 'test $(git ls-files 'cephadm.py' 'cephadmlib/*.py' | sort -u | xargs grep "quay.io" | wc -l) == 25' + bash -c 'test $(git ls-files 'cephadm.py' 'cephadmlib/*.py' | sort -u | xargs grep "quay.io" | wc -l) == 7' # Downstream distributions may choose to alter this "docker.io" number, # to make sure no new references to docker.io are creeping in unnoticed. diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index e7e429e88cd..15079c40be6 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -30,6 +30,7 @@ import multiprocessing.pool import subprocess from prettytable import PrettyTable +import ceph.cephadm.images as default_images from ceph.deployment import inventory from ceph.deployment.drive_group import DriveGroupSpec from ceph.deployment.service_spec import \ @@ -130,28 +131,7 @@ def os_exit_noop(status: int) -> None: os._exit = os_exit_noop # type: ignore - -# Default container images ----------------------------------------------------- DEFAULT_IMAGE = 'quay.io/ceph/ceph' -DEFAULT_PROMETHEUS_IMAGE = 'quay.io/prometheus/prometheus:v2.51.0' -DEFAULT_NODE_EXPORTER_IMAGE = 'quay.io/prometheus/node-exporter:v1.7.0' -DEFAULT_NVMEOF_IMAGE = 'quay.io/ceph/nvmeof:1.3.3' -DEFAULT_LOKI_IMAGE = 'quay.io/ceph/loki:3.0.0' -DEFAULT_PROMTAIL_IMAGE = 'quay.io/ceph/promtail:3.0.0' -DEFAULT_ALERT_MANAGER_IMAGE = 'quay.io/prometheus/alertmanager:v0.27.0' -DEFAULT_GRAFANA_IMAGE = 'quay.io/ceph/grafana:10.4.8' -DEFAULT_HAPROXY_IMAGE = 'quay.io/ceph/haproxy:2.3' -DEFAULT_KEEPALIVED_IMAGE = 'quay.io/ceph/keepalived:2.2.4' -DEFAULT_SNMP_GATEWAY_IMAGE = 'quay.io/ceph/snmp-notifier:v1.2.1' -DEFAULT_ELASTICSEARCH_IMAGE = 'quay.io/omrizeneva/elasticsearch:6.8.23' -DEFAULT_JAEGER_COLLECTOR_IMAGE = 'quay.io/jaegertracing/jaeger-collector:1.29' -DEFAULT_JAEGER_AGENT_IMAGE = 'quay.io/jaegertracing/jaeger-agent:1.29' -DEFAULT_NGINX_IMAGE = 'quay.io/ceph/nginx:sclorg-nginx-126' -DEFAULT_OAUTH2_PROXY_IMAGE = 'quay.io/oauth2-proxy/oauth2-proxy:v7.6.0' -DEFAULT_JAEGER_QUERY_IMAGE = 'quay.io/jaegertracing/jaeger-query:1.29' -DEFAULT_SAMBA_IMAGE = 'quay.io/samba.org/samba-server:devbuilds-centos-amd64' -DEFAULT_SAMBA_METRICS_IMAGE = 'quay.io/samba.org/samba-metrics:latest' -# ------------------------------------------------------------------------------ def host_exists(hostname_position: int = 1) -> Callable: @@ -239,92 +219,92 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, ), Option( 'container_image_prometheus', - default=DEFAULT_PROMETHEUS_IMAGE, + default=default_images.DEFAULT_PROMETHEUS_IMAGE, desc='Prometheus container image', ), Option( 'container_image_nvmeof', - default=DEFAULT_NVMEOF_IMAGE, + default=default_images.DEFAULT_NVMEOF_IMAGE, desc='Nvme-of container image', ), Option( 'container_image_grafana', - default=DEFAULT_GRAFANA_IMAGE, + default=default_images.DEFAULT_GRAFANA_IMAGE, desc='Prometheus container image', ), Option( 'container_image_alertmanager', - default=DEFAULT_ALERT_MANAGER_IMAGE, + default=default_images.DEFAULT_ALERTMANAGER_IMAGE, desc='Prometheus container image', ), Option( 'container_image_node_exporter', - default=DEFAULT_NODE_EXPORTER_IMAGE, + default=default_images.DEFAULT_NODE_EXPORTER_IMAGE, desc='Prometheus container image', ), Option( 'container_image_loki', - default=DEFAULT_LOKI_IMAGE, + default=default_images.DEFAULT_LOKI_IMAGE, desc='Loki container image', ), Option( 'container_image_promtail', - default=DEFAULT_PROMTAIL_IMAGE, + default=default_images.DEFAULT_PROMTAIL_IMAGE, desc='Promtail container image', ), Option( 'container_image_haproxy', - default=DEFAULT_HAPROXY_IMAGE, + default=default_images.DEFAULT_HAPROXY_IMAGE, desc='HAproxy container image', ), Option( 'container_image_keepalived', - default=DEFAULT_KEEPALIVED_IMAGE, + default=default_images.DEFAULT_KEEPALIVED_IMAGE, desc='Keepalived container image', ), Option( 'container_image_snmp_gateway', - default=DEFAULT_SNMP_GATEWAY_IMAGE, + default=default_images.DEFAULT_SNMP_GATEWAY_IMAGE, desc='SNMP Gateway container image', ), Option( 'container_image_nginx', - default=DEFAULT_NGINX_IMAGE, + default=default_images.DEFAULT_NGINX_IMAGE, desc='Nginx container image', ), Option( 'container_image_oauth2_proxy', - default=DEFAULT_OAUTH2_PROXY_IMAGE, + default=default_images.DEFAULT_OAUTH2_PROXY_IMAGE, desc='oauth2-proxy container image', ), Option( 'container_image_elasticsearch', - default=DEFAULT_ELASTICSEARCH_IMAGE, + default=default_images.DEFAULT_ELASTICSEARCH_IMAGE, desc='elasticsearch container image', ), Option( 'container_image_jaeger_agent', - default=DEFAULT_JAEGER_AGENT_IMAGE, + default=default_images.DEFAULT_JAEGER_AGENT_IMAGE, desc='Jaeger agent container image', ), Option( 'container_image_jaeger_collector', - default=DEFAULT_JAEGER_COLLECTOR_IMAGE, + default=default_images.DEFAULT_JAEGER_COLLECTOR_IMAGE, desc='Jaeger collector container image', ), Option( 'container_image_jaeger_query', - default=DEFAULT_JAEGER_QUERY_IMAGE, + default=default_images.DEFAULT_JAEGER_QUERY_IMAGE, desc='Jaeger query container image', ), Option( 'container_image_samba', - default=DEFAULT_SAMBA_IMAGE, + default=default_images.DEFAULT_SAMBA_IMAGE, desc='Samba/SMB container image', ), Option( 'container_image_samba_metrics', - default=DEFAULT_SAMBA_METRICS_IMAGE, + default=default_images.DEFAULT_SAMBA_METRICS_IMAGE, desc='Samba/SMB metrics exporter container image', ), Option( diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini index 45d8dbd4871..5afbe93ace0 100644 --- a/src/pybind/mgr/tox.ini +++ b/src/pybind/mgr/tox.ini @@ -160,7 +160,7 @@ commands = flake8 --config=tox.ini {posargs} \ {posargs:{[testenv:flake8]modules}} bash -c 'test $(git ls-files cephadm | grep ".py$" | grep -v tests | xargs grep "docker.io" | wc -l) == 3' - bash -c 'test $(git ls-files cephadm | grep ".py$" | grep -v tests | xargs grep "quay.io" | wc -l) == 26' + bash -c 'test $(git ls-files cephadm | grep ".py$" | grep -v tests | xargs grep "quay.io" | wc -l) == 8' [testenv:jinjalint] deps = |