Skip to content

Adding workshop provisioning reporting #2069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions helm/crds/workshops.babylon.gpte.redhat.com.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@ spec:
total:
description: Total user assignments for workshop.
type: integer
provisionCount:
type: object
properties:
provisioning:
description: Number of WorkshopProvisions that are provisioning.
type: integer
failed:
description: Number of WorkshopProvisions that have failed.
type: integer
completed:
description: Number of WorkshopProvisions that have completed.
type: integer
required:
- apiVersion
- kind
Expand Down
2 changes: 1 addition & 1 deletion workshop-manager/operator/resourceclaim.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def handle_event(cls, event, logger):
await resource_claim.delete_workshop_user_assignments(logger=logger)
return

if not resource_claim.provision_complete:
if not resource_claim.provision_complete or resource_claim.is_failed:
return

try:
Expand Down
10 changes: 10 additions & 0 deletions workshop-manager/operator/workshop.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,13 @@ async def update_status(self):
"total": total_user_count,
}
})

async def update_provision_count(self, provisioning, failed, completed):

await self.merge_patch_status({
"provisionCount": {
"provisioning": provisioning,
"failed": failed,
"completed": completed,
}
})
6 changes: 6 additions & 0 deletions workshop-manager/operator/workshopprovision.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,12 @@ async def manage_resource_claims(self, logger, workshop):
if resource_claim.is_failed:
failed_count += 1

await workshop.update_provision_count(
provisioning=provisioning_count,
failed=failed_count,
completed=resource_claim_count - provisioning_count - failed_count
)

# Do not start any provisions if lifespan start is in the future
if self.lifespan_start and self.lifespan_start > datetime.now(timezone.utc):
return
Expand Down
Loading