Skip to content

Commit bd9e8b0

Browse files
committed
Don't require ACL tokens to run consul-dataplane
1 parent 414d1b5 commit bd9e8b0

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ RUN go build ./cmd/consul-dataplane
2323
FROM alpine:3.16 as consul-dataplane-container
2424
WORKDIR /root/
2525
RUN apk add gcompat
26-
COPY --from=consul-dataplane-binary /cdp/consul-dataplane ./
26+
COPY --from=consul-dataplane-binary /cdp/consul-dataplane /usr/local/bin/consul-dataplane
2727
COPY --from=envoy-binary /usr/local/bin/envoy /usr/local/bin/envoy
2828
ENTRYPOINT [ "./consul-dataplane" ]

pkg/consuldp/consul_dataplane.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"time"
1010

1111
"github.com/hashicorp/go-hclog"
12-
netaddrs "github.com/hashicorp/go-netaddrs"
12+
"github.com/hashicorp/go-netaddrs"
1313
"google.golang.org/grpc"
1414
"google.golang.org/grpc/credentials/insecure"
1515

@@ -60,10 +60,6 @@ func validateConfig(cfg *Config) error {
6060
switch {
6161
case cfg.Consul == nil || cfg.Consul.Addresses == "":
6262
return errors.New("consul addresses not specified")
63-
case cfg.Consul.Credentials == nil:
64-
return errors.New("consul credentials not specified")
65-
case cfg.Consul.Credentials.Static == nil || cfg.Consul.Credentials.Static.Token == "":
66-
return errors.New("only static credentials are supported but none were specified")
6763
case cfg.Consul.GRPCPort == 0:
6864
return errors.New("consul server gRPC port not specified")
6965
case cfg.Service == nil:
@@ -144,12 +140,14 @@ func (cdp *ConsulDataplane) Run(ctx context.Context) error {
144140
// TODO: Acquire ACL token and pass it in gRPC calls.
145141

146142
if err := cdp.setConsulServerSupportedFeatures(ctx); err != nil {
147-
return err
143+
cdp.logger.Error("failed to set supported features", "error", err)
144+
return fmt.Errorf("failed to set supported features: %w", err)
148145
}
149146

150147
cfg, err := cdp.bootstrapConfig(ctx)
151148
if err != nil {
152-
return err
149+
cdp.logger.Error("failed to get bootstrap config", "error", err)
150+
return fmt.Errorf("failed to get bootstrap config: %w", err)
153151
}
154152
cdp.logger.Debug("generated envoy bootstrap config", "config", string(cfg))
155153

@@ -159,10 +157,12 @@ func (cdp *ConsulDataplane) Run(ctx context.Context) error {
159157
BootstrapConfig: cfg,
160158
})
161159
if err != nil {
162-
return err
160+
cdp.logger.Error("failed to create new proxy", "error", err)
161+
return fmt.Errorf("failed to create new proxy: %w", err)
163162
}
164163
if err := proxy.Run(); err != nil {
165-
return err
164+
cdp.logger.Error("failed to run proxy", "error", err)
165+
return fmt.Errorf("failed to run proxy: %w", err)
166166
}
167167

168168
doneCh := make(chan error)

pkg/consuldp/consul_dataplane_test.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"net"
77
"testing"
88

9-
mock "github.com/stretchr/testify/mock"
9+
"github.com/stretchr/testify/mock"
1010
"github.com/stretchr/testify/require"
1111

1212
"github.com/hashicorp/consul-dataplane/internal/consul-proto/pbdataplane"
@@ -71,21 +71,6 @@ func TestNewConsulDPError(t *testing.T) {
7171
modFn: func(c *Config) { c.Consul.GRPCPort = 0 },
7272
expectErr: "consul server gRPC port not specified",
7373
},
74-
{
75-
name: "missing credentials",
76-
modFn: func(c *Config) { c.Consul.Credentials = nil },
77-
expectErr: "consul credentials not specified",
78-
},
79-
{
80-
name: "missing static credentials",
81-
modFn: func(c *Config) { c.Consul.Credentials.Static = nil },
82-
expectErr: "only static credentials are supported but none were specified",
83-
},
84-
{
85-
name: "missing static credentials token",
86-
modFn: func(c *Config) { c.Consul.Credentials.Static.Token = "" },
87-
expectErr: "only static credentials are supported but none were specified",
88-
},
8974
{
9075
name: "missing service config",
9176
modFn: func(c *Config) { c.Service = nil },

0 commit comments

Comments
 (0)