Skip to content

Commit

Permalink
Add subnet_ids param in AzureContainerInstancesOperator (#34850)
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajastro committed Oct 10, 2023
1 parent 609eed9 commit 434f571
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from azure.mgmt.containerinstance.models import (
Container,
ContainerGroup,
ContainerGroupSubnetId,
ContainerPort,
EnvironmentVariable,
IpAddress,
Expand Down Expand Up @@ -88,6 +89,7 @@ class AzureContainerInstancesOperator(BaseOperator):
:param restart_policy: Restart policy for all containers within the container group.
Possible values include: 'Always', 'OnFailure', 'Never'
:param ip_address: The IP address type of the container group.
:param subnet_ids: The subnet resource IDs for a container group
**Example**::
Expand Down Expand Up @@ -142,6 +144,7 @@ def __init__(
restart_policy: str = "Never",
ip_address: IpAddress | None = None,
ports: list[ContainerPort] | None = None,
subnet_ids: list[ContainerGroupSubnetId] | None = None,
**kwargs,
) -> None:
super().__init__(**kwargs)
Expand Down Expand Up @@ -179,6 +182,7 @@ def __init__(
)
self.ip_address = ip_address
self.ports = ports
self.subnet_ids = subnet_ids

def execute(self, context: Context) -> int:
# Check name again in case it was templated.
Expand Down Expand Up @@ -251,6 +255,7 @@ def execute(self, context: Context) -> int:
os_type=self.os_type,
tags=self.tags,
ip_address=self.ip_address,
subnet_ids=self.subnet_ids,
)

self._ci_hook.create_or_update(self.resource_group, self.name, container_group)
Expand Down

0 comments on commit 434f571

Please sign in to comment.