AmitKumarDas / metac

It is metacontroller and more
Apache License 2.0
57 stars 16 forks source link

feat(gctl): add explicit update & delete logic to generic controller #141

Closed AmitKumarDas closed 4 years ago

AmitKumarDas commented 4 years ago

This commit adds logic to update or delete attachments that were not created by the generic controller. In other words, a controller developer can update or delete any attachment via a generic controller even if this attachment was not created by this controller.

This feature was already available in GenericController via UpdateAny and DeleteAny flags. However, these flags were too generic and enabled update or delete of any kind of attachment. With this new change a developer can selectively update or delete specific attachment instances.

This commit also removes the old way to implement an integration test. This introduces a new approach to test any feature that is more readable and concentrates on the logic at hand instead of dealing with k8s based CRUD operations. Any integration test can be implemented as a series of steps. Each of this step can be specified either as a create or update or delete or assert of any kubernetes resource.

In addition generic, composite as well as decorator tests are clubbed into a single package. Integration tests are still divided into two categories (i.e. crd or config mode) based on the way metac binary can be started.

There will be more enhancements to integration tests going forward which in turn will align metac to be production grade all the times in-spite of new features or changes to existing ones.

Note to Reviewer

PR is divided into 4 commits:

Signed-off-by: AmitKumarDas amit.das@mayadata.io

grzesuav commented 4 years ago

Hi @AmitKumarDas , still unfortunately my go skill are on very basic level, therefore I cannot do proper code review. However still I am able to ask some questions ;)

So, if attachment is managed by other controller, and by metac, could it cause some infinite update loop ? Maybe this is something which should be put to documentation ?

AmitKumarDas commented 4 years ago

thanks @grzesuav I will add doc about GenericController in this PR.

Infinite update loop can happen if multiple controllers try to update same field(s) with different values. As per best practices a custom resource can be updated by more than one controllers if these controllers don't interfere updating same fields.

AmitKumarDas commented 4 years ago

@grzesuav While looking more at documentation aspects. I felt it will be best to have them in a separate PR. I will send a new PR with just the doc updates.

AmitKumarDas commented 4 years ago

:tada: This PR is included in version 0.3.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: