chaostoolkit-kubernetes
chaostoolkit-kubernetes copied to clipboard
Cleaning and rework
The discussion started here. This issue is here to share thoughts and plan a small rework to clean up the repository.
The plugin is actually a bit messy because of the background. The most annoying things (making it hard for a user to understand what to use and when) is that, at the beginning of the project, some actions and probes meant to be high-level. This is also why the project still contains unnamespaced actions and probes. Also, as I mentioned in the PR linked above, some functions have the same prefix but don't work with the same resources (cf. microservice_available_and_healthy
function which looks for a deployment vs. microservice_is_not_available
which looks for pods). Finally, some of them may be a bit redundant.
As you can see, the actions and probes included recently are namespaced per resource (pod
and node
actually).
Here are two things I think we should do for now:
- namespace the high-level functions to be consistent with the newly added ones
- rename the high-level functions to have a clear name of the resource they are working with (for instance, do not use
microservice_
prefix anymore since it does not relate to a Kubernetes resource) - remove/deprecate redundant functions and opt it for more flexible ones to cover more use cases and keep it clear
We should still keep backward compatibility with existing functions and mark them as deprecated to remove them in a next release.
Breaking this into separate PRs
Hi Joris,
Thanks a lot for kicking the discussion and work on cleaning this extension. As discussed in that PR's comment, indeed, this extension is our oldest and it reflects a level of uncertainty we had about the right level for probes/actions back then.
The structure that seems widespread in other extensions is to have subdirectories per resource types (for instance ec2, ecs on AWS). So we started with pod
, but we should have a service
and deployment
directory.
Then in each, have one or many probes.py
and actions.py
modules.
One thing I dislike very much also is the mistake I made for the label_selector default value in many places. We should have am ore sensible one or none.
Does this make sense?
I started to work on a draft PR. I'll split the rework in multiple commits to make it easier to review since it'll be a big change.
You can take a first look at what I've pushed.