Skip to content

Commit

Permalink
fix: ignore already exist error in worker reconcile
Browse files Browse the repository at this point in the history
Signed-off-by: bjwswang <[email protected]>
  • Loading branch information
bjwswang committed Nov 28, 2023
1 parent 62ee08f commit 3792a46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 9 additions & 2 deletions controllers/worker_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/go-logr/logr"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -216,7 +217,10 @@ func (r *WorkerReconciler) reconcileWhenWorkerReady(ctx context.Context, logger
return err
}
if err = r.Client.Create(ctx, embedder); err != nil {
return err
// Ignore error when already exists
if !k8serrors.IsAlreadyExists(err) {
return err
}
}
case arcadiaworker.Update:
// Skip update when found
Expand All @@ -237,7 +241,10 @@ func (r *WorkerReconciler) reconcileWhenWorkerReady(ctx context.Context, logger
return err
}
if err = r.Client.Create(ctx, llm); err != nil {
return err
// Ignore error when already exists
if !k8serrors.IsAlreadyExists(err) {
return err
}
}
case arcadiaworker.Update:
// Skip update when found
Expand Down
7 changes: 2 additions & 5 deletions tests/example-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,12 @@ kubectl apply -f config/samples/arcadia_v1alpha1_dataset.yaml
kubectl apply -f config/samples/arcadia_v1alpha1_versioneddataset.yaml
waitCRDStatusReady "VersionedDataset" "arcadia" "dataset-playground-v1"

info "7.3 create embedder and wait it ready"
kubectl apply -f config/samples/arcadia_v1alpha1_embedders.yaml
waitCRDStatusReady "Embedders" "arcadia" "zhipuai-embedders-sample"

info "7.4 create knowledgebase and wait it ready"
info "7.3 create knowledgebase and wait it ready"
kubectl apply -f config/samples/arcadia_v1alpha1_knowledgebase.yaml
waitCRDStatusReady "KnowledgeBase" "arcadia" "knowledgebase-sample"

info "7.5 check this vectorstore has data"
info "7.4 check this vectorstore has data"
kubectl port-forward -n arcadia svc/chroma-chromadb 8000:8000 >/dev/null 2>&1 &
chroma_pid=$!
info "port-forward chroma in pid: $minio_pid"
Expand Down

0 comments on commit 3792a46

Please sign in to comment.