From 7e07fc14d553aa583e04b5fd5f9c005901936a64 Mon Sep 17 00:00:00 2001 From: Andrei Matei Date: Thu, 9 Jun 2022 15:35:46 -0400 Subject: [PATCH] obsservice: move the http proxy to its own package Release note: None --- pkg/obsservice/cmd/obsservice/BUILD.bazel | 2 +- pkg/obsservice/cmd/obsservice/main.go | 6 +++--- pkg/obsservice/obslib/BUILD.bazel | 15 --------------- pkg/obsservice/obslib/httpproxy/BUILD.bazel | 15 +++++++++++++++ .../obslib/{lib.go => httpproxy/reverseproxy.go} | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 pkg/obsservice/obslib/httpproxy/BUILD.bazel rename pkg/obsservice/obslib/{lib.go => httpproxy/reverseproxy.go} (99%) diff --git a/pkg/obsservice/cmd/obsservice/BUILD.bazel b/pkg/obsservice/cmd/obsservice/BUILD.bazel index 33e9b7092238..568b9e733198 100644 --- a/pkg/obsservice/cmd/obsservice/BUILD.bazel +++ b/pkg/obsservice/cmd/obsservice/BUILD.bazel @@ -7,7 +7,7 @@ go_library( visibility = ["//visibility:private"], deps = [ "//pkg/cli/exit", - "//pkg/obsservice/obslib", + "//pkg/obsservice/obslib/httpproxy", "//pkg/obsservice/obslib/migrations", "@com_github_spf13_cobra//:cobra", ], diff --git a/pkg/obsservice/cmd/obsservice/main.go b/pkg/obsservice/cmd/obsservice/main.go index d351ec3ac467..eab93130f991 100644 --- a/pkg/obsservice/cmd/obsservice/main.go +++ b/pkg/obsservice/cmd/obsservice/main.go @@ -14,7 +14,7 @@ import ( "fmt" "github.com/cockroachdb/cockroach/pkg/cli/exit" - "github.com/cockroachdb/cockroach/pkg/obsservice/obslib" + "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/httpproxy" "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/migrations" "github.com/spf13/cobra" ) @@ -27,7 +27,7 @@ var RootCmd = &cobra.Command{ from one or more CockroachDB clusters.`, Run: func(cmd *cobra.Command, args []string) { ctx := context.Background() - cfg := obslib.ReverseHTTPProxyConfig{ + cfg := httpproxy.ReverseHTTPProxyConfig{ HTTPAddr: httpAddr, TargetURL: targetURL, CACertPath: caCertPath, @@ -40,7 +40,7 @@ from one or more CockroachDB clusters.`, } // Block forever running the proxy. - <-obslib.NewReverseHTTPProxy(ctx, cfg).RunAsync(ctx) + <-httpproxy.NewReverseHTTPProxy(ctx, cfg).RunAsync(ctx) }, } diff --git a/pkg/obsservice/obslib/BUILD.bazel b/pkg/obsservice/obslib/BUILD.bazel index 10bf7083089b..e69de29bb2d1 100644 --- a/pkg/obsservice/obslib/BUILD.bazel +++ b/pkg/obsservice/obslib/BUILD.bazel @@ -1,15 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "obslib", - srcs = ["lib.go"], - importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib", - visibility = ["//visibility:public"], - deps = [ - "//pkg/cli/exit", - "//pkg/util/log", - "//pkg/util/syncutil", - "@com_github_cockroachdb_cmux//:cmux", - "@com_github_cockroachdb_errors//:errors", - ], -) diff --git a/pkg/obsservice/obslib/httpproxy/BUILD.bazel b/pkg/obsservice/obslib/httpproxy/BUILD.bazel new file mode 100644 index 000000000000..897933ce8716 --- /dev/null +++ b/pkg/obsservice/obslib/httpproxy/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "httpproxy", + srcs = ["reverseproxy.go"], + importpath = "github.com/cockroachdb/cockroach/pkg/obsservice/obslib/httpproxy", + visibility = ["//visibility:public"], + deps = [ + "//pkg/cli/exit", + "//pkg/util/log", + "//pkg/util/syncutil", + "@com_github_cockroachdb_cmux//:cmux", + "@com_github_cockroachdb_errors//:errors", + ], +) diff --git a/pkg/obsservice/obslib/lib.go b/pkg/obsservice/obslib/httpproxy/reverseproxy.go similarity index 99% rename from pkg/obsservice/obslib/lib.go rename to pkg/obsservice/obslib/httpproxy/reverseproxy.go index e89c9f7b97e8..d1de62367312 100644 --- a/pkg/obsservice/obslib/lib.go +++ b/pkg/obsservice/obslib/httpproxy/reverseproxy.go @@ -6,7 +6,7 @@ // // http://www.apache.org/licenses/LICENSE-2.0 -package obslib +package httpproxy import ( "context"