Code Monkey home page Code Monkey logo

chaostoolkit-cloud-foundry's People

Contributors

lawouach avatar russmiles avatar singhgarima avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

chaostoolkit-cloud-foundry's Issues

A provider must have a type

Hi am trying to get the app stats. It complains as below

chaos run .\experiment.json
[2019-04-03 15:44:45 INFO] Validating the experiment's syntax
[2019-04-03 15:44:45 ERROR] a provider must have a type

====================================================

Experiment.json

{ "version": "1.0.0", "title": "Moving a file from under our feet is forgivable", "description": "Our application should re-create a file that was removed", "contributions": { "reliability": "high", "availability": "high" }, "steady-state-hypothesis": { "title": "The file must be around first", "probes": [ { "type": "probe", "tolerance": "false", "name": "fetch-app-statistics", "provider": { "type": "python", "secrets": ["cloudfoundry"], "module": "chaoscf.probes", "func": "get_app_stats", "arguments": { "app_name": "my-app", "org_name": "my-org", "space_name": "my-space" } } } ] }, "method": [ { "type": "action", "name": "file-be-gone", "provider": { "module": "os.path", "func": "remove", "arguments": { "path": "some/file" } }, "pauses": { "after": 5 } }, { "ref": "file-must-exist" } ] }

Targeting V3 API

Hi All,

I've been having a tinker with the CF driver, thanks for putting it together it's great.

Is there a roadmap or plan for moving over from the CF V2 to V3 api?

Here's the docs for the V3 api

Reorganize function parameters

We tend to favour keeping configuration and secrets as the last two parameters. This is not the case in this driver. Let's update all the function's signature accordingly.

See #16 for an example of the change that is needed.

Test "Unbind_service_from_app" doesn't work

Hello everyone,

I tried to run an experiment on cloudfoundry environment (unbind service from app) but when i run the json file, i get an error.
I would like to unbind service "rabbitmq" from my app "hello-spring-cloud". So that what i refer in my experiment file:

~$ cf services
Getting services in org POV / space appchaos as chaos...

name          service       plan                  bound apps           last operation     broker        upgrade available
mon-service   appdynamics   dynam-vipa-01ri67ba   hello-spring-cloud   update succeeded   appdservice   
rabbitmq      p-rabbitmq    standard              hello-spring-cloud   create succeeded   p-rabbitmq 
"method": [
        {
            "type": "action",
            "name": "unbind_service_from_app",
            "provider": {
                "type": "python",
                "secrets": ["cloudfoundry"],
                "module": "chaoscf.actions",
                "func": "unbind_service_from_app",
                "arguments": {
                    "app_name": "hello-spring-cloud",
                    "bind_name": "rabbitmq",
                    "org_name": "POV",
                    "space_name": "appchaos"
                }
            }
        }
    ]
}

You can also find log from chaostoolkit.log:


[36m[2022-03-01 16:00:04 DEBUG] [cli:112][39m ###############################################################################
[36m[2022-03-01 16:00:04 DEBUG] [cli:113][39m Running command 'run'
[36m[2022-03-01 16:00:04 DEBUG] [cli:117][39m Using settings file '/home/icel6280/.chaostoolkit/settings.yaml'
[36m[2022-03-01 16:00:05 DEBUG] [settings:30][39m The Chaos Toolkit settings file could not be found at '/home/icel6280/.chaostoolkit/settings.yaml'.
[36m[2022-03-01 16:00:05 DEBUG] [_init_:389][39m No controls to apply on 'loader'
[36m[2022-03-01 16:00:05 DEBUG] [_init_:389][39m No controls to apply on 'loader'
[36m[2022-03-01 16:00:05 DEBUG] [caching:24][39m Building activity cache...
[36m[2022-03-01 16:00:05 DEBUG] [caching:35][39m Cached 1 activities
[32m[2022-03-01 16:00:05 INFO] [experiment:58][39m Validating the experiment's syntax
[36m[2022-03-01 16:00:05 DEBUG] [configuration:63][39m Loading configuration...
[36m[2022-03-01 16:00:05 DEBUG] [secret:78][39m Loading secrets...
[36m[2022-03-01 16:00:05 DEBUG] [secret:78][39m Loading secrets...
[36m[2022-03-01 16:00:05 DEBUG] [secret:104][39m Done loading secrets
[36m[2022-03-01 16:00:05 DEBUG] [secret:104][39m Done loading secrets
[32m[2022-03-01 16:00:05 INFO] [experiment:109][39m Experiment looks valid
[36m[2022-03-01 16:00:05 DEBUG] [caching:42][39m Clearing activities cache
[36m[2022-03-01 16:00:05 DEBUG] [caching:24][39m Building activity cache...
[36m[2022-03-01 16:00:05 DEBUG] [caching:35][39m Cached 1 activities
[36m[2022-03-01 16:00:05 DEBUG] [configuration:63][39m Loading configuration...
[36m[2022-03-01 16:00:05 DEBUG] [secret:78][39m Loading secrets...
[36m[2022-03-01 16:00:05 DEBUG] [secret:78][39m Loading secrets...
[36m[2022-03-01 16:00:05 DEBUG] [secret:104][39m Done loading secrets
[36m[2022-03-01 16:00:05 DEBUG] [secret:104][39m Done loading secrets
[36m[2022-03-01 16:00:05 DEBUG] [configuration:155][39m Loading dynamic configuration...
[32m[2022-03-01 16:00:05 INFO] [run:320][39m Running experiment: unbind d'un service
[36m[2022-03-01 16:00:05 DEBUG] [_init_:49][39m Initializing controls
[32m[2022-03-01 16:00:05 INFO] [run:337][39m Steady-state strategy: default
[32m[2022-03-01 16:00:05 INFO] [run:341][39m Rollbacks strategy: default
[32m[2022-03-01 16:00:05 INFO] [run:346][39m No steady state hypothesis defined. That's ok, just exploring.
[36m[2022-03-01 16:00:05 DEBUG] [_init_:389][39m No controls to apply on 'experiment'
[32m[2022-03-01 16:00:05 INFO] [run:600][39m Playing your experiment's method now...
[36m[2022-03-01 16:00:05 DEBUG] [_init_:389][39m No controls to apply on 'method'
[36m[2022-03-01 16:00:05 DEBUG] [_init_:389][39m No controls to apply on 'activity'
[32m[2022-03-01 16:00:05 INFO] [activity:188][39m Action: unbind_service_from_app
[36m[2022-03-01 16:00:05 DEBUG] [python:33][39m Activity 'unbind_service_from_app' loaded from '/home/icel6280/.local/lib/python3.8/site-packages/chaoscf/actions.py'
[36m[2022-03-01 16:00:05 DEBUG] [_init_:54][39m Querying a new access token for client 'cf'
[36m[2022-03-01 16:00:05 DEBUG] [api:47][39m Request ID: 820283f9-3aa3-49da-4d69-638d36de2d52::a75296eb-8243-474c-986a-c393c4a44660
[36m[2022-03-01 16:00:05 DEBUG] [_init_:54][39m Querying a new access token for client 'cf'
[36m[2022-03-01 16:00:06 DEBUG] [api:47][39m Request ID: f5ad27bb-b863-4e9d-4edd-bb0bfbea9c7b::83a30c11-ec73-4da0-bfe5-097e086b535a
[36m[2022-03-01 16:00:06 DEBUG] [_init_:54][39m Querying a new access token for client 'cf'
[36m[2022-03-01 16:00:07 DEBUG] [api:47][39m Request ID: 3180615c-873a-4b9e-57a9-458bdceda250::16fd7db5-2bb5-4a0e-871b-b2f93e08d39f
[36m[2022-03-01 16:00:07 DEBUG] [_init_:54][39m Querying a new access token for client 'cf'
[36m[2022-03-01 16:00:07 DEBUG] [api:47][39m Request ID: 4f3300a0-7f69-45c9-5b8f-922ccc6396de::2c84526a-9d20-40a6-9495-2c0d5997a79f
[36m[2022-03-01 16:00:07 DEBUG] [_init_:54][39m Querying a new access token for client 'cf'
[36m[2022-03-01 16:00:08 DEBUG] [api:47][39m Request ID: 0b807152-0747-4987-50eb-5089890b2ec1::dce53f92-30b3-40a0-a03e-84fb8e1bb344
[36m[2022-03-01 16:00:08 DEBUG] [activity:260][39m Activity failed
    Traceback (most recent call last):
      File "/home/icel6280/.local/lib/python3.8/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
        return func(**arguments)
      File "/home/icel6280/.local/lib/python3.8/site-packages/chaoscf/actions.py", line 231, in unbind_service_from_app
        service_bind = get_bind_by_name(
      File "/home/icel6280/.local/lib/python3.8/site-packages/chaoscf/api.py", line 255, in get_bind_by_name
        service_binding = next(item for item in binds["resources"]
    StopIteration
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      File "/home/icel6280/.local/lib/python3.8/site-packages/chaoslib/activity.py", line 253, in run_activity
        result = run_python_activity(activity, configuration, secrets)
      File "/home/icel6280/.local/lib/python3.8/site-packages/chaoslib/provider/python.py", line 58, in run_python_activity
        raise ActivityFailed(
      File "/home/icel6280/.local/lib/python3.8/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
        return func(**arguments)
      File "/home/icel6280/.local/lib/python3.8/site-packages/chaoscf/actions.py", line 231, in unbind_service_from_app
        service_bind = get_bind_by_name(
      File "/home/icel6280/.local/lib/python3.8/site-packages/chaoscf/api.py", line 255, in get_bind_by_name
        service_binding = next(item for item in binds["resources"]
    chaoslib.exceptions.ActivityFailed: StopIteration
[31m[2022-03-01 16:00:08 ERROR] [activity:213][39m   => failed: StopIteration
[36m[2022-03-01 16:00:08 DEBUG] [_init_:389][39m No controls to apply on 'activity'
[36m[2022-03-01 16:00:08 DEBUG] [_init_:389][39m No controls to apply on 'method'
[32m[2022-03-01 16:00:08 INFO] [run:886][39m Let's rollback...
[36m[2022-03-01 16:00:08 DEBUG] [_init_:389][39m No controls to apply on 'rollback'
[32m[2022-03-01 16:00:08 INFO] [rollback:27][39m No declared rollbacks, let's move on.
[36m[2022-03-01 16:00:08 DEBUG] [_init_:389][39m No controls to apply on 'rollback'
[32m[2022-03-01 16:00:08 INFO] [run:451][39m Experiment ended with status: completed
[36m[2022-03-01 16:00:08 DEBUG] [_init_:389][39m No controls to apply on 'experiment'
[36m[2022-03-01 16:00:08 DEBUG] [_init_:82][39m Cleaning up controls
[36m[2022-03-01 16:00:08 DEBUG] [caching:42][39m Clearing activities cache

If someone has an idea it would be helpful !
Thank you

What would the "tolerance" value(s) be for get_app_stats

The documentation doesn't mention anything about tolerance. If I leave it out of example code, it tells me that a tolerance is needed. I have tried a coulple of things like "true" or "200" (for the status code returned by /v2/apps/{app guid}/stats}. When I do a "run" it fails for the tolerance. What should the tolerance value(s) be?

run

chaos run experiment3.json
[2021-01-15 11:17:05 INFO] Validating the experiment's syntax
[2021-01-15 11:17:06 INFO] Experiment looks valid
[2021-01-15 11:17:06 INFO] Running experiment: CF App stuff
[2021-01-15 11:17:06 INFO] Steady-state strategy: default
[2021-01-15 11:17:06 INFO] Rollbacks strategy: default
[2021-01-15 11:17:06 INFO] Steady state hypothesis: Application responds
[2021-01-15 11:17:06 INFO] Probe: fetch-app-statistics
[2021-01-15 11:17:09 CRITICAL] Steady state probe 'fetch-app-statistics' is not in the given tolerance so failing this experiment
[2021-01-15 11:17:09 INFO] Experiment ended with status: failed

experiment file with my specific information removed.

{
"version": "1.0.0",
"title": "CF App stuff",
"description": "Initital App test",
"tags": ["tls"],
"steady-state-hypothesis": {
"title": "Application responds",
"probes": [{
"type": "probe",
"name": "fetch-app-statistics",
"tolerance": 200,
"provider": {
"type": "python",
"module": "chaoscf.probes",
"secrets": ["cloudfoundry"],
"func": "get_app_stats",
"arguments": {
"app_name": "my-app",
"org_name": "my-org",
"space_name": "my-space"
}
}
}]
},
"method": [{
"type": "action",
"name": "terminate-random-instance",
"provider": {
"type": "python",
"module": "chaoscf.actions",
"func": "terminate_some_random_instance",
"arguments": {
"app_name": "my-app",
"org_name": "my-org",
"space_name": "my-space"
}
}
}],
"rollbacks": [],
"configuration": {
"cf_api_url": "https://api.cf.example.com",
"cf_verify_ssl": false
},
"secrets": {
"cloudfoundry": {
"cf_username": "xxxx",
"cf_password": "xxxx"
}
}
}

run with "tolerance" removed (like your example)
chaos run experiment3.json
[2021-01-15 11:29:10 INFO] Validating the experiment's syntax
[2021-01-15 11:29:11 ERROR] hypothesis probe must have a tolerance entry

Invalid URL 'None/v2/info': No schema supplied.

Hi, my setup is throwing below exception, experiment txt is attached. Why is it still picking None/v2/info when I have specified "cf_api_url": "https://api.cffs.test.net", in the experiment.json?
Not sure what I am missing.

[exp_org.txt](https://github.com/chaostoolkit-incubator/chaostoolkit-cloud-foundry/files/3303444/exp_org.txt)
[2019-06-18 16:01:05 DEBUG] [__init__:55] Querying a new access token for client 'cf'
[2019-06-18 16:01:05 DEBUG] [activity:226] Activity failed
    Traceback (most recent call last):
      File "c:\myinstalls\python\lib\site-packages\chaoslib\provider\python.py", line 55, in run_python_activity
        return func(**arguments)
      File "c:\myinstalls\python\lib\site-packages\chaoscf\probes.py", line 33, in get_app_stats
        space_name=space_name)
      File "c:\myinstalls\python\lib\site-packages\chaoscf\api.py", line 134, in get_app_by_name
        configuration, secrets, space_name, space_guid, org_name, org_guid)
      File "c:\myinstalls\python\lib\site-packages\chaoscf\api.py", line 103, in _get_filter_query
        org = get_org_by_name(org_name, configuration, secrets)
      File "c:\myinstalls\python\lib\site-packages\chaoscf\api.py", line 63, in get_org_by_name
        "q": "name:{o}".format(o=org_name)}).json()
      File "c:\myinstalls\python\lib\site-packages\chaoscf\api.py", line 25, in call_api
        tokens = auth(configuration, secrets)
      File "c:\myinstalls\python\lib\site-packages\chaoscf\__init__.py", line 57, in auth
        verify_ssl)
      File "c:\myinstalls\python\lib\site-packages\chaoscf\__init__.py", line 67, in get_tokens
        r = requests.get(info_url, verify=verify_ssl)
      File "c:\myinstalls\python\lib\site-packages\requests\api.py", line 75, in get
        return request('get', url, params=params, **kwargs)
      File "c:\myinstalls\python\lib\site-packages\requests\api.py", line 60, in request
        return session.request(method=method, url=url, **kwargs)
      File "c:\myinstalls\python\lib\site-packages\requests\sessions.py", line 519, in request
        prep = self.prepare_request(req)
      File "c:\myinstalls\python\lib\site-packages\requests\sessions.py", line 462, in prepare_request
        hooks=merge_hooks(request.hooks, self.hooks),
      File "c:\myinstalls\python\lib\site-packages\requests\models.py", line 313, in prepare
        self.prepare_url(url, params)
      File "c:\myinstalls\python\lib\site-packages\requests\models.py", line 387, in prepare_url
        raise MissingSchema(error)
    requests.exceptions.MissingSchema: Invalid URL 'None/v2/info': No schema supplied. Perhaps you meant http://None/v2/info?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.