Skip to content

Commit

Permalink
Propagating orederdBy, requester and asset-uuid values to RC
Browse files Browse the repository at this point in the history
  • Loading branch information
makirill committed Oct 8, 2024
1 parent 05c1a13 commit cb42143
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion workshop-manager/operator/babylon.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ class Babylon():
poolboy_api_version = os.environ.get('POOLBOY_API_VERSION', 'v1')
poolboy_namespace = os.environ.get('POOLBOY_NAMESPACE', 'poolboy')
demo_domain = os.environ.get('DEMO_DOMAIN', 'demo.redhat.com')
gpte_domain = os.environ.get('GPTE_DOMAIN', 'gpte.redhat.com')

asset_uuid_label = f"{gpte_domain}/asset-uuid"
babylon_ignore_label = f"{babylon_domain}/ignore"
catalog_display_name_annotation = f"{babylon_domain}/catalogDisplayName"
catalog_item_display_name_annotation = f"{babylon_domain}/catalogItemDisplayName"
Expand All @@ -20,9 +22,10 @@ class Babylon():
lab_ui_url_annotation = f"{babylon_domain}/labUserInterfaceUrl"
lab_ui_urls_annotation = f"{babylon_domain}/labUserInterfaceUrls"
notifier_annotation = f"{babylon_domain}/notifier"
ordered_by_annotation = f"{demo_domain}/orderedBy"
purpose_annotation = f"{demo_domain}/purpose"
purpose_activity_annotation = f"{demo_domain}/purpose-activity"
requester_annotation = f"{babylon_domain}/requester"
requester_annotation = f"{demo_domain}/requester"
resource_broker_ignore_label = f"{poolboy_domain}/ignore"
resource_claim_label = f"{poolboy_domain}/resource-claim"
resource_pool_annotation = f"{poolboy_domain}/resource-pool-name"
Expand Down
8 changes: 8 additions & 0 deletions workshop-manager/operator/workshop.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def action_schedule_stop(self):
stop_timestamp, '%Y-%m-%dT%H:%M:%SZ'
).replace(tzinfo=timezone.utc)

@property
def asset_uuid(self):
return self.labels.get(Babylon.asset_uuid_label)

@property
def ignore(self):
return Babylon.babylon_ignore_label in self.labels
Expand Down Expand Up @@ -70,6 +74,10 @@ def multiuser_services(self):
def requester(self):
return self.annotations.get(Babylon.requester_annotation)

@property
def ordered_by(self):
return self.annotations.get(Babylon.ordered_by_annotation)

@property
def service_url(self):
return self.annotations.get(Babylon.url_annotation)
Expand Down
6 changes: 6 additions & 0 deletions workshop-manager/operator/workshopprovision.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,15 @@ async def create_resource_claim(self, logger, workshop):
if not self.enable_resource_pools:
resource_claim_definition['metadata']['annotations'][Babylon.resource_pool_annotation] = "disable"

if workshop.asset_uuid:
resource_claim_definition['metadata']['labels'][Babylon.asset_uuid_label] = workshop.asset_uuid

if workshop.requester:
resource_claim_definition['metadata']['annotations'][Babylon.requester_annotation] = workshop.requester

if workshop.ordered_by:
resource_claim_definition['metadata']['annotations'][Babylon.ordered_by_annotation] = workshop.ordered_by

if catalog_item.lab_ui_type:
resource_claim_definition['metadata']['labels'][Babylon.lab_ui_label] = catalog_item.lab_ui_type

Expand Down

0 comments on commit cb42143

Please sign in to comment.