Skip to content

Commit

Permalink
Revert "Add verification for index correction e2e and add clusterrole…
Browse files Browse the repository at this point in the history
… cronjobs for operator to deploy index correction (#2205)"

This reverts commit b4028e7.
  • Loading branch information
ykadowak committed Nov 30, 2023
1 parent a5700ee commit c14564b
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 1,050 deletions.
1 change: 0 additions & 1 deletion .github/helm/values/values-lb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,3 @@ manager:
# suspend because you do not want corrector to start automatically in CI
# instead run it manually
suspend: true
schedule: "1 2 3 4 5"
4 changes: 0 additions & 4 deletions .github/valdrelease/valdrelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,3 @@ spec:
auto_index_duration_limit: 2m
auto_index_check_duration: 30s
auto_index_length: 1000
corrector:
enabled: true
suspend: true
schedule: "1 2 3 4 5"
13 changes: 0 additions & 13 deletions charts/vald-helm-operator/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,4 @@ rules:
- get
- patch
- update
- apiGroups:
- batch
resources:
- cronjobs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch

{{- end }}
2 changes: 1 addition & 1 deletion charts/vald/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2682,7 +2682,7 @@ manager:
enabled: false
# @schema {"name": "manager.index.corrector.schedule", "type": "string"}
# manager.index.corrector.schedule -- CronJob schedule setting for index correction
schedule: "6 3 * * *"
schedule: "5 * * * *"
# @schema {"name": "manager.index.corrector.suspend", "type": "boolean"}
# manager.index.corrector.suspend -- CronJob suspend setting for index correction
suspend: false
Expand Down
12 changes: 0 additions & 12 deletions k8s/operator/helm/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,3 @@ rules:
- get
- patch
- update
- apiGroups:
- batch
resources:
- cronjobs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
965 changes: 0 additions & 965 deletions k8s/operator/helm/crds/valdrelease.yaml

Large diffs are not rendered by default.

58 changes: 8 additions & 50 deletions tests/e2e/crud/crud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"flag"
"fmt"
"os"
"os/exec"
"testing"
"time"

Expand All @@ -43,14 +42,13 @@ var (
port int
ds *hdf5.Dataset

insertNum int
correctionInsertNum int
searchNum int
searchByIDNum int
getObjectNum int
updateNum int
upsertNum int
removeNum int
insertNum int
searchNum int
searchByIDNum int
getObjectNum int
updateNum int
upsertNum int
removeNum int

insertFrom int
searchFrom int
Expand All @@ -75,7 +73,6 @@ func init() {
flag.IntVar(&port, "port", 8081, "gRPC port")

flag.IntVar(&insertNum, "insert-num", 10000, "number of id-vector pairs used for insert")
flag.IntVar(&correctionInsertNum, "correction-insert-num", 3000, "number of id-vector pairs used for insert")
flag.IntVar(&searchNum, "search-num", 10000, "number of id-vector pairs used for search")
flag.IntVar(&searchByIDNum, "search-by-id-num", 100, "number of id-vector pairs used for search-by-id")
flag.IntVar(&getObjectNum, "get-object-num", 100, "number of id-vector pairs used for get-object")
Expand Down Expand Up @@ -761,9 +758,7 @@ func TestE2EIndexJobCorrection(t *testing.T) {
t.Fatalf("an error occurred: %s", err)
}

// prepare train data
train := ds.Train[insertFrom : insertFrom+correctionInsertNum]

train := ds.Train[insertFrom : insertFrom+insertNum]
err = op.Insert(t, ctx, operation.Dataset{
Train: train,
})
Expand All @@ -773,49 +768,12 @@ func TestE2EIndexJobCorrection(t *testing.T) {

sleep(t, waitAfterInsertDuration)

t.Log("Test case 1: just execute index correction and check if replica number is correct after correction")
exe := operation.NewCronJobExecutor("vald-index-correction")
err = exe.CreateAndWait(t, ctx, "correction-test")
if err != nil {
t.Fatalf("an error occurred: %s", err)
}

// check if replica number is correct
err = op.StreamListObject(t, ctx, operation.Dataset{
Train: train,
})
if err != nil {
t.Fatalf("an error occurred: %s", err)
}

t.Log("Test case 2: execute index correction after one agent removed")
t.Log("removing vald-agent-ngt-0...")
cmd := exec.CommandContext(ctx, "sh", "-c", "kubectl delete pod vald-agent-ngt-0 && kubectl wait --for=condition=Ready pod/vald-agent-ngt-0")
out, err := cmd.Output()
if err != nil {
if exitErr, ok := err.(*exec.ExitError); ok {
t.Fatalf("%s, %s, %v", string(out), string(exitErr.Stderr), err)
} else {
t.Fatalf("unexpected error on creating job: %v", err)
}
}
t.Log(string(out))

// correct the deleted index
err = exe.CreateAndWait(t, ctx, "correction-test")
if err != nil {
t.Fatalf("an error occurred: %s", err)
}

// check if replica number is correct
err = op.StreamListObject(t, ctx, operation.Dataset{
Train: train,
})
if err != nil {
t.Fatalf("an error occurred: %s", err)
}

t.Log("Tear down. Removing all vectors...")
err = op.Remove(t, ctx, operation.Dataset{
Train: train,
})
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/operation/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func deleteJob(t *testing.T, jobName string) error {
func waitJob(t *testing.T, ctx context.Context, jobName string) error {
t.Helper()
t.Log("waiting for the correction job to complete or fail")
waitCompleteCmd := fmt.Sprintf("kubectl wait --timeout=10m job/%s --for=condition=complete", jobName)
waitFailedCmd := fmt.Sprintf("kubectl wait --timeout=10m job/%s --for=condition=failed", jobName)
waitCompleteCmd := fmt.Sprintf("kubectl wait --timeout=-1s job/%s --for=condition=complete", jobName)
waitFailedCmd := fmt.Sprintf("kubectl wait --timeout=-1s job/%s --for=condition=failed", jobName)

ctx, cancel := context.WithCancel(ctx)
defer cancel()
Expand Down
2 changes: 0 additions & 2 deletions tests/e2e/operation/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,5 @@ exit_loop:
return fmt.Errorf("the number of vectors returned is different at index id %v: got %v, want %v", k, v, replica)
}
}

t.Log("StreamListObject operation finished successfully and all vectors are returned with correct replica number")
return nil
}

0 comments on commit c14564b

Please sign in to comment.