Skip to content

Commit

Permalink
Merge pull request #249 from ilausuch/increase_logs_k8s
Browse files Browse the repository at this point in the history
Increase the number of logs for K8s operations
  • Loading branch information
asmorodskyi authored May 17, 2023
2 parents be8b3af + 0af5a40 commit 23704a8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ocw/lib/aks.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def kubectl_client(self, resource_group: str, cluster_name: str):

def cleanup_k8s_jobs(self):
clusters = PCWConfig.get_k8s_clusters_for_provider(self._namespace, "azure")
self.log_info(f"Cleanup k8s jobs in AKS clusters. {len(clusters)} will be queried ")
for cluster in clusters:
self.log_info(f"Cleanup k8s jobs in AKS cluster {cluster['cluster_name']}")
client = self.kubectl_client(cluster["resource_group"], cluster["cluster_name"])
clean_jobs(self, client, cluster["cluster_name"])
3 changes: 2 additions & 1 deletion ocw/lib/eks.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ def delete_all_clusters(self) -> None:
self.eks_client(region).delete_cluster(name=cluster)

def cleanup_k8s_jobs(self):
self.log_info("Cleanup k8s jobs in EKS clusters")
for region in self.__cluster_regions:
self.log_dbg(f"Region {region}")
clusters = self.eks_client(region).list_clusters()['clusters']
for cluster_name in clusters:
self.log_dbg(f"Clean up of cluster {cluster_name} in region {region}")
self.log_info(f"Cleanup k8s jobs in EKS cluster {cluster_name} in region {region}")
client = self.kubectl_client(region, cluster_name)
clean_jobs(self, client, cluster_name)
3 changes: 2 additions & 1 deletion ocw/lib/gke.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ def get_clusters(self, zone):
return []

def cleanup_k8s_jobs(self):
self.log_info("Cleanup k8s jobs in GKE clusters")
for region in self.list_regions():
for zone in self.list_zones(region):
for cluster in self.get_clusters(zone):
cluster_name = cluster["name"]
self.log_dbg(f"Clean up of cluster {cluster_name} in zone {zone}")
self.log_info(f"Cleanup k8s jobs in GKE cluster {cluster_name} in zone {zone}")
client = self.kubectl_client(zone, cluster)
clean_jobs(self, client, cluster_name)

0 comments on commit 23704a8

Please sign in to comment.