mirror of https://github.com/linkerd/linkerd2.git
add jaeger check: to confirm whether the jaeger injector pod is in running state or not (#5528)
Currently, the linkerd jaeger check runs multiple checks but it doesn't have a check to confirm the state of the jaeger injector to be running. This commit adds that required check to confirm the running state of the jaeger injector pod. Fixes #5495 Signed-off-by: Yashvardhan Kukreja <yash.kukreja.98@gmail.com>
This commit is contained in:
parent
c416e78261
commit
b67bbe157b
|
@ -65,7 +65,7 @@ func jaegerCategory(hc *healthcheck.HealthChecker) (*healthcheck.Category, error
|
|||
checkers = append(checkers,
|
||||
*healthcheck.NewChecker("collector pod is running").
|
||||
WithHintAnchor("l5d-jaeger-collector-running").
|
||||
Warning().
|
||||
Fatal().
|
||||
WithRetryDeadline(hc.RetryDeadline).
|
||||
SurfaceErrorOnRetry().
|
||||
WithCheck(func(ctx context.Context) error {
|
||||
|
@ -74,13 +74,13 @@ func jaegerCategory(hc *healthcheck.HealthChecker) (*healthcheck.Category, error
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return healthcheck.CheckPodsRunning(podList.Items)
|
||||
return healthcheck.CheckPodsRunning(podList.Items, fmt.Sprintf("No collector pods found in the %s namespace", namespace))
|
||||
}))
|
||||
|
||||
checkers = append(checkers,
|
||||
*healthcheck.NewChecker("jaeger pod is running").
|
||||
WithHintAnchor("l5d-jaeger-jaeger-running").
|
||||
Warning().
|
||||
Fatal().
|
||||
WithRetryDeadline(hc.RetryDeadline).
|
||||
SurfaceErrorOnRetry().
|
||||
WithCheck(func(ctx context.Context) error {
|
||||
|
@ -89,7 +89,22 @@ func jaegerCategory(hc *healthcheck.HealthChecker) (*healthcheck.Category, error
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return healthcheck.CheckPodsRunning(podList.Items)
|
||||
return healthcheck.CheckPodsRunning(podList.Items, fmt.Sprintf("No jaeger pods found in the %s namespace", namespace))
|
||||
}))
|
||||
|
||||
checkers = append(checkers,
|
||||
*healthcheck.NewChecker("jaeger injector pod is running").
|
||||
WithHintAnchor("l5d-jaeger-jaeger-running").
|
||||
Fatal().
|
||||
WithRetryDeadline(hc.RetryDeadline).
|
||||
SurfaceErrorOnRetry().
|
||||
WithCheck(func(ctx context.Context) error {
|
||||
// Check for Jaeger Injector pod
|
||||
podList, err := kubeAPI.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{LabelSelector: "component=jaeger-injector"})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return healthcheck.CheckPodsRunning(podList.Items, fmt.Sprintf("No jaeger injector pods found in the %s namespace", namespace))
|
||||
}))
|
||||
|
||||
checkers = append(checkers,
|
||||
|
@ -97,7 +112,7 @@ func jaegerCategory(hc *healthcheck.HealthChecker) (*healthcheck.Category, error
|
|||
WithHintAnchor("l5d-jaeger-pods-injection").
|
||||
Warning().
|
||||
WithCheck(func(ctx context.Context) error {
|
||||
// Check for Jaeger pod
|
||||
// Check if Jaeger Extension pods have been injected
|
||||
pods, err := kubeAPI.GetPodsByNamespace(ctx, jaegerNamespace)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -2595,7 +2595,10 @@ func CheckForPods(pods []corev1.Pod, deployNames []string) error {
|
|||
}
|
||||
|
||||
// CheckPodsRunning checks if the given pods are in running state
|
||||
func CheckPodsRunning(pods []corev1.Pod) error {
|
||||
func CheckPodsRunning(pods []corev1.Pod, podsNotFoundMsg string) error {
|
||||
if len(pods) == 0 && podsNotFoundMsg != "" {
|
||||
return fmt.Errorf(podsNotFoundMsg)
|
||||
}
|
||||
for _, pod := range pods {
|
||||
if pod.Status.Phase != "Running" {
|
||||
return fmt.Errorf("%s status is %s", pod.Name, pod.Status.Phase)
|
||||
|
|
|
@ -146,7 +146,7 @@ func vizCategory(hc *healthcheck.HealthChecker) *healthcheck.Category {
|
|||
return err
|
||||
}
|
||||
|
||||
return healthcheck.CheckPodsRunning(pods)
|
||||
return healthcheck.CheckPodsRunning(pods, "")
|
||||
}))
|
||||
|
||||
checkers = append(checkers,
|
||||
|
|
Loading…
Reference in New Issue