Skip to content

Commit

Permalink
fix: separate-models (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone authored Jan 24, 2025
1 parent b7cb0e0 commit 93f171f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions controllers/resources/bentorequest_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (r *BentoRequestReconciler) Reconcile(ctx context.Context, req ctrl.Request
var modelsExistsResult ctrl.Result
var modelsExistsErr error

if separateModels {
if separateModels && !isImageStoredInS3(bentoRequest) {
bentoRequest, modelsExists, modelsExistsResult, modelsExistsErr = r.ensureModelsExists(ctx, ensureModelsExistsOption{
bentoRequest: bentoRequest,
req: req,
Expand Down Expand Up @@ -268,7 +268,7 @@ func (r *BentoRequestReconciler) Reconcile(ctx context.Context, req ctrl.Request
return
}

if separateModels && modelsExists {
if separateModels && !isImageStoredInS3(bentoRequest) && modelsExists {
// Delete PVCs for all seeded models
for _, model := range bentoRequest.Spec.Models {
model := model
Expand All @@ -288,7 +288,7 @@ func (r *BentoRequestReconciler) Reconcile(ctx context.Context, req ctrl.Request
}
}

if separateModels && !modelsExists {
if separateModels && !isImageStoredInS3(bentoRequest) && !modelsExists {
result = modelsExistsResult
bentoRequest, err = r.setStatusConditions(ctx, req,
metav1.Condition{
Expand Down Expand Up @@ -319,7 +319,7 @@ func (r *BentoRequestReconciler) Reconcile(ctx context.Context, req ctrl.Request
},
}

if separateModels {
if separateModels && !isImageStoredInS3(bentoRequest) {
bentoCR.Annotations = map[string]string{
commonconsts.KubeAnnotationYataiImageBuilderSeparateModels: commonconsts.KubeLabelValueTrue,
commonconsts.KubeAnnotationAWSAccessKeySecretName: bentoRequest.Annotations[commonconsts.KubeAnnotationAWSAccessKeySecretName],
Expand Down Expand Up @@ -1481,7 +1481,7 @@ func getBentoImageName(bentoRequest *resourcesv1alpha1.BentoRequest, dockerRegis
}

func isSeparateModels(bentoRequest *resourcesv1alpha1.BentoRequest) (separateModels bool) {
return bentoRequest.Annotations[commonconsts.KubeAnnotationYataiImageBuilderSeparateModels] == commonconsts.KubeLabelValueTrue && !isImageStoredInS3(bentoRequest)
return bentoRequest.Annotations[commonconsts.KubeAnnotationYataiImageBuilderSeparateModels] == commonconsts.KubeLabelValueTrue
}

func isImageStoredInS3(bentoRequest *resourcesv1alpha1.BentoRequest) (storedInS3 bool) {
Expand Down

0 comments on commit 93f171f

Please sign in to comment.