-
Notifications
You must be signed in to change notification settings - Fork 185
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 rpc call for PeerBlockPool #2457
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rewantsoni 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 |
a73e09d
to
f721b9b
Compare
6cb2451
to
201eadd
Compare
c9c775f
to
a6c7525
Compare
a6c7525
to
605e15e
Compare
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.
The rpc call is initiated from the primary cluster which wants to mirror the pool, the server receives the request and does the following
- a bit incomplete (at-least for me), by above do you mean the server is running in "another" cluster (maybe
secondary
?) and primary cluster wants to send over the info to secondary cluster? - through out app lifecycle, does
primary
andsecondary
change identities and become the opposite? if yes, should we only useserver
andclient
terminology for all operations?
Let me know if you don't want review on draft PRs, I need to review this PR again as I'm not totally upto speed w/ RDR.
}, nil | ||
} | ||
|
||
func (c *cephRBDMirrorManager) Create(ctx context.Context) 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.
any reason in not using creatorupdate from controller util?
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 the case when we run MaintenanceMode (this requires the RBD mirror to be scaled down). If a new PeerBlockPool call is received while MaintenacneMode is in progress it and we use CreateOrUpdate, it will interfere with it.
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.
fair enough, does the owner scale up after the maintenance mode?
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.
Yes, that would be the responsibility of the controller executing the maintenance mode
@@ -690,3 +705,34 @@ func (s *OCSProviderServer) ReportStatus(ctx context.Context, req *pb.ReportStat | |||
|
|||
return &pb.ReportStatusResponse{}, nil | |||
} | |||
|
|||
// PeerBlockPool RPC call to send the bootstrap secret for the pool | |||
func (s *OCSProviderServer) PeerBlockPool(ctx context.Context, req *pb.PeerBlockPoolRequest) (*pb.PeerBlockPoolResponse, 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.
either make this RPC idempotent or ensure different failure for resource already exists requests.
services/provider/server/server.go
Outdated
// enable mirroring on blockPool in the req | ||
if err := s.cephBlockPoolManager.EnableBlockPoolMirroring(ctx, req.BlockPoolName); err != nil { | ||
if kerrors.IsNotFound(err) { | ||
return nil, status.Errorf(codes.NotFound, "Failed to find CephBlockPool resource %s: %v", req.BlockPoolName, 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.
I believe the errors are a bit misleading (same for remaining), basically the function asks for enabling mirroring and if you didn't find the source why are we at this line 🤔?
by source I mean, block pool, at the start why can't we return if we didn't find the blockpool? basically we are checking blockpool existence indirectly three times throughtout this function.
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.
updated to return at the beginning of the function if the blockpool doesn't exist
Yes right, we will have two clusters, one running the server(secondary) and other cluster as a client who sends the request (StorageClusterPeer; primary). The primary cluster sends over the contents of the bootstrap secret (that is pool and token fields) along with the blockPool Name it wants to mirror.
We are implementing peering in one-way replication, for RDR both primary and secondary clusters will act as both a server and a client, to be more specific,
Yes, I would like reviews on the draft PRs I have tested the PR. I need to complete unit tests and uninstall flow (probably as a part of a different PR). |
605e15e
to
42c6b87
Compare
5b03275
to
dd90597
Compare
d861d4a
to
08ac1ed
Compare
08ac1ed
to
48323a3
Compare
48323a3
to
675c086
Compare
@rewantsoni this PR was marked as a dependent on which a comment was made until which invalidates the changes in this PR, let me know if this still need a review, thanks. |
675c086
to
d06eb77
Compare
if kerrors.IsNotFound(err) { | ||
return nil, fmt.Errorf("CephBlockPool resource %q not found: %v", blockPoolName, err) | ||
} | ||
return nil, fmt.Errorf("failed to get CephBlockPool resource with name %q: %v", blockPoolName, 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.
I don't see the result is different if the resource is not found here, as such don't make any differentiation as the returned error already contains the reason.
cephRBDMirror := &rookCephv1.CephRBDMirror{} | ||
cephRBDMirror.Name = rBDMirrorName | ||
cephRBDMirror.Namespace = c.namespace | ||
err := c.client.Get(ctx, client.ObjectKeyFromObject(cephRBDMirror), cephRBDMirror) |
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.
any reason in making two calls rather than a single create?
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 one rbdMirror for the cluster, hence I am checking if it already exists, and create it only if it doesn't
services/provider/server/server.go
Outdated
// enable mirroring on blockPool in the req | ||
if err := s.cephBlockPoolManager.EnableBlockPoolMirroring(ctx, cephBlockPool); err != nil { | ||
return nil, status.Errorf(codes.Internal, "Failed to enable mirroring for CephBlockPool resource %s: %v", req.Pool, err) | ||
} | ||
|
||
// create and set secret ref on the blockPool | ||
if err := s.cephBlockPoolManager.SetBootstrapSecretRef( |
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.
It's guaranteed that the call to SetBootstrap will fail first time since the resource version changes due to update in EnableBlock func. I believe we need to get fresh copy every time we want to update I guess.
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 will check it again
Signed-off-by: Rewant Soni <[email protected]>
Signed-off-by: Rewant Soni <[email protected]>
d06eb77
to
c681a2b
Compare
/retest-required |
Signed-off-by: Rewant Soni <[email protected]>
Signed-off-by: Rewant Soni <[email protected]>
@rewantsoni: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Closing this in favour of #2671 |
Add a new RPC call PeerBlockPool to enable one-way mirroring between the block pools.
The rpc call is initiated from the primary cluster which wants to mirror the pool, the server receives the request and does the following:
Depends on: