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

update tproxy logging messages to be a bit more informative #514

Merged
merged 3 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion connect-inject/endpoints_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ func (r *EndpointsController) Reconcile(ctx context.Context, req ctrl.Request) (
// Note: the order of how we register services is important,
// and the connect-proxy service should come after the "main" service
// because its alias health check depends on the main service existing.
r.Log.Info("registering service with Consul", "name", serviceRegistration.Name)
r.Log.Info("registering service with Consul", "name", serviceRegistration.Name,
"serviceID", serviceRegistration.ID, "agentIP", pod.Status.HostIP)
err = client.Agent().ServiceRegister(serviceRegistration)
if err != nil {
r.Log.Error(err, "failed to register service", "name", serviceRegistration.Name)
Expand Down
6 changes: 6 additions & 0 deletions subcommand/connect-init/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func (c *Command) Run(args []string) int {
// Now wait for the service to be registered. Do this by querying the Agent for a service
// which maps to this pod+namespace.
var proxyID string
loggingRetryCounter := 0
var errServiceNameMismatch error
err = backoff.Retry(func() error {
filter := fmt.Sprintf("Meta[%q] == %q and Meta[%q] == %q", connectinject.MetaKeyPodName, c.flagPodName, connectinject.MetaKeyKubeNS, c.flagPodNamespace)
Expand All @@ -162,7 +163,12 @@ func (c *Command) Run(args []string) int {
}
// Wait for the service and the connect-proxy service to be registered.
if len(serviceList) != 2 {
loggingRetryCounter++
c.logger.Info("Unable to find registered services; retrying")
if loggingRetryCounter%10 == 0 {
c.logger.Info("Check to ensure a Kubernetes service has been created for this application, " +
"Status of the service registration can be found in the webhook logs.")
}
return fmt.Errorf("did not find correct number of services: %d", len(serviceList))
}
for _, svc := range serviceList {
Expand Down