Skip to content

Commit

Permalink
Support subPath and mountOptions for AzureContainerApps (#6403)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaylaLiu-gmail authored Jun 14, 2023
1 parent a19e53b commit 5f3ec9b
Show file tree
Hide file tree
Showing 7 changed files with 4,843 additions and 2,069 deletions.
1 change: 1 addition & 0 deletions src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Release History
Upcoming
++++++
* 'az containerapp job execution show/list': improve table output format
* 'az containerapp create/update': --yaml support properties for api-version 2023-04-01-preview (e.g. subPath, mountOptions)

0.3.33
++++++
Expand Down
4 changes: 3 additions & 1 deletion src/containerapp/azext_containerapp/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@

VolumeMount = {
"volumeName": None,
"mountPath": None
"mountPath": None,
"subPath": None
}

Container = {
Expand All @@ -89,6 +90,7 @@
"storageType": "EmptyDir", # AzureFile, EmptyDir or Secret
"storageName": None, # None for EmptyDir or Secret, otherwise name of storage resource
"secrets": None, # [SecretVolumeItem]
"mountOptions": None,
}

ScaleRuleAuth = {
Expand Down
23 changes: 22 additions & 1 deletion src/containerapp/azext_containerapp/_sdk_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8088,13 +8088,16 @@ class Volume(_serialization.Model):
:ivar secrets: List of secrets to be added in volume. If no secrets are provided, all secrets
in collection will be added to volume.
:vartype secrets: list[~azure.mgmt.appcontainers.models.SecretVolumeItem]
:ivar mount_options: Mount options for the AzureFile type volume.
:vartype mount_options: str
"""

_attribute_map = {
"name": {"key": "name", "type": "str"},
"storage_type": {"key": "storageType", "type": "str"},
"storage_name": {"key": "storageName", "type": "str"},
"secrets": {"key": "secrets", "type": "[SecretVolumeItem]"},
"mount_options": {"key": "mountOptions", "type": "str"},
}

def __init__(
Expand All @@ -8104,6 +8107,7 @@ def __init__(
storage_type: Optional[Union[str, "_models.StorageType"]] = None,
storage_name: Optional[str] = None,
secrets: Optional[List["_models.SecretVolumeItem"]] = None,
mount_options: Optional[str] = None,
**kwargs: Any
) -> None:
"""
Expand All @@ -8117,12 +8121,15 @@ def __init__(
:keyword secrets: List of secrets to be added in volume. If no secrets are provided, all
secrets in collection will be added to volume.
:paramtype secrets: list[~azure.mgmt.appcontainers.models.SecretVolumeItem]
:keyword mount_options: Mount options for the AzureFile type volume.
:paramtype mount_options: str
"""
super().__init__(**kwargs)
self.name = name
self.storage_type = storage_type
self.storage_name = storage_name
self.secrets = secrets
self.mount_options = mount_options


class VolumeMount(_serialization.Model):
Expand All @@ -8133,24 +8140,38 @@ class VolumeMount(_serialization.Model):
:ivar mount_path: Path within the container at which the volume should be mounted.Must not
contain ':'.
:vartype mount_path: str
:ivar sub_path: Path within the volume from which the container's volume should be mounted.
:vartype sub_path: str
"""

_attribute_map = {
"volume_name": {"key": "volumeName", "type": "str"},
"mount_path": {"key": "mountPath", "type": "str"},
"sub_path": {"key": "subPath", "type": "str"}
}

def __init__(self, *, volume_name: Optional[str] = None, mount_path: Optional[str] = None, **kwargs: Any) -> None:
def __init__(
self,
*,
volume_name: Optional[str] = None,
mount_path: Optional[str] = None,
sub_path: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword volume_name: This must match the Name of a Volume.
:paramtype volume_name: str
:keyword mount_path: Path within the container at which the volume should be mounted.Must not
contain ':'.
:paramtype mount_path: str
:keyword sub_path: Path within the volume from which the container's volume should be mounted.
Defaults to "" (volume's root).
:paramtype sub_path: str
"""
super().__init__(**kwargs)
self.volume_name = volume_name
self.mount_path = mount_path
self.sub_path = sub_path


class WorkloadProfile(_serialization.Model):
Expand Down
Loading

0 comments on commit 5f3ec9b

Please sign in to comment.