Skip to content
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

[all] Promote component.UseLocalHostAsDefaultHost feature gate to beta #33658

Merged
merged 8 commits into from
Jun 27, 2024
45 changes: 45 additions & 0 deletions .chloggen/mx-psi_localhost-fg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Use this changelog template to create an entry for release notes.
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: all

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Promote `component.UseLocalHostAsDefaultHost` feature gate to beta. This changes default endpoints from 0.0.0.0 to localhost"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [30702]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
This change affects the following components:
- extension/awsproxy
- extension/health_check
- extension/health_checkv2
- extension/jaegerremotesampling
- internal/aws/proxy
- processor/remotetap
- receiver/awsfirehose
- receiver/awsxray
- receiver/influxdb
- receiver/jaeger
- receiver/loki
- receiver/opencensus
- receiver/sapm
- receiver/signalfx
- receiver/skywalking
- receiver/splunk_hec
- receiver/zipkin
- receiver/zookeeper
mx-psi marked this conversation as resolved.
Show resolved Hide resolved

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
2 changes: 1 addition & 1 deletion extension/awsproxy/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestFactory_CreateDefaultConfig(t *testing.T) {
assert.Equal(t, &Config{
ProxyConfig: proxy.Config{
TCPAddrConfig: confignet.TCPAddrConfig{
Endpoint: "0.0.0.0:2000",
Endpoint: "localhost:2000",
},
},
}, cfg)
Expand Down
2 changes: 1 addition & 1 deletion extension/healthcheckextension/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestFactory_CreateDefaultConfig(t *testing.T) {
cfg := createDefaultConfig()
assert.Equal(t, &Config{
ServerConfig: confighttp.ServerConfig{
Endpoint: "0.0.0.0:13133",
Endpoint: "localhost:13133",
},
CheckCollectorPipeline: defaultCheckCollectorPipelineSettings(),
Path: "/",
Expand Down
8 changes: 4 additions & 4 deletions extension/jaegerremotesampling/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ func TestLoadConfig(t *testing.T) {
{
id: component.NewID(metadata.Type),
expected: &Config{
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "0.0.0.0:5778"},
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "localhost:5778"},
GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:14250",
Endpoint: "localhost:14250",
Transport: confignet.TransportTypeTCP,
}},
Source: Source{
Expand All @@ -44,9 +44,9 @@ func TestLoadConfig(t *testing.T) {
{
id: component.NewIDWithName(metadata.Type, "1"),
expected: &Config{
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "0.0.0.0:5778"},
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "localhost:5778"},
GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:14250",
Endpoint: "localhost:14250",
Transport: confignet.TransportTypeTCP,
}},
Source: Source{
Expand Down
4 changes: 2 additions & 2 deletions extension/jaegerremotesampling/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
func TestCreateDefaultConfig(t *testing.T) {
// prepare and test
expected := &Config{
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "0.0.0.0:5778"},
HTTPServerConfig: &confighttp.ServerConfig{Endpoint: "localhost:5778"},
GRPCServerConfig: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:14250",
Endpoint: "localhost:14250",
Transport: confignet.TransportTypeTCP,
}},
}
Expand Down
6 changes: 3 additions & 3 deletions internal/common/localhostgate/featuregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const UseLocalHostAsDefaultHostID = "component.UseLocalHostAsDefaultHost"
var UseLocalHostAsDefaultHostfeatureGate = mustRegisterOrLoad(
featuregate.GlobalRegistry(),
UseLocalHostAsDefaultHostID,
featuregate.StageAlpha,
featuregate.StageBeta,
featuregate.WithRegisterDescription("controls whether server-like receivers and extensions such as the OTLP receiver use localhost as the default host for their endpoints"),
)

Expand Down Expand Up @@ -60,8 +60,8 @@ func EndpointForPort(port int) string {
// LogAboutUseLocalHostAsDefault logs about the upcoming change from 0.0.0.0 to localhost on server-like components.
func LogAboutUseLocalHostAsDefault(logger *zap.Logger) {
if !UseLocalHostAsDefaultHostfeatureGate.IsEnabled() {
logger.Warn(
"The default endpoints for all servers in components will change to use localhost instead of 0.0.0.0 in a future version. Use the feature gate to preview the new default.",
logger.Info(
"The default endpoints for all servers in components have changed to use localhost instead of 0.0.0.0. Use the feature gate to temporarily revert to the previous default.",
zap.String("feature gate ID", UseLocalHostAsDefaultHostID),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
k8sattributes:
extract:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
k8sattributes:
filter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
k8sattributes:
filter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
k8sattributes:
filter:
Expand Down
2 changes: 1 addition & 1 deletion processor/remotetapprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import (

func TestCreateDefaultConfig(t *testing.T) {
cfg := createDefaultConfig().(*Config)
assert.Equal(t, "0.0.0.0:12001", cfg.Endpoint)
assert.Equal(t, "localhost:12001", cfg.Endpoint)
assert.EqualValues(t, 1, cfg.Limit)
}
4 changes: 2 additions & 2 deletions receiver/awsxrayreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestLoadConfig(t *testing.T) {
},
ProxyServer: &proxy.Config{
TCPAddrConfig: confignet.TCPAddrConfig{
Endpoint: "0.0.0.0:2000",
Endpoint: "localhost:2000",
},
ProxyAddress: "",
TLSSetting: configtls.ClientConfig{
Expand All @@ -59,7 +59,7 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(metadata.Type, "proxy_server"),
expected: &Config{
AddrConfig: confignet.AddrConfig{
Endpoint: "0.0.0.0:2000",
Endpoint: "localhost:2000",
Transport: confignet.TransportTypeUDP,
},
ProxyServer: &proxy.Config{
Expand Down
10 changes: 5 additions & 5 deletions receiver/jaegerreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ func TestLoadConfig(t *testing.T) {
Protocols: Protocols{
GRPC: &configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:14250",
Endpoint: "localhost:14250",
Transport: confignet.TransportTypeTCP,
},
},
ThriftHTTP: &confighttp.ServerConfig{
Endpoint: "0.0.0.0:14268",
Endpoint: "localhost:14268",
},
ThriftCompact: &ProtocolUDP{
Endpoint: "0.0.0.0:6831",
Endpoint: "localhost:6831",
ServerConfigUDP: defaultServerConfigUDP(),
},
ThriftBinary: &ProtocolUDP{
Endpoint: "0.0.0.0:6832",
Endpoint: "localhost:6832",
ServerConfigUDP: defaultServerConfigUDP(),
},
},
Expand All @@ -98,7 +98,7 @@ func TestLoadConfig(t *testing.T) {
},
},
ThriftCompact: &ProtocolUDP{
Endpoint: "0.0.0.0:6831",
Endpoint: "localhost:6831",
ServerConfigUDP: defaultServerConfigUDP(),
},
},
Expand Down
2 changes: 1 addition & 1 deletion receiver/jaegerreceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func TestCreateInvalidHTTPEndpoint(t *testing.T) {
r, err := factory.CreateTracesReceiver(context.Background(), set, cfg, nil)

assert.NoError(t, err, "unexpected error creating receiver")
assert.Equal(t, "0.0.0.0:14268", r.(*jReceiver).config.HTTPServerConfig.Endpoint, "http port should be default")
assert.Equal(t, "localhost:14268", r.(*jReceiver).config.HTTPServerConfig.Endpoint, "http port should be default")
}

func TestCreateInvalidThriftBinaryEndpoint(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
receivers:
k8s_cluster:
Expand Down
1 change: 1 addition & 0 deletions receiver/k8sobjectsreceiver/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func TestE2E(t *testing.T) {
f := otlpreceiver.NewFactory()
cfg := f.CreateDefaultConfig().(*otlpreceiver.Config)
cfg.HTTP = nil
cfg.GRPC.NetAddr.Endpoint = "0.0.0.0:4317"
logsConsumer := new(consumertest.LogsSink)
rcvr, err := f.CreateLogsReceiver(context.Background(), receivertest.NewNopSettings(), cfg, logsConsumer)
require.NoError(t, rcvr.Start(context.Background(), componenttest.NewNopHost()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
transform/k8sobjectsNS:
error_mode: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ data:
tls:
insecure: true
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
receivers:
kubeletstats:
Expand Down
4 changes: 2 additions & 2 deletions receiver/lokireceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ func TestLoadConfig(t *testing.T) {
Protocols: Protocols{
GRPC: &configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:3600",
Endpoint: "localhost:3600",
Transport: confignet.TransportTypeTCP,
},
},
HTTP: &confighttp.ServerConfig{
Endpoint: "0.0.0.0:3500",
Endpoint: "localhost:3500",
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions receiver/opencensusreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestLoadConfig(t *testing.T) {
expected: &Config{
ServerConfig: configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:55678",
Endpoint: "localhost:55678",
Transport: confignet.TransportTypeTCP,
},
ReadBufferSize: 512 * 1024,
Expand All @@ -71,7 +71,7 @@ func TestLoadConfig(t *testing.T) {
expected: &Config{
ServerConfig: configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:55678",
Endpoint: "localhost:55678",
Transport: confignet.TransportTypeTCP,
},
MaxRecvMsgSizeMiB: 32,
Expand All @@ -91,7 +91,7 @@ func TestLoadConfig(t *testing.T) {
expected: &Config{
ServerConfig: configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:55678",
Endpoint: "localhost:55678",
Transport: confignet.TransportTypeTCP,
},
ReadBufferSize: 512 * 1024,
Expand All @@ -109,7 +109,7 @@ func TestLoadConfig(t *testing.T) {
expected: &Config{
ServerConfig: configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:55678",
Endpoint: "localhost:55678",
Transport: confignet.TransportTypeTCP,
},
ReadBufferSize: 512 * 1024,
Expand Down
4 changes: 2 additions & 2 deletions receiver/sapmreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(metadata.Type, "tls"),
expected: &Config{
ServerConfig: confighttp.ServerConfig{
Endpoint: "0.0.0.0:7276",
Endpoint: "localhost:7276",
TLSSetting: &configtls.ServerConfig{
Config: configtls.Config{
CertFile: "/test.crt",
Expand All @@ -58,7 +58,7 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(metadata.Type, "passthrough"),
expected: &Config{
ServerConfig: confighttp.ServerConfig{
Endpoint: "0.0.0.0:7276",
Endpoint: "localhost:7276",
},
AccessTokenPassthroughConfig: splunk.AccessTokenPassthroughConfig{
AccessTokenPassthrough: true,
Expand Down
2 changes: 1 addition & 1 deletion receiver/signalfxreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(metadata.Type, "tls"),
expected: &Config{
ServerConfig: confighttp.ServerConfig{
Endpoint: "0.0.0.0:9943",
Endpoint: "localhost:9943",
TLSSetting: &configtls.ServerConfig{
Config: configtls.Config{
CertFile: "/test.crt",
Expand Down
18 changes: 15 additions & 3 deletions receiver/skywalkingreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,20 @@ func TestLoadConfig(t *testing.T) {
expected component.Config
}{
{
id: component.NewIDWithName(metadata.Type, ""),
expected: createDefaultConfig(),
id: component.NewIDWithName(metadata.Type, ""),
expected: &Config{
Protocols: Protocols{
HTTP: &confighttp.ServerConfig{
Endpoint: "0.0.0.0:12800",
},
GRPC: &configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:11800",
Transport: confignet.TransportTypeTCP,
},
},
},
},
},
{
id: component.NewIDWithName(metadata.Type, "customname"),
Expand All @@ -48,7 +60,7 @@ func TestLoadConfig(t *testing.T) {
Protocols: Protocols{
GRPC: &configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:11800",
Endpoint: "localhost:11800",
Transport: confignet.TransportTypeTCP,
},
},
Expand Down
2 changes: 1 addition & 1 deletion receiver/splunkhecreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(metadata.Type, "tls"),
expected: &Config{
ServerConfig: confighttp.ServerConfig{
Endpoint: "0.0.0.0:8088",
Endpoint: "localhost:8088",
TLSSetting: &configtls.ServerConfig{
Config: configtls.Config{
CertFile: "/test.crt",
Expand Down
2 changes: 1 addition & 1 deletion receiver/zipkinreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

const (
defaultHTTPPort = 9411
defaultBindEndpoint = "0.0.0.0:9411"
defaultBindEndpoint = "localhost:9411"
)

// NewFactory creates a new Zipkin receiver factory
Expand Down
Loading