Skip to content

Commit

Permalink
fix: add default value for replicas
Browse files Browse the repository at this point in the history
Signed-off-by: YouXam <[email protected]>
  • Loading branch information
YouXam committed Jul 13, 2024
1 parent b37a71c commit 57b6621
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/controller/aimodel_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ func (r *AIModelReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
return ctrl.Result{}, err
}

if aimodel.Spec.Replicas == nil {
aimodel.Spec.Replicas = new(int32)
*aimodel.Spec.Replicas = 1
}

// Define the desired Deployment object
dep := r.deploymentForAIModel(aimodel)

Expand Down Expand Up @@ -144,7 +149,7 @@ func (r *AIModelReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
}
}

// Check if ServiceAccount was updated after last recorded update
// Check if ServiceAccount was updated after the last recorded update
lastUpdate, _ := time.Parse(time.RFC3339, found.Spec.Template.ObjectMeta.Annotations["last-serviceaccount-update"])
needsRestart := sa.CreationTimestamp.After(lastUpdate)

Expand Down

0 comments on commit 57b6621

Please sign in to comment.