Skip to content

Commit

Permalink
api: add protectedNamespaces field to DRPC and VRG
Browse files Browse the repository at this point in the history
This new field will be used by DRPC and VRG in the multi namespace mode.

When this field is set, it is expected that the PlacementRef and DRPC
are created in the RamenOpsNamespace. When set, ramen will treat the
resources listed in these namespaces as unmanaged and not controlled by
any gitops. It is upto the admins to ensure that only cluster admins of
the hub are allowed to create DRPC and Placement Objects in the
RamenOpsNamespace.

Signed-off-by: Raghavendra Talur <[email protected]>
  • Loading branch information
raghavendra-talur authored and ShyamsundarR committed Mar 30, 2024
1 parent fc41b0d commit 6269b17
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/v1alpha1/drplacementcontrol_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ type DRPlacementControlSpec struct {
// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="placementRef is immutable"
PlacementRef v1.ObjectReference `json:"placementRef"`

// ProtectedNamespaces is a list of namespaces that are protected by the DRPC.
// Omitting this field means resources are only protected in the namespace controlled by the PlacementRef.
// If this field is set, the PlacementRef and the DRPC must be in the RamenOpsNamespace as set in the Ramen Config.
// If this field is set, the protected namespace resources are treated as unmanaged.
// You can use a recipe to filter and coordinate the order of the resources that are protected.
// +kubebuilder:validation:Optional
ProtectedNamespaces *[]string `json:"protectedNamespace,omitempty"`

// DRPolicyRef is the reference to the DRPolicy participating in the DR replication for this DRPC
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="drPolicyRef is immutable"
Expand Down
8 changes: 8 additions & 0 deletions api/v1alpha1/volumereplicationgroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ type VolumeReplicationGroupSpec struct {
Action VRGAction `json:"action,omitempty"`
//+optional
KubeObjectProtection *KubeObjectProtectionSpec `json:"kubeObjectProtection,omitempty"`

// ProtectedNamespaces is a list of namespaces that are considered for protection by the VRG.
// Omitting this field means resources are only protected in the namespace where VRG is.
// If this field is set, the VRG must be in the Ramen Ops Namespace as configured in the Ramen Config.
// If this field is set, the protected namespace resources are treated as unmanaged.
// You can use a recipe to filter and coordinate the order of the resources that are protected.
//+optional
ProtectedNamespaces *[]string `json:"protectedNamespace,omitempty"`
}

type Identifier struct {
Expand Down
18 changes: 18 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions config/crd/bases/ramendr.openshift.io_drplacementcontrols.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ spec:
description: PreferredCluster is the cluster name that the user preferred
to run the application on
type: string
protectedNamespace:
description: |-
ProtectedNamespaces is a list of namespaces that are protected by the DRPC.
Omitting this field means resources are only protected in the namespace controlled by the PlacementRef.
If this field is set, the PlacementRef and the DRPC must be in the RamenOpsNamespace as set in the Ramen Config.
If this field is set, the protected namespace resources are treated as unmanaged.
You can use a recipe to filter and coordinate the order of the resources that are protected.
items:
type: string
type: array
pvcSelector:
description: |-
Label selector to identify all the PVCs that need DR protection.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,16 @@ spec:
PrepareForFinalSync when set, it tells VRG to prepare for the final sync from source to destination
cluster. Final sync is needed for relocation only, and for VolSync only
type: boolean
protectedNamespace:
description: |-
ProtectedNamespaces is a list of namespaces that are considered for protection by the VRG.
Omitting this field means resources are only protected in the namespace where VRG is.
If this field is set, the VRG must be in the Ramen Ops Namespace as configured in the Ramen Config.
If this field is set, the protected namespace resources are treated as unmanaged.
You can use a recipe to filter and coordinate the order of the resources that are protected.
items:
type: string
type: array
pvcSelector:
description: |-
Label selector to identify all the PVCs that are in this group
Expand Down
10 changes: 10 additions & 0 deletions config/crd/bases/ramendr.openshift.io_volumereplicationgroups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ spec:
PrepareForFinalSync when set, it tells VRG to prepare for the final sync from source to destination
cluster. Final sync is needed for relocation only, and for VolSync only
type: boolean
protectedNamespace:
description: |-
ProtectedNamespaces is a list of namespaces that are considered for protection by the VRG.
Omitting this field means resources are only protected in the namespace where VRG is.
If this field is set, the VRG must be in the Ramen Ops Namespace as configured in the Ramen Config.
If this field is set, the protected namespace resources are treated as unmanaged.
You can use a recipe to filter and coordinate the order of the resources that are protected.
items:
type: string
type: array
pvcSelector:
description: |-
Label selector to identify all the PVCs that are in this group
Expand Down

0 comments on commit 6269b17

Please sign in to comment.