Skip to content

Commit

Permalink
operator: crawler 1.5.0 now has an exit code 3 for when crawler is ou…
Browse files Browse the repository at this point in the history
…t of storage, handle the exit code by increased pvc size
  • Loading branch information
ikreymer committed Feb 10, 2025
1 parent 83211b2 commit 04aa08a
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions backend/btrixcloud/operator/crawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,7 @@ async def update_crawl_state(
)

for key, value in sizes.items():
increase_storage = False
value = int(value)
if value > 0 and status.podStatus:
pod_info = status.podStatus[key]
Expand All @@ -1388,15 +1389,21 @@ async def update_crawl_state(
and pod_info.used.storage * self.min_avail_storage_ratio
> pod_info.allocated.storage
):
new_storage = math.ceil(
pod_info.used.storage
* self.min_avail_storage_ratio
/ 1_000_000_000
)
pod_info.newStorage = f"{new_storage}Gi"
print(
f"Attempting to adjust storage to {pod_info.newStorage} for {key}"
)
increase_storage = True

# out of storage
if pod_info.isNewExit and pod_info.exitCode == 3:
pod_info.used.storage = pod_info.allocated.storage
increase_storage = True

if increase_storage:
new_storage = math.ceil(
pod_info.used.storage * self.min_avail_storage_ratio / 1_000_000_000
)
pod_info.newStorage = f"{new_storage}Gi"
print(
f"Attempting to adjust storage to {pod_info.newStorage} for {key}"
)

if not status.stopReason:
status.stopReason = await self.is_crawl_stopping(crawl, status, data)
Expand Down

0 comments on commit 04aa08a

Please sign in to comment.