Skip to content

Commit eb7c4f5

Browse files
authored
Merge pull request ceph#60412 from ShwetaBhosale1/fix_issue_68605_modify_structure_of_default_images
cephadm: Modify the structure of the default container images Reviewed-by: Adam King <[email protected]> Reviewed-by: John Mulligan <[email protected]> Reviewed-by: Redouane Kachach <[email protected]>
2 parents c62c9e7 + 77605ce commit eb7c4f5

File tree

14 files changed

+112
-177
lines changed

14 files changed

+112
-177
lines changed

doc/cephadm/services/mgmt-gateway.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ The `mgmt-gateway` service internally makes use of nginx reverse proxy. The foll
183183

184184
::
185185

186-
DEFAULT_NGINX_IMAGE = 'quay.io/ceph/nginx:1.26.1'
186+
mgr/cephadm/container_image_nginx = 'quay.io/ceph/nginx:sclorg-nginx-126'
187187

188188
Admins can specify the image to be used by changing the `container_image_nginx` cephadm module option. If there were already
189189
running daemon(s) you must redeploy the daemon(s) in order to have them actually use the new image.

doc/cephadm/services/monitoring.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,24 +173,22 @@ the [ceph-users] mailing list in April of 2024. The thread can be viewed here:
173173
``var/lib/ceph/{FSID}/cephadm.{DIGEST}``, where ``{DIGEST}`` is an alphanumeric
174174
string representing the currently-running version of Ceph.
175175

176-
To see the default container images, run a command of the following form:
176+
To see the default container images, run below command:
177177

178178
.. prompt:: bash #
179179

180-
grep -E "DEFAULT*IMAGE" /var/lib/ceph/{FSID}/cephadm.{DIGEST}
180+
cephadm list-images
181181

182-
::
183-
184-
DEFAULT_PROMETHEUS_IMAGE = 'quay.io/prometheus/prometheus:v2.51.0'
185-
DEFAULT_LOKI_IMAGE = 'docker.io/grafana/loki:2.9.5'
186-
DEFAULT_PROMTAIL_IMAGE = 'docker.io/grafana/promtail:2.9.5'
187-
DEFAULT_NODE_EXPORTER_IMAGE = 'quay.io/prometheus/node-exporter:v1.7.0'
188-
DEFAULT_ALERT_MANAGER_IMAGE = 'quay.io/prometheus/alertmanager:v0.27.0'
189-
DEFAULT_GRAFANA_IMAGE = 'quay.io/ceph/grafana:10.4.0'
190182

191183
Default monitoring images are specified in
192-
``/src/cephadm/cephadmlib/constants.py`` and in
193-
``/src/pybind/mgr/cephadm/module.py``.
184+
``/src/python-common/ceph/cephadm/images.py``.
185+
186+
187+
.. autoclass:: ceph.cephadm.images.DefaultImages
188+
:members:
189+
:undoc-members:
190+
:exclude-members: desc, image_ref, key
191+
194192

195193
Using custom images
196194
~~~~~~~~~~~~~~~~~~~

doc/man/8/cephadm.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Synopsis
1313
| [--log-dir LOG_DIR] [--logrotate-dir LOGROTATE_DIR]
1414
| [--unit-dir UNIT_DIR] [--verbose] [--timeout TIMEOUT]
1515
| [--retry RETRY] [--no-container-init]
16-
| {version,pull,inspect-image,ls,list-networks,adopt,rm-daemon,rm-cluster,run,shell,enter,ceph-volume,unit,logs,bootstrap,deploy,check-host,prepare-host,add-repo,rm-repo,install}
16+
| {version,pull,inspect-image,ls,list-networks,adopt,rm-daemon,rm-cluster,run,shell,enter,ceph-volume,unit,logs,bootstrap,deploy,check-host,prepare-host,add-repo,rm-repo,install,list-images}
1717
| ...
1818
1919

@@ -104,6 +104,8 @@ Synopsis
104104
| [--registry-password REGISTRY_PASSWORD]
105105
| [--registry-json REGISTRY_JSON] [--fsid FSID]
106106
107+
| **cephadm** **list-images**
108+
107109

108110

109111
Description
@@ -527,6 +529,12 @@ Arguments:
527529
* [--name NAME, -n NAME] daemon name (type.id)
528530

529531

532+
list-images
533+
-----------
534+
535+
List the default container images for all services in ini format. The output can be modified with custom images and passed to --config flag during bootstrap.
536+
537+
530538
Availability
531539
============
532540

src/cephadm/cephadmlib/container_types.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from .call_wrappers import call, call_throws, CallVerbosity
1111
from .constants import DEFAULT_TIMEOUT
12-
import ceph.cephadm.images as default_images
12+
from ceph.cephadm.images import DefaultImages
1313
from .container_engines import Docker, Podman
1414
from .context import CephadmContext
1515
from .daemon_identity import DaemonIdentity, DaemonSubIdentity
@@ -665,14 +665,8 @@ def enable_shared_namespaces(
665665

666666
def get_mgr_images() -> dict:
667667
"""Return dict of default mgr images"""
668-
mgr_prefix = 'mgr/cephadm/container_image_'
669-
mgr_images = {}
670-
images = vars(default_images)
671-
for key, value in images.items():
672-
if key.startswith('DEFAULT_') and key.endswith('_IMAGE'):
673-
# flake8 and black disagree about spaces around ":" hence the noqa comment
674-
suffix = key[
675-
len('DEFAULT_') : -len('_IMAGE') # noqa: E203
676-
].lower()
677-
mgr_images[mgr_prefix + suffix] = value
668+
mgr_prefix = 'mgr/cephadm/'
669+
mgr_images = {
670+
f'{mgr_prefix}{image.key}': image.image_ref for image in DefaultImages
671+
}
678672
return mgr_images

src/cephadm/cephadmlib/daemons/ingress.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
from typing import Dict, List, Optional, Tuple, Union
44

5-
from ceph.cephadm.images import (
6-
DEFAULT_HAPROXY_IMAGE,
7-
DEFAULT_KEEPALIVED_IMAGE,
8-
)
5+
from ceph.cephadm.images import DefaultImages
96
from ..constants import (
107
DATA_DIR_MODE,
118
)
@@ -27,7 +24,7 @@ class HAproxy(ContainerDaemonForm):
2724

2825
daemon_type = 'haproxy'
2926
required_files = ['haproxy.cfg']
30-
default_image = DEFAULT_HAPROXY_IMAGE
27+
default_image = DefaultImages.HAPROXY.image_ref
3128

3229
@classmethod
3330
def for_daemon_type(cls, daemon_type: str) -> bool:
@@ -155,7 +152,7 @@ class Keepalived(ContainerDaemonForm):
155152

156153
daemon_type = 'keepalived'
157154
required_files = ['keepalived.conf']
158-
default_image = DEFAULT_KEEPALIVED_IMAGE
155+
default_image = DefaultImages.KEEPALIVED.image_ref
159156

160157
@classmethod
161158
def for_daemon_type(cls, daemon_type: str) -> bool:

src/cephadm/cephadmlib/daemons/mgmt_gateway.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from ..daemon_form import register as register_daemon_form
1212
from ..daemon_identity import DaemonIdentity
1313
from ..deployment_utils import to_deployment_container
14-
from ceph.cephadm.images import DEFAULT_NGINX_IMAGE
14+
from ceph.cephadm.images import DefaultImages
1515
from ..data_utils import dict_get, is_fsid
1616
from ..file_utils import populate_files, makedirs, recursive_chown
1717
from ..exceptions import Error
@@ -32,7 +32,7 @@ class MgmtGateway(ContainerDaemonForm):
3232
'nginx_internal.key',
3333
]
3434

35-
default_image = DEFAULT_NGINX_IMAGE
35+
default_image = DefaultImages.NGINX.image_ref
3636

3737
@classmethod
3838
def for_daemon_type(cls, daemon_type: str) -> bool:
@@ -44,7 +44,7 @@ def __init__(
4444
fsid: str,
4545
daemon_id: str,
4646
config_json: Dict,
47-
image: str = DEFAULT_NGINX_IMAGE,
47+
image: str = DefaultImages.NGINX.image_ref,
4848
):
4949
self.ctx = ctx
5050
self.fsid = fsid

src/cephadm/cephadmlib/daemons/monitoring.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33
from typing import Dict, List, Tuple
44

55
from ..call_wrappers import call, CallVerbosity
6-
from ceph.cephadm.images import (
7-
DEFAULT_ALERTMANAGER_IMAGE,
8-
DEFAULT_GRAFANA_IMAGE,
9-
DEFAULT_LOKI_IMAGE,
10-
DEFAULT_NODE_EXPORTER_IMAGE,
11-
DEFAULT_PROMETHEUS_IMAGE,
12-
DEFAULT_PROMTAIL_IMAGE,
13-
)
6+
from ceph.cephadm.images import DefaultImages
147
from ..constants import (
158
UID_NOBODY,
169
GID_NOGROUP,
@@ -43,7 +36,7 @@ class Monitoring(ContainerDaemonForm):
4336

4437
components = {
4538
'prometheus': {
46-
'image': DEFAULT_PROMETHEUS_IMAGE,
39+
'image': DefaultImages.PROMETHEUS.image_ref,
4740
'cpus': '2',
4841
'memory': '4GB',
4942
'args': [
@@ -55,7 +48,7 @@ class Monitoring(ContainerDaemonForm):
5548
],
5649
},
5750
'loki': {
58-
'image': DEFAULT_LOKI_IMAGE,
51+
'image': DefaultImages.LOKI.image_ref,
5952
'cpus': '1',
6053
'memory': '1GB',
6154
'args': [
@@ -64,7 +57,7 @@ class Monitoring(ContainerDaemonForm):
6457
'config-json-files': ['loki.yml'],
6558
},
6659
'promtail': {
67-
'image': DEFAULT_PROMTAIL_IMAGE,
60+
'image': DefaultImages.PROMTAIL.image_ref,
6861
'cpus': '1',
6962
'memory': '1GB',
7063
'args': [
@@ -75,13 +68,13 @@ class Monitoring(ContainerDaemonForm):
7568
],
7669
},
7770
'node-exporter': {
78-
'image': DEFAULT_NODE_EXPORTER_IMAGE,
71+
'image': DefaultImages.NODE_EXPORTER.image_ref,
7972
'cpus': '1',
8073
'memory': '1GB',
8174
'args': ['--no-collector.timex'],
8275
},
8376
'grafana': {
84-
'image': DEFAULT_GRAFANA_IMAGE,
77+
'image': DefaultImages.GRAFANA.image_ref,
8578
'cpus': '2',
8679
'memory': '4GB',
8780
'args': [],
@@ -93,7 +86,7 @@ class Monitoring(ContainerDaemonForm):
9386
],
9487
},
9588
'alertmanager': {
96-
'image': DEFAULT_ALERTMANAGER_IMAGE,
89+
'image': DefaultImages.ALERTMANAGER.image_ref,
9790
'cpus': '2',
9891
'memory': '2GB',
9992
'args': [

src/cephadm/cephadmlib/daemons/nvmeof.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from ..context_getters import fetch_configs, get_config_and_keyring
99
from ..daemon_form import register as register_daemon_form
1010
from ..daemon_identity import DaemonIdentity
11-
from ceph.cephadm.images import DEFAULT_NVMEOF_IMAGE
11+
from ceph.cephadm.images import DefaultImages
1212
from ..context import CephadmContext
1313
from ..data_utils import dict_get, is_fsid
1414
from ..deployment_utils import to_deployment_container
@@ -26,7 +26,7 @@ class CephNvmeof(ContainerDaemonForm):
2626

2727
daemon_type = 'nvmeof'
2828
required_files = ['ceph-nvmeof.conf']
29-
default_image = DEFAULT_NVMEOF_IMAGE
29+
default_image = DefaultImages.NVMEOF.image_ref
3030

3131
@classmethod
3232
def for_daemon_type(cls, daemon_type: str) -> bool:
@@ -38,7 +38,7 @@ def __init__(
3838
fsid: str,
3939
daemon_id: Union[int, str],
4040
config_json: Dict,
41-
image: str = DEFAULT_NVMEOF_IMAGE,
41+
image: str = DefaultImages.NVMEOF.image_ref,
4242
) -> None:
4343
self.ctx = ctx
4444
self.fsid = fsid

src/cephadm/cephadmlib/daemons/oauth2_proxy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from ..daemon_form import register as register_daemon_form
1212
from ..daemon_identity import DaemonIdentity
1313
from ..deployment_utils import to_deployment_container
14-
from ceph.cephadm.images import DEFAULT_OAUTH2_PROXY_IMAGE
14+
from ceph.cephadm.images import DefaultImages
1515
from ..constants import UID_NOBODY, GID_NOGROUP
1616
from ..data_utils import dict_get, is_fsid
1717
from ..file_utils import populate_files, makedirs, recursive_chown
@@ -25,7 +25,7 @@
2525
class OAuth2Proxy(ContainerDaemonForm):
2626
"""Define the configs for the jaeger tracing containers"""
2727

28-
default_image = DEFAULT_OAUTH2_PROXY_IMAGE
28+
default_image = DefaultImages.OAUTH2_PROXY.image_ref
2929
daemon_type = 'oauth2-proxy'
3030
required_files = [
3131
'oauth2-proxy.conf',
@@ -43,7 +43,7 @@ def __init__(
4343
fsid: str,
4444
daemon_id: str,
4545
config_json: Dict,
46-
image: str = DEFAULT_OAUTH2_PROXY_IMAGE,
46+
image: str = DefaultImages.OAUTH2_PROXY.image_ref,
4747
):
4848
self.ctx = ctx
4949
self.fsid = fsid

src/cephadm/cephadmlib/daemons/smb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from .. import deployment_utils
1515
from .. import file_utils
1616
from ..call_wrappers import call, CallVerbosity
17-
from ceph.cephadm.images import DEFAULT_SAMBA_IMAGE
17+
from ceph.cephadm.images import DefaultImages
1818
from ..container_daemon_form import ContainerDaemonForm, daemon_to_container
1919
from ..container_engines import Podman
2020
from ..container_types import (
@@ -368,7 +368,7 @@ class SMB(ContainerDaemonForm):
368368

369369
daemon_type = 'smb'
370370
daemon_base = '/usr/sbin/smbd'
371-
default_image = DEFAULT_SAMBA_IMAGE
371+
default_image = DefaultImages.SAMBA.image_ref
372372

373373
@classmethod
374374
def for_daemon_type(cls, daemon_type: str) -> bool:

0 commit comments

Comments
 (0)