Skip to content

Commit

Permalink
Replace apache pulsar client go repo on 3.0 branch (#1205)
Browse files Browse the repository at this point in the history
* Support status check for pulsarctl command (#1200)

* Support read config from env
* Add site toc content

(cherry picked from commit be22457)

* Migrate pulsar-admin-go to apache pulsar client go (#1170)

(cherry picked from commit 811717e)

Replace streamnative admin go repo use apache admin go repo
  • Loading branch information
tuteng authored Sep 11, 2023
1 parent 0aad200 commit d3dec24
Show file tree
Hide file tree
Showing 263 changed files with 737 additions and 558 deletions.
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/streamnative/pulsarctl
go 1.18

require (
github.com/apache/pulsar-client-go v0.9.0
github.com/apache/pulsar-client-go v0.9.1-0.20230816081803-fbee610ddcbf
github.com/docker/go-connections v0.4.0
github.com/fatih/color v1.7.0
github.com/ghodss/yaml v1.0.0
Expand All @@ -17,7 +17,6 @@ require (
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/streamnative/pulsar-admin-go v0.1.0
github.com/stretchr/testify v1.8.0
github.com/testcontainers/testcontainers-go v0.0.10
gopkg.in/yaml.v2 v2.4.0
Expand Down Expand Up @@ -62,7 +61,7 @@ require (
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
google.golang.org/grpc v1.38.0 // indirect
google.golang.org/protobuf v1.26.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
262 changes: 7 additions & 255 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/bookkeeper/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"net/http"
"path"

"github.com/streamnative/pulsar-admin-go/pkg/rest"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/rest"

"github.com/streamnative/pulsarctl/pkg/bookkeeper/bkdata"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/bookkeeper/ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package bookkeeper
import (
"strconv"

"github.com/streamnative/pulsar-admin-go/pkg/rest"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/rest"

"github.com/streamnative/pulsarctl/pkg/bookkeeper/bkdata"
)
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmdutils/cmdutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import (
"strings"
"time"

"github.com/apache/pulsar-client-go/pulsaradmin/pkg/admin"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/admin/config"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/rest"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
"github.com/streamnative/pulsar-admin-go/pkg/admin"
"github.com/streamnative/pulsar-admin-go/pkg/admin/config"
"github.com/streamnative/pulsar-admin-go/pkg/rest"

"github.com/streamnative/pulsarctl/pkg/bookkeeper"
)
Expand Down
29 changes: 26 additions & 3 deletions pkg/cmdutils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ import (
"io/ioutil"
"log"
"os"
"strconv"

"github.com/apache/pulsar-client-go/pulsaradmin/pkg/admin"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/admin/config"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/kris-nova/logger"
"github.com/magiconair/properties"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/admin"
"github.com/streamnative/pulsar-admin-go/pkg/admin/config"
"github.com/streamnative/pulsar-admin-go/pkg/utils"
"gopkg.in/yaml.v2"

"github.com/streamnative/pulsarctl/pkg/bookkeeper"
Expand Down Expand Up @@ -235,6 +236,28 @@ func LoadFromEnv() *ClusterConfig {
config.AuthPlugin = props.GetString("authPlugin", "")
config.TLSEnableHostnameVerification = props.GetBool("tlsEnableHostnameVerification", false)
}
} else if clientFromEnv, ok := os.LookupEnv("PULSAR_CLIENT_FROM_ENV"); ok && clientFromEnv == "true" {
if webServiceURL, ok := os.LookupEnv("webServiceUrl"); ok {
config.WebServiceURL = webServiceURL
}
if tlsAllowInsecureConnection, ok := os.LookupEnv("tlsAllowInsecureConnection"); ok {
config.TLSAllowInsecureConnection, _ = strconv.ParseBool(tlsAllowInsecureConnection)
}
if tlsTrustCertsFilePath, ok := os.LookupEnv("tlsTrustCertsFilePath"); ok {
config.TLSTrustCertsFilePath = tlsTrustCertsFilePath
}
if brokerServiceURL, ok := os.LookupEnv("brokerServiceUrl"); ok {
config.BKWebServiceURL = brokerServiceURL
}
if authParams, ok := os.LookupEnv("authParams"); ok {
config.AuthParams = authParams
}
if authPlugin, ok := os.LookupEnv("authPlugin"); ok {
config.AuthPlugin = authPlugin
}
if tlsEnableHostnameVerification, ok := os.LookupEnv("tlsEnableHostnameVerification"); ok {
config.TLSEnableHostnameVerification, _ = strconv.ParseBool(tlsEnableHostnameVerification)
}
} else {
ctxConf, err := readConfigFile()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/brokers/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"encoding/json"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/brokers/delete_dynamic_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package brokers

import (
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/brokers/namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ package brokers
import (
"errors"

"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/brokers/namespaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"encoding/json"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/brokers/update_dynamic_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package brokers

import (
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/brokerstats/allocator_stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"encoding/json"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/brokerstats/load_report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"encoding/json"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/brokerstats/mbeans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"encoding/json"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cluster/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package cluster

import (
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cluster/create_failure_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package cluster

import (
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/pkg/errors"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cluster/delete_failure_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package cluster

import (
"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cluster/get_failure_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"encoding/json"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cluster/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"regexp"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cluster/list_failure_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"encoding/json"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/ctl/cluster/tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build tls
// +build tls

package cluster
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cluster/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package cluster

import (
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cluster/update_failure_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package cluster

import (
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/pkg/errors"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cluster/update_failure_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"encoding/json"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cluster/update_peer_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package cluster

import (
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cluster/update_peer_clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"encoding/json"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cluster/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"encoding/json"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/context/create_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package context

import (
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/admin"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/admin"

"github.com/streamnative/pulsarctl/pkg/bookkeeper"
"github.com/streamnative/pulsarctl/pkg/cmdutils"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/context/create_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"os"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/context/delete_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"os"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/context/internal/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/imdario/mergo"
"gopkg.in/yaml.v2"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/context/rename_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"os"
"testing"

"github.com/streamnative/pulsar-admin-go/pkg/utils"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/ctl/functions/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package functions

import (
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/admin/config"
util "github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/admin/config"
util "github.com/streamnative/pulsar-admin-go/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
"github.com/streamnative/pulsarctl/pkg/ctl/utils"
Expand Down
4 changes: 2 additions & 2 deletions pkg/ctl/functions/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package functions

import (
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/admin/config"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/admin/config"
"github.com/streamnative/pulsar-admin-go/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/ctl/functions/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package functions

import (
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/admin/config"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/spf13/pflag"
"github.com/streamnative/pulsar-admin-go/pkg/admin/config"
"github.com/streamnative/pulsar-admin-go/pkg/utils"

"github.com/streamnative/pulsarctl/pkg/cmdutils"
)
Expand Down
Loading

0 comments on commit d3dec24

Please sign in to comment.