Skip to content

Commit

Permalink
feat: Add indication to look at container logs (#1340)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreylimnardy authored Aug 13, 2024
1 parent b19ba1d commit 3430bd8
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 67 deletions.
2 changes: 1 addition & 1 deletion docs/user/resources/02-logpipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ The status of the LogPipeline is determined by the condition types `AgentHealthy
| AgentHealthy | False | AgentNotReady | No Pods deployed |
| AgentHealthy | False | AgentNotReady | DaemonSet is not yet created |
| AgentHealthy | False | AgentNotReady | Failed to get DaemonSet |
| AgentHealthy | False | AgentNotReady | Pod is in the pending state because container: `container name` is not running due to: `reason` |
| AgentHealthy | False | AgentNotReady | Pod is in the pending state because container: `container name` is not running due to: `reason`. Please check the container: `container name` logs. |
| AgentHealthy | False | AgentNotReady | Pod is in the failed state due to: `reason` |
| ConfigurationGenerated | True | AgentConfigured | LogPipeline specification is successfully applied to the configuration of Fluent Bit agent |
| ConfigurationGenerated | True | TLSCertificateAboutToExpire | TLS (CA) certificate is about to expire, configured certificate is valid until YYYY-MM-DD |
Expand Down
2 changes: 1 addition & 1 deletion docs/user/resources/04-tracepipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ The status of the TracePipeline is determined by the condition types `GatewayHea
| GatewayHealthy | False | GatewayNotReady | Failed to list ReplicaSets: `reason` |
| GatewayHealthy | False | GatewayNotReady | Failed to fetch ReplicaSets: `reason` |
| GatewayHealthy | False | GatewayNotReady | Pod is not scheduled: `reason` |
| GatewayHealthy | False | GatewayNotReady | Pod is in the pending state because container: `container name` is not running due to: `reason` |
| GatewayHealthy | False | GatewayNotReady | Pod is in the pending state because container: `container name` is not running due to: `reason`. Please check the container: `container name` logs. |
| GatewayHealthy | False | GatewayNotReady | Pod is in the failed state due to: `reason` |
| GatewayHealthy | False | GatewayNotReady | Deployment is not yet created |
| GatewayHealthy | False | GatewayNotReady | Failed to get Deployment |
Expand Down
4 changes: 2 additions & 2 deletions docs/user/resources/05-metricpipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ The status of the MetricPipeline is determined by the condition types `GatewayHe
| GatewayHealthy | False | GatewayNotReady | Failed to list ReplicaSets: `reason` |
| GatewayHealthy | False | GatewayNotReady | Failed to fetch ReplicaSets: `reason` |
| GatewayHealthy | False | GatewayNotReady | Pod is not scheduled: `reason` |
| GatewayHealthy | False | GatewayNotReady | Pod is in the pending state because container: `container name` is not running due to: `reason` |
| GatewayHealthy | False | GatewayNotReady | Pod is in the pending state because container: `container name` is not running due to: `reason`. Please check the container: `container name` logs. |
| GatewayHealthy | False | GatewayNotReady | Pod is in the failed state due to: `reason` |
| GatewayHealthy | False | GatewayNotReady | Deployment is not yet created |
| GatewayHealthy | False | GatewayNotReady | Failed to get Deployment |
Expand All @@ -195,7 +195,7 @@ The status of the MetricPipeline is determined by the condition types `GatewayHe
| AgentHealthy | False | AgentNotReady | No Pods deployed |
| AgentHealthy | False | AgentNotReady | DaemonSet is not yet created |
| AgentHealthy | False | AgentNotReady | Failed to get DaemonSet |
| AgentHealthy | False | AgentNotReady | Pod is in the pending state because container: `container name` is not running due to: `reason` |
| AgentHealthy | False | AgentNotReady | Pod is in the pending state because container: `container name` is not running due to: `reason`. Please check the container: `container name` logs. |
| AgentHealthy | False | AgentNotReady | Pod is in the failed state due to: `reason` |
| ConfigurationGenerated | True | AgentGatewayConfigured | MetricPipeline specification is successfully applied to the configuration of Metric gateway |
| ConfigurationGenerated | True | TLSCertificateAboutToExpire | TLS (CA) certificate is about to expire, configured certificate is valid until YYYY-MM-DD |
Expand Down
2 changes: 1 addition & 1 deletion internal/conditions/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const (
// Error messages
const (
podIsNotScheduled = "Pod is not scheduled: %s"
podIsPending = "Pod is in the pending state because container: %s is not running due to: %s"
podIsPending = "Pod is in the pending state because container: %s is not running due to: %s. Please check the container: %s logs."
podIsFailed = "Pod is in the failed state due to: %s"
podRolloutInProgress = "Pods are being started/updated"
)
Expand Down
4 changes: 2 additions & 2 deletions internal/conditions/error_to_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ func (etc *ErrorToMessageConverter) Convert(err error) string {
var pipe *workloadstatus.PodIsPendingError
if errors.As(err, &pipe) {
if pipe.Reason == "" {
return fmt.Sprintf(podIsPending, pipe.ContainerName, pipe.Message)
return fmt.Sprintf(podIsPending, pipe.ContainerName, pipe.Message, pipe.ContainerName)
}
return fmt.Sprintf(podIsPending, pipe.ContainerName, pipe.Reason)
return fmt.Sprintf(podIsPending, pipe.ContainerName, pipe.Reason, pipe.ContainerName)
}

var pfe *workloadstatus.PodIsFailingError
Expand Down
4 changes: 2 additions & 2 deletions internal/conditions/error_to_message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ func TestErrorConverter(t *testing.T) {
{
name: "PodIsPendingError Without Reason",
err: &workloadstatus.PodIsPendingError{ContainerName: "fluent-bit", Message: "Error"},
want: "Pod is in the pending state because container: fluent-bit is not running due to: Error",
want: "Pod is in the pending state because container: fluent-bit is not running due to: Error. Please check the container: fluent-bit logs.",
},
{
name: "PodIsPendingError With Reason",
err: &workloadstatus.PodIsPendingError{ContainerName: "fluent-bit", Reason: "CrashLoopBackOff"},
want: "Pod is in the pending state because container: fluent-bit is not running due to: CrashLoopBackOff",
want: "Pod is in the pending state because container: fluent-bit is not running due to: CrashLoopBackOff. Please check the container: fluent-bit logs.",
},
{
name: "PodIsFailedError",
Expand Down
4 changes: 2 additions & 2 deletions internal/reconciler/commonstatus/checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestTracesGetHealthCondition(t *testing.T) {
Type: conditions.TypeGatewayHealthy,
Status: metav1.ConditionFalse,
Reason: conditions.ReasonGatewayNotReady,
Message: "Pod is in the pending state because container: foo is not running due to: foo",
Message: "Pod is in the pending state because container: foo is not running due to: foo. Please check the container: foo logs.",
},
},
}
Expand Down Expand Up @@ -137,7 +137,7 @@ func TestMetricsGetHealthCondition(t *testing.T) {
Type: conditions.TypeGatewayHealthy,
Status: metav1.ConditionFalse,
Reason: conditions.ReasonGatewayNotReady,
Message: "Pod is in the pending state because container: foo is not running due to: fooMessage",
Message: "Pod is in the pending state because container: foo is not running due to: fooMessage. Please check the container: foo logs.",
},
expectedAgentCondition: &metav1.Condition{
Type: conditions.TypeAgentHealthy,
Expand Down
2 changes: 1 addition & 1 deletion internal/reconciler/logparser/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestUpdateStatus(t *testing.T) {
require.NotNil(t, agentHealthyCond, "could not find condition of type %s", conditions.TypeAgentHealthy)
require.Equal(t, metav1.ConditionFalse, agentHealthyCond.Status)
require.Equal(t, conditions.ReasonAgentNotReady, agentHealthyCond.Reason)
require.Equal(t, "Pod is in the pending state because container: foo is not running due to: OOMKilled", agentHealthyCond.Message)
require.Equal(t, "Pod is in the pending state because container: foo is not running due to: OOMKilled. Please check the container: foo logs.", agentHealthyCond.Message)
require.Equal(t, updatedParser.Generation, agentHealthyCond.ObservedGeneration)
require.NotEmpty(t, agentHealthyCond.LastTransitionTime)
})
Expand Down
4 changes: 2 additions & 2 deletions internal/reconciler/logpipeline/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,14 +640,14 @@ func TestReconcile(t *testing.T) {
probeErr: &workloadstatus.PodIsPendingError{ContainerName: "foo", Reason: "OOMKilled", Message: ""},
expectedStatus: metav1.ConditionFalse,
expectedReason: conditions.ReasonAgentNotReady,
expectedMessage: "Pod is in the pending state because container: foo is not running due to: OOMKilled",
expectedMessage: "Pod is in the pending state because container: foo is not running due to: OOMKilled. Please check the container: foo logs.",
},
{
name: "pod is CrashLoop",
probeErr: &workloadstatus.PodIsPendingError{ContainerName: "foo", Message: "Error"},
expectedStatus: metav1.ConditionFalse,
expectedReason: conditions.ReasonAgentNotReady,
expectedMessage: "Pod is in the pending state because container: foo is not running due to: Error",
expectedMessage: "Pod is in the pending state because container: foo is not running due to: Error. Please check the container: foo logs.",
},
{
name: "no Pods deployed",
Expand Down
12 changes: 6 additions & 6 deletions internal/reconciler/metricpipeline/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func TestReconcile(t *testing.T) {
conditions.TypeGatewayHealthy,
metav1.ConditionFalse,
conditions.ReasonGatewayNotReady,
"Pod is in the pending state because container: foo is not running due to: Error")
"Pod is in the pending state because container: foo is not running due to: Error. Please check the container: foo logs.")

gatewayConfigBuilderMock.AssertExpectations(t)
})
Expand Down Expand Up @@ -307,7 +307,7 @@ func TestReconcile(t *testing.T) {
conditions.TypeAgentHealthy,
metav1.ConditionFalse,
conditions.ReasonAgentNotReady,
"Pod is in the pending state because container: is not running due to: Error")
"Pod is in the pending state because container: is not running due to: Error. Please check the container: logs.")

agentConfigBuilderMock.AssertExpectations(t)
gatewayConfigBuilderMock.AssertExpectations(t)
Expand Down Expand Up @@ -1176,15 +1176,15 @@ func TestReconcile(t *testing.T) {
probeGatewayErr: nil,
expectedStatus: metav1.ConditionFalse,
expectedReason: conditions.ReasonAgentNotReady,
expectedMessage: "Pod is in the pending state because container: foo is not running due to: OOMKilled",
expectedMessage: "Pod is in the pending state because container: foo is not running due to: OOMKilled. Please check the container: foo logs.",
},
{
name: "pod is CrashLoop",
probeAgentErr: &workloadstatus.PodIsPendingError{ContainerName: "foo", Message: "Error"},
probeGatewayErr: nil,
expectedStatus: metav1.ConditionFalse,
expectedReason: conditions.ReasonAgentNotReady,
expectedMessage: "Pod is in the pending state because container: foo is not running due to: Error",
expectedMessage: "Pod is in the pending state because container: foo is not running due to: Error. Please check the container: foo logs.",
},
{
name: "no Pods deployed",
Expand All @@ -1200,15 +1200,15 @@ func TestReconcile(t *testing.T) {
probeGatewayErr: &workloadstatus.PodIsPendingError{ContainerName: "foo", Message: "Error"},
expectedStatus: metav1.ConditionFalse,
expectedReason: conditions.ReasonGatewayNotReady,
expectedMessage: "Pod is in the pending state because container: foo is not running due to: Error",
expectedMessage: "Pod is in the pending state because container: foo is not running due to: Error. Please check the container: foo logs.",
},
{
name: "Container is not ready",
expectedStatus: metav1.ConditionFalse,
expectedReason: conditions.ReasonGatewayNotReady,
probeAgentErr: nil,
probeGatewayErr: &workloadstatus.PodIsPendingError{ContainerName: "foo", Reason: "OOMKilled"},
expectedMessage: "Pod is in the pending state because container: foo is not running due to: OOMKilled",
expectedMessage: "Pod is in the pending state because container: foo is not running due to: OOMKilled. Please check the container: foo logs.",
},
{
name: "Agent Rollout in progress",
Expand Down
8 changes: 4 additions & 4 deletions internal/reconciler/tracepipeline/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func TestReconcile(t *testing.T) {
conditions.TypeGatewayHealthy,
metav1.ConditionFalse,
conditions.ReasonGatewayNotReady,
"Pod is in the pending state because container: foo is not running due to: Error",
"Pod is in the pending state because container: foo is not running due to: Error. Please check the container: foo logs.",
)

gatewayConfigBuilderMock.AssertExpectations(t)
Expand Down Expand Up @@ -905,14 +905,14 @@ func TestReconcile(t *testing.T) {
probeGatewayErr: &workloadstatus.PodIsPendingError{ContainerName: "foo", Reason: "OOMKilled"},
expectedStatus: metav1.ConditionFalse,
expectedReason: conditions.ReasonGatewayNotReady,
expectedMessage: "Pod is in the pending state because container: foo is not running due to: OOMKilled",
expectedMessage: "Pod is in the pending state because container: foo is not running due to: OOMKilled. Please check the container: foo logs.",
},
{
name: "pod is craashbackloop",
name: "pod is crashbackloop",
probeGatewayErr: &workloadstatus.PodIsPendingError{ContainerName: "foo", Message: "Error"},
expectedStatus: metav1.ConditionFalse,
expectedReason: conditions.ReasonGatewayNotReady,
expectedMessage: "Pod is in the pending state because container: foo is not running due to: Error",
expectedMessage: "Pod is in the pending state because container: foo is not running due to: Error. Please check the container: foo logs.",
},
{
name: "no Pods deployed",
Expand Down
Loading

0 comments on commit 3430bd8

Please sign in to comment.