Граф коммитов

147 Коммитов

Автор SHA1 Сообщение Дата
Dave Poole 0c9a693cc7 feedback 2024-04-24 11:04:11 -07:00
Dave Poole e4c00e98d7 feedback 2024-04-23 19:54:35 +00:00
Dave Poole c86499738b make sure bash files are lf line endings 2024-04-22 21:47:18 +00:00
Dave Poole fc430b00fc correct typo 2024-04-22 21:46:04 +00:00
Dave Poole 8dae5e7377 Switch to use systemd-run to launch vmwatch
Background:

Our tests have been running fine for a long time but suddenly started failing on specific os versions.  This was because the process (although initially associated with the correct cgroup that we created) gets moved back to the parent cgroup.  This results in the limits being removed.

I did some research and reached out to various people and found that this is something that has previously been seen.  When a process is started with systemd you are not supposed to manage cgroups directly, systemd owns its own hierarchy and can manipulate things within it.  Documentation says that you should not modify the cgroups within that slice hierarchy directly but instead you should use `systemd-run` to launch processes.

The GuestAgent folks saw very similar behavior and switching to systemd-run resolved all their issues.

Changes:

Changed the code to run using `systemd-run` to launch the vmwatch process.  Using the `--scope` parameter results in the call to wait until the vmwatch process completes.

The process id returned from the call is the actual process id of vmwatch.

I have confirmed that killing vmwatch and killing app health extension still has the same behavior (the PDeathSig integration is working fine) and the aurora tests are working fine with these changes.

NOTE: Because in docker containers, systemd-run is not available, the code falls back to run the process directly and continues to use the old code path in that case.  This should also cover and linux distros which don't use systemd where direct cgroup assignment should work fine.
2024-04-22 10:02:51 -07:00
Frank Pang 7a9c4ffbe1 Bump to v2.0.9 2024-03-19 12:23:37 -07:00
Kevin Lugo 3ae2bd3f80
Fixing bug to successfully kill AppHealth Gracefully & VMWatch. (#59)
Changes by @dpoole73 
- Fix bug where we were not using the global `vmWatchCommand` variable so the SIGTERM handler was not killing anything
- set the `Pdealthsig` property on the command so the SIGTERM signal is sent to the sub process on parent process termination

This fixes both issues:

Before the fix if we killed app health process, vmwatch process was always leaked

After the fix:
`kill <pid>` -> log message "Received shutdown request" and kill vmwatch.
`kill -9 <pid>`-> no log message, vmwatch is killed

Changes by @klugorosado 
- Added Integration tests to kill AppHealth Gracefully with SIGTERM and SIGINT, and validated VMWatch Shutdown. 
- Added Integration tests to kill AppHealth Forcibly with SIGKILL, and validated VMWatch Shutdown. 
- Added the capability for dev containers to run Integration tests inside.
2024-03-19 12:06:04 -07:00
dpoole73 1bc094cf51
Merge pull request #56 from Azure/dev/dpoole/update-vmwatch-to-1.0.13
update vmwatch to 1.0.13
2024-02-15 06:53:28 -08:00
Dave Poole 16ab06cd58 update vmwatch to 1.0.13 2024-02-12 15:09:20 -08:00
dpoole73 b2f10123ea
Merge pull request #55 from Azure/dev/dpoole/tweak-resource-governance
Dev/dpoole/tweak resource governance
2024-02-10 13:15:48 -08:00
Dave Poole d6fedcb57e feedback 2024-02-09 20:27:26 +00:00
Dave Poole a537451ab1 clean up logic a bit 2024-02-09 11:06:03 -08:00
Dave Poole d29ce6a4be add validation of default value 2024-02-08 16:08:17 -08:00
Dave Poole cba77e8a06 Configurable rg settings
tweaking settings based on findings in sql vms
2024-02-08 15:54:59 -08:00
dpoole73 57bca902fd
Merge pull request #54 from Azure/dev/dpoole/update-vmwatch-to-1.0.8
updating vmwatch version to 1.0.8
2024-01-26 09:17:50 -08:00
Dave Poole 9c6393af71 1.0.11 2024-01-25 17:39:58 -08:00
Dave Poole 8f3fd7520f updating to 1.0.10 version 2024-01-24 16:54:13 -08:00
Dave Poole 3791d080c5 move to version 1.0.9 2024-01-22 15:20:55 -08:00
Dave Poole f443d2e7ac updating vmwatch version to 1.0.8 2024-01-22 14:46:10 -08:00
Kevin Lugo 1f5e41b085
Passing Extension Version to VMWatch (#52)
* Added --apphealth-version flag to VMWatch with AppHealth version from manifest.xml

* - Validated Extension Version on existing VMWatch.
- Created bash function to extract Version from manifest.xml.
- GetExtensionManifestVersion now first attempts to get Extension Version from Version passed at build time and uses manifest.xml file as fallback.
2024-01-18 14:02:30 -08:00
Manish Satwani e27e5e5de8
Merge pull request #51 from manishsat/feature/v2/bootstrapVMWatch
adding a way to provide custom container to upload artifact
2024-01-12 16:28:11 -08:00
Manish Satwani 0f218be75c use variable instead of hard coded value 2024-01-13 00:04:38 +00:00
Manish Satwani 1e33779b0c removed extra space 2024-01-13 00:03:36 +00:00
Manish Satwani 23fde9d16e adding a way to provide custom container to upload artifact 2024-01-13 00:02:00 +00:00
Manish Satwani e7ab697c21
Merge pull request #50 from manishsat/feature/v2/bootstrapVMWatch
removing data-type key from json tag for url type, unmarshal is failing otherwise
2024-01-10 14:32:38 -08:00
Manish Satwani 87048b99a3 added asserts on enabled and globalConfigUrl 2024-01-10 22:09:02 +00:00
Manish Satwani 48c44fce7b Adding test case unmarshal public settings 2024-01-10 20:33:32 +00:00
Manish Satwani 3900799438 removing type from tag, unmarshal is failing otherwise 2024-01-10 19:06:10 +00:00
Manish Satwani 1d7ac0a4e7
Merge pull request #48 from manishsat/feature/v2/bootstrapVMWatch
adding more properties to pass down to vmwatch
2024-01-09 17:39:14 -08:00
Manish Satwani 314b7a1002 adding compatible binaries 2024-01-09 16:49:02 -08:00
Manish Satwani 0bda3000f2
Merge branch 'feature/v2/bootstrapVMWatch' into feature/v2/bootstrapVMWatch 2024-01-08 15:30:11 -08:00
Manish Satwani 5794e7b42f added parameters to schema 2024-01-08 15:01:27 -08:00
Mingyang Zheng b9a863ff84
Merge pull request #49 from zmyzheng/dev/zmyzheng/debugflag
Add debug flag when running vmwatch
2024-01-04 17:26:49 -08:00
Mingyang Zheng 5d53e50b14 Add debug flag when running vmwatch 2024-01-04 15:55:22 -08:00
Manish Satwani 03813f38ac adding more properties to pass down to vmwatch 2024-01-04 11:48:57 -08:00
dpoole73 ee2640aba7
cgroup fixes (#47)
* Initial checkpoint

* tweak tests

* tweak the scripts

1. use nc for a tco server instead of web server for simplicity
2. add the variables to control tolerating the failure assignment to cgroup to allow tests to run
3. add new test for the case where it fails

* feedback

* feedback

* feeback

* feedback
2024-01-03 11:49:46 -08:00
dpoole73 10f4a64598
fix script variable syntax (#46) 2023-12-07 12:49:48 -08:00
dpoole73 7d3df06186
Resource governance, heartbeat and dev container changes (#43)
* Bootstrapping has no integration test regressions

* Add cleanup of VMWatch process during shutdown signals and upon other commands, plus integration test template

* Added integration tests for VMWatch

* Linting

* Fix file vet issues

* attempt to fix handler command: install - creates the data dir

* nit integration tests

* Use handlerenvironment to dictate vmwatch signal folder and verbose log file paths

* Include missing changes in previous commit

* Remove unnecessary changes

* Try to fix docker installation error in go workflow

* Fix integration tests

* Update HandlerManifest with process names for guest agent to monitor cpu/memory usage

* Run linting

* Remove cpu/memory limits in HandlerManifest + update VMWatch binary directory to bin/VMWatch/ + implement VMWatch process retries + update integration tests

* Update test.Dockerfile

* Rename workflow

* Add formatting & linting

* Add logic to do retries on failed tests + don't fail fast

* Minor nits

* Update integration tests + code changes to resolve comments regarding execution of process

* Formatting + Linting + Vet

* Add logic for recover and defer for executing VMWatch. Proper close and read of channel. Also only  every 60 seconds

* fix integration tests

* Bump to v2.0.7

* revert unnecessary changes to schema.go

* Small fix to killVMWatch

* Fix logic for killing VMWatch

* v2.0.8 Added Support for dynamic EventsFolder directory from extension Handler Environment (#39)

* - moved handlerenv.go and seqno.go from "github.com/Azure/azure-docker-extension/pkg/vmextension"
- Added EventsFolder with other missing parameters.

* -removed vmextension lib dependency from VMwatch and other Files.
- Updates HandlerEnviroment.json test file.
- Updated VMwatch Integration Tests.

* - Bump to v2.0.8

* initial devcontainer changes

changes:

1. add devcontainer condig
2. add vscode build config
3. add makefile target to set up the appropriate stuff in the container
4. update some line endings and add gitattributes so script run
5. fix what seems to be a bug in fake-waagent script as it doesn't work without this fix for me

* update binaries and config to latest

* Resource governance, heartbeat and dev container changes

The main feature change here is the addition of resource governance for linux via cgroups.

We discover the current cgroup and add a sub cgroup for our purposes (limiting cpu to 1% and memory to 40MB)

I also added support for detecting a stuck vmwatch using the heartbeat file and implemented the same logic for restarts from the windows version (3 restarts per 3 hours)

As part of the development of this, I added support for devcontainer execution so we can step through the code from a dev machine into either a WSL session or a linux vm with tools installed.

I added integration tests to check process exit, OOM and cpu throttling.  These changes required a few changes to the makefile and scripts.

I also updated the vmwatch binaries and added a script to download the latest ones as well

I updated the govendor files using the tool it told me to run I hope I did this right

* feedback

* feedback

* Run 'go mod edit -go=1.18 to be conistent with linux extensions repo

* Run linting/formatting

* Fix merge nits to merge conflicts

* Fix app health handler.log directory path

* Change to applicationhealth-extension

* Mistakenly added two VMWatch substatus items

* Adding filtering for tests which can only run on a real linux host (not WSL or docker)

continuing investigation...

* fix time from minutes to hours plus add makefile target to create zip file (for use in testing)

* feedback

* feedback

* add readme

* updated vmwatch version, config schema and commandline

* typo

* test fixes

* test fixes

* add helper script to upload binaries to storage

* change container name

* feedback

* feedback

* typo

---------

Co-authored-by: Frank Pang <frankpang@microsoft.com>
Co-authored-by: frank-pang-msft <92764154+frank-pang-msft@users.noreply.github.com>
Co-authored-by: klugorosado <142627157+klugorosado@users.noreply.github.com>
2023-11-30 18:38:07 -08:00
frank-pang-msft 463490dafe
Bump to v2.0.8: Bootstrap VMWatch Process if vmWatchSettings present (#33)
## Overview
This PR contains changes to support running VMWatch (amd64 and arm64) as an executable via goroutines and channels. 
> VMWatch is a standardized, lightweight, and open-sourced testing framework designed to enhance the monitoring and management of guest VMs on the Azure platform, including both 1P and 3P instances. VMWatch is engineered to collect vital health signals across multiple dimensions, which will be seamlessly integrated into Azure's quality systems. By leveraging these signals, VMWatch will enable Azure to swiftly detect and prevent regressions induced by platform updates or configuration changes, identify gaps in platform telemetry, and ultimately improve the guest experience for all Azure customers.

## Behavior
VMWatch will run asynchronously as a separate process than ApplicationHealth, so the probing of application health will not be affected by the state of VMWatch. Depending on extension settings, VMWatch can be enabled/disabled, and also specify the test names and parameter overrides to VMWatch binary. The status of VMWatch will be displayed in the extension x.status files and also in GET VM Instance View. Main process will attempt to start VMWatch binary up to 3 times, after which VMWatch status will be set to failed.

## Process Leaks
To ensure that VMWatch processes do not accumulate, applicationhealth-shim will be responsible for killing existing VMWatch processes by looking for processes running with the VMWatch binary names according to the architecture type. For unexpected process termination, if for some reason the main applicationhealth-extension process is terminated, we also ensure that the VMWatch process is also killed by subscribing to shutdown/termination signals in the main process, and killing the VMWatch based off process ID.

## Example Binary Execution
Example execution from integration testing 
`
SIGNAL_FOLDER=/var/log/azure/Microsoft.ManagedServices.ApplicationHealthLinux/events VERBOSE_LOG_FILE_FULL_PATH=/var/log/azure/Microsoft.ManagedServices.ApplicationHealthLinux/VE.RS.ION/vmwatch.log ./var/lib/waagent/Extension/bin/VMWatch/vmwatch_linux_amd64 --config /var/lib/waagent/Extension/bin/VMWatch/vmwatch.conf --input-filter disk_io:outbound_connectivity
`

## Release/Packaging
In addition to the arm64 or amd64 VMWatch binaries, `vmwatch.conf` will be expected to be present in the bin/VMWatch directory for VMWatch process to read. VMWatch will also be populating and sharing eventsFolder with ApplicationHealth, so events can be viewed in Kusto. The verbose logs of VMWatch will be written to `vmwatch.log`.

---------

Co-authored-by: klugorosado <142627157+klugorosado@users.noreply.github.com>
2023-11-17 08:25:58 -08:00
klugorosado 2e8fd9e0fe
App Health Extension v2: Added Support TLS 1.3, added Parallel test execution and updated GitHub Workflow. (#38)
* - Added min and max TLS version support.
- Included Support for TLS 1.3
- Minimum  TLS 1.1 enforced.

* - Added bash function to create and delete certificates.
- Modified run.sh script to use the create and delete certificate functions.
- Added new instructions to run integration tests in README.md

* - Added 3 Integration tests to test each version of TLS.
- Added tlsVersion flag for webserver input.
- Added TLS Config for https webserver.
- Added helper functions to get TLS Version and Health State.
- Changed port of https server from 443 to 4430.

* - refactored NewHttpHealthProbe function.

* - changed min version to TLS 1.0

* - Test all TLS versions, including SSLv3
- Parallelize integration tests.

* - modified go.yml to use run.sh

* - Changes Flag to securityProtocol and updated Comments.

* -Added dynamic container names to bats tests.

* - TLS Config set to Defaults but tested.

* cleanup logic for created container.

* Only basic.bats tests are ran sequentially

* Only basic.bats tests are ran sequentially

* Attempt to fix go.yml

* Revert: TLS Config set to Defaults but tested

* TLS Max Version set to Default.

* Added small comments and verbose logs for integration tests.

* Try fix go workflow

* Update github workflow for v2/main and v2/develop.

* Try Add sequential and parallel integration tests with retry option.

* Try Fix: "Try Add sequential and parallel integration tests with retry option."

* Try Fix: "Try Fix: "Try Add sequential and parallel integration tests with retry option.""

* Update branch names in go.yml workflow

* Refactor health probe address construction

* Add While loop to finf unique docker image and Added Clarification comments.

* Refactor integration test job names

* capture error from run.sh script

* Fixed repeated Assertions on SSLv3 test

* Refactor health test function names and added new tests to validate request path.

* Remove unnecessary code in health.go

* nit changes to getHealthStatus

* Refactor integration test scripts for better
organization and parallelization

* Fix github workflow integration test directory paths.

* Update branch restrictions for push and
pull_request workflows
2023-11-15 17:31:45 -08:00
klugorosado 4867d78b2d
- Cleaned up Github Workflow flow Godep and added correct Go Version (Go 1.18.10) (#41)
- Changed Makefile to build to Go Moduled instead of govvv.
- Removed Godep dependencies.
- ran go mod tidy -> go mod vendor
2023-10-17 13:25:55 -07:00
klugorosado ad2e94e8dd
App Health Extension v2: Increase maximum grace period to 4 hours. (#36)
* - change publicSettingsSchema.properties.gracePeriod to 14400 seconds.

* - Added a new unit test for the grace period (tested multiple scenarios).

* - Attempted to fix docker installation error in go workflow.
2023-09-05 11:28:31 -07:00
klugorosado 31d41d597e
Fix go workflow, updated test dockerfile to use ubuntu 20.04, and fix failing integration tests (#35)
* - Fixed "meta: can start the test container" Integration Test.
* - fixed bug with ubuntu-18.04.
- fixed handler-commands-install Integration Test.
- modified start_container function.
2023-08-23 15:21:23 -07:00
Kai Lüke 674c230913
Makefile: Always build static binaries (#31)
Static binaries were use for arm64 through the cross-compilation but not
for amd64. This added a dependency on some system libraries that the
host OS should provide, such as glibc with a certain minimal version.

To align the amd64 with the arm64 binary and reduce requirements for the
host OS, always build static binaries. The result was checked with
running "file bin/applicationhealth-*".
2023-08-01 14:37:05 -07:00
frank-pang-msft da4cc111e8
Bump to v2.0.6 (#32)
* Bump to v2.0.6
2023-07-19 13:07:05 -07:00
microsoft-github-policy-service[bot] b4803fdf40
Auto merge mandatory file pr
This pr is auto merged as it contains a mandatory file and is opened for more than 10 days.
2022-11-28 19:35:33 +00:00
frank-pang-msft bbc0bc557b
Increase max settle time to 240 seconds (#29)
Increase max settle time 120 -> 240 seconds.
Update unit test for scenario for trying to have total settle time of 180 -> 300 should result in error
2022-10-27 13:05:53 -07:00
frank-pang-msft 99e6109e9c
Add ubuntu latest and ubuntu 20.04 to integration test (#30)
* Add ubuntu latest and ubuntu 20.04 to integration test

* Update bats to bats-core
2022-10-26 14:36:19 -07:00
Frank Pang 001d10d347 Bump version to support go modules 2022-10-13 16:22:30 -07:00
Bhaskar Brahma c6bd5c829e
Migrated to golang modules (#28)
Due to pending update of Compute-ART-LinuxExtensions go lang compiler to 1.17.x. I am migrating the code to use go modules.

https://go.dev/blog/migrating-to-go-modules

The vendor directory has been trimmed by running 'go mod init', 'go mod vendor' 'go mod tidy', no files were removed manually.

main.go has been updated to call the renamed method in github.com/Azure/azure-docker-extension/pkg/vmextension

* go mod vendor
* Ran go mod tidy and updated main.go
2022-10-10 10:16:38 -07:00