Skip to content

Commit

Permalink
validate deploy_type on startup (fixes #32) (#33)
Browse files Browse the repository at this point in the history
Co-authored-by: Chen Anidam <chen.anidam@catonetworks.com>
  • Loading branch information
canidam and Chen Anidam authored Oct 26, 2023
1 parent 23db55a commit 12d54a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 12d54a1

Please sign in to comment.