Skip to content

feat: install waagent via wireserver#7987

Open
mxj220 wants to merge 19 commits intomainfrom
markibrahim/install-waagent-via-manifest
Open

feat: install waagent via wireserver#7987
mxj220 wants to merge 19 commits intomainfrom
markibrahim/install-waagent-via-manifest

Conversation

@mxj220
Copy link
Contributor

@mxj220 mxj220 commented Feb 27, 2026

Upgrades WALinuxAgent through manifest to preserve existing configurations but support the latest features (including FIPS 140-3 compatibility). Upgrading during build means that the customer faces no waagent update delays during AKS boot, as the latest version is baked into the VHD.

This update also blocks the WALinuxAgent from automatically updating afterwards.
What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Copy link
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

Adds support for installing/upgrading WALinuxAgent via the Azure wireserver manifest and running the install post-deprovision during VHD build, with accompanying VHD validation and regenerated CustomData snapshots.

Changes:

  • Update packer deprovision steps to optionally run a post-deprovision WALinuxAgent install script.
  • Add installWALinuxAgent (wireserver/manifest-based) and a VHD content test validating the cached agent + waagent.conf settings.
  • Add a walinuxagent entry to components.json, update build logging, capture waagent logs in e2e, and regenerate snapshot testdata.

Reviewed changes

Copilot reviewed 51 out of 78 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
vhdbuilder/packer/vhd-image-builder-mariner.json Run post-deprovision WALinuxAgent install after waagent deprovision.
vhdbuilder/packer/vhd-image-builder-mariner-cvm.json Same post-deprovision WALinuxAgent install hook (Mariner CVM).
vhdbuilder/packer/vhd-image-builder-mariner-arm64.json Same post-deprovision WALinuxAgent install hook (Mariner arm64).
vhdbuilder/packer/vhd-image-builder-cvm.json Same post-deprovision WALinuxAgent install hook (Ubuntu CVM).
vhdbuilder/packer/vhd-image-builder-base.json Same post-deprovision WALinuxAgent install hook (Ubuntu base).
vhdbuilder/packer/vhd-image-builder-arm64-gen2.json Same post-deprovision WALinuxAgent install hook (Ubuntu arm64 gen2).
vhdbuilder/packer/test/linux-vhd-content-test.sh Add WALinuxAgent validation in VHD content tests.
vhdbuilder/packer/pre-install-dependencies.sh Add OS variant detection.
vhdbuilder/packer/install-dependencies.sh Add walinuxagent handling/logging in package loop.
vhdbuilder/packer/cleanup-vhd.sh Generate post-deprovision WALinuxAgent install script driven by components.json.
pkg/agent/testdata/MarinerV2+Kata/CustomData Regenerated CustomData snapshot.
pkg/agent/testdata/MarinerV2+CustomCloud/CustomData Regenerated CustomData snapshot.
pkg/agent/testdata/Flatcar/CustomData.inner Regenerated CustomData snapshot.
pkg/agent/testdata/CustomizedImageLinuxGuard/CustomData Regenerated CustomData snapshot.
pkg/agent/testdata/CustomizedImageKata/CustomData Regenerated CustomData snapshot.
pkg/agent/testdata/CustomizedImage/CustomData Regenerated CustomData snapshot.
parts/linux/cloud-init/artifacts/cse_install.sh Add manifest-based installWALinuxAgent implementation.
parts/common/components.json Add walinuxagent downloadLocation entry.
e2e/vmss.go Collect /var/log/waagent.log in VM log extraction.

Copy link
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

Copilot reviewed 51 out of 78 changed files in this pull request and generated 11 comments.

Copilot AI review requested due to automatic review settings March 2, 2026 18:24
Copy link
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

Copilot reviewed 51 out of 78 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings March 2, 2026 19:30
Copy link
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

Copilot reviewed 51 out of 78 changed files in this pull request and generated 4 comments.

@mxj220 mxj220 requested review from sulixu and surajssd as code owners March 2, 2026 21:03
@mxj220 mxj220 changed the title feat: install waagent via manifest feat: install waagent via wireserver Mar 2, 2026
Copilot AI review requested due to automatic review settings March 2, 2026 21:13
Copy link
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

Copilot reviewed 50 out of 75 changed files in this pull request and generated no new comments.


# Step 1: Get the goalstate to find the ExtensionsConfig URL
local goalstate
goalstate=$(retrycmd_if_failure 10 5 60 curl -sSf -H "x-ms-agent-name: WALinuxAgent" -H "x-ms-version: 2012-11-30" "${wireserverURL}/machine/?comp=goalstate") || {
Copy link
Contributor

Choose a reason for hiding this comment

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

curl has its own retries mechanism, look at the repo and search for --retries

# GAFamily is the exact version the waagent daemon targets during auto-update.
# Installing it during VHD build lets the daemon pick it up locally without
# downloading from the network at provisioning time.
installWALinuxAgent() {
Copy link
Contributor

Choose a reason for hiding this comment

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

i see lot of python used in this function. Why not move all the functionality into a python script and call it? Just makes it easier to read and maintain.

if [ "$OS_ID" != "FLATCAR" ] && [ "$OS_VARIANT_ID" != "OSGUARD" ]; then
WALINUXAGENT_DOWNLOAD_DIR="/opt/walinuxagent/downloads"
WALINUXAGENT_WIRESERVER_URL="http://168.63.129.16:80"
cat > /opt/azure/containers/post-deprovision-walinuxagent.sh << WALINUXAGENT_SCRIPT
Copy link
Contributor

Choose a reason for hiding this comment

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

can you create this file in the repo directly (check it in) instead of creating one on the fly

@@ -784,7 +784,7 @@
"inline": [
"sudo /bin/bash -eux /home/packer/cis.sh",
"sudo /bin/bash -eux /opt/azure/containers/cleanup-vhd.sh",
"sudo /usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync || exit 125"
"sudo /bin/bash -c '/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync && if [ -f /opt/azure/containers/post-deprovision-walinuxagent.sh ]; then /bin/bash -eu /opt/azure/containers/post-deprovision-walinuxagent.sh && rm -f /opt/azure/containers/post-deprovision-walinuxagent.sh; fi' || exit 125"
Copy link
Contributor

Choose a reason for hiding this comment

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

move the whole command into deprovision script for easier debugging

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

Labels

components This pull request updates cached components on Linux or Windows VHDs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants