diff --git a/go.mod b/go.mod index 7dcd338..98f764a 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/onsi/gomega v1.28.0 github.com/prometheus/client_golang v1.17.0 github.com/rs/zerolog v1.31.0 + k8s.io/apimachinery v0.28.2 k8s.io/client-go v0.28.2 ) @@ -55,7 +56,6 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/api v0.28.2 // indirect - k8s.io/apimachinery v0.28.2 // indirect k8s.io/klog/v2 v2.100.1 // indirect k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect diff --git a/main.go b/main.go index 6a9f5f9..7f3ce1d 100644 --- a/main.go +++ b/main.go @@ -245,6 +245,10 @@ func main() { port := getEnv("METRICS_PORT", "9100") adjustedPollingRate, _ = strconv.ParseBool(getEnv("ADJUSTED_POLLING_RATE", "false")) deployType = getEnv("DEPLOY_TYPE", "DaemonSet") + if deployType != "Deployment" && deployType != "DaemonSet" { + log.Error().Msg(fmt.Sprintf("deployType must be 'Deployment' or 'DaemonSet', got %s", deployType)) + os.Exit(1) + } http.Handle("/metrics", promhttp.Handler()) log.Info().Msg(fmt.Sprintf("Starting server listening on :%s", port)) err := http.ListenAndServe(fmt.Sprintf(":%s", port), nil)