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

[App Service] Add support for linux sitecontainers #30776

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

sarsharma
Copy link
Member

@sarsharma sarsharma commented Feb 6, 2025

Related command

az webapp create
az webapp sitecontainers create
az webapp sitecontainers update
az webapp sitecontainers delete
az webapp sitecontainers show
az webapp sitecontainers list
az webapp sitecontainers log
az webapp sitecontainers status

Description

Adding support for sitecontainers commands for azure web apps. Sitecontainers is a new capability supported on linux webapps: https://azure.github.io/AppService/2024/11/08/Global-Availability-Sidecars.html

Testing Guide

  • Create a new webapp of type=sitecontainers
    az webapp create --name {} --resource-group {} --sitecontainers-app

  • Create Sitecontainers
    az webapp sitecontainers create --name {} --resource-group {} --container-name {} --image {} --target-port {}

image

az webapp sitecontainers create --name {} --resource-group {} --sitecontainers-spec-file {}
image

  • Update Sitecontainer
    az webapp sitecontainers update --name {} --resource-group {} --container-name {} --image {} --target-port {}
image
  • Delete Sitecontainer
    az webapp sitecontainers delete --name {} --resource-group {} --container-name {}
image
  • Show Sitecontainer
    az webapp sitecontainers show --name {} --resource-group {} --container-name {}
image
  • List Sitecontainers
    az webapp sitecontainers show --name {} --resource-group {}
image
  • Get logs for sitecontaines
    az webapp sitecontainers log --name {} --resource-group {} --container-name {}
image
  • Get status for sitecontainer
    az webapp sitecontainers status --name {} --resource-group {} --container-name {}
image

History Notes

[App Service] az webapp sitecontainers: Add new commands for linux web app sitecontainers

This checklist is used to make sure that common guidelines for a pull request are followed.

Copy link

Validation for Azure CLI Full Test Starting...

Thanks for your contribution!

Copy link

Validation for Breaking Change Starting...

Thanks for your contribution!

@yonzhan
Copy link
Collaborator

yonzhan commented Feb 6, 2025

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

Copy link

github-actions bot commented Feb 6, 2025

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>

@microsoft-github-policy-service microsoft-github-policy-service bot added the Auto-Assign Auto assign by bot label Feb 6, 2025
@sarsharma sarsharma changed the title [App Service] Add support for sitecontainers operations [App Service] Add support for linux sitecontainers Feb 6, 2025
@sarsharma sarsharma marked this pull request as ready for review February 6, 2025 20:43
Copy link

@kumaramit-msft kumaramit-msft left a comment

Choose a reason for hiding this comment

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

Can we do these validations too:

  1. Only one main container should be allowed to be added.
  2. Target port if provided should be an integer in port range 1-65535
  3. Environment Value should be an AppSetting ref, so it should exist in site appsettings list.
  4. Avoid port conflicts in multiple sidecars. Same target port in multiple sidecars should be flagged.
  5. Check system identity is enabled for site, if auth-type is system identity.
  6. Check user-assigned managed identity is already added to site and client-id is one among them for MI case.

raise ValidationError("The sitecontainer spec file does not exist at the path '{}'"
.format(sitecontainers_spec_file))
with open(sitecontainers_spec_file, 'r') as file:
sitecontainers_spec_json = json.load(file)
Copy link

@kumaramit-msft kumaramit-msft Feb 11, 2025

Choose a reason for hiding this comment

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

This will throw an exception if json is malformed. Lets catch and send appropriate error message.

response.append(_create_or_update_webapp_sitecontainer_internal(cmd, name, resource_group,
spec.name, sitecontainer, slot))
else:
if container_name is None or image is None or target_port is None:

Choose a reason for hiding this comment

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

is_main should be mandatory, but target port can be optional.



def create_webapp_sitecontainers(cmd, name, resource_group, container_name=None, image=None, target_port=None,
slot=None, startup_cmd=None, is_main=None, system_assigned_identity=None,

Choose a reason for hiding this comment

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

nit: make slot as last argument.



def get_webapp_sitecontainer_log(cmd, name, resource_group, container_name, slot=None):
scm_url = _get_scm_url(cmd, resource_group, name, slot)

Choose a reason for hiding this comment

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

Does this handle regionalized urls?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Web Apps az webapp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants