Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please do not log when you're not supposed to #11

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ func main() {

// If an envoy API was set and config is set to wait on envoy
if config.EnvoyAdminAPI != "" && !config.StartWithoutEnvoy {
log.Info("blocking until envoy starts")
if config.LoggingEnabled {
log.Info("blocking until envoy starts")
}
block()
}

Expand Down Expand Up @@ -134,15 +136,19 @@ func killGenericEndpoints() {
}

func killIstioWithAPI() (int, error) {
log.Infof("stopping Istio using Istio API '%s' (intended for Istio >v1.2)", config.IstioQuitAPI)
if config.LoggingEnabled {
log.Infof("stopping Istio using Istio API '%s' (intended for Istio >v1.2)", config.IstioQuitAPI)
}

url := fmt.Sprintf("%s/quitquitquit", config.IstioQuitAPI)
resp := typhon.NewRequest(context.Background(), "POST", url, nil).Send().Response()
if resp.Error != nil {
log.Warnf("sent POST to '%s', error: %s", url, resp.Error)
return 200, resp.Error
}
log.Infof("sent quitquitquit to Istio, status code: %d", resp.StatusCode)
if config.LoggingEnabled {
log.Infof("sent quitquitquit to Istio, status code: %d", resp.StatusCode)
}

return resp.StatusCode, resp.Error
}
Expand Down
Loading