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

api: make the pvcSelector optional in the DRPlacementControl CRD #904

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

Conversation

raghavendra-talur
Copy link
Member

When admission webhooks are enabled, then not having a omitempty tag on the pvcSelector causes the DRPC controller to update the field which is denied by the admission webhook.

When admission webhooks are enabled, then not having a omitempty tag on
the pvcSelector causes the DRPC controller to update the field which is
denied by the admission webhook.

Signed-off-by: Raghavendra Talur <raghavendra.talur@gmail.com>
@ShyamsundarR
Copy link
Member

Quick comment:

  • The PVCSelector being a mandatory field is to ensure that from an API perspective the user/entity creating the resource is forced to provide an empty or valid label selector
  • This is done as otherwise it is easy to create an instance "missing" the label selector by ignorance and attempting to protect all PVCs in the namespace

The issue seems to be an initial label selector that is actually empty, but carries an empty sub-struct, and a subsequent update is an empty selector in all. Potentially we could look at the webhook to be smarter in this regard and allow a variation of empty sub-structs in the label selector, than adding an omitempty to the field for the above reasons.

@@ -112,7 +112,7 @@ type DRPlacementControlSpec struct {
// Label selector to identify all the PVCs that need DR protection.
// This selector is assumed to be the same for all subscriptions that
// need DR protection. It will be passed in to the VRG when it is created
PVCSelector metav1.LabelSelector `json:"pvcSelector"`
PVCSelector metav1.LabelSelector `json:"pvcSelector,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Should not be allowed empty. If it is allowed, then by default everything in the namespace is protected. This will not work with VolSync (as its PVCs are on the same namespace), and it will not work with applications where all its PVCs should be protected. Kafka is an example of where zookeeper PVCs should NOT be protected.

@ShyamsundarR ShyamsundarR added the high Issue is of high priority and needs attention label Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high Issue is of high priority and needs attention
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants