feat: Export Connection CR#3999
Conversation
Signed-off-by: Noah Reisch <noahreisch4@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3999 +/- ##
===========================================
- Coverage 54.49% 38.91% -15.59%
===========================================
Files 134 243 +109
Lines 12329 20382 +8053
===========================================
+ Hits 6719 7931 +1212
- Misses 5116 11862 +6746
- Partials 494 589 +95
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Noah Reisch <noahreisch4@gmail.com>
JaydipGabani
left a comment
There was a problem hiding this comment.
Thanks for working on this PR @nreisch. Still reviewing PR but posting partial review.
| version: v1alpha1 | ||
| - group: status | ||
| kind: ConnectionPodStatus | ||
| version: v1beta1 |
There was a problem hiding this comment.
Should this be alpha as this is net new status type?
There was a problem hiding this comment.
In the following comment, #2598 (comment) it was suggested to go to beta directly, since the pod status resource isn't interfaced with directly by user facing clients, and instead it's only operated on internally, although it still requires backward compatibility with the status.
However, I do think it make sense to start with alpha to be safe and align with the Connection version, changed to alpha.
|
|
||
| err = c.Watch( | ||
| source.Kind( | ||
| mgr.GetCache(), &statusv1beta1.ConnectionPodStatus{}, |
There was a problem hiding this comment.
Do we need to watch for connectionPodStatus here? We don't have any operational steps to be reconciled on pod status for connection unless I am missing something.
There was a problem hiding this comment.
There's a comment here by @maxsmythe describing the value of having the primary controller watching the pod status #3544 (comment).
Snippet from that comment:
primary controllers want to watch podStatus for the corresponding pod -- if someone deletes a podStatus resource the main object should be re-reconciled to avoid missing state.
I'm also not clear if the primary controller watching the pod status is required. My understanding is that even without the primary controller watching the pod status, if there's a delete or modification to the pod status, the status controller should pick that up, write the new/empty status to the primary resource, and as a result the primary resource should get reconciled by the primary controller.
Maybe Max can chime in on the above
Signed-off-by: Noah Reisch <noahreisch4@gmail.com>
e4108be to
cc976b9
Compare
Signed-off-by: Noah Reisch <noahreisch4@gmail.com>
Signed-off-by: Noah Reisch <noahreisch4@gmail.com>
JaydipGabani
left a comment
There was a problem hiding this comment.
Nothing major, just few nits and questions. Otherwise lgtm.
| version: v1alpha1 | ||
| - group: status | ||
| kind: ConnectionPodStatus | ||
| version: v1beta1 |
| err = r.system.UpsertConnection(ctx, connObj.Spec.Config.Value, request.Name, connObj.Spec.Driver) | ||
| if err != nil { | ||
| // Reset the active connection status to false if UpsertConnection fails | ||
| activeConnection := false |
There was a problem hiding this comment.
is there a need to change active here? this will be overwritten regardless from audit if publish fails for all messages. Thinking out loud.
There was a problem hiding this comment.
I think this decision to set to false here is about having stronger consistency guarantees. The observedGeneration of the status should reflect the latest state of the updated connection spec, so if Reconcile gets called for an updated connection with active currently set to true, and Upsert fails we should set active to false, instead of - maintaining the existing true value if it was previously successful as the status gets updated with the new observedGeneration, and waiting some delay for it to get accurately reflected when the current or next Audit finishes. There's potentially another way of viewing this active property that it should only be managed by Audit when publishing but then we get the delays reconciling the property.
| // Reset the active connection state when there are updates to the Connection object to ensure the active state is only true when the Publish succeeds for the current Connection | ||
| resetActiveConnection := false | ||
| activeConnection = &resetActiveConnection | ||
| } else if activeConnection == nil { |
There was a problem hiding this comment.
when will activeConnection == nil be true? Just curious.
In the code activeConnection is true if published messages are > 0 which is always either result in true or false, right?
There was a problem hiding this comment.
At the end of the Audit when we update the connection status, if active gets set to true, this Reconcile will get triggered and an Upsert will occur on the connection, in that case, the connection spec hasn't changed so we don't want to reset active to false, instead just use the existing active value otherwise if we did reset it would cause thrashing. In other words - anytime there's a successful Upsert we don't know if active can be true only from Upsert perspective can we set active to false if there was a failure, so we pass nil on successful Upsert and then it will fall into the if and else if above to determine if it should maintain the existing or reset based on the observedGeneration.
Signed-off-by: Noah Reisch <noahreisch4@gmail.com>
Signed-off-by: Noah Reisch <noahreisch4@gmail.com>
7f357a8 to
7e50f5a
Compare
sozercan
left a comment
There was a problem hiding this comment.
minor comments, otherwise LGTM. Thank you!
Signed-off-by: Noah Reisch <noahreisch4@gmail.com>
Signed-off-by: Noah Reisch <noahreisch4@gmail.com>
5b72d9c to
de195a3
Compare
What this PR does / why we need it:
Details: https://docs.google.com/document/d/12P3LCaOAQO9Uts4cVljHXkRgukEyWqyLketDP0rFq8A/edit?tab=t.0
Which issue(s) this PR fixes (optional, using
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when the PR gets merged):Fixes #2802
Special notes for your reviewer: