-
Notifications
You must be signed in to change notification settings - Fork 324
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
inject envoy_telemetry_bind_socket_dir proxy config when telemetry collector is enabled #2143
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
```release-note:feature | ||
consul-telemetry-collector: Configure envoy proxy config during registration when consul-telemetry-collector is enabled. | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,9 +44,10 @@ const ( | |
terminatingGateway = "terminating-gateway" | ||
ingressGateway = "ingress-gateway" | ||
|
||
kubernetesSuccessReasonMsg = "Kubernetes health checks passing" | ||
envoyPrometheusBindAddr = "envoy_prometheus_bind_addr" | ||
defaultNS = "default" | ||
kubernetesSuccessReasonMsg = "Kubernetes health checks passing" | ||
envoyPrometheusBindAddr = "envoy_prometheus_bind_addr" | ||
envoyTelemetryCollectorBindSocketDir = "envoy_telemetry_collector_bind_socket_dir" | ||
defaultNS = "default" | ||
|
||
// clusterIPTaggedAddressName is the key for the tagged address to store the service's cluster IP and service port | ||
// in Consul. Note: This value should not be changed without a corresponding change in Consul. | ||
|
@@ -119,6 +120,10 @@ type Controller struct { | |
// to Consul client agents. | ||
EnableAutoEncrypt bool | ||
|
||
// EnableTelemetryCollector controls whether the proxy service should be registered | ||
// with config to enable telemetry forwarding. | ||
EnableTelemetryCollector bool | ||
|
||
MetricsConfig metrics.Config | ||
Log logr.Logger | ||
|
||
|
@@ -482,6 +487,10 @@ func (r *Controller) createServiceRegistrations(pod corev1.Pod, serviceEndpoints | |
proxyConfig.Config[envoyPrometheusBindAddr] = prometheusScrapeListener | ||
} | ||
|
||
if r.EnableTelemetryCollector { | ||
proxyConfig.Config[envoyTelemetryCollectorBindSocketDir] = "/consul/connect-inject" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a blocker but I am thinking that maybe the directory should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does If we want to create a dedicated emptyDir volume for it we can. I figured it was a bit heavy handed given we already have a dir for connect related coordination. |
||
} | ||
|
||
if consulServicePort > 0 { | ||
proxyConfig.LocalServiceAddress = "127.0.0.1" | ||
proxyConfig.LocalServicePort = consulServicePort | ||
|
@@ -761,6 +770,10 @@ func (r *Controller) createGatewayRegistrations(pod corev1.Pod, serviceEndpoints | |
} | ||
} | ||
|
||
if r.EnableTelemetryCollector { | ||
service.Proxy.Config[envoyTelemetryCollectorBindSocketDir] = "/consul/service" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to above. Maybe |
||
} | ||
|
||
serviceRegistration := &api.CatalogRegistration{ | ||
Node: common.ConsulNodeNameFromK8sNode(pod.Spec.NodeName), | ||
Address: pod.Status.HostIP, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be toggleable on a per pod basis through annotations? Most of our features allow you to turn a feature on globally through the helm chart or per pod using annotations.
An example, is how we check if metrics is enabled on the annotation (https://github.com/hashicorp/consul-k8s/blob/main/control-plane/connect-inject/metrics/metrics_configuration.go#L72)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats an interesting idea. I guess if I was operating a cluster I wouldn't want consumers to be able to disable telemetry. We currently assume the feature is either enabled or disabled cluster wide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be up for exploring adding this in the future though.