Skip to content
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

Generates VolRepClasses based on the RamenDR replication schedule resource #177

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raaizik
Copy link
Contributor

@raaizik raaizik commented Jul 2, 2024

Changess

  • Creates VolumeReplicationClass in response to changes made to DRClusterConfig -- the RamenDR replication schedule CR. VRCs are generated per each sched interval detailed in DRClusterConfig, for both flatten and non-flatten mode VRC types.
  • Handles VRCs deletion in case of removed replication scheduling intervals
  • kubernetes-csi-addons version bump

RHSTOR-5753

Copy link

openshift-ci bot commented Jul 2, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: raaizik
Once this PR has been reviewed and has the lgtm label, please assign nb-ohad for approval. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@raaizik raaizik changed the title Generates VRCs based upon the RamenDR replication schedule resource Generates VRCs based on the RamenDR replication schedule resource Jul 2, 2024
@raaizik raaizik force-pushed the RHSTOR-5753 branch 2 times, most recently from 597255c to 7a6fc7b Compare July 21, 2024 11:36
@raaizik raaizik force-pushed the RHSTOR-5753 branch 2 times, most recently from 626d539 to f0ceee7 Compare July 28, 2024 10:01
@raaizik raaizik force-pushed the RHSTOR-5753 branch 3 times, most recently from 08910fd to 8ee12ce Compare October 28, 2024 15:10
@raaizik raaizik changed the title Generates VRCs based on the RamenDR replication schedule resource Generates VolRepClass based on the RamenDR replication schedule resource Nov 5, 2024
@raaizik raaizik force-pushed the RHSTOR-5753 branch 3 times, most recently from 66dca4f to 27ee9da Compare November 5, 2024 15:05
@raaizik raaizik changed the title Generates VolRepClass based on the RamenDR replication schedule resource Generates VolRepClasses based on the RamenDR replication schedule resource Nov 5, 2024
@raaizik
Copy link
Contributor Author

raaizik commented Nov 5, 2024

Depends on #2727

}
// check if DRClusterConfig has been removed
if len(drclusterconfigs.Items) == 0 {
vrcs := &replicationv1alpha1.VolumeReplicationClassList{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just set the owneRef of VolumeReplicationClass as the drclusterconfig as both are clusterscoped resouces?

}
}
drclusterconfig := &drclusterconfigs.Items[0]
for interval := range drclusterconfig.Spec.ReplicationSchedules {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will happen when specific ReplicationSchedules are deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that, added ✔️

if err != nil {
return reconcile.Result{}, fmt.Errorf("failed to get VolumeReplicationClassList: %v", err)
}
drclusterconfig := &drclusterconfigs.Items[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail if the len(drclusterconfigs.Items) is zero

@@ -141,8 +192,9 @@ func (r *StorageClaimReconciler) SetupWithManager(mgr ctrl.Manager) error {
//+kubebuilder:rbac:groups=snapshot.storage.k8s.io,resources=volumesnapshotclasses,verbs=get;list;watch;create;delete
//+kubebuilder:rbac:groups=core,resources=persistentvolumes,verbs=get;list;watch
//+kubebuilder:rbac:groups=snapshot.storage.k8s.io,resources=volumesnapshotcontents,verbs=get;list;watch
//+kubebuilder:rbac:groups=ramendr.openshift.io,resources=drclusterconfigs,verbs=get;list;watch
//+kubebuilder:rbac:groups=replication.storage.openshift.io,resources=volumereplicationclass,verbs=get;list;watch;create;delete
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you run make bundle after updating the rbac?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Comment on lines 497 to 501
if len(drclusterconfigs.Items) == 0 {
return reconcile.Result{}, fmt.Errorf("no DRClusterConfig found")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not an error, it means that we don't need to create VRC.

go.mod Outdated Show resolved Hide resolved
internal/controller/storageclaim_controller.go Outdated Show resolved Hide resolved
internal/controller/storageclaim_controller.go Outdated Show resolved Hide resolved
internal/controller/storageclaim_controller.go Outdated Show resolved Hide resolved
internal/controller/storageclaim_controller.go Outdated Show resolved Hide resolved
internal/controller/storageclaim_controller.go Outdated Show resolved Hide resolved
internal/controller/storageclaim_controller.go Outdated Show resolved Hide resolved
internal/controller/storageclaim_controller.go Outdated Show resolved Hide resolved
internal/controller/storageclaim_controller.go Outdated Show resolved Hide resolved
internal/controller/storageclaim_controller.go Outdated Show resolved Hide resolved
- Creates VolRepClass in response to changes made to DRClusterConfig
- k8s csi addons bump

Signed-off-by: raaizik <[email protected]>
@openshift-merge-robot
Copy link

PR needs rebase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants