Implement the changes for ClientProfileReplication#522
Conversation
11f55b2 to
13d5e15
Compare
|
Testing: |
Madhu-1
left a comment
There was a problem hiding this comment.
Please update the documentation and helm charts for this new CR creation
| @@ -0,0 +1,108 @@ | |||
| /* | |||
| Copyright 2024. | |||
| app.kubernetes.io/managed-by: kustomize | ||
| name: clientprofilereplication-sample | ||
| spec: | ||
| # TODO(user): Add fields here |
| RBD *remoteRBDDetails `json:"rbd,omitempty"` | ||
| } | ||
|
|
||
| type remoteRBDDetails struct { |
| @@ -0,0 +1,219 @@ | |||
| /* | |||
| Copyright 2024. | |||
| // Step 3: Conflict detection - oldest CR wins | ||
| // Sort by creation timestamp (oldest first) | ||
| sort.Slice(cprList.Items, func(i, j int) bool { | ||
| return cprList.Items[i].CreationTimestamp.Before(&cprList.Items[j].CreationTimestamp) |
There was a problem hiding this comment.
creation timestamp will be in seconds? can we also consider the name of the CR as tie breaker to get the same sorted slice always
There was a problem hiding this comment.
It will be in timestamp format, so it will capture seconds as well, yes I will add the CR name as well as a tie breaker
| r.clientProfile.Status.Phase = csiv1.ClientProfilePhaseFailed | ||
| r.clientProfile.Status.Message = fmt.Sprintf("failed to remove finalizer: %v", err) | ||
| return err | ||
| } |
There was a problem hiding this comment.
dont we need return nil here to avoid status update to Ready for cleanup?
There was a problem hiding this comment.
The status will be updated irrespective what the reconcile returns
There was a problem hiding this comment.
After removing the finalizer we should not be setting the status as Ready
| } | ||
| } | ||
|
|
||
| if len(readyCRs) > 1 { |
There was a problem hiding this comment.
this need to be moved below cleanup?
| // Step 4: Update status based on whether this CR is the winner | ||
| if r.clientProfileReplication.Name == winner.Name && r.clientProfileReplication.Namespace == winner.Namespace { | ||
| r.log.Info("this CR is the winner, marking as Ready") | ||
| r.clientProfileReplication.Status.Phase = csiv1.ClientProfileReplicationPhaseReady |
There was a problem hiding this comment.
dont we need finalizers on the CR to ensure we dont leave any stale values in the configmap?
There was a problem hiding this comment.
When the clientProfileReplication is deleted, it will also trigger the clientProfile controller so it should eventually update the configmap to remove the value
There was a problem hiding this comment.
what about the controller restart, if it works between restarts we are good
There was a problem hiding this comment.
The record is constructed each time and is overwritten. So if a clientProfileReplication is deleted when controller is down, as soon as controller is brought up again it will be removed from the configmap
|
|
||
| reconcileErr := r.reconcilePhases() | ||
|
|
||
| statusErr := r.Status().Update(r.ctx, &r.clientProfile) |
There was a problem hiding this comment.
in line 196, can we add finalizer only when r.cleanup is not set
74c24dd to
a2b3e90
Compare
a2b3e90 to
0151403
Compare
this commit does the following: 1. add the api changes required for clientProfileReplication and ClientProfile 2. Scaffolding the api/controller 3. add the generated changes Signed-off-by: Rewant Soni <resoni@redhat.com>
implement the clientProfileReplication controller Signed-off-by: Rewant Soni <resoni@redhat.com>
add clientProfile controller implementation to add the replicationDestinationInfo to the ceph csi configmap Signed-off-by: Rewant Soni <resoni@redhat.com>
Signed-off-by: Rewant Soni <resoni@redhat.com>
Signed-off-by: Rewant Soni <resoni@redhat.com>
Signed-off-by: Rewant Soni <resoni@redhat.com>
0151403 to
76164fb
Compare
Describe what this PR does
Implement the changes for clientProfileReplication. The doc for the design was added in the PR #489
Is there anything that requires special attention
Is the change backward compatible?
Yes, the clientProfileMapping works along with clientProfileReplication.
Are there concerns around backward compatibility?
No.
Provide any external context for the change, if any.
Checklist: