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

[Misc] Operator: Errors in workloads logged #140

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion internal/controller/reconcile-capapplicationversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func (c *Controller) processWorkloads(ctx context.Context, ca *v1alpha1.CAPAppli
c.updateCAPApplicationVersionStatus(ctx, cav, v1alpha1.CAPApplicationVersionStateProcessing, metav1.Condition{Type: string(v1alpha1.ConditionTypeReady), Status: "False", Reason: "WaitingForWorkloads"})
return NewReconcileResultWithResource(ResourceCAPApplicationVersion, cav.Name, cav.Namespace, 10*time.Second), nil
} else if err != nil {
util.LogError(err, "Workload(s) in error status", string(Error), cav, nil, "version", cav.Spec.Version)
c.updateCAPApplicationVersionStatus(ctx, cav, v1alpha1.CAPApplicationVersionStateError, metav1.Condition{Type: string(v1alpha1.ConditionTypeReady), Status: "False", Reason: "ErrorInWorkloadStatus", Message: err.Error()})
return nil, err
}
Expand Down Expand Up @@ -998,6 +999,7 @@ func (c *Controller) checkContentWorkloadStatus(ctx context.Context, cav *v1alph

numOfFinishedJobsBeforeUpd := len(cav.Status.FinishedJobs)
if err := checkAndUpdateJobStatusFinishedJobs(contentDeployJob, cav); err != nil {
util.LogError(err, "Error in content job", string(Processing), cav, contentDeployJob, "version", cav.Spec.Version)
return false, err
}

Expand Down Expand Up @@ -1039,7 +1041,10 @@ func (c *Controller) checkOverallWorkloadStatus(ctx context.Context, overallDepl
deploymentAvailable = true
break
} else if condition.Type == appsv1.DeploymentReplicaFailure && condition.Status == corev1.ConditionTrue {
return false, fmt.Errorf("%s", condition.Message)
// if the deployment has replica failure, return error
err := fmt.Errorf("%s", condition.Message)
util.LogError(err, "Error in deployment", string(Processing), cav, deployment, "version", cav.Spec.Version)
return false, err
}
}
if !deploymentAvailable {
Expand Down
1 change: 1 addition & 0 deletions internal/controller/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ const (
Deprovisioning Steps = "Deprovisioning"
Deleting Steps = "Deleting"
Ready Steps = "Ready"
Error Steps = "Error"
)

func (c *Controller) Event(main runtime.Object, related runtime.Object, eventType, reason, action, message string) {
Expand Down