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

Adding secretef Webhook For Backingstore and Namespacestore #930

Closed

Conversation

liranmauda
Copy link
Contributor

Explain the changes

  • Adding secretef Webhook For Backingstore and Namespacestore to validate that it has namespace in it.

Closing the gap from #914

Signed-off-by: liranmauda liran.mauda@gmail.com

Issues:

  1. Fixed https://bugzilla.redhat.com/show_bug.cgi?id=2084201

Testing Instructions:

  1. Try to apply a backingstore without a namespace in its secretef
  2. Try to update backingstore to remove the namespace from its secretef
  3. Do the above steps on a namespacestore.
  • Tests added

@liranmauda
Copy link
Contributor Author

@dannyzaken @kfir-payne please take a look.
The PR is in draft so we can look at its logic, once we think it is ok, I will add tests and remove from draft.

@liranmauda liranmauda requested a review from romayalon May 31, 2022 13:37
@liranmauda liranmauda force-pushed the liran-secretRef-Namespace-webhook branch from 9e26122 to e79b7dc Compare May 31, 2022 13:38
Copy link
Contributor

@kfir-payne kfir-payne left a comment

Choose a reason for hiding this comment

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

I think it would be easier to address those comments after a rebase because the structure of calling the validation had changed.
Also tests are missing.

@@ -92,6 +92,10 @@ func (nsv *ResourceValidator) ValidateUpdateNS() {
nsv.SetValidationResult(false, err.Error())
return
}
if err := validations.ValidateNamespacestoreSecretRefNamespace(*ns); err != nil && util.IsValidationError(err) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that the call for ValidateNamespacestoreSecretRefNamespace should be inside ValidateNamespaceStore function, that way this validation will be checked in creation ops as well.

func ValidateBackingstoreSecretRefNamespace(bs nbv1.BackingStore) error{
secretRef, err := util.GetBackingStoreSecretByType(&bs);
if err != nil {
return util.ValidationError{
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not a validation error, it's an error in the retrieval of the Backingstore secret reference.
same goes for Namespacestore.

- Adding secretef Webhook For Backingstore and Namespacestore to validate that it have namespace in it.

Signed-off-by: liranmauda <liran.mauda@gmail.com>
@liranmauda liranmauda force-pushed the liran-secretRef-Namespace-webhook branch from e79b7dc to d9fead1 Compare October 23, 2022 12:07
@dannyzaken
Copy link
Contributor

@liranmauda I think that for now we can skip the webhook validation for that. let's close

@liranmauda
Copy link
Contributor Author

@liranmauda I think that for now we can skip the webhook validation for that. let's close

Closing.

@liranmauda liranmauda closed this Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants