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

add call to return if machine exists and consider requeue-after error… #546

Merged
merged 2 commits into from
Oct 19, 2018

Conversation

enxebre
Copy link
Member

@enxebre enxebre commented Oct 16, 2018

… on create

What this PR does / why we need it:

  • Call return after an update is triggered for the machine controller
  • Includes requeue-after error on a create event for the machine controller

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #547

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

Call `return` after an update is triggered for the machine controller
Includes requeue-after error on a create event for the machine controller

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 16, 2018
@enxebre
Copy link
Member Author

enxebre commented Oct 16, 2018

cc @roberthbailey @pwittrock

@roberthbailey
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 17, 2018
@randomvariable
Copy link
Member

/lgtm

}
return reconcile.Result{}, nil
return reconcile.Result{}, err

Choose a reason for hiding this comment

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

why return err here? can this ever not-be nil? seems like we return on line 158 if err != nil, and the other assignments shadow this.

Copy link
Member Author

@enxebre enxebre Oct 18, 2018

Choose a reason for hiding this comment

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

It can be not nil:
if line 175 returns error and is not a requeueErr error then line 182 must return the error (or nil)

Choose a reason for hiding this comment

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

Correct me if I am wrong - but doesn't line 175 shadow the err value, so you will never get that assignment:

if err := r.create(m)

Copy link
Member Author

Choose a reason for hiding this comment

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

oh yeh, I think you are right! thanks! I'll change it

@pwittrock
Copy link

lgtm

for reference - make it look more like this again

@@ -168,14 +168,18 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul
return reconcile.Result{Requeue: true, RequeueAfter: requeueErr.RequeueAfter}, nil
}
}
return reconcile.Result{}, err
}
// Machine resource created. Machine does not yet exist.
glog.Infof("Reconciling machine object %v triggers idempotent create.", m.ObjectMeta.Name)
if err := r.create(m); err != nil {

Choose a reason for hiding this comment

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

if we want to return this, we should not shadow it

if err = r.create(m)

Choose a reason for hiding this comment

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

fwiw, we may not want to shadow the update either

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 18, 2018
@pwittrock
Copy link

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 18, 2018
@roberthbailey
Copy link
Contributor

/test pull-cluster-api-test

@roberthbailey
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enxebre, roberthbailey

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 19, 2018
@k8s-ci-robot k8s-ci-robot merged commit 2d88aef into kubernetes-sigs:master Oct 19, 2018
jayunit100 pushed a commit to jayunit100/cluster-api that referenced this pull request Jan 31, 2020
…-uri

Update generation script w correct CABPK image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

create always gets call after triggering an update con machine controller
5 participants