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

Implement feature management policy and reference #21

Merged

Conversation

morningspace
Copy link
Collaborator

@morningspace morningspace commented Jan 4, 2022

Signed-off-by: Ying Mo morningspace@yahoo.com

Description of your changes

Fixes #13 to implement the proposed features that are documented in this design doc.

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

All newly-added methods have been tested by adding new test cases in object_test.go. Just follow the same pattern that is used on object_test.go to define sample data, add new cases with expected results, and iterate over the cases to trigger Observe/Create/Update/Delete, also AddFinalizer/RemoveFinalizer. The code coverage has also been increased.

Signed-off-by: Ying Mo <morningspace@yahoo.com>
@morningspace morningspace changed the title init commit for feature mgmt policy and reference Implement feature management policy and reference Jan 4, 2022
@morningspace
Copy link
Collaborator Author

Hi @turkenh This is the initial commit for an early review. The feature has been manually tested at local and I was adding test cases to catch up the code coverage, will submit a second commit including the test cases soon.

Signed-off-by: Ying Mo <morningspace@yahoo.com>
@morningspace
Copy link
Collaborator Author

morningspace commented Jan 5, 2022

Added test cases and now the coverage has been increased to 81.17% :-) https://codecov.io/github/crossplane-contrib/provider-kubernetes/commit/d7bcc5a8e1aff6bad593147b0f2b95fd4af31405

Copy link
Collaborator

@turkenh turkenh left a comment

Choose a reason for hiding this comment

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

Thanks @morningspace, added couple of comments mostly around styling and nitpick.

I just have some questions for the client to use reference resolution and also a concern with ignoring errors.

apis/object/v1alpha1/types.go Outdated Show resolved Hide resolved
apis/object/v1alpha1/types.go Outdated Show resolved Hide resolved
apis/object/v1alpha1/types.go Outdated Show resolved Hide resolved
apis/object/v1alpha1/types.go Outdated Show resolved Hide resolved
internal/controller/object/object.go Outdated Show resolved Hide resolved
internal/controller/object/object.go Outdated Show resolved Hide resolved
internal/controller/object/object.go Outdated Show resolved Hide resolved
internal/controller/object/object.go Outdated Show resolved Hide resolved
internal/controller/object/object.go Outdated Show resolved Hide resolved
internal/controller/object/object.go Outdated Show resolved Hide resolved
Signed-off-by: Ying Mo <morningspace@yahoo.com>
Signed-off-by: Ying Mo <morningspace@yahoo.com>
Signed-off-by: Ying Mo <morningspace@yahoo.com>
@morningspace
Copy link
Collaborator Author

Code has been updated according to the review comments. Now, all newly added code has been fully covered by unit tests. :-) @turkenh

Copy link
Collaborator

@turkenh turkenh left a comment

Choose a reason for hiding this comment

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

Looking pretty good @morningspace, I think we are very close to get this merged.

I did some testing this time using the manifest I used in some of my comments and working well except minor issues I've commented.

Could you also include some examples under examples/object and fill the How has this code been tested section in PR description :)

Thanks again also for your patience during this review process!

apis/object/v1alpha1/types.go Outdated Show resolved Hide resolved
internal/controller/object/object.go Show resolved Hide resolved
apis/object/v1alpha1/types.go Outdated Show resolved Hide resolved
err = f.handleRefFinalizer(ctx, obj, func(
ctx context.Context, res *unstructured.Unstructured, finalizer string) error {
if !meta.FinalizerExists(res, finalizer) {
meta.AddFinalizer(res, finalizer)
Copy link
Collaborator

Choose a reason for hiding this comment

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

One problem with adding finalizers to referred resources is how to handle changes there. For example, an Object depends on secret-a, but then changed to secret-b with a kubectl apply, in that case, we would need to remove finalizer from secret-a and add secret-b.
However, this could be handled with a subsequent PR, feel free to create an issue to track such a case and ignore for this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That makes sense. Issue created #28.

apis/object/v1alpha1/types.go Outdated Show resolved Hide resolved
apis/object/v1alpha1/types.go Outdated Show resolved Hide resolved
apis/object/v1alpha1/types.go Outdated Show resolved Hide resolved
@haarchri
Copy link
Member

@morningspace can you check latest comments ? We really want to use this feature ;)

@morningspace
Copy link
Collaborator Author

Hey @haarchri, also @turkenh, sorry for my slowness! Just want to let you know that I was stuck into some project work last week, and just resume this work yesterday. I plan to finish the code change this week that will address the last couple of review comments made by @turkenh.

Signed-off-by: Ying Mo <morningspace@yahoo.com>
Signed-off-by: Ying Mo <morningspace@yahoo.com>
Signed-off-by: Ying Mo <morningspace@yahoo.com>
Signed-off-by: Ying Mo <morningspace@yahoo.com>
Signed-off-by: Ying Mo <morningspace@yahoo.com>
@morningspace
Copy link
Collaborator Author

Alright, I think ultimately I've made all changes needed per latest comments. @turkenh Could you please take another round of review, and see if anything missed :-)

Copy link
Collaborator

@turkenh turkenh left a comment

Choose a reason for hiding this comment

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

Looking great, thanks for incorporating all the feedback @morningspace 👍

My only suggestion would be to consider some sort of documentation, especially how to configure RBAC if other resources need to be referenced. Your design doc is already great for anyone that wants to understand how things are working (which also needs some updates due to naming changes during implementation), but a simpler document or maybe a small section in Readme could be helpful. But this is definitely not blocking, please let me know if you want to handle this separately so that we can merge this!

@morningspace
Copy link
Collaborator Author

@turkenh wow, it's great to see the PR gets approved ultimately!

Re: docs updates, sure, how about having a separate PR to address it since this PR has been full of so many comments and makes it hard to follow. I will start another PR to cover all docs related work.

@turkenh turkenh merged commit 9bfb526 into crossplane-contrib:main Feb 18, 2022
@cdenneen
Copy link

Instead of the patchesFrom being another object could it be from a patchSet? I’m trying to patch aws-auth which mapRoles is a Literal Scalar Block

@morningspace
Copy link
Collaborator Author

@cdenneen IIUC, you are referring to the patchSet in Composition right? So, we are kind of copying stuff from Composition to provider level. I'd defer it till we see there's no other better option. Can you open a separate issue on this and share a concrete example w/ us? I'd like to better understand the problem and see if there's better option. Thanks.

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.

Design proposal to enhance provider kubernetes with new features
4 participants