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

add cg controllers for cephfs #1484

Merged
merged 9 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ ramenctl/build

# Generated disk images
*.qcow2
*.iso
*.iso
18 changes: 18 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,22 @@ resources:
kind: DRClusterConfig
path: github.com/ramendr/ramen/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: openshift.io
group: ramendr
kind: ReplicationGroupDestination
path: github.com/ramendr/ramen/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: openshift.io
group: ramendr
kind: ReplicationGroupSource
path: github.com/ramendr/ramen/api/v1alpha1
version: v1alpha1
version: "3"
6 changes: 6 additions & 0 deletions api/v1alpha1/drpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ type DRPolicySpec struct {
// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="volumeSnapshotClassSelector is immutable"
VolumeSnapshotClassSelector metav1.LabelSelector `json:"volumeSnapshotClassSelector"`

// Label selector to identify the VolumeGroupSnapshotClass resources
// that are scanned to select an appropriate VolumeGroupSnapshotClass
// for the VolumeGroupSnapshot resource when using VolSync.
//+optional
VolumeGroupSnapshotClassSelector metav1.LabelSelector `json:"volumeGroupSnapshotClassSelector,omitempty"`

// List of DRCluster resources that are governed by this policy
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="size(self) == 2", message="drClusters requires a list of 2 clusters"
Expand Down
75 changes: 75 additions & 0 deletions api/v1alpha1/replicationgroupdestination_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// SPDX-FileCopyrightText: The RamenDR authors
// SPDX-License-Identifier: Apache-2.0

package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ReplicationGroupDestinationSpec defines the desired state of ReplicationGroupDestination
type ReplicationGroupDestinationSpec struct {
// Label selector to identify the VolumeSnapshotClass resources
// that are scanned to select an appropriate VolumeSnapshotClass
// for the VolumeReplication resource when using VolSync.
//+optional
VolumeSnapshotClassSelector metav1.LabelSelector `json:"volumeSnapshotClassSelector,omitempty"`

RDSpecs []VolSyncReplicationDestinationSpec `json:"rdSpecs,omitempty"`
}

// ReplicationGroupDestinationStatus defines the observed state of ReplicationGroupDestination
type ReplicationGroupDestinationStatus struct {
// lastSyncTime is the time of the most recent successful synchronization.
//+optional
LastSyncTime *metav1.Time `json:"lastSyncTime,omitempty"`
// lastSyncStartTime is the time the most recent synchronization started.
//+optional
LastSyncStartTime *metav1.Time `json:"lastSyncStartTime,omitempty"`
// lastSyncDuration is the amount of time required to send the most recent
// update.
//+optional
LastSyncDuration *metav1.Duration `json:"lastSyncDuration,omitempty"`
// nextSyncTime is the time when the next volume synchronization is
// scheduled to start (for schedule-based synchronization).
//+optional
NextSyncTime *metav1.Time `json:"nextSyncTime,omitempty"`
// conditions represent the latest available observations of the
// source's state.
Conditions []metav1.Condition `json:"conditions,omitempty"`
// latestImage in the object holding the most recent consistent replicated
// image.
//+optional
LatestImages map[string]*corev1.TypedLocalObjectReference `json:"latestImage,omitempty"`
// Created ReplicationDestinations by this ReplicationGroupDestination
ReplicationDestinations []*corev1.ObjectReference `json:"replicationDestinations,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Last sync",type="string",format="date-time",JSONPath=`.status.lastSyncTime`
// +kubebuilder:printcolumn:name="Duration",type="string",JSONPath=`.status.lastSyncDuration`
// +kubebuilder:printcolumn:name="Last sync start",type="string",format="date-time",JSONPath=`.status.lastSyncStartTime`

// ReplicationGroupDestination is the Schema for the replicationgroupdestinations API
type ReplicationGroupDestination struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ReplicationGroupDestinationSpec `json:"spec,omitempty"`
Status ReplicationGroupDestinationStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// ReplicationGroupDestinationList contains a list of ReplicationGroupDestination
type ReplicationGroupDestinationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ReplicationGroupDestination `json:"items"`
}

func init() {
SchemeBuilder.Register(&ReplicationGroupDestination{}, &ReplicationGroupDestinationList{})
}
96 changes: 96 additions & 0 deletions api/v1alpha1/replicationgroupsource_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// SPDX-FileCopyrightText: The RamenDR authors
// SPDX-License-Identifier: Apache-2.0

package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ReplicationGroupSourceSpec defines the desired state of ReplicationGroupSource
type ReplicationGroupSourceSpec struct {
Trigger *ReplicationSourceTriggerSpec `json:"trigger,omitempty"`

// +required
VolumeGroupSnapshotClassName string `json:"volumeGroupSnapshotClassName,omitempty"`

// +required
VolumeGroupSnapshotSource *metav1.LabelSelector `json:"volumeGroupSnapshotSource,omitempty"`
}

// ReplicationSourceTriggerSpec defines when a volume will be synchronized with
// the destination.
type ReplicationSourceTriggerSpec struct {
// schedule is a cronspec (https://en.wikipedia.org/wiki/Cron#Overview) that
// can be used to schedule replication to occur at regular, time-based
// intervals.
// nolint:lll
//+kubebuilder:validation:Pattern=`^(@(annually|yearly|monthly|weekly|daily|hourly))|((((\d+,)*\d+|(\d+(\/|-)\d+)|\*(\/\d+)?)\s?){5})$`
//+optional
Schedule *string `json:"schedule,omitempty"`
// manual is a string value that schedules a manual trigger.
// Once a sync completes then status.lastManualSync is set to the same string value.
// A consumer of a manual trigger should set spec.trigger.manual to a known value
// and then wait for lastManualSync to be updated by the operator to the same value,
// which means that the manual trigger will then pause and wait for further
// updates to the trigger.
//+optional
Manual string `json:"manual,omitempty"`
}

// ReplicationGroupSourceStatus defines the observed state of ReplicationGroupSource
type ReplicationGroupSourceStatus struct {
// lastSyncTime is the time of the most recent successful synchronization.
//+optional
LastSyncTime *metav1.Time `json:"lastSyncTime,omitempty"`
// lastSyncStartTime is the time the most recent synchronization started.
//+optional
LastSyncStartTime *metav1.Time `json:"lastSyncStartTime,omitempty"`
// lastSyncDuration is the amount of time required to send the most recent
// update.
//+optional
LastSyncDuration *metav1.Duration `json:"lastSyncDuration,omitempty"`
// nextSyncTime is the time when the next volume synchronization is
// scheduled to start (for schedule-based synchronization).
//+optional
NextSyncTime *metav1.Time `json:"nextSyncTime,omitempty"`
// lastManualSync is set to the last spec.trigger.manual when the manual sync is done.
//+optional
LastManualSync string `json:"lastManualSync,omitempty"`
// conditions represent the latest available observations of the
// source's state.
Conditions []metav1.Condition `json:"conditions,omitempty"`
// Created ReplicationSources by this ReplicationGroupSource
ReplicationSources []*corev1.ObjectReference `json:"replicationSources,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Last sync",type="string",format="date-time",JSONPath=`.status.lastSyncTime`
// +kubebuilder:printcolumn:name="Duration",type="string",JSONPath=`.status.lastSyncDuration`
// +kubebuilder:printcolumn:name="Next sync",type="string",format="date-time",JSONPath=`.status.nextSyncTime`
// +kubebuilder:printcolumn:name="Source",type="string",JSONPath=`.spec.volumeGroupSnapshotSource`
// +kubebuilder:printcolumn:name="Last sync start",type="string",format="date-time",JSONPath=`.status.lastSyncStartTime`

// ReplicationGroupSource is the Schema for the replicationgroupsources API
type ReplicationGroupSource struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ReplicationGroupSourceSpec `json:"spec,omitempty"`
Status ReplicationGroupSourceStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// ReplicationGroupSourceList contains a list of ReplicationGroupSource
type ReplicationGroupSourceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ReplicationGroupSource `json:"items"`
}

func init() {
SchemeBuilder.Register(&ReplicationGroupSource{}, &ReplicationGroupSourceList{})
}
6 changes: 6 additions & 0 deletions api/v1alpha1/volumereplicationgroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ type VRGAsyncSpec struct {
//+optional
VolumeSnapshotClassSelector metav1.LabelSelector `json:"volumeSnapshotClassSelector,omitempty"`

// Label selector to identify the VolumeGroupSnapshotClass resources
// that are scanned to select an appropriate VolumeGroupSnapshotClass
// for the VolumeGroupSnapshot resource when using VolSync.
//+optional
VolumeGroupSnapshotClassSelector metav1.LabelSelector `json:"volumeGroupSnapshotClassSelector,omitempty"`

// scheduling Interval for replicating Persistent Volume
// data to a peer cluster. Interval is typically in the
// form <num><m,h,d>. Here <num> is a number, 'm' means
Expand Down
Loading
Loading