-
Notifications
You must be signed in to change notification settings - Fork 158
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
refactor: secret generator #1262
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
- split logic to deletion and creation - final return nil in the end Signed-off-by: Wen Zhou <wenzhou@redhat.com>
a87edad
to
4ac8cbc
Compare
return ctrl.Result{}, err | ||
} | ||
|
||
r.Log.Info("Reconciling Secret on creation.", "Request.Name", request.Name) |
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.
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.
thanks , updated
generatedSecretKey := types.NamespacedName{ | ||
Name: generatedSecret.Name, Namespace: generatedSecret.Namespace, | ||
} | ||
err = r.Client.Get(ctx, generatedSecretKey, generatedSecret) | ||
err = r.Client.Get(ctx, client.ObjectKey{Name: generatedSecret.Name, Namespace: generatedSecret.Namespace}, generatedSecret) |
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.
What does the types.NamespacedName
change to client.ObjectKey
achieve?
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.
no real difference.
both generatedSecretKey
and client.ObjectKey{}
return types.NamespacedName
type,
i went for the later one only because of inline style than introducing a one time variable
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.
FWIW, there is also a function helper https://github.com/kubernetes-sigs/controller-runtime/blob/b901db121e1f53c47ec9f9683fad90a546688c3e/pkg/client/interfaces.go#L35
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.
nice, then it can be simplified to err = r.Client.Get(ctx, client.ObjectKeyFromObject(generatedSecret), generatedSecret)
Signed-off-by: Wen Zhou <wenzhou@redhat.com>
PR needs rebase. 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-sigs/prow repository. |
@zdtsw: The following tests failed, say
Full PR test history. Your PR dashboard. 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-sigs/prow repository. I understand the commands that are listed here. |
close in favor of #1311 |
…flux/component-updates/odh-notebook-controller-v2-17 chore(deps): update odh-notebook-controller-v2-17 to e38a228
Description
How Has This Been Tested?
local build: quay.io/wenzhou/opendatahub-operator:2.18.925-0
Screenshot or short clip
Merge criteria