diff --git a/internal/controllers/v1beta2/podmonitor_taskhandlers.go b/internal/controllers/v1beta2/podmonitor_taskhandlers.go index 6ecf221f..64c73282 100644 --- a/internal/controllers/v1beta2/podmonitor_taskhandlers.go +++ b/internal/controllers/v1beta2/podmonitor_taskhandlers.go @@ -126,7 +126,7 @@ func (r *LagoonMonitorReconciler) taskLogsToLagoonLogs(opLog logr.Logger, Environment: lagoonTask.Spec.Environment.Name, JobName: lagoonTask.ObjectMeta.Name, JobStatus: condition, - RemoteID: string(jobPod.ObjectMeta.UID), + RemoteID: string(lagoonTask.ObjectMeta.UID), Key: lagoonTask.Spec.Key, Cluster: r.LagoonTargetName, }, @@ -152,6 +152,15 @@ Logs on pod %s, assigned to cluster %s // really matter if we don't smootly transition in what we send back to lagoon return err } + if r.EnableDebug { + opLog.Info( + fmt.Sprintf( + "Published event %s for %s to lagoon-logs exchange", + fmt.Sprintf("task-logs:job-kubernetes:%s", jobPod.ObjectMeta.Name), + jobPod.ObjectMeta.Name, + ), + ) + } // if we are able to publish the message, then we need to remove any pending messages from the resource // and make sure we don't try and publish again } @@ -186,7 +195,7 @@ func (r *LagoonMonitorReconciler) updateLagoonTask(opLog logr.Logger, ProjectID: lagoonTask.Spec.Project.ID, JobName: lagoonTask.ObjectMeta.Name, JobStatus: condition, - RemoteID: string(jobPod.ObjectMeta.UID), + RemoteID: string(lagoonTask.ObjectMeta.UID), Key: lagoonTask.Spec.Key, Cluster: r.LagoonTargetName, }, @@ -217,6 +226,14 @@ func (r *LagoonMonitorReconciler) updateLagoonTask(opLog logr.Logger, // really matter if we don't smootly transition in what we send back to lagoon return err } + if r.EnableDebug { + opLog.Info( + fmt.Sprintf( + "Published task update message for %s to lagoon-tasks:controller queue", + jobPod.ObjectMeta.Name, + ), + ) + } // if we are able to publish the message, then we need to remove any pending messages from the resource // and make sure we don't try and publish again } @@ -226,7 +243,6 @@ func (r *LagoonMonitorReconciler) updateLagoonTask(opLog logr.Logger, // taskStatusLogsToLagoonLogs sends the logs to lagoon-logs message queue, used for general messaging func (r *LagoonMonitorReconciler) taskStatusLogsToLagoonLogs(opLog logr.Logger, lagoonTask *lagooncrd.LagoonTask, - jobPod *corev1.Pod, condition string, ) error { if r.EnableMQ && lagoonTask != nil { @@ -242,7 +258,7 @@ func (r *LagoonMonitorReconciler) taskStatusLogsToLagoonLogs(opLog logr.Logger, ProjectID: lagoonTask.Spec.Project.ID, JobName: lagoonTask.ObjectMeta.Name, JobStatus: condition, - RemoteID: string(jobPod.ObjectMeta.UID), + RemoteID: string(lagoonTask.ObjectMeta.UID), Key: lagoonTask.Spec.Key, Cluster: r.LagoonTargetName, }, @@ -263,6 +279,15 @@ func (r *LagoonMonitorReconciler) taskStatusLogsToLagoonLogs(opLog logr.Logger, // really matter if we don't smootly transition in what we send back to lagoon return err } + if r.EnableDebug { + opLog.Info( + fmt.Sprintf( + "Published event %s for %s to lagoon-logs exchange", + fmt.Sprintf("task:job-kubernetes:%s", condition), + lagoonTask.ObjectMeta.Name, + ), + ) + } // if we are able to publish the message, then we need to remove any pending messages from the resource // and make sure we don't try and publish again } @@ -347,7 +372,7 @@ Task %s // send any messages to lagoon message queues // update the deployment with the status - if err = r.taskStatusLogsToLagoonLogs(opLog, &lagoonTask, &jobPod, taskCondition.ToLower()); err != nil { + if err = r.taskStatusLogsToLagoonLogs(opLog, &lagoonTask, taskCondition.ToLower()); err != nil { opLog.Error(err, "unable to publish task status logs") } if err = r.updateLagoonTask(opLog, &lagoonTask, &jobPod, taskCondition.ToLower()); err != nil { diff --git a/internal/messenger/consumer.go b/internal/messenger/consumer.go index 7a3e0b02..decb53fc 100644 --- a/internal/messenger/consumer.go +++ b/internal/messenger/consumer.go @@ -104,7 +104,7 @@ func (m *Messenger) Consumer(targetName string) { //error { message.Ack(false) // ack to remove from queue }) if err != nil { - log.Fatalf(fmt.Sprintf("Failed to set handler to consumer `%s`: %v", "builddeploy-queue", err)) + log.Fatalf("Failed to set handler to consumer `%s`: %v", "builddeploy-queue", err) } // Handle any tasks that go to the `remove` queue @@ -228,7 +228,7 @@ func (m *Messenger) Consumer(targetName string) { //error { message.Ack(false) // ack to remove from queue }) if err != nil { - log.Fatalf(fmt.Sprintf("Failed to set handler to consumer `%s`: %v", "remove-queue", err)) + log.Fatalf("Failed to set handler to consumer `%s`: %v", "remove-queue", err) } // Handle any tasks that go to the `jobs` queue @@ -286,7 +286,7 @@ func (m *Messenger) Consumer(targetName string) { //error { message.Ack(false) // ack to remove from queue }) if err != nil { - log.Fatalf(fmt.Sprintf("Failed to set handler to consumer `%s`: %v", "jobs-queue", err)) + log.Fatalf("Failed to set handler to consumer `%s`: %v", "jobs-queue", err) } // Handle any tasks that go to the `misc` queue @@ -499,7 +499,7 @@ func (m *Messenger) Consumer(targetName string) { //error { message.Ack(false) // ack to remove from queue }) if err != nil { - log.Fatalf(fmt.Sprintf("Failed to set handler to consumer `%s`: %v", "misc-queue", err)) + log.Fatalf("Failed to set handler to consumer `%s`: %v", "misc-queue", err) } <-forever } diff --git a/internal/messenger/tasks_restore.go b/internal/messenger/tasks_restore.go index ad481984..dc5d593b 100644 --- a/internal/messenger/tasks_restore.go +++ b/internal/messenger/tasks_restore.go @@ -30,7 +30,6 @@ func (m *Messenger) ResticRestore(namespace string, jobSpec *lagoonv1beta2.Lagoo // just log the error then return return nil } - // check if k8up crds exist in the cluster k8upv1alpha1Exists := false k8upv1Exists := false