summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRedouane Kachach <rkachach@ibm.com>2024-06-27 12:11:55 +0200
committerRedouane Kachach <rkachach@ibm.com>2024-07-09 15:27:33 +0200
commit11aaee1176680a6e9acf2bd7f57a5edecc06ebad (patch)
treeb61a6ac4715edb4ccacef70f6f2884f56d54e1e7
parentmgr/cephadm: adding documentation for cephadm mgmt-gateway service (diff)
downloadceph-11aaee1176680a6e9acf2bd7f57a5edecc06ebad.tar.xz
ceph-11aaee1176680a6e9acf2bd7f57a5edecc06ebad.zip
mgr/cephadm: introducing nobody/nogroup constants
Signed-off-by: Redouane Kachach <rkachach@ibm.com>
-rw-r--r--src/cephadm/cephadmlib/constants.py2
-rw-r--r--src/cephadm/cephadmlib/daemons/custom.py5
-rw-r--r--src/cephadm/cephadmlib/daemons/mgmt_gateway.py4
-rw-r--r--src/cephadm/cephadmlib/daemons/monitoring.py4
-rw-r--r--src/cephadm/cephadmlib/daemons/tracing.py3
5 files changed, 12 insertions, 6 deletions
diff --git a/src/cephadm/cephadmlib/constants.py b/src/cephadm/cephadmlib/constants.py
index 41add9fd10d..b0a989df620 100644
--- a/src/cephadm/cephadmlib/constants.py
+++ b/src/cephadm/cephadmlib/constants.py
@@ -50,3 +50,5 @@ DEFAULT_RETRY = 15
DATEFMT = '%Y-%m-%dT%H:%M:%S.%fZ'
QUIET_LOG_LEVEL = 9 # DEBUG is 10, so using 9 to be lower level than DEBUG
NO_DEPRECATED = False
+UID_NOBODY = 65534
+GID_NOGROUP = 65534
diff --git a/src/cephadm/cephadmlib/daemons/custom.py b/src/cephadm/cephadmlib/daemons/custom.py
index e833c80c9a5..76b4162e289 100644
--- a/src/cephadm/cephadmlib/daemons/custom.py
+++ b/src/cephadm/cephadmlib/daemons/custom.py
@@ -15,6 +15,7 @@ from ..deploy import DeploymentType
from ..deployment_utils import to_deployment_container
from ..file_utils import write_new, makedirs
from ..net_utils import EndPoint
+from ..constants import UID_NOBODY, GID_NOGROUP
logger = logging.getLogger()
@@ -43,8 +44,8 @@ class CustomContainer(ContainerDaemonForm):
# config-json options
self.entrypoint = dict_get(config_json, 'entrypoint')
- self.uid = dict_get(config_json, 'uid', 65534) # nobody
- self.gid = dict_get(config_json, 'gid', 65534) # nobody
+ self.uid = dict_get(config_json, 'uid', UID_NOBODY)
+ self.gid = dict_get(config_json, 'gid', GID_NOGROUP)
self.volume_mounts = dict_get(config_json, 'volume_mounts', {})
self.args = dict_get(config_json, 'args', [])
self.envs = dict_get(config_json, 'envs', [])
diff --git a/src/cephadm/cephadmlib/daemons/mgmt_gateway.py b/src/cephadm/cephadmlib/daemons/mgmt_gateway.py
index f3b28bcccc7..93dfc275c41 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 ..constants import DEFAULT_NGINX_IMAGE, 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
@@ -90,7 +90,7 @@ class MgmtGateway(ContainerDaemonForm):
return to_deployment_container(ctx, ctr)
def uid_gid(self, ctx: CephadmContext) -> Tuple[int, int]:
- return 65534, 65534 # nobody, nobody
+ return UID_NOBODY, GID_NOGROUP
def get_daemon_args(self) -> List[str]:
return []
diff --git a/src/cephadm/cephadmlib/daemons/monitoring.py b/src/cephadm/cephadmlib/daemons/monitoring.py
index 55e6a9458f0..fca4da406e5 100644
--- a/src/cephadm/cephadmlib/daemons/monitoring.py
+++ b/src/cephadm/cephadmlib/daemons/monitoring.py
@@ -10,6 +10,8 @@ from ..constants import (
DEFAULT_NODE_EXPORTER_IMAGE,
DEFAULT_PROMETHEUS_IMAGE,
DEFAULT_PROMTAIL_IMAGE,
+ UID_NOBODY,
+ GID_NOGROUP,
)
from ..container_daemon_form import ContainerDaemonForm, daemon_to_container
from ..container_types import CephContainer, extract_uid_gid
@@ -170,7 +172,7 @@ class Monitoring(ContainerDaemonForm):
if daemon_type == 'prometheus':
uid, gid = extract_uid_gid(ctx, file_path='/etc/prometheus')
elif daemon_type == 'node-exporter':
- uid, gid = 65534, 65534
+ uid, gid = UID_NOBODY, GID_NOGROUP
elif daemon_type == 'grafana':
uid, gid = extract_uid_gid(ctx, file_path='/var/lib/grafana')
elif daemon_type == 'loki':
diff --git a/src/cephadm/cephadmlib/daemons/tracing.py b/src/cephadm/cephadmlib/daemons/tracing.py
index 4d4fecacbb0..365458a9c57 100644
--- a/src/cephadm/cephadmlib/daemons/tracing.py
+++ b/src/cephadm/cephadmlib/daemons/tracing.py
@@ -15,6 +15,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 UID_NOBODY, GID_NOGROUP
logger = logging.getLogger()
@@ -87,7 +88,7 @@ class Tracing(ContainerDaemonForm):
return to_deployment_container(ctx, ctr)
def uid_gid(self, ctx: CephadmContext) -> Tuple[int, int]:
- return 65534, 65534
+ return UID_NOBODY, GID_NOGROUP
def get_daemon_args(self) -> List[str]:
return self.components[self.identity.daemon_type].get(