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

fix(*) traffic logging to tcp backends #1394

Merged
merged 3 commits into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion app/kuma-dp/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func newRunCmd() *cobra.Command {
if err != nil {
return err
}
server := accesslogs.NewAccessLogServer()
server := accesslogs.NewAccessLogServer(cfg.Dataplane)

componentMgr := component.NewManager(leader_memory.NewNeverLeaderElector())
if err := componentMgr.Add(server, dataplane); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions app/kuma-dp/pkg/dataplane/accesslogs/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/pkg/errors"
"google.golang.org/grpc"

kumadp "github.com/kumahq/kuma/pkg/config/app/kuma-dp"
"github.com/kumahq/kuma/pkg/core"
"github.com/kumahq/kuma/pkg/core/runtime/component"
)
Expand All @@ -31,9 +32,8 @@ func (s *accessLogServer) NeedLeaderElection() bool {
return false
}

func NewAccessLogServer() *accessLogServer {
id := core.NewUUID()
var address = fmt.Sprintf("/tmp/%s.sock", id)
func NewAccessLogServer(dataplane kumadp.Dataplane) *accessLogServer {
address := fmt.Sprintf("/tmp/%s-%s.sock", dataplane.Name, dataplane.Mesh)
return &accessLogServer{
server: grpc.NewServer(),
newHandler: defaultHandler,
Expand Down
2 changes: 1 addition & 1 deletion pkg/xds/bootstrap/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (b *bootstrapGenerator) generateFor(proxyId core_xds.ProxyId, dataplane *co
}
certBytes = base64.StdEncoding.EncodeToString(cert)
}
accessLogPipe := fmt.Sprintf("/tmp/kuma-access-logs-%s-%s.sock", request.Name, request.Mesh)
accessLogPipe := fmt.Sprintf("/tmp/%s-%s.sock", request.Name, request.Mesh)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it's better to create a function like:

func AccessLogPipeName(name, mesh string) string {
    return fmt.Sprintf("/tmp/%s-%s.sock", name, mesh)
}

and use it from both places? That'd allow avoiding bugs like this one, what do you think?

params := configParameters{
Id: proxyId.String(),
Service: service,
Expand Down
2 changes: 1 addition & 1 deletion pkg/xds/bootstrap/testdata/bootstrap.k8s.golden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ staticResources:
- endpoint:
address:
pipe:
path: /tmp/kuma-access-logs-dp-1.default-default.sock
path: /tmp/dp-1.default-default.sock
name: access_log_sink
type: STATIC
upstreamConnectionOptions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ staticResources:
- endpoint:
address:
pipe:
path: /tmp/kuma-access-logs-dp-1.default-default.sock
path: /tmp/dp-1.default-default.sock
name: access_log_sink
type: STATIC
upstreamConnectionOptions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ staticResources:
- endpoint:
address:
pipe:
path: /tmp/kuma-access-logs-dp-1-default.sock
path: /tmp/dp-1-default.sock
name: access_log_sink
type: STATIC
upstreamConnectionOptions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ staticResources:
- endpoint:
address:
pipe:
path: /tmp/kuma-access-logs-name.namespace-mesh.sock
path: /tmp/name.namespace-mesh.sock
name: access_log_sink
type: STATIC
upstreamConnectionOptions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ staticResources:
- endpoint:
address:
pipe:
path: /tmp/kuma-access-logs-name.namespace-mesh.sock
path: /tmp/name.namespace-mesh.sock
name: access_log_sink
type: STATIC
upstreamConnectionOptions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ staticResources:
- endpoint:
address:
pipe:
path: /tmp/kuma-access-logs-name.namespace-mesh.sock
path: /tmp/name.namespace-mesh.sock
name: access_log_sink
type: STATIC
upstreamConnectionOptions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ staticResources:
- endpoint:
address:
pipe:
path: /tmp/kuma-access-logs-name.namespace-mesh.sock
path: /tmp/name.namespace-mesh.sock
name: access_log_sink
type: STATIC
upstreamConnectionOptions:
Expand Down