chaostoolkit-kubernetes icon indicating copy to clipboard operation
chaostoolkit-kubernetes copied to clipboard

Cleaning and rework

Open Devatoria opened this issue 5 years ago • 2 comments

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.

Devatoria avatar Apr 18 '19 15:04 Devatoria

Breaking this into separate PRs

dustinfarris avatar Nov 09 '16 22:11 dustinfarris

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?

Lawouach avatar Apr 19 '19 15:04 Lawouach

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.

Devatoria avatar Jun 06 '19 08:06 Devatoria