Add depot, attendant, jetfire, optimus, ota services with kustomize overlays

This commit is contained in:
Chris Rai
2026-01-31 15:35:07 -05:00
parent a0ec642ca1
commit 9a5cb2f547
404 changed files with 38817 additions and 16 deletions

View File

@@ -0,0 +1,59 @@
package controllers
import (
"time"
"github.com/fiskerinc/cloud-services/services/attendant/services"
"github.com/fiskerinc/cloud-services/pkg/health"
"github.com/fiskerinc/cloud-services/pkg/logger"
"github.com/pkg/errors"
)
var mismatchTypeError = errors.New("mismatch type error")
func HealthCheck() {
redis := health.NewRedisHealth(services.RedisClientPool())
server := health.HealthCheckServer{}
err := server.Serve([]health.Config{
{
Name: "db",
Check: health.NewPostgresCheck(services.GetDB().GetDBClient().GetConn()),
Timeout: time.Second * 1,
},
{
Name: "redis",
Check: redis.Check,
Timeout: time.Second * 1,
},
{
Name: "kafka",
Check: health.NewKafkaMultiCheck(getKafkaConsumer),
Timeout: time.Second * 1,
Vital: true,
},
})
if err != nil {
logger.Error().Err(err).Send()
}
}
func getKafkaConsumer() (connections []health.KafkaConnCheckInterface, err error) {
client, oldClient, err := services.GetKafkaConsumer()
if err != nil {
return connections, err
}
conn, ok := client.(health.KafkaConnCheckInterface)
if !ok {
return nil, errors.WithStack(mismatchTypeError)
}
connections = append(connections, conn)
oldConn, ok := oldClient.(health.KafkaConnCheckInterface)
if !ok {
return connections, errors.WithStack(mismatchTypeError)
}
connections = append(connections, oldConn)
return connections, nil
}