Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{AKS} Implicitly enable istio when ingress gateway is enabled for Azure Service Mesh #7240

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Pending
+++++++
* Deprecate the alias "-r" of parameter --source-resource-id in `az aks trustedaccess rolebinding create`
* Refactor azure service mesh related code to meet cli style requirements.
deveshdama marked this conversation as resolved.
Show resolved Hide resolved
* Implicitly enable istio when ingress or egress gateway is enabled for Azure Service Mesh.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rebase/merge latest main? History note have changed here.


1.0.0b4
+++++++
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:
deveshdama marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -3746,6 +3746,26 @@ 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(
self.cmd,
Expand Down Expand Up @@ -3777,6 +3797,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