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

skipper: improve createDataClients errors #3260

Merged
merged 1 commit into from
Oct 1, 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
13 changes: 5 additions & 8 deletions skipper.go
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,7 @@ func createDataClients(o Options, cr *certregistry.CertRegistry) ([]routing.Data
for _, rf := range strings.Split(o.RoutesFile, ",") {
f, err := eskipfile.Open(rf)
if err != nil {
log.Error("error while opening eskip file", err)
return nil, err
return nil, fmt.Errorf("error while opening eskip file: %w", err)
}

clients = append(clients, f)
Expand All @@ -1060,8 +1059,7 @@ func createDataClients(o Options, cr *certregistry.CertRegistry) ([]routing.Data
HTTPTimeout: o.SourcePollTimeout,
})
if err != nil {
log.Errorf("error while loading routes from url %s: %s", url, err)
return nil, err
return nil, fmt.Errorf("error while loading routes from url %s: %w", url, err)
}
clients = append(clients, client)
}
Expand All @@ -1070,8 +1068,7 @@ func createDataClients(o Options, cr *certregistry.CertRegistry) ([]routing.Data
if o.InlineRoutes != "" {
ir, err := routestring.New(o.InlineRoutes)
if err != nil {
log.Error("error while parsing inline routes", err)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This log was also missing whitespace:

$ ./bin/skipper -inline-routes='* -> '
[APP]INFO[0000] Expose metrics in codahale format            
[APP]ERRO[0000] error while parsing inline routesparse failed after token ->, position 5: syntax error 
[APP]FATA[0000] parse failed after token ->, position 5: syntax error

return nil, err
return nil, fmt.Errorf("error while parsing inline routes: %w", err)
}

clients = append(clients, ir)
Expand All @@ -1089,7 +1086,7 @@ func createDataClients(o Options, cr *certregistry.CertRegistry) ([]routing.Data
})

if err != nil {
return nil, err
return nil, fmt.Errorf("error while creating etcd client: %w", err)
}

clients = append(clients, etcdClient)
Expand All @@ -1101,7 +1098,7 @@ func createDataClients(o Options, cr *certregistry.CertRegistry) ([]routing.Data

kubernetesClient, err := kubernetes.New(kops)
if err != nil {
return nil, err
return nil, fmt.Errorf("error while creating kubernetes data client: %w", err)
}
clients = append(clients, kubernetesClient)
}
Expand Down
Loading