chaostoolkit-incubator / chaostoolkit-azure

Chaos Toolkit Extension for Azure
https://chaostoolkit.org/
Apache License 2.0
22 stars 28 forks source link

How to define the number of restart / stop_node on AKS Cluster? #78

Open ShotaAshida opened 4 years ago

ShotaAshida commented 4 years ago

https://github.com/chaostoolkit-incubator/chaostoolkit-azure/blob/8d4b596b0b4ec95834dfe3b50cee02b3f363e6fa/chaosazure/aks/actions.py#L44

This Document shows that restart_node and stop_node commands stop a node at random. However, all nodes in my cluster stopped when I tried to do command "stop_node". And also tried to add "sample" query on argument like

        "arguments":{
          "filter": "'where resourceGroup=='Staging' and name='dmc-staging-1' | sample 1'"
        },

but it doesn't work. My sample json is below. Do you have an any idea for this issue?

{
  "version": "1.0.0",
  "title": "...",
  "description": "...",
  "tags": [
    "azure",
    "kubernetes",
    "aks",
    "node"
  ],
  "configuration": {
    "azure": {
        "subscription_id": "xx"
    }
  },
  "secrets": {
    "azure": {
        "client_id": "xx",
        "client_secret": "xx",
        "tenant_id": "xx"
    }
  },
  "steady-state-hypothesis": {
    "title": "Services are all available and healthy",
    "probes": [
        {
          "name": "all-microservices-healthy",
          "type": "probe",
          "tolerance": true,
          "provider": {
            "func": "all_microservices_healthy",
            "type": "python",
            "module": "chaosk8s.probes"
          }
        }
    ]
  },
  "method": [
    {
      "name": "stop-node",
      "type": "action",
      "provider": {
        "func": "stop_node",
        "argument":{
          "filter": "'where resourceGroup=='Staging' and name='dmc-staging-1' | sample 1'"
        },
        "type": "python",
        "module": "chaosazure.aks.actions",
        "secrets": [
          "azure"
        ],
        "config": [
          "azure"
        ]
      }
    }
  ],
  "rollbacks": [
  ]
}
bugra-derre commented 4 years ago

@ShotaAshida

The filter you provided ... It seems almost correct except that it has a apostrophe too much.

You have

"filter": "'where resourceGroup=='Staging' and name='dmc-staging-1' | sample 1'"

It should be

"filter": "where resourceGroup=='Staging' and name='dmc-staging-1' | sample 1"

Side note: The filter is nothing different than the Kusto query syntax combined with the MS Azure graph query.