Skip to content

Commit

Permalink
Add parameter to set revision --revision for the Azure Service Mesh…
Browse files Browse the repository at this point in the history
… addon while creating AKS cluster. (#7270)

* Add parameter to set revision `--revision` for the Azure Service Mesh addon while creating AKS cluster.

* fix style issues

* added a unit test case

* dynamically fetch asm supported revision for test cases.

* fix azdev style error

* update live test recording files.

* changes  as per review comments

* Update src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py

---------

Co-authored-by: FumingZhang <[email protected]>
  • Loading branch information
deveshdama and FumingZhang authored Feb 29, 2024
1 parent 418c56f commit 141ed26
Show file tree
Hide file tree
Showing 13 changed files with 4,975 additions and 5,597 deletions.
4 changes: 4 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ If there is no rush to release a new version, please just add a description of t

To release a new version, please select a new version number (usually plus 1 to last patch version, X.Y.Z -> Major.Minor.Patch, more details in `\doc <https://semver.org/>`_), and then add a new section named as the new version number in this file, the content should include the new modifications and everything from the *Pending* section. Finally, update the `VERSION` variable in `setup.py` with this new version number.

Pending
+++++++
* Add parameter to set revision `--revision` for the Azure Service Mesh addon while creating AKS cluster.

2.0.0b2
+++++++
* Add `--pod-ip-allocation-mode` to `az aks create` and `az aks nodepool` commands.
Expand Down
3 changes: 3 additions & 0 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,9 @@
- name: --enable-asm --enable-azure-service-mesh
type: bool
short-summary: Enable Azure Service Mesh.
- name: --revision
type: string
short-summary: Azure Service Mesh revision to install.
- name: --enable-azuremonitormetrics
type: bool
short-summary: Enable Azure Monitor Metrics Profile
Expand Down
1 change: 1 addition & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ def load_arguments(self, _):
action="store_true",
is_preview=True,
)
c.argument("revision", validator=validate_azure_service_mesh_revision)
c.argument("image_cleaner_interval_hours", type=int)
c.argument(
"cluster_snapshot_id",
Expand Down
1 change: 1 addition & 0 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ def aks_create(
safeguards_excluded_ns=None,
# azure service mesh
enable_azure_service_mesh=None,
revision=None,
# azure monitor profile
enable_azuremonitormetrics=False,
enable_azure_monitor_metrics=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2068,10 +2068,16 @@ def get_initial_service_mesh_profile(self) -> ServiceMeshProfile:

# returns a service mesh profile only if '--enable-azure-service-mesh' is applied
enable_asm = self.raw_param.get("enable_azure_service_mesh", False)
revision = self.raw_param.get("revision", None)
revisions = None
if revision is not None:
revisions = [revision]
if enable_asm:
return self.models.ServiceMeshProfile( # pylint: disable=no-member
mode=CONST_AZURE_SERVICE_MESH_MODE_ISTIO,
istio=self.models.IstioServiceMesh(), # pylint: disable=no-member
istio=self.models.IstioServiceMesh(
revisions=revisions
), # pylint: disable=no-member
)

return None
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,44 @@ interactions:
ParameterSetName:
- -l
User-Agent:
- AZURECLI/2.54.0 azsdk-python-azure-mgmt-containerservice/28.0.0b Python/3.8.10
(Linux-6.2.0-1016-azure-x86_64-with-glibc2.29)
- AZURECLI/2.57.0 azsdk-python-core/1.28.0 Python/3.8.10 (Linux-6.2.0-1019-azure-x86_64-with-glibc2.29)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/meshRevisionProfiles?api-version=2024-01-02-preview
response:
body:
string: "{\n \"value\": [\n {\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/meshRevisionProfiles/istio\",\n
\ \"name\": \"istio\",\n \"type\": \"Microsoft.ContainerService/locations/meshRevisionProfiles\",\n
\ \"properties\": {\n \"meshRevisions\": [\n {\n \"revision\":
\"asm-1-17\",\n \"upgrades\": [\n \"asm-1-18\"\n ],\n \"compatibleWith\":
\"asm-1-18\",\n \"upgrades\": [\n \"asm-1-19\"\n ],\n \"compatibleWith\":
[\n {\n \"name\": \"kubernetes\",\n \"versions\": [\n
\ \"1.25.11\",\n \"1.25.15\",\n \"1.26.6\",\n \"1.26.10\",\n
\ \"1.27.3\",\n \"1.27.7\",\n \"1.28.0\",\n \"1.28.3\"\n
\ ]\n }\n ]\n },\n {\n \"revision\": \"asm-1-18\",\n
\ \"compatibleWith\": [\n {\n \"name\": \"kubernetes\",\n
\ \"versions\": [\n \"1.25.11\",\n \"1.25.15\",\n
\ \"1.26.6\",\n \"1.26.10\",\n \"1.27.3\",\n \"1.27.7\",\n
\ \"1.28.0\",\n \"1.28.3\"\n ]\n }\n ]\n
\ \"1.26.10\",\n \"1.26.12\",\n \"1.27.7\",\n \"1.27.9\",\n
\ \"1.28.3\",\n \"1.28.5\"\n ]\n }\n ]\n
\ },\n {\n \"revision\": \"asm-1-19\",\n \"compatibleWith\":
[\n {\n \"name\": \"kubernetes\",\n \"versions\": [\n
\ \"1.26.10\",\n \"1.26.12\",\n \"1.27.7\",\n \"1.27.9\",\n
\ \"1.28.3\",\n \"1.28.5\"\n ]\n }\n ]\n
\ }\n ]\n }\n }\n ]\n }"
headers:
cache-control:
- no-cache
content-length:
- '1040'
- '958'
content-type:
- application/json
date:
- Sat, 25 Nov 2023 12:31:30 GMT
- Tue, 27 Feb 2024 23:45:59 GMT
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-cache:
- CONFIG_NOCACHE
x-content-type-options:
- nosniff
x-msedge-ref:
- 'Ref A: E490D4E66F3A4B3C8A90882B7B6A04D1 Ref B: MNZ221060608021 Ref C: 2024-02-27T23:46:00Z'
status:
code: 200
message: OK
Expand Down
Loading

0 comments on commit 141ed26

Please sign in to comment.