-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MOD healthChecker notifiers settings
MOD extend bots and sinks with errorMsg
- Loading branch information
1 parent
9b6b3ce
commit 87e88de
Showing
12 changed files
with
192 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package bot | ||
|
||
import ( | ||
"github.com/kubeshop/botkube/internal/health" | ||
) | ||
|
||
type HealthNotifierBot interface { | ||
GetStatus() health.PlatformStatus | ||
} | ||
|
||
// FailedBot mock of bot, uses for healthChecker. | ||
type FailedBot struct { | ||
status health.PlatformStatusMsg | ||
failureReason health.FailureReasonMsg | ||
errorMsg string | ||
} | ||
|
||
// NewBotFailed creates a new FailedBot instance. | ||
func NewBotFailed(failureReason health.FailureReasonMsg, errorMsg string) *FailedBot { | ||
return &FailedBot{ | ||
status: health.StatusUnHealthy, | ||
failureReason: failureReason, | ||
errorMsg: errorMsg, | ||
} | ||
} | ||
|
||
// GetStatus gets bot status. | ||
func (b *FailedBot) GetStatus() health.PlatformStatus { | ||
return health.PlatformStatus{ | ||
Status: b.status, | ||
Restarts: "0/0", | ||
Reason: b.failureReason, | ||
ErrorMsg: b.errorMsg, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.