Skip to content

Commit

Permalink
cmtadm,cmtlib: Add crc detection
Browse files Browse the repository at this point in the history
Detect OpenShift CRC.

Signed-off-by: David Weinehall <[email protected]>
  • Loading branch information
taotriad committed Jul 4, 2023
1 parent 215bfa5 commit 1ab2c0d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmtadm
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,15 @@ def rebuild_installation_info(state: Optional[str] = None) -> None:
tmp_k8s_distro = None
minikube_name = deep_get(node, DictPath("metadata#labels#minikube.k8s.io/name"), "")
labels = deep_get(node, DictPath("metadata#labels"), {})
images = deep_get(node, DictPath("status#images"), [])
for image in images:
names = deep_get(image, DictPath("names"), [])
for name in names:
if "openshift-crc-cluster" in name:
tmp_k8s_distro = "crc"
break
if tmp_k8s_distro is not None:
break
if minikube_name != "":
tmp_k8s_distro = "minikube"
elif deep_get(labels, DictPath("microk8s.io/cluster"), False) == True:
Expand Down
9 changes: 9 additions & 0 deletions cmtlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,15 @@ def identify_k8s_distro() -> str:
tmp_k8s_distro = None
minikube_name = deep_get(node, DictPath("metadata#labels#minikube.k8s.io/name"), "")
labels = deep_get(node, DictPath("metadata#labels"), {})
images = deep_get(node, DictPath("status#images"), [])
for image in images:
names = deep_get(image, DictPath("names"), [])
for name in names:
if "openshift-crc-cluster" in name:
tmp_k8s_distro = "crc"
break
if tmp_k8s_distro is not None:
break
if minikube_name != "":
tmp_k8s_distro = "minikube"
elif deep_get(labels, DictPath("microk8s.io/cluster"), False) == True:
Expand Down

0 comments on commit 1ab2c0d

Please sign in to comment.