-
Notifications
You must be signed in to change notification settings - Fork 84
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
Checks for annotation for objects in-cluster #111
Checks for annotation for objects in-cluster #111
Conversation
Hi @somtochiama. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -134,6 +136,40 @@ func (r *Reconciler) reconcileExists(ctx context.Context, name types.NamespacedN | |||
if err != nil { | |||
return reconcile.Result{}, err | |||
} | |||
|
|||
// dynamic config | |||
dynamicClientset, err := dynamic.NewForConfig(r.config) |
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.
We may want to construct this earlier and cache it in the Reconciler object; though it doesn't matter as much for the dynamic client which doesn't have as much state.
|
||
// Uses unsafe method?? Is it safe? | ||
getOptions := metav1.GetOptions{} | ||
gvk, _ := meta.UnsafeGuessKindToResource(obj.GroupVersionKind()) |
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.
Nit: rename gvk to resource
or similar
newItems := []*manifest.Object{} | ||
for _, obj := range objects.Items { | ||
|
||
// Uses unsafe method?? Is it safe? |
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 think you can use RESTMapping, like here https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/blob/master/pkg/patterns/declarative/pkg/watch/dynamic.go#L64
319fbaa
to
0105582
Compare
|
||
getOptions := metav1.GetOptions{} | ||
gvk := obj.GroupVersionKind() | ||
restMapper, err := apiutil.NewDiscoveryRESTMapper(r.config) |
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.
As with the other PR, probably caching this (like you do dynamicClient) is a win
/ok-to-test /approve One potential improvement: caching the RESTMapper, but LGTM! |
/test pull-declarative-test (The tests aren't failing for me locally, so not sure what's going on) The goimports failure does look legitimate, though |
Ah: It should be apierrors, when you rebase on latest origin/master the tests do fail. |
a66c404
to
13c533b
Compare
13c533b
to
0e3e778
Compare
Looks good - I think all your PRs are overlapping with each other, and this one is now failing on the goimports check! /approve (though you'll need to fix the test anyway) |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justinsb, SomtochiAma The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
No description provided.