DEFAULT_NODE_EXPORTER_IMAGE = 'docker.io/prom/node-exporter:v0.18.1'
DEFAULT_GRAFANA_IMAGE = 'docker.io/ceph/ceph-grafana:6.7.4'
DEFAULT_ALERT_MANAGER_IMAGE = 'docker.io/prom/alertmanager:v0.20.0'
+DEFAULT_REGISTRY = 'docker.io' # normalize unqualified digests to this
# ------------------------------------------------------------------------------
LATEST_STABLE_RELEASE = 'pacific'
return 0
+def normalize_image_digest(digest):
+ # normal case:
+ # ceph/ceph -> docker.io/ceph/ceph
+ # edge cases that shouldn't ever come up:
+ # ubuntu -> docker.io/ubuntu (ubuntu alias for library/ubuntu)
+ # no change:
+ # quay.ceph.io/ceph/ceph -> ceph
+ # docker.io/ubuntu -> no change
+ bits = digest.split('/')
+ if '.' not in bits[0] or len(bits) < 3:
+ digest = DEFAULT_REGISTRY + '/' + digest
+ return digest
+
+
def get_image_info_from_inspect(out, image):
# type: (str, str) -> Dict[str, Union[str,List[str]]]
image_id, digests = out.split(',', 1)
'image_id': normalize_container_id(image_id)
} # type: Dict[str, Union[str,List[str]]]
if digests:
- r['repo_digests'] = digests[1:-1].split(' ')
+ r['repo_digests'] = list(map(normalize_image_digest, digests[1:-1].split(' ')))
return r
##################################