From 7740639fe451b385eca0a60b6566d645c264a7f9 Mon Sep 17 00:00:00 2001 From: Benedikt Bongartz Date: Mon, 7 Oct 2024 19:36:39 +0200 Subject: [PATCH] internal/components: move default address Signed-off-by: Benedikt Bongartz --- internal/components/multi_endpoint.go | 2 +- internal/components/receivers/helpers.go | 24 ------------------------ internal/components/single_endpoint.go | 2 +- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/internal/components/multi_endpoint.go b/internal/components/multi_endpoint.go index 30162eeaee..891f648ab0 100644 --- a/internal/components/multi_endpoint.go +++ b/internal/components/multi_endpoint.go @@ -118,7 +118,7 @@ func (m *MultiPortReceiver) GetRBACRules(logr.Logger, interface{}) ([]rbacv1.Pol type MultiPortBuilder[ComponentConfigType any] []Builder[ComponentConfigType] func NewMultiPortReceiverBuilder(name string) MultiPortBuilder[*MultiProtocolEndpointConfig] { - return append(MultiPortBuilder[*MultiProtocolEndpointConfig]{}, NewBuilder[*MultiProtocolEndpointConfig]().WithName(name)) + return append(MultiPortBuilder[*MultiProtocolEndpointConfig]{}, NewBuilder[*MultiProtocolEndpointConfig]().WithName(name).WithDefaultRecAddress("0.0.0.0")) } func NewProtocolBuilder(name string, port int32) Builder[*MultiProtocolEndpointConfig] { diff --git a/internal/components/receivers/helpers.go b/internal/components/receivers/helpers.go index 6ecb85b60a..89a3cb6fe7 100644 --- a/internal/components/receivers/helpers.go +++ b/internal/components/receivers/helpers.go @@ -52,112 +52,88 @@ var ( components.NewMultiPortReceiverBuilder("otlp"). AddPortMapping(components.NewProtocolBuilder("grpc", 4317). WithAppProtocol(&components.GrpcProtocol). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(4317)). AddPortMapping(components.NewProtocolBuilder("http", 4318). WithAppProtocol(&components.HttpProtocol). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(4318)). MustBuild(), components.NewMultiPortReceiverBuilder("skywalking"). AddPortMapping(components.NewProtocolBuilder(components.GrpcProtocol, 11800). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(11800). WithAppProtocol(&components.GrpcProtocol)). AddPortMapping(components.NewProtocolBuilder(components.HttpProtocol, 12800). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(12800). WithAppProtocol(&components.HttpProtocol)). MustBuild(), components.NewMultiPortReceiverBuilder("jaeger"). AddPortMapping(components.NewProtocolBuilder(components.GrpcProtocol, 14250). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(14250). WithProtocol(corev1.ProtocolTCP). WithAppProtocol(&components.GrpcProtocol)). AddPortMapping(components.NewProtocolBuilder("thrift_http", 14268). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(14268). WithProtocol(corev1.ProtocolTCP). WithAppProtocol(&components.HttpProtocol)). AddPortMapping(components.NewProtocolBuilder("thrift_compact", 6831). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(6831). WithProtocol(corev1.ProtocolUDP)). AddPortMapping(components.NewProtocolBuilder("thrift_binary", 6832). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(6832). WithProtocol(corev1.ProtocolUDP)). MustBuild(), components.NewMultiPortReceiverBuilder("loki"). AddPortMapping(components.NewProtocolBuilder(components.GrpcProtocol, 9095). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(9095). WithAppProtocol(&components.GrpcProtocol)). AddPortMapping(components.NewProtocolBuilder(components.HttpProtocol, 3100). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(3100). WithAppProtocol(&components.HttpProtocol)). MustBuild(), components.NewSinglePortParserBuilder("awsxray", 2000). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(2000). WithProtocol(corev1.ProtocolUDP). MustBuild(), components.NewSinglePortParserBuilder("carbon", 2003). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(2003). MustBuild(), components.NewSinglePortParserBuilder("collectd", 8081). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(8081). MustBuild(), components.NewSinglePortParserBuilder("fluentforward", 8006). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(8006). MustBuild(), components.NewSinglePortParserBuilder("influxdb", 8086). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(8086). MustBuild(), components.NewSinglePortParserBuilder("opencensus", 55678). WithAppProtocol(nil). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(55678). MustBuild(), components.NewSinglePortParserBuilder("sapm", 7276). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(7276). MustBuild(), components.NewSinglePortParserBuilder("signalfx", 9943). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(9943). MustBuild(), components.NewSinglePortParserBuilder("splunk_hec", 8088). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(8088). MustBuild(), components.NewSinglePortParserBuilder("statsd", 8125). - WithDefaultRecAddress("0.0.0.0"). WithProtocol(corev1.ProtocolUDP). WithTargetPort(8125). MustBuild(), components.NewSinglePortParserBuilder("tcplog", components.UnsetPort). - WithDefaultRecAddress("0.0.0.0"). WithProtocol(corev1.ProtocolTCP). MustBuild(), components.NewSinglePortParserBuilder("udplog", components.UnsetPort). - WithDefaultRecAddress("0.0.0.0"). WithProtocol(corev1.ProtocolUDP). MustBuild(), components.NewSinglePortParserBuilder("wavefront", 2003). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(2003). MustBuild(), components.NewSinglePortParserBuilder("zipkin", 9411). WithAppProtocol(&components.HttpProtocol). WithProtocol(corev1.ProtocolTCP). - WithDefaultRecAddress("0.0.0.0"). WithTargetPort(3100). MustBuild(), NewScraperParser("prometheus"), diff --git a/internal/components/single_endpoint.go b/internal/components/single_endpoint.go index 51a6124b61..5cb52e49e7 100644 --- a/internal/components/single_endpoint.go +++ b/internal/components/single_endpoint.go @@ -84,7 +84,7 @@ func internalParseSingleEndpoint(logger logr.Logger, name string, failSilently b } func NewSinglePortParserBuilder(name string, port int32) Builder[*SingleEndpointConfig] { - return NewBuilder[*SingleEndpointConfig]().WithPort(port).WithName(name).WithPortParser(ParseSingleEndpoint).WithDefaultsApplier(AddressDefaulter) + return NewBuilder[*SingleEndpointConfig]().WithPort(port).WithName(name).WithPortParser(ParseSingleEndpoint).WithDefaultsApplier(AddressDefaulter).WithDefaultRecAddress("0.0.0.0") } func NewSilentSinglePortParserBuilder(name string, port int32) Builder[*SingleEndpointConfig] {