Skip to content
This repository has been archived by the owner on Oct 21, 2021. It is now read-only.

Commit

Permalink
Collect K8s CRD Ciliumidentities and Ciliumnodes
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Wicki <[email protected]>
Signed-off-by: Dan Wendlandt <[email protected]>
Signed-off-by: Sebastian Wicki <[email protected]>
  • Loading branch information
2 people authored and rolinh committed Jun 23, 2020
1 parent a617c0d commit 87bc991
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions cilium-sysdump/sysdumpcollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,36 @@ def collect_cep(self):
else:
log.info("collected cilium endpoints: {}".format(cep_file_name))

def collect_ciliumids(self):
ciliumids_file_name = "ciliumidentities-{}.yaml".format(
utils.get_current_time())
cmd = ("kubectl get ciliumidentities -o yaml --all-namespaces > {}/{}"
.format(self.sysdump_dir_name, ciliumids_file_name))
try:
subprocess.check_output(cmd, shell=True)
except subprocess.CalledProcessError as exc:
if exc.returncode != 0:
log.error("Error: {}. Could not collect cilium identities {}"
.format(exc, ciliumids_file_name))
else:
log.info("collected cilium identities: {}".format(
ciliumids_file_name))

def collect_ciliumnodes(self):
ciliumnodes_file_name = "ciliumnodes-{}.yaml".format(
utils.get_current_time())
cmd = ("kubectl get ciliumnodes -o yaml --all-namespaces > {}/{}"
.format(self.sysdump_dir_name, ciliumnodes_file_name))
try:
subprocess.check_output(cmd, shell=True)
except subprocess.CalledProcessError as exc:
if exc.returncode != 0:
log.error("Error: {}. Could not collect cilium nodes {}"
.format(exc, ciliumnodes_file_name))
else:
log.info("collected cilium nodes: {}".format(
ciliumnodes_file_name))

def collect_daemonset_yaml(self, name="cilium"):
ns = namespace.cilium_ns
if name == "hubble":
Expand Down Expand Up @@ -484,6 +514,10 @@ def collect(self, node_ip_filter):
self.collect_cilium_secret()
log.info("collecting cilium endpoints ...")
self.collect_cep()
log.info("collecting cilium identities ...")
self.collect_ciliumids()
log.info("collecting cilium nodes ...")
self.collect_ciliumnodes()
log.info("collecting cilium daemonset yaml ...")
self.collect_daemonset_yaml(name="cilium")
log.info("collecting hubble daemonset yaml ...")
Expand Down

0 comments on commit 87bc991

Please sign in to comment.