Skip to content

Commit d092854

Browse files
lubaihua33LiliDeng
authored andcommitted
Add ip service tags update hook
1 parent d038392 commit d092854

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

lisa/sut_orchestrator/azure/hooks.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@ def azure_update_vm_capabilities(
4848
"""
4949
...
5050

51+
@hookspec
52+
def azure_update_ip_service_tags(
53+
self, subscription_id: str, ip_service_tags: Dict[str, str]
54+
) -> None:
55+
"""
56+
Implement it to update ip service tags in-place before deployment.
57+
58+
Implementations should mutate the passed-in `ip_service_tags` dict (e.g.
59+
add/update keys). Rebinding the parameter won't affect the caller.
60+
61+
Args:
62+
subscription_id: current deployment subscription id.
63+
ip_service_tags: ip service tags to apply on public IP.
64+
"""
65+
...
66+
5167

5268
class AzureHookSpecDefaultImpl:
5369
__error_maps: List[Tuple[str, Pattern[str], Any]] = [

lisa/sut_orchestrator/azure/platform_.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,16 @@ def _create_deployment_parameters(
13561356
availability_copied_fields,
13571357
)
13581358
if not arm_parameters.ip_service_tags:
1359-
if self._is_byoip_feature_registered():
1359+
arm_parameters.ip_service_tags = {}
1360+
plugin_manager.hook.azure_update_ip_service_tags(
1361+
subscription_id=self.subscription_id,
1362+
ip_service_tags=arm_parameters.ip_service_tags,
1363+
)
1364+
1365+
if (
1366+
not arm_parameters.ip_service_tags
1367+
and self._is_byoip_feature_registered()
1368+
):
13601369
arm_parameters.ip_service_tags = {"FirstPartyUsage": "/SyntheticLoad"}
13611370

13621371
arm_parameters.virtual_network_resource_group = (

0 commit comments

Comments
 (0)