Skip to content

Commit

Permalink
Merge pull request #601 from bjwswang/web
Browse files Browse the repository at this point in the history
fix: shoud delete worker label with DeepCopied object
  • Loading branch information
bjwswang authored Jan 22, 2024
2 parents 5fd9bbd + b31d71f commit 9c9e8e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions controllers/base/worker_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ func (r *WorkerReconciler) initialize(ctx context.Context, logger logr.Logger, i
if err := r.Client.Get(ctx, types.NamespacedName{Namespace: ns, Name: instance.Spec.Model.Name}, &m); err != nil {
return true, err
}
if types, ok := instanceDeepCopy.Labels[arcadiav1alpha1.WorkerModelTypesLabel]; !ok || types != m.Spec.Types {
if types, ok := instanceDeepCopy.Labels[arcadiav1alpha1.WorkerModelTypesLabel]; !ok || strings.ReplaceAll(types, "_", ",") != m.Spec.Types {
// label do not accept `,`,so replace it with `_`
instanceDeepCopy.Labels[arcadiav1alpha1.WorkerModelTypesLabel] = strings.ReplaceAll(m.Spec.Types, ",", "_")
update = true
}
} else {
if _, ok := instance.Labels[arcadiav1alpha1.WorkerModelTypesLabel]; ok {
delete(instance.Labels, arcadiav1alpha1.WorkerModelTypesLabel)
if _, ok := instanceDeepCopy.Labels[arcadiav1alpha1.WorkerModelTypesLabel]; ok {
delete(instanceDeepCopy.Labels, arcadiav1alpha1.WorkerModelTypesLabel)
update = true
}
}
Expand Down

0 comments on commit 9c9e8e1

Please sign in to comment.