-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat: toSelectorMatchFields #376
feat: toSelectorMatchFields #376
Conversation
2fc50f2
to
d713cf1
Compare
I think the linter will be OK now :-) |
go.mod
Outdated
@@ -18,6 +18,8 @@ require ( | |||
sigs.k8s.io/controller-tools v0.11.3 | |||
) | |||
|
|||
require github.com/tidwall/gjson v1.14.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this got moved outside the main require block, but if it's not too much trouble we should move it back in. I suspect it's an IDE thing. We can also sort this out post-merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was the go
cli, when I move the require to the upper block in vscodium and save it, all spaces are rewrited but if it's not a problem I can try to push that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted, this lead to many git conflict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any particular reason for not using k8s.io/client-go/util/jsonpath
instead of this library?
Also I would really like for us to have all the requires in the same grouping.
pkg/sharing/secret_exports.go
Outdated
Name: nsName, | ||
} | ||
namespace := corev1.Namespace{} | ||
err := matcher.SecretImportReconciler.client.Get(matcher.Ctx, query, &namespace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to see a client specifically for getting this namespace (which can be expanded in the future for other usecases) rather than re-using the import reconciler's client. Definitely feels like a borrowing of something we don't really need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to add more network connections (and I didn't knew the exact behavior of this, like persistent connection or something)
Have you a suggestion to the good way to create a new client ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does feel like an overreach inside the SecretImportReconciler to get a private attribute.
I think this struct should have an Interface that knows how to execute a Get, so something like:
type K8sReader interface {
Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, fixed
91d57a7
to
ee2c04a
Compare
f8e40df
to
64fc04d
Compare
Hi, is there anything we can do to make this happen ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good feature that is useful for a tool like Secretgen, but there is the cost associated with it of allowing people to copy secrets to places they should not be in. So let's make some changes to the naming of it to signal to the users that want to use it to be sure about it.
Also added some other comments about other parts of the code.
go.mod
Outdated
@@ -18,6 +18,8 @@ require ( | |||
sigs.k8s.io/controller-tools v0.11.3 | |||
) | |||
|
|||
require github.com/tidwall/gjson v1.14.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any particular reason for not using k8s.io/client-go/util/jsonpath
instead of this library?
Also I would really like for us to have all the requires in the same grouping.
pkg/sharing/secret_exports.go
Outdated
Name: nsName, | ||
} | ||
namespace := corev1.Namespace{} | ||
err := matcher.SecretImportReconciler.client.Get(matcher.Ctx, query, &namespace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does feel like an overreach inside the SecretImportReconciler to get a private attribute.
I think this struct should have an Interface that knows how to execute a Get, so something like:
type K8sReader interface {
Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
}
e849c32
to
1e07fca
Compare
All should be good now, according to your feedbacks :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey
Thanks for all the changes. It is looking much better now 😄
I have some questions/nitpicks that I would love for you to look into.
Also, adding some tests to ensure that we cover all the Operators we have created would be great. Do we have any tests to ensure that if you provide multiple selectors, the namespace matches all of them?
29fb29b
to
76a2a55
Compare
Thanks for your time and for the feedback :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I think we are almost there just have two asks:
- I just reread the documentation and have some nitpicks there
- Can you please squash your commits
After this, I think we are good to get this PR merged.
0381d30
to
ac8c190
Compare
Thanks for the fixs on documentation, your corrections has been commited I'm very glad to hear that, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Can you please check the linting issue? |
ac8c190
to
a379ddd
Compare
fixed |
I didn't see this message on first lint run, I check that now |
Signed-off-by: devthejo <[email protected]>
a379ddd
to
c7b0284
Compare
I fixed the last error message, but couldn't reproduce locally:
so I hope all will be good on next lint running on ci, but couldn't guarantee |
looks like that was a winner 😄 |
Yeah !!! |
Hello @joaopapereira, any idea when this could be released ? thanks ! |
@revolunet Hey we should be able to release it in the next couple of weeks, we are trying to get #446 delivered before we do that. Is that ok or are you in a rush? |
Thats very fine, thanks @joaopapereira May the force be with you for #446 |
fix #348