-
Notifications
You must be signed in to change notification settings - Fork 64
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
Re-fetch the VM secret userdata if it was changed #211
Conversation
Welcome @rgolangh! |
b6bbc43
to
505c8ee
Compare
505c8ee
to
af05efe
Compare
/ok-to-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.
i'm so glad to see this being addressed. thanks for the PR. I left some comments in line.
ctx.BootstrapDataSecret = bootstrapDataSecret | ||
return nil | ||
} | ||
infraClusterClient.Get(ctx, bootstrapDataSecretKey, bootstrapDataSecret) |
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 need error checking here for this client command.
if bootstrapDataSecret != nil && bytes.Compare(bootstrapDataSecret.Data["value"], value) == 0 { | ||
ctx.BootstrapDataSecret = bootstrapDataSecret | ||
return nil | ||
} |
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.
isn't this similar to what the CreateOrUpdate
function is supposed to be doing?
af05efe
to
9b2a399
Compare
err := infraClusterClient.Get( | ||
ctx, | ||
client.ObjectKey{Namespace: vmNamespace, Name: *ctx.Machine.Spec.Bootstrap.DataSecretName + "-userdata"}, | ||
bootstrapDataSecret) | ||
if err != nil && !apierrors.IsNotFound(err) { | ||
// not found means not created yet, that's ok. Other errors are something we can't handle. | ||
return err |
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.
Is this code really needed now?
There is no other usage for the "bootstrapDataSecret", and anyway the "CreateOrUpdate" func is going to be called
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.
good catch. Now that we are always updating the secret, I don't think we need this early exit check if the secret already exists.
9b2a399
to
780fec0
Compare
@@ -1063,6 +1063,36 @@ var _ = Describe("reconcile a kubevirt machine", func() { | |||
Expect(err).ToNot(HaveOccurred()) | |||
Expect(out).To(Equal(ctrl.Result{RequeueAfter: 20 * time.Second})) | |||
}) | |||
|
|||
FIt("should fetch the latest bootstrap secret and update the machine context if changed", 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.
Please change to It
780fec0
to
33c4c33
Compare
33c4c33
to
da896fd
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nunnatsa, rgolangh 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 |
da896fd
to
ae4e3dd
Compare
/lgtm |
/retest |
After 24 hours the userdata secret for a VM contains an outdated value. We must refetch and update the cloud init secret with the latest data, otherwise a node will fail the ignition stage. Signed-off-by: Roy Golan <rgolan@redhat.com>
ae4e3dd
to
73b73d1
Compare
/lgtm |
What this PR does / why we need it:
After 24 hours the userdata secret for a VM contains an outdated value.
In order not to return a stale copy of a VM secret refetch it and store.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Fixes: #169
Release notes: