Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
300576d
Support Azure China Cloud, refactory client init #70 (#71)
xpdable Oct 21, 2019
5155259
Add ability to stress virtual machine scale set instances (#81)
maximmold Nov 5, 2019
da7319b
Initial Azure token based authentication support (#83)
maximmold Nov 12, 2019
dc8cb44
Improve classifiers to reflect reality
Lawouach Nov 12, 2019
78e9e27
Bump version 0.5.0 -> 0.6.0
Lawouach Nov 12, 2019
efbd67b
Add tests for Azure token authentication and handling missing paramet…
maximmold Dec 2, 2019
c653e92
Support criteria for selecting vmss instance to stop (#87)
maximmold Dec 5, 2019
bcdc34b
Remove creds from test cases (#88)
Lawouach Mar 4, 2020
a9ec163
added optional path parameter to fill_disk
Mar 16, 2020
85c1c40
Use official configuration accessor (#92)
Lawouach Apr 9, 2020
3a616f9
Bump version 0.6.0 -> 0.7.0
Lawouach Apr 9, 2020
8bf049b
Merge pull request #90 from shadowmynd/master
buderre May 1, 2020
3c453f7
Interrupt experiment execution when secrets are missing (#94)
bugra-derre May 6, 2020
f893c1e
Bug: Update list of unsupported scripts for Windows VM
bugra-derre May 6, 2020
4692917
Offer a VMSS probe that counts the number of provisioned instances
bugra-derre May 6, 2020
00122e3
Merge pull request #97 from bugra-derre/bug/93-list-unsupported-windo…
buderre May 7, 2020
cd0d61c
Merge pull request #99 from bugra-derre/feature/98-offer-vmss-probes
buderre May 7, 2020
fe7766d
Apply the DRY principle to command module
bugra-derre May 8, 2020
1fa3e40
Merge pull request #105 from bugra-derre/feature/refactoring-v4
buderre May 10, 2020
923b3be
Allow to load secrets from azure credential fileSigned-off-by: Marcin…
mkaszub May 10, 2020
07dbbab
Merge pull request #107 from mkaszub/feature/introduce-credential-file
buderre May 11, 2020
cd62d68
Select more than one VMSS instance
bugra-derre May 12, 2020
ddf8a61
Merge pull request #110 from bugra-derre/feature/108-select-more-than…
buderre May 12, 2020
8ebf413
Return output results for activities
bugra-derre May 13, 2020
3af5682
Merge pull request #113 from bugra-derre/feature/112-return-results-f…
buderre May 13, 2020
36154d5
Bump version 0.7.0 -> 0.8.0
Lawouach May 14, 2020
dff1e56
Expose missing subpackages
Lawouach May 14, 2020
f49432d
Bump version 0.8.0 -> 0.8.1
Lawouach May 14, 2020
9c8ab5b
Move to setuptools.find_packages
Lawouach May 14, 2020
3787afb
Bump version 0.8.1 -> 0.8.2
Lawouach May 14, 2020
df681f0
Add missing __init__.py modules to create packages
Lawouach May 14, 2020
1ed41aa
Bump version 0.8.2 -> 0.8.3
Lawouach May 14, 2020
82cf883
Added new Managemant clinet function which calls (#119)
HemantAHK Oct 20, 2020
eaee305
Adjustment to fit existing MS name.
YanumVlad Oct 30, 2020
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 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ language: python
python:
- 3.5
- 3.6
- 3.7

install:
- pip install -r requirements.txt -r requirements-dev.txt
Expand Down
78 changes: 77 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,79 @@
# Changelog

## [Unreleased][]
[Unreleased]: https://github.com/chaostoolkit-incubator/chaostoolkit-azure/compare/0.5.0...HEAD
[Unreleased]: https://github.com/chaostoolkit-incubator/chaostoolkit-azure/compare/0.8.3...HEAD

### Added

- Individual Azure managemnt clients for website and compute resources

### Removed

- Removed common init_client

## [0.8.3][] - 2020-05-14

[0.8.3]: https://github.com/chaostoolkit-incubator/chaostoolkit-azure/compare/0.8.2...0.8.3

### Added

- Missing init module files

## [0.8.2][] - 2020-05-14

[0.8.2]: https://github.com/chaostoolkit-incubator/chaostoolkit-azure/compare/0.8.1...0.8.2

### Changed

- Letting setuptools find all packages

## [0.8.1][] - 2020-05-14

[0.8.1]: https://github.com/chaostoolkit-incubator/chaostoolkit-azure/compare/0.8.0...0.8.1

### Added

- Expose the `auth` and `common` packages on building the top-level package

## [0.8.0][] - 2020-05-14

[0.8.0]: https://github.com/chaostoolkit-incubator/chaostoolkit-azure/compare/0.7.0...0.8.0

### Added
- Return output from activities
- Allow user to load more than one VMSS instance for VMSS actions
- Update list of unsupported scripts for Windows VM
- Added network latency operation vor VMSS instances
- Added burn io (memory exploit) operation vor VMSS instances
- Added fill disk operation vor VMSS instances
- Interrupt an experiment execution when secrets are error-prone
- Interrupt an experiment execution when an invalid cloud is configured
- Remove an unused configuration property from the resource graph since it is deprecated
- Technical refactoring: Separate concerns from the main _init_ module
- Technical refactoring: Applied DRY principles in test module
- Technical refactoring: Resource graph client now outputs error messages
- Allow to load secrets from azure credential file

## [0.7.0][] - 2020-04-09

[0.7.0]: https://github.com/chaostoolkit-incubator/chaostoolkit-azure/compare/0.6.0...0.7.0

### Added

- Supporting criteria for selection of the virtual machine scale set instance to stop
- Added optional path parameter to fill_disk

### Changed

- Use the official configuration accessor for `subscription_id` [#91][91]

[91]: https://github.com/chaostoolkit-incubator/chaostoolkit-azure/issues/91

## [0.6.0][] - 2019-11-12

[0.6.0]: https://github.com/chaostoolkit-incubator/chaostoolkit-azure/compare/0.5.0...0.6.0

### Added

- Added the burn_io feature: increase the I/O operations per seconds of the
hard drive for a time period (default time period is 1 minute). Works by
Expand All @@ -10,6 +82,10 @@ script.
- Added the network_latency feature: disturb the network of the VM, adding some
latency for a time period (defaults to a 200 +/- 50ms latency for 1 minute).
Only works on Linux machines for now.
- Supporting multiple Azure Cloud, such as AZURE_CHINA_CLOUD.
- Code clean up and refactoring, moving up client initiation.
- Added the ability to stress a machine instance in a virtual machine scale set
- Supporting Azure token based credentials (no refresh token support yet)

## [0.5.0][] - 2019-07-05

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ include requirements-dev.txt
include LICENSE
include CHANGELOG.md
include pytest.ini
include chaosazure/machine/scripts/*
include chaosazure/common/scripts/*
199 changes: 125 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,103 +30,160 @@ experiment file:

```json
{
"type": "action",
"name": "start-service-factory-chaos",
"provider": {
"type": "python",
"module": "chaosazure.vm.actions",
"func": "stop_machines",
"secrets": ["azure"],
"arguments": {
"parameters": {
"TimeToRunInSeconds": 45
}
}
"type": "action",
"name": "start-service-factory-chaos",
"provider": {
"type": "python",
"module": "chaosazure.vm.actions",
"func": "stop_machines",
"secrets": ["azure"],
"arguments": {
"parameters": {
"TimeToRunInSeconds": 45
}
}
}
}
```

That's it!

Please explore the code to see existing probes and actions.

## Configuration

This extension uses the [Azure SDK][sdk] libraries under the hood. The Azure SDK library expects that you have a tenant and client identifier, as well as a client secret and subscription, that allows you to authenticate with the Azure resource management API.

## Configuration
Configuration values for the Chaos Toolkit Extension for Azure can come from several sources:

### Credentials
This extension uses the [Azure SDK][sdk] libraries under the hood. The Azure SDK library
expects that you have a tenant and client identifier, as well as a client secret and subscription, that allows you to
authenticate with the Azure resource management API.
- Experiment file
- Azure credential file

The extension will first try to load the configuration from the `experiment file`. If configuration is not provided in the `experiment file`, it will try to load it from the `Azure credential file`.

[creds]: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-connect-to-secure-cluster
[requests]: http://docs.python-requests.org/en/master/
[sdk]: https://github.com/Azure/azure-sdk-for-python

There are two ways of doing this:
### Credentials

* you can either pass the name of the environment variables to the experiment definition as follows (recommended):
- Secrets in the Experiment file

```json
{
"azure": {
"client_id": {
"type": "env",
"key": "AZURE_CLIENT_ID"
},
"client_secret": {
"type": "env",
"key": "AZURE_CLIENT_SECRET"
},
"tenant_id": {
"type": "env",
"key": "AZURE_TENANT_ID"
}
}
```json
{
"secrets": {
"azure": {
"client_id": "your-super-secret-client-id",
"client_secret": "your-even-more-super-secret-client-secret",
"tenant_id": "your-tenant-id"
}
}
```

* or you inject the secrets explicitly to the experiment definition:
}
```

```json
{
"azure": {
"client_id": "your-super-secret-client-id",
"client_secret": "your-even-more-super-secret-client-secret",
"tenant_id": "your-tenant-id"
}
You can retrieve secretes as well from [environment][env_secrets] or [HashiCorp vault][vault_secrets].


If you are not working with Public Global Azure, e.g. China Cloud You can set the cloud environment.

```json
{
"client_id": "your-super-secret-client-id",
"client_secret": "your-even-more-super-secret-client-secret",
"tenant_id": "your-tenant-id",
"azure_cloud": "AZURE_CHINA_CLOUD"
}
```

Available cloud names:

- AZURE_CHINA_CLOUD
- AZURE_GERMAN_CLOUD
- AZURE_PUBLIC_CLOUD
- AZURE_US_GOV_CLOUD

[vault_secrets]: https://docs.chaostoolkit.org/reference/api/experiment/#vault-secrets
[env_secrets]: https://docs.chaostoolkit.org/reference/api/experiment/#environment-secrets


- Secrets in the Azure credential file

You can retrieve a credentials file with your subscription ID already in place by signing in to Azure using the az login command followed by the az ad sp create-for-rbac command

```bash
az login
az ad sp create-for-rbac --sdk-auth > credentials.json
```

credentials.json:

```json
{
"subscriptionId": "<azure_aubscription_id>",
"tenantId": "<tenant_id>",
"clientId": "<application_id>",
"clientSecret": "<application_secret>",
"activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
"resourceManagerEndpointUrl": "https://management.azure.com/",
"activeDirectoryGraphResourceId": "https://graph.windows.net/",
"sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
"galleryEndpointUrl": "https://gallery.azure.com/",
"managementEndpointUrl": "https://management.core.windows.net/"
}
```

Store the path to the file in an environment variable called **AZURE_AUTH_LOCATION** and make sure that your experiment does **NOT** contain `secrets` section.

### Subscription

Additionally you need to provide the Azure subscription id.

- Subscription id in the experiment file

```json
{
"configuration": {
"azure_subscription_id": "your-azure-subscription-id"
}
```

Additionally you need to provide the Azure subscription id.
}
```

```json
{
"azure": {
"subscription_id": "your-azure-subscription-id"
}
Configuration may be as well retrieved from an [environment][env_configuration].

An old, but deprecated way of doing it was as follows, this still works
but should not be favoured over the previous approaches as it's not the
Chaos Toolkit way to pass structured configurations.

```json
{
"configuration": {
"azure": {
"subscription_id": "your-azure-subscription-id"
}
}
```
}
```

[env_configuration]: https://docs.chaostoolkit.org/reference/api/experiment/#environment-configurations

- Subscription id in the Azure credential file

Credential file described in the previous "Credential" section contains as well subscription id. If **AZURE_AUTH_LOCATION** is set and subscription id is **NOT** set in the experiment definition, extension will try to load it from the credential file.



### Putting it all together

Here is a full example:
Here is a full example for an experiment containing secrets and configuration:

```json
{
"version": "1.0.0",
"title": "...",
"description": "...",
"tags": [
"azure",
"kubernetes",
"aks",
"node"
],
"tags": ["azure", "kubernetes", "aks", "node"],
"configuration": {
"azure": {
"subscription_id": "xxx"
}
"azure_subscription_id": "xxx"
},
"secrets": {
"azure": {
Expand Down Expand Up @@ -157,18 +214,12 @@ Here is a full example:
"type": "python",
"module": "chaosazure.machine.actions",
"func": "restart_machines",
"secrets": [
"azure"
],
"config": [
"azure"
]
"secrets": ["azure"],
"config": ["azure_subscription_id"]
}
}
],
"rollbacks": [

]
"rollbacks": []
}
```

Expand Down Expand Up @@ -197,7 +248,7 @@ those dependencies.
[venv]: http://chaostoolkit.org/reference/usage/install/#create-a-virtual-environment

```console
$ pip install -r requirements-dev.txt -r requirements.txt
$ pip install -r requirements-dev.txt -r requirements.txt
```

Then, point your environment to this directory:
Expand Down
Loading