You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NET-59: Generate bootstrap config and run Envoy (#2)
This is a minimum viable implementation of the consul-dataplane process that
configures and runs an Envoy proxy.
It has a few major limitations:
1. Only static ACL tokens (i.e. not auth-methods) are supported.
2. In lieu of the ADS proxy we will eventually provide, Envoy is configured to
connect directly to the Consul server.
3. If Envoy crashes `consul-dataplane` will exit too rather than attempting to
restart it.
The envoy package implements a simple wrapper around the Envoy process.
It writes the given configuration to a FIFO pipe (a pattern established in
hashicorp/consul#5964), starts the process, and notifies
callers via the `Exited` channel if the process exits unexpectedly.
This is unit tested using a dummy program called fake-envoy which writes its
received arguments and configuration to disk for the Go tests to verify.
As there's a fair amount of complex logic, regexes, etc. in our bootstrap
configuration already implemented by the `consul connect envoy` command, we're
borrowing the relevant files from Consul repo (see the copy-bootstrap-config
make target). Eventually, this command will be removed from Consul and these
files will only belong in this repository.
We're unit(ish?) testing this using a combination of golden files and checking
the configuration is valid by running Envoy in "validate mode" (on demand when
you run the tests with the -validate flag).
As ingress gateways may have no listeners configured, `consul connect envoy`
creates one with a /ready HTTP endpoint that can be used by checks - it does
this based on the -address flag. In consul-dataplane you can opt-in to this
behavior by passing the -envoy-ready-bind-address and -envoy-ready-bind-port
flags. This works regardless of the service kind.
" b) on failure - exit with a non-zero code and optionally print an error message of upto 1024 bytes to stderr.\n"+
25
43
" Refer to https://github.com/hashicorp/go-netaddrs#summary for more details and examples.")
26
44
27
-
flag.IntVar(&grpcPort, "grpc-port", 8502, "gRPC port on Consul servers")
45
+
flag.IntVar(&grpcPort, "grpc-port", 8502, "gRPC port on Consul servers.")
28
46
29
47
flag.StringVar(&logLevel, "log-level", "info", "Log level of the messages to print. "+
30
48
"Available log levels are \"trace\", \"debug\", \"info\", \"warn\", and \"error\".")
31
49
32
50
flag.BoolVar(&logJSON, "log-json", false, "Controls consul-dataplane logging in JSON format. By default this is false.")
51
+
52
+
flag.StringVar(&nodeName, "service-node-name", "", "The name of the node to which the proxy service instance is registered.")
53
+
flag.StringVar(&nodeID, "service-node-id", "", "The ID of the node to which the proxy service instance is registered.")
54
+
flag.StringVar(&serviceID, "proxy-service-id", "", "The proxy service instance's ID.")
55
+
flag.StringVar(&namespace, "service-namespace", "", "The Consul Enterprise namespace in which the proxy service instance is registered.")
56
+
flag.StringVar(&partition, "service-partition", "", "The Consul Enterprise partition in which the proxy service instance is registered.")
57
+
58
+
flag.StringVar(&token, "static-token", "", "The ACL token used to authenticate requests to Consul servers (when -login-method is set to static).")
59
+
60
+
flag.BoolVar(&useCentralTelemetryConfig, "telemetry-use-central-config", true, "Controls whether the proxy will apply the central telemetry configuration.")
61
+
62
+
flag.StringVar(&adminBindAddr, "envoy-admin-bind-address", "127.0.0.1", "The address on which the Envoy admin server will be available.")
63
+
flag.IntVar(&adminBindPort, "envoy-admin-bind-port", 19000, "The port on which the Envoy admin server will be available.")
64
+
flag.StringVar(&readyBindAddr, "envoy-ready-bind-address", "", "The address on which Envoy's readiness probe will be available.")
65
+
flag.IntVar(&readyBindPort, "envoy-ready-bind-port", 0, "The port on which Envoy's readiness probe will be available.")
33
66
}
34
67
35
68
// validateFlags performs semantic validation of the flag values
0 commit comments