Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPORTANT] Refactoring, Krkn Scenario Plugin API introduction #694

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

tsebastiani
Copy link
Collaborator

@tsebastiani tsebastiani commented Sep 12, 2024

main goals:

  • Introduce an API for the Krkn Scenario Plugins
  • Introduce a dynamic plugin loader for all the classes implementing the API
  • Convert all the existing scenarios in classes that implement the API
  • Define a strict naming convention for Scenario Plugins validated by the loader to give to the comunity a clear guideline on how to implement new scenarios (MVC Frameworks approach)
  • reduce the run_krkn.py line numbers and complexity
  • minimize the code changes in the run_krkn.py to introduce a new scenario (plugins are loaded dynamically)
  • Produce a clear documentation on how to develop new Krkn scenarios
  • Unit test the scenarios

main benefits:

  • speed up the on-boarding on scenario development (community and new team members)
  • create more traction around the project
  • increase the test coverage
  • streamline the codebase to increase readability

@tsebastiani tsebastiani changed the title Codebase refactoring, Krkn Scenario Plugin API introduction [IMPORTANT] Refactoring, Krkn Scenario Plugin API introduction Sep 12, 2024
@tsebastiani tsebastiani force-pushed the plugin_api branch 2 times, most recently from 14879d1 to 47edcf8 Compare September 13, 2024 08:51
@tsebastiani tsebastiani force-pushed the plugin_api branch 3 times, most recently from a8e5a87 to d04d35f Compare September 13, 2024 14:59
@tsebastiani tsebastiani marked this pull request as ready for review September 17, 2024 11:19
@tsebastiani tsebastiani force-pushed the plugin_api branch 6 times, most recently from 388197f to 9719473 Compare September 19, 2024 08:15
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

scenarios post_actions

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

fix

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Copy link
Collaborator

@chaitanyaenr chaitanyaenr left a comment

Choose a reason for hiding this comment

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

Minor nits

distribution: kubernetes # Distribution can be kubernetes or openshift
kubeconfig_path: ~/.kube/config # Path to kubeconfig
distribution: openshift # Distribution can be kubernetes or openshift
kubeconfig_path: /home/tsebasti/Scrap/ocp/auth/kubeconfig # Path to kubeconfig
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to switch it back to default location under $HOME

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
- application_outages:
- scenarios/openshift/app_outage.yaml
- container_scenarios: # List of chaos pod scenarios to load
- - scenarios/openshift/container_etcd.yml
- scenarios/openshift/container_etcd.yml
- plugin_scenarios:
Copy link
Collaborator

Choose a reason for hiding this comment

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

The suggested change is out of scope of this PR but would be good to add as part of the refactoring:

It would be easy for the users to understand if we rename plugin_scenarios to a appropriate name describing the scenario instead - pod_disruptions, hog_scenarios for instance. Also might be better to have the configs under scenarios/openshift and scenarios/kubernetes instead of scenarios/arcaflow to have everything under similar dir structure and avoid any confusion for the end users.

Thoughts?

Copy link
Collaborator

@chaitanyaenr chaitanyaenr left a comment

Choose a reason for hiding this comment

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

Nice work as always @tsebastiani! Minor nits, other than that it's good for merge!

- vmware_node_scenarios:
- scenarios/openshift/vmware_node_scenarios.yml
- ibmcloud_node_scenarios:
- scenarios/openshift/ibmcloud_node_scenarios.yml
- node_scenarios: # List of chaos node scenarios to load
- scenarios/openshift/aws_node_scenarios.yml
- plugin_scenarios:
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might want to delete this section as it's a duplicate.

distribution: kubernetes # Distribution can be kubernetes or openshift
kubeconfig_path: ~/.kube/config # Path to kubeconfig
distribution: openshift # Distribution can be kubernetes or openshift
kubeconfig_path: /home/tsebasti/.kube/config # Path to kubeconfig
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need to switch it back to ~/.kube/config

@chaitanyaenr
Copy link
Collaborator

@tsebastiani funtional tests are failing

Error: -01 16:49:36,210 [ERROR] impossible to find scenario application_outages, plugin not found. Exiting

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

test fix

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

test fix

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants