(feat) Add auto-discovery in k8s | Adarsh

This commit is contained in:
Adarsh K Kumar
2020-10-30 21:00:03 +05:30
parent d76caeeb35
commit 81e6e0b188
1170 changed files with 441034 additions and 14 deletions

14
main.go
View File

@ -3,15 +3,17 @@ package main
import (
"bytes"
"compress/gzip"
"github.com/TwinProduction/gatus/config"
"github.com/TwinProduction/gatus/security"
"github.com/TwinProduction/gatus/watchdog"
"github.com/prometheus/client_golang/prometheus/promhttp"
"log"
"net/http"
"os"
"strings"
"time"
"github.com/TwinProduction/gatus/config"
"github.com/TwinProduction/gatus/discovery"
"github.com/TwinProduction/gatus/security"
"github.com/TwinProduction/gatus/watchdog"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
const cacheTTL = 10 * time.Second
@ -24,6 +26,10 @@ var (
func main() {
cfg := loadConfiguration()
if cfg.AutoDiscoverK8SServices {
discoveredServices := discovery.GetServices(cfg)
cfg.Services = append(cfg.Services, discoveredServices...)
}
resultsHandler := serviceResultsHandler
if cfg.Security != nil && cfg.Security.IsValid() {
resultsHandler = security.Handler(serviceResultsHandler, cfg.Security)