mirror of
https://github.com/fluxcd/flux2.git
synced 2025-11-01 01:25:53 +08:00
check: exit 1 on control plane failed checks
This commit is contained in:
@ -202,14 +202,16 @@ func componentsCheck() bool {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
ok := true
|
||||||
for _, deployment := range components {
|
for _, deployment := range components {
|
||||||
command := fmt.Sprintf("kubectl -n %s rollout status deployment %s --timeout=%s",
|
command := fmt.Sprintf("kubectl -n %s rollout status deployment %s --timeout=%s",
|
||||||
namespace, deployment, timeout.String())
|
namespace, deployment, timeout.String())
|
||||||
if output, err := utils.execCommand(ctx, ModeCapture, command); err != nil {
|
if output, err := utils.execCommand(ctx, ModeCapture, command); err != nil {
|
||||||
logFailure("%s: %s", deployment, strings.TrimSuffix(output, "\n"))
|
logFailure("%s: %s", deployment, strings.TrimSuffix(output, "\n"))
|
||||||
|
ok = false
|
||||||
} else {
|
} else {
|
||||||
logSuccess("%s is healthy", deployment)
|
logSuccess("%s is healthy", deployment)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
return ok
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user