Skip to content

Commit

Permalink
Merge pull request #307 from Kong/fix/grpc-access-log-server-on-k8s
Browse files Browse the repository at this point in the history
kuma-cp: fix an issue with Access Log Server on k8s (`kuma-cp` was configuring Envoy to use a Unix socket other than `kuma-dp` was actually listening on)
  • Loading branch information
yskopets authored Oct 3, 2019
2 parents f7ff4f7 + 40a9a33 commit 1c71770
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pkg/xds/bootstrap/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (b *bootstrapGenerator) Generate(ctx context.Context, request rest.Bootstra
if request.AdminPort != 0 {
adminPort = request.AdminPort
}
accessLogPipe := fmt.Sprintf("/tmp/kuma-access-logs-%s-%s-%s.sock", dataplane.Meta.GetName(), dataplane.Meta.GetMesh(), dataplane.Meta.GetNamespace())
accessLogPipe := fmt.Sprintf("/tmp/kuma-access-logs-%s-%s.sock", request.Name, request.Mesh)
params := configParameters{
Id: proxyId.String(),
Service: service,
Expand Down
15 changes: 8 additions & 7 deletions pkg/xds/bootstrap/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ package bootstrap

import (
"context"
"io/ioutil"
"net/http"
"path/filepath"
"strconv"
"strings"

mesh_proto "github.com/Kong/kuma/api/mesh/v1alpha1"
xds_config "github.com/Kong/kuma/pkg/config/xds"
"github.com/Kong/kuma/pkg/core/resources/apis/mesh"
Expand All @@ -12,11 +18,6 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
"io/ioutil"
"net/http"
"path/filepath"
"strconv"
"strings"
)

var _ = Describe("Bootstrap Server", func() {
Expand Down Expand Up @@ -102,11 +103,11 @@ var _ = Describe("Bootstrap Server", func() {
},
Entry("minimal data provided (universal)", testCase{
body: `{ "mesh": "default", "name": "dp-1" }`,
expectedConfigFile: "bootstrap.golden.yaml",
expectedConfigFile: "bootstrap.universal.golden.yaml",
}),
Entry("minimal data provided (k8s)", testCase{
body: `{ "mesh": "default", "name": "dp-1.default" }`,
expectedConfigFile: "bootstrap.golden.yaml",
expectedConfigFile: "bootstrap.k8s.golden.yaml",
}),
Entry("overridden admin port", testCase{
body: `{ "mesh": "default", "name": "dp-1.default", "adminPort": 1234 }`,
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-dp-1-default-default.sock
path: /tmp/kuma-access-logs-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 @@ -43,7 +43,7 @@ staticResources:
- endpoint:
address:
pipe:
path: /tmp/kuma-access-logs-dp-1-default-default.sock
path: /tmp/kuma-access-logs-dp-1.default-default.sock
name: access_log_sink
type: STATIC
upstreamConnectionOptions:
Expand Down
44 changes: 44 additions & 0 deletions pkg/xds/bootstrap/testdata/bootstrap.universal.golden.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
dynamicResources:
adsConfig:
apiType: GRPC
grpcServices:
- envoyGrpc:
clusterName: ads_cluster
cdsConfig:
ads: {}
ldsConfig:
ads: {}
node:
cluster: backend
id: default.dp-1.default
staticResources:
clusters:
- connectTimeout: 0.250s
http2ProtocolOptions: {}
loadAssignment:
clusterName: ads_cluster
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 127.0.0.1
portValue: 5678
name: ads_cluster
type: STRICT_DNS
upstreamConnectionOptions:
tcpKeepalive: {}
- connectTimeout: 1s
http2ProtocolOptions: {}
loadAssignment:
clusterName: access_log_sink
endpoints:
- lbEndpoints:
- endpoint:
address:
pipe:
path: /tmp/kuma-access-logs-dp-1-default.sock
name: access_log_sink
type: STATIC
upstreamConnectionOptions:
tcpKeepalive: {}

0 comments on commit 1c71770

Please sign in to comment.