-
Notifications
You must be signed in to change notification settings - Fork 21
Upgrade to controller-runtime 0.8.3 #9
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
Conversation
Signed-off-by: Richard Wall <[email protected]>
Signed-off-by: Richard Wall <[email protected]>
c9ac06a to
15ff4c1
Compare
Signed-off-by: Richard Wall <[email protected]>
Signed-off-by: Richard Wall <[email protected]>
ebbe964 to
a3b2d62
Compare
wallrj
left a comment
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.
Some explanatory comments.
| return ctrl.Result{}, nil | ||
| } | ||
|
|
||
| issuer := issuerRO.(client.Object) |
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.
Case a runtime.Object to client.Object.
This should always work for issuer types because they will always also satisfy the metav1.Object interface.
See https://github.com/kubernetes-sigs/controller-runtime/blob/fa42462a01b0f33cfb42dd7396d198435a013122/pkg/client/object.go#L24-L48
| - create | ||
| - get | ||
| - list | ||
| - update |
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.
|
|
||
| func (r *CertificateRequestReconciler) Reconcile(req ctrl.Request) (result ctrl.Result, err error) { | ||
| ctx := context.Background() | ||
| func (r *CertificateRequestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err 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.
| fakeClient := fake.NewClientBuilder(). | ||
| WithScheme(scheme). | ||
| WithObjects(tc.objects...). | ||
| Build() |
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.
Signed-off-by: Richard Wall <[email protected]>
f2e0514 to
5260912
Compare
| // CertificateRequestReconciler reconciles a CertificateRequest object | ||
| type CertificateRequestReconciler struct { | ||
| client.Client | ||
| Log logr.Logger |
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.
controller-runtime now sets up a logger for each controller and gives it a name based on the Kind of resource that it being reconciled. See kubernetes-sigs/controller-runtime#1203
| ctx := context.Background() | ||
| log := r.Log.WithValues("certificaterequest", req.NamespacedName) | ||
| func (r *CertificateRequestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) { | ||
| log := ctrl.LoggerFrom(ctx) |
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.
controller-runtime now sets up a logger for each controller and gives it a name based on the Kind of resource that it being reconciled. See kubernetes-sigs/controller-runtime#1203
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: JoshVanL, wallrj 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 |
client.Objectinterface which is a superset ofruntime.Object. Use that where appropriate.Reconcileinterface to include acontext.Contextcoordination.k8s.ioAPI in KubernetesFixes #7