Skip to content

[appnet-preview] Enable Managed Gateway API addon in test AKS clusters#9851

Open
deveshdama wants to merge 7 commits intoAzure:mainfrom
deveshdama:deveshdama/appnet-preview-enable-gateway-api
Open

[appnet-preview] Enable Managed Gateway API addon in test AKS clusters#9851
deveshdama wants to merge 7 commits intoAzure:mainfrom
deveshdama:deveshdama/appnet-preview-enable-gateway-api

Conversation

@deveshdama
Copy link
Copy Markdown
Contributor

@deveshdama deveshdama commented May 6, 2026

Related command

az appnet member join / az appnet member update

Description

The mesh membership API rejects AKS clusters that don't have the Managed Gateway API addon enabled (see https://aka.ms/managed-gateway-api). Tests that exercise the join path (test_appnet_member_join_fully_managed, test_appnet_member_list) need to create AKS clusters with --enable-gateway-api, which is only available via the aks-preview CLI extension.

We can't use cassette playback for these tests: the aks-preview extension ships its own command override for aks create that targets a preview api-version (currently 2026-02-02-preview), and that api-version drifts with every aks-preview release. The in-process testsdk caches the command table at process startup, so installing aks-preview mid-test doesn't change which module handles aks create. This caused the recorded cassette (2026-02-02-preview) to mismatch the replay request (2026-02-01 from public acs).

Following the convention used by connectedk8s, k8s-runtime, vme, and containerapp, the two AKS-creating tests are now marked @live_only() so they only run during recording / live test runs and are skipped in playback CI. The stale cassettes have been removed.

Testing

  • test_appnet_member_join_fully_managed and test_appnet_member_list run live against a real subscription with aks-preview installed.
  • Other tests (test_appnet_*) continue to use cassette playback unchanged.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

deveshdama added 2 commits May 5, 2026 23:00
The AKS RP now requires the Managed Gateway API addon (Standard or
InferenceExtension) to be enabled on a managed cluster before it can
join an AppLink-managed mesh. Mesh membership PUT returns 400 BadRequest
otherwise.

Update create_aks_cluster() in the test helper to install aks-preview
and pass --enable-gateway-api so the appnet member join tests succeed.

See https://aka.ms/managed-gateway-api
The aks-preview install added in the prior commit triggers a download of
the CLI extension index, which exceeds the testsdk default 1MB response
limit. Decorate test_appnet_member_join_fully_managed with
@AllowLargeResponse(size_kb=99999) and re-record the cassette against
the updated AKS create command.
Copilot AI review requested due to automatic review settings May 6, 2026 07:06
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 6, 2026

️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Hi @deveshdama,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 6, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the appnet-preview scenario test infrastructure so AKS clusters created during recordings/tests satisfy the new AKS RP prerequisite for managed mesh membership creation (Managed Gateway API addon enabled).

Changes:

  • Install/upgrade aks-preview in the AKS test cluster helper so az aks create --enable-gateway-api is available.
  • Enable Managed Gateway API during AKS cluster creation (--enable-gateway-api) to unblock az appnet member join provisioning.
  • Increase the ScenarioTest HTTP recording response limit for the fully-managed member-join scenario via @AllowLargeResponse.

Comment thread src/appnet-preview/azext_appnet_preview/tests/latest/test_appnet_preview.py Outdated
deveshdama added 5 commits May 6, 2026 00:50
The new member-join/member-list cassettes were recorded against the
Canary endpoint (eastus2euap.management.azure.com) where the AppLink
preview RP is exposed. CI playback uses the public ARM host, so the
VCR host matcher failed. Replace the regional prefix to match the
existing appnet cassettes.
Extension index lookup hits aka.ms / azcliextensionsync which doesn't
match the recorded blob URL. Gate on self.is_live.
Using self.cmd records the extension index lookup into the cassette;
gating on is_live skips it during playback, but then 'aks create'
resolves to a different api-version than what was recorded. Run the
install in a subprocess so VCR doesn't see it, but the extension is
still present during both record and replay.
Tests that create real AKS clusters with --enable-gateway-api depend on
the aks-preview SDK's api-version, which drifts with every aks-preview
release. The in-process testsdk caches the command table at startup, so
installing aks-preview mid-test (subprocess or otherwise) doesn't change
the api-version sent. This caused cassette playback to fail with an
api-version mismatch (2026-02-01 vs 2026-02-02-preview).

Match the convention used by connectedk8s, k8s-runtime, vme, and
containerapp: mark tests that create AKS clusters with @live_only().
Drop the now-unused cassettes.
super(AppnetMemberPreviewScenario, self).__init__(*args, **kwargs)

@live_only()
@AllowLargeResponse(size_kb=99999)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's put this as a constant to understand who is the responsible of making this large response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AKS Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants