diff --git a/CHANGELOG.md b/CHANGELOG.md index c38fd62bd11..bed08cfc8db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,12 @@ Changes by Version ### Backend Changes -#### Breaking changes +#### Breaking Changes + +* Remove deprecated CLI flags ([#2751](https://github.com/jaegertracing/jaeger/issues/2751), [@LostLaser](https://github.com/LostLaser)): + * `--collector.http-port` is replaced by `--collector.http-server.host-port` + * `--collector.grpc-port` is replaced by `--collector.grpc-server.host-port` + * `--collector.zipkin.http-port` is replaced by `--collector.zipkin.host-port` * Remove deprecated flags `--health-check-http-port` & `--admin-http-port`, please use `--admin.http.host-port` ([#2752](https://github.com/jaegertracing/jaeger/pull/2752), [@pradeepnnv](https://github.com/pradeepnnv)) diff --git a/cmd/collector/app/builder_flags.go b/cmd/collector/app/builder_flags.go index 839329812cf..a02e55c34ab 100644 --- a/cmd/collector/app/builder_flags.go +++ b/cmd/collector/app/builder_flags.go @@ -29,22 +29,15 @@ const ( collectorDynQueueSizeMemory = "collector.queue-size-memory" collectorQueueSize = "collector.queue-size" collectorNumWorkers = "collector.num-workers" - collectorHTTPPort = "collector.http-port" - collectorGRPCPort = "collector.grpc-port" // CollectorHTTPHostPort is the flag for collector HTTP port CollectorHTTPHostPort = "collector.http-server.host-port" // CollectorGRPCHostPort is the flag for collector gRPC port - CollectorGRPCHostPort = "collector.grpc-server.host-port" - collectorZipkinHTTPPort = "collector.zipkin.http-port" + CollectorGRPCHostPort = "collector.grpc-server.host-port" // CollectorZipkinHTTPHostPort is the flag for Zipkin HTTP port CollectorZipkinHTTPHostPort = "collector.zipkin.host-port" collectorTags = "collector.tags" collectorZipkinAllowedOrigins = "collector.zipkin.allowed-origins" collectorZipkinAllowedHeaders = "collector.zipkin.allowed-headers" - - collectorHTTPPortWarning = "(deprecated, will be removed after 2020-06-30 or in release v1.20.0, whichever is later)" - collectorGRPCPortWarning = "(deprecated, will be removed after 2020-06-30 or in release v1.20.0, whichever is later)" - collectorZipkinHTTPPortWarning = "(deprecated, will be removed after 2020-06-30 or in release v1.20.0, whichever is later)" ) var tlsFlagsConfig = tlscfg.ServerFlagsConfig{ @@ -81,9 +74,6 @@ type CollectorOptions struct { func AddFlags(flags *flag.FlagSet) { flags.Int(collectorQueueSize, DefaultQueueSize, "The queue size of the collector") flags.Int(collectorNumWorkers, DefaultNumWorkers, "The number of workers pulling items from the queue") - flags.Int(collectorHTTPPort, 0, collectorHTTPPortWarning+" see --"+CollectorHTTPHostPort) - flags.Int(collectorGRPCPort, 0, collectorGRPCPortWarning+" see --"+CollectorGRPCHostPort) - flags.Int(collectorZipkinHTTPPort, 0, collectorZipkinHTTPPortWarning+" see --"+CollectorZipkinHTTPHostPort) flags.Uint(collectorDynQueueSizeMemory, 0, "(experimental) The max memory size in MiB to use for the dynamic queue.") flags.String(collectorTags, "", "One or more tags to be added to the Process tags of all spans passing through this collector. Ex: key1=value1,key2=${envVar:defaultValue}") flags.String(collectorZipkinAllowedOrigins, "*", "Comma separated list of allowed origins for the Zipkin collector service, default accepts all") @@ -109,9 +99,9 @@ func (cOpts *CollectorOptions) InitFromViper(v *viper.Viper) *CollectorOptions { cOpts.DynQueueSizeMemory = v.GetUint(collectorDynQueueSizeMemory) * 1024 * 1024 // we receive in MiB and store in bytes cOpts.QueueSize = v.GetInt(collectorQueueSize) cOpts.NumWorkers = v.GetInt(collectorNumWorkers) - cOpts.CollectorHTTPHostPort = ports.GetAddressFromCLIOptions(v.GetInt(collectorHTTPPort), v.GetString(CollectorHTTPHostPort)) - cOpts.CollectorGRPCHostPort = ports.GetAddressFromCLIOptions(v.GetInt(collectorGRPCPort), v.GetString(CollectorGRPCHostPort)) - cOpts.CollectorZipkinHTTPHostPort = ports.GetAddressFromCLIOptions(v.GetInt(collectorZipkinHTTPPort), v.GetString(CollectorZipkinHTTPHostPort)) + cOpts.CollectorHTTPHostPort = ports.FormatHostPort(v.GetString(CollectorHTTPHostPort)) + cOpts.CollectorGRPCHostPort = ports.FormatHostPort(v.GetString(CollectorGRPCHostPort)) + cOpts.CollectorZipkinHTTPHostPort = ports.FormatHostPort(v.GetString(CollectorZipkinHTTPHostPort)) cOpts.CollectorTags = flags.ParseJaegerTags(v.GetString(collectorTags)) cOpts.CollectorZipkinAllowedOrigins = v.GetString(collectorZipkinAllowedOrigins) cOpts.CollectorZipkinAllowedHeaders = v.GetString(collectorZipkinAllowedHeaders) diff --git a/ports/ports.go b/ports/ports.go index 449ed9a918d..6ab2e997f81 100644 --- a/ports/ports.go +++ b/ports/ports.go @@ -60,6 +60,11 @@ func GetAddressFromCLIOptions(port int, hostPort string) string { return PortToHostPort(port) } + return FormatHostPort(hostPort) +} + +// FormatHostPort returns hostPort in a usable format (host:port) if it wasn't already +func FormatHostPort(hostPort string) string { if hostPort == "" { return "" } diff --git a/ports/ports_test.go b/ports/ports_test.go index 2072b2bc19c..a57b375e28d 100644 --- a/ports/ports_test.go +++ b/ports/ports_test.go @@ -44,3 +44,10 @@ func TestGetAddressFromCLIOptionsLegacy(t *testing.T) { }) } } + +func TestFormatHostPort(t *testing.T) { + assert.Equal(t, ":42", FormatHostPort("42")) + assert.Equal(t, ":831", FormatHostPort(":831")) + assert.Equal(t, "", FormatHostPort("")) + assert.Equal(t, "localhost:42", FormatHostPort("localhost:42")) +}