delete job if not equal and create new
[ZITADOPER-7]
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"encoding/json"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -291,10 +292,14 @@ func (r *ZitadelClusterReconciler) reconcileInitJob(ctx context.Context, zitadel
|
||||
}
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
||||
patch := client.MergeFrom(existingJob.DeepCopy())
|
||||
existingJob.Spec.Template.Spec = desiredInitJob.Spec.Template.Spec
|
||||
return ctrl.Result{}, r.Patch(ctx, &existingJob, patch)
|
||||
if !reflect.DeepEqual(existingJob.Spec.Template.Spec, desiredInitJob.Spec.Template.Spec) {
|
||||
err := r.Delete(ctx, &existingJob)
|
||||
if err != nil {
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
return ctrl.Result{}, r.Create(ctx, desiredInitJob)
|
||||
}
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
||||
func (r *ZitadelClusterReconciler) reconcileSetupJob(ctx context.Context, zitadel *zitadelv1alpha1.ZitadelCluster) (ctrl.Result, error) {
|
||||
|
||||
Reference in New Issue
Block a user