Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr/rook: Fix container id and image id in 'orch ps' #38106

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pybind/mgr/rook/module.py
Expand Up @@ -374,7 +374,6 @@ def _list_daemons(self, service_name=None, daemon_type=None, daemon_id=None, hos
for p in pods:
sd = orchestrator.DaemonDescription()
sd.hostname = p['hostname']
sd.container_id = p['name']
sd.daemon_type = p['labels']['app'].replace('rook-ceph-', '')
status = {
'Pending': -1,
Expand All @@ -397,6 +396,7 @@ def _list_daemons(self, service_name=None, daemon_type=None, daemon_id=None, hos
if service_name is not None and service_name != sd.service_name():
continue
sd.container_image_name = p['container_image_name']
sd.container_image_id = p['container_image_id']
sd.created = p['created']
sd.last_configured = p['created']
sd.last_deployed = p['created']
Expand Down
9 changes: 7 additions & 2 deletions src/pybind/mgr/rook/rook_cluster.py
Expand Up @@ -197,7 +197,7 @@ def __init__(self, coreV1_api, batchV1_api, rook_env):
self.rook_pods = KubernetesResource(self.coreV1_api.list_namespaced_pod,
namespace=self.rook_env.namespace,
label_selector="rook_cluster={0}".format(
self.rook_env.cluster_name))
self.rook_env.namespace))
self.nodes = KubernetesResource(self.coreV1_api.list_node)

def rook_url(self, path):
Expand Down Expand Up @@ -284,7 +284,7 @@ def describe_pods(self, service_type, service_id, nodename):
rook_cluster=rook
And MDS containers additionally have `rook_filesystem` label

Label filter is rook_cluster=<cluster name>
Label filter is rook_cluster=<cluster namespace>
rook_file_system=<self.fs_name>
"""
def predicate(item):
Expand Down Expand Up @@ -319,6 +319,7 @@ def predicate(item):
pods = [i for i in self.rook_pods.items if predicate(i)]

pods_summary = []
prefix = 'sha256:'

for p in pods:
d = p.to_dict()
Expand All @@ -329,12 +330,16 @@ def predicate(item):
image_name = c['image']
break

image_id = d['status']['container_statuses'][0]['image_id']
image_id = image_id.split(prefix)[1] if prefix in image_id else image_id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the sha256: prefix? If this is just for display, maybe the user wants to differentiate between the sha256, docker, and other prefixes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@travisn I removed it, to keep it consistent with cephadm. You want display the entire image id docker.io/ceph/daemon-base@sha256:21be74b3068 ?

@sebastian-philipp what do you think ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for showing the real value?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency with cephadm sounds good.


s = {
"name": d['metadata']['name'],
"hostname": d['spec']['node_name'],
"labels": d['metadata']['labels'],
'phase': d['status']['phase'],
'container_image_name': image_name,
'container_image_id': image_id,
'refreshed': refreshed,
# these may get set below...
'started': None,
Expand Down