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
Ensure that Node lease has OwnerReference set #84998
Conversation
8d5e0fb
to
c85407b
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wojtek-t 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 |
@@ -84,6 +84,30 @@ var _ = framework.KubeDescribe("NodeLease", func() { | |||
time.Duration(*lease.Spec.LeaseDurationSeconds/4)*time.Second) | |||
}) | |||
|
|||
ginkgo.It("should have OwnerReferences set", func() { |
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.
Should this be a conformance test?
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 don't create conformance test from scratch.
At some point it probably should be, but we need to create it as is and after proving its stability promote it to conformance.
c85407b
to
07200a0
Compare
Added unit tests - this is now ready for review |
// lease does not exist, create it. | ||
leaseToCreate := c.newLease(nil) | ||
if len(leaseToCreate.OwnerReferences) == 0 { | ||
// We want to ensure that a lease will always have OwnerReferences set. |
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.
If we want to ensure a new lease always have OwnerReferences, should we do it in newLease() and return "missing owner ref" error in such case?
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 was thinking about that, but that would be much more invasive change (despite the first glance, the flow is non-trivial). I wanted to avoid making significant rewrite on the last moment before code-freeze.
Also note that if we create the Lease correctly, we will be fine (assuming noone will remove it, but that could cause issues anyway, because the node may be deleted in the meantime, so protecting against it is not the goal).
So I actually think the current approach is the best tradeoff between simplicity of code-changes and the goal to 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.
ACK
/lgtm |
Ref #84981