Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
prevent tasks scheduled by kube launcher are deemed as external user (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
xudifsd authored Mar 19, 2019
1 parent b218973 commit e7a4624
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/job-exporter/src/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,17 @@ def get_container_id(pid):

for line in content.split("\n"):
line = line.strip()
if "pids" in line and "/docker/" in line:
parts = line.split("/docker/")
if len(parts) == 2 and re.match(u"[0-9a-f]+", parts[1]):
return True, parts[1]
if "pids" in line:
if "/docker/" in line:
parts = line.split("/docker/")
if len(parts) == 2 and re.match(u"[0-9a-f]+", parts[1]):
return True, parts[1]
elif "/kubepods/" in line:
parts = line.split("/kubepods/")
if len(parts) == 2 and re.match(u"pod[0-9a-f-]+", parts[1]):
return True, parts[1]
else:
logger.info("unknown format in pid cgroup %s", line)

return False, ""

Expand Down

0 comments on commit e7a4624

Please sign in to comment.