Skip to content

Commit

Permalink
{AKS} Implicitly enable istio when ingress gateway is enabled for Azu…
Browse files Browse the repository at this point in the history
…re Service Mesh (#7253)
  • Loading branch information
deveshdama authored Feb 7, 2024
1 parent b8dd0b8 commit fbd37d1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ To release a new version, please select a new version number (usually plus 1 to
Pending
+++++++
* Vendor new SDK and bump API version to 2023-11-02-preview.
* Implicitly enable istio when ingress or egress gateway is enabled for Azure Service Mesh.

1.0.0b5
+++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2205,6 +2205,8 @@ def _handle_egress_gateways_asm(self, new_profile: ServiceMeshProfile) -> Tuple[
# if a gateway is enabled, enable the mesh
if enable_egress_gateway:
new_profile.mode = CONST_AZURE_SERVICE_MESH_MODE_ISTIO
if new_profile.istio is None:
new_profile.istio = self.models.IstioServiceMesh() # pylint: disable=no-member
updated = True

# ensure necessary fields
Expand Down Expand Up @@ -2259,6 +2261,8 @@ def _handle_ingress_gateways_asm(self, new_profile: ServiceMeshProfile) -> Tuple
# if an ingress gateway is enabled, enable the mesh
if enable_ingress_gateway:
new_profile.mode = CONST_AZURE_SERVICE_MESH_MODE_ISTIO
if new_profile.istio is None:
new_profile.istio = self.models.IstioServiceMesh() # pylint: disable=no-member
updated = True

if not ingress_gateway_type:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3745,6 +3745,25 @@ def test_handle_ingress_gateways_asm(self):
)
),
))
# ASM was never enabled on the cluster
old_profile = self.models.ServiceMeshProfile(
mode=CONST_AZURE_SERVICE_MESH_MODE_DISABLED,
)
new_profile, updated = ctx_0._handle_ingress_gateways_asm(old_profile)
self.assertEqual(updated, True)
self.assertEqual(new_profile, self.models.ServiceMeshProfile(
mode="Istio",
istio=self.models.IstioServiceMesh(
components=self.models.IstioComponents(
ingress_gateways=[
self.models.IstioIngressGateway(
mode="Internal",
enabled=True,
)
]
)
),
))

def test_handle_egress_gateways_asm(self):
ctx_0 = AKSPreviewManagedClusterContext(
Expand Down Expand Up @@ -3777,6 +3796,24 @@ def test_handle_egress_gateways_asm(self):
)
),
))
# ASM was never enabled on the cluster
old_profile = self.models.ServiceMeshProfile(
mode=CONST_AZURE_SERVICE_MESH_MODE_DISABLED,
)
new_profile, updated = ctx_0._handle_egress_gateways_asm(old_profile)
self.assertEqual(updated, True)
self.assertEqual(new_profile, self.models.ServiceMeshProfile(
mode="Istio",
istio=self.models.IstioServiceMesh(
components=self.models.IstioComponents(
egress_gateways=[
self.models.IstioEgressGateway(
enabled=True, nodeSelector={"istio": "egress"}
)
]
)
),
))

def test_handle_pluginca_asm(self):
ctx_0 = AKSPreviewManagedClusterContext(
Expand Down

0 comments on commit fbd37d1

Please sign in to comment.