Skip to content

Commit

Permalink
Merge pull request #719 from Comcast/external-URL-fix
Browse files Browse the repository at this point in the history
Fixes variable assignment to allow use of custom external reporting U…
  • Loading branch information
zjhans committed Nov 5, 2020
2 parents 53208d2 + 333af2a commit 1050686
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
19 changes: 8 additions & 11 deletions cmd/kuberhealthy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,17 @@ func init() {
log.Println("WARNING: Failed to read configuration file from disk:", err)
}

// set env variables into config if specified
// set env variables into config if specified. otherwise set external check URL to default
externalCheckURL, err := getEnvVar(KHExternalReportingURL)
if err != nil {
cfg.ExternalCheckReportingURL = externalCheckURL
if len(podNamespace) == 0 {
log.Fatalln("KH_EXTERNAL_REPORTING_URL environment variable not set and POD_NAMESPACE environment variable was blank. Could not determine Kuberhealthy callback URL.")
}
log.Infoln("KH_EXTERNAL_REPORTING_URL environment variable not set, using default value")
externalCheckURL = "http://kuberhealthy." + podNamespace + ".svc.cluster.local/externalCheckStatus"
}
cfg.ExternalCheckReportingURL = externalCheckURL
log.Infoln("External check reporting URL set to:", cfg.ExternalCheckReportingURL)

// parse and set logging level
parsedLogLevel, err := log.ParseLevel(cfg.LogLevel)
Expand All @@ -125,15 +131,6 @@ func init() {
log.SetLevel(log.DebugLevel)
}

// parse external check URL configuration
if len(cfg.ExternalCheckReportingURL) == 0 {
if len(podNamespace) == 0 {
log.Fatalln("KH_EXTERNAL_REPORTING_URL environment variable not set and POD_NAMESPACE environment variable was blank. Could not determine Kuberhealthy callback URL.")
}
cfg.ExternalCheckReportingURL = "http://kuberhealthy." + podNamespace + ".svc.cluster.local/externalCheckStatus"
}
log.Infoln("External check reporting URL set to:", cfg.ExternalCheckReportingURL)

// Handle force master mode
if cfg.EnableForceMaster == true {
log.Infoln("Enabling forced master mode")
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/kuberhealthy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ prometheus:

image:
repository: kuberhealthy/kuberhealthy
tag: v2.3.0
tag: v2.3.1

resources:
requests:
Expand Down

0 comments on commit 1050686

Please sign in to comment.