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

Create webhook for VerticaRestorePointQuery CR #709

Merged

Conversation

chinhtranvan
Copy link
Collaborator

@chinhtranvan chinhtranvan commented Feb 16, 2024

This PR creates a webhook for the new VerticaRestorePointQuery CR to catch the checks early. There is some webhook part that is added in #643."

@chinhtranvan chinhtranvan force-pushed the chinh/create--webhook-for-VerticaRestorePointQuery-CR branch from 05948ab to fbf8a86 Compare February 16, 2024 07:27
Copy link
Collaborator

@spilchen spilchen left a comment

Choose a reason for hiding this comment

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

Thanks for adding this in. A few minor comments in addition to what I already added:

  • There should be an update to PROJECT to indicate that we have a webhook now for the CR.
  • Unrelated to this PR, but I noticed it while playing with vrpq. Can we remove omitempty from VerticaRestorePointsQueryStatus.RestorePoints? I created a vrpq that didn't return anything and that field wasn't there. I think it will be clear if we have it even if it is empty. That is what most people are going to look for when they create the CR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a little confused about this rename. Are you sure this is suppose to be an assert file? It looks like we have logic in it to create a vrpq. It should only be checking what was done (or not done) in 20-invalid-startTimestamp.yaml.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As discussed in the scrum, we should add one more step filter for vrpq

@@ -15,5 +15,5 @@ apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
export STARTTIMESTAMP=$(kubectl get vrpq archive-query -o json -n $NAMESPACE | jq -r '.status.restorePoints[] | select(.index==1 and .archive=="db") | .timestamp')
export STARTTIMESTAMP="$(kubectl get vrpq archive-query -o json -n $NAMESPACE | jq -r '.status.restorePoints[] | select(.index==1 and .archive=="db") | .timestamp')"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@spilchen There is one thing I've noticed: when I run it without double quotes on my local machine, it doesn't work. It freezes, possibly due to the timestamp containing a space. I'm unsure why it passes in the GitHub CI but not on my local machine. After discussing with @jizhuoyu , we concluded that adding double quotes would make it more persistent and reliable

@spilchen
Copy link
Collaborator

Can we remove omitempty from VerticaRestorePointsQueryStatus.RestorePoints? I think that will make it clear when we create the CR and no results are returned.

@spilchen
Copy link
Collaborator

Can we remove omitempty from VerticaRestorePointsQueryStatus.RestorePoints? I think that will make it clear when we create the CR and no results are returned.

Never mind, I noticed that it's on the server side.

@chinhtranvan
Copy link
Collaborator Author

Can we remove omitempty from VerticaRestorePointsQueryStatus.RestorePoints? I think that will make it clear when we create the CR and no results are returned.

Never mind, I noticed that it's on the server side.

yes, I already opened a PR on the server side, you can take a look it https://git.verticacorp.com/projects/VER/repos/server/pull-requests/20274/overview

@chinhtranvan chinhtranvan force-pushed the chinh/create--webhook-for-VerticaRestorePointQuery-CR branch 3 times, most recently from 816800c to df3f964 Compare February 16, 2024 23:19
@@ -146,7 +147,7 @@ func (q *QueryReconciler) runShowRestorePoints(ctx context.Context, dispatcher v
opts []showrestorepoints.Option) (err error) {
// set Querying status condition ,state and restore points prior to calling vclusterops API
err = vrpqstatus.Update(ctx, q.VRec.Client, q.VRec.Log, q.Vrpq,
[]*metav1.Condition{vapi.MakeCondition(v1beta1.Querying, metav1.ConditionTrue, "Started")}, stateQuerying, nil)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm guessing this change is needed because the restorePoints list is required now? Did you try setting the optional marker?

// +kubebuilder:validation:Optional

Copy link
Collaborator Author

@chinhtranvan chinhtranvan Feb 17, 2024

Choose a reason for hiding this comment

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

Oops, why didn't I think this setting? Yes, this setting is better. We don't need to update nil to vops.RestorePoints{}, and it still returns an empty status for Restore Points in the CR. Will fix it

@chinhtranvan chinhtranvan force-pushed the chinh/create--webhook-for-VerticaRestorePointQuery-CR branch from df3f964 to 9d1e885 Compare February 17, 2024 16:28
Copy link
Collaborator

@spilchen spilchen left a comment

Choose a reason for hiding this comment

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

Thanks for making the final revisions

@chinhtranvan chinhtranvan merged commit 6d1929e into vnext Feb 17, 2024
30 checks passed
@chinhtranvan chinhtranvan deleted the chinh/create--webhook-for-VerticaRestorePointQuery-CR branch February 17, 2024 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants