Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve some of the messages in planexecution controller #591

Merged
merged 2 commits into from
Jul 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions pkg/controller/planexecution/planexecution_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func (r *ReconcilePlanExecution) Reconcile(request reconcile.Request) (reconcile
err := r.Client.Get(context.TODO(), key, truth)
rawObj, _ := apijson.Marshal(obj)
if err == nil {
log.Printf("PlanExecutionController: CreateOrUpdate Object present")
log.Printf("PlanExecutionController: Object %v already exists for instance %v, going to apply patch", key, instance.Name)
//update
log.Printf("Going to apply patch\n%+v\n\n to object\n%s\n", string(rawObj), prettyPrint(truth))
if err != nil {
Expand All @@ -464,18 +464,20 @@ func (r *ReconcilePlanExecution) Reconcile(request reconcile.Request) (reconcile
if errors.IsUnsupportedMediaType(err) {
err = r.Client.Patch(context.TODO(), truth, client.ConstantPatch(types.MergePatchType, rawObj))
if err != nil {
log.Printf("PlanExecutionController: CreateOrUpdate MergePatch: %v", err)
log.Printf("PlanExecutionController: Error when applying merge patch to object %v for instance %v: %v", key, instance.Name, err)
}
} else {
log.Printf("PlanExecutionController: CreateOrUpdate StrategicMergePatch: Unknown Error: %v", err)
log.Printf("PlanExecutionController: Error when applying StrategicMergePatch to object %v for instance %v: %v", key, instance.Name, err)
}
}
}
} else {
//create
log.Println("PlanExecutionController: CreateOrUpdate Object not present")
log.Printf("PlanExecutionController: Object %v does not exist, going to create new object for instance %v", key, instance.Name)
err = r.Client.Create(context.TODO(), obj)
log.Printf("PlanExecutionController: CreateOrUpdate Create: %v", err)
if err != nil {
log.Printf("PlanExecutionController: Error when creating object %v: %v", key, err)
}
}

if err != nil {
Expand Down