This is an automated email from the ASF dual-hosted git repository.
zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git
The following commit(s) were added to refs/heads/master by this push:
new 8fd57d1b [operator] Reorganize part of the directory structure
8fd57d1b is described below
commit 8fd57d1b476c93a634e68b07d46ed64957a6dc9b
Author: mfordjody <[email protected]>
AuthorDate: Thu Oct 31 14:50:57 2024 +0800
[operator] Reorganize part of the directory structure
---
dubboctl/cmd/prompt/prompt.go | 7 +--
dubboctl/pkg/dashboard/all.go | 4 +-
dubboctl/pkg/deploy/build.go | 35 ++++++------
dubboctl/pkg/deploy/client.go | 34 ++++++------
dubboctl/pkg/deploy/create.go | 43 +++++++--------
dubboctl/pkg/deploy/create_test.go | 10 +---
dubboctl/pkg/deploy/deploy.go | 27 ++++-----
dubboctl/pkg/deploy/repository.go | 15 ++---
dubboctl/pkg/deploy/repository_test.go | 5 +-
dubboctl/pkg/deploy/util.go | 5 +-
dubboctl/pkg/manifest/diff.go | 2 +-
dubboctl/pkg/manifest/generate.go | 12 ++--
dubboctl/pkg/manifest/install.go | 4 +-
dubboctl/pkg/manifest/uninstall.go | 4 +-
dubboctl/pkg/profile/diff.go | 6 +-
dubboctl/pkg/profile/list.go | 6 +-
dubboctl/pkg/proxy/context.go | 2 +-
dubboctl/pkg/proxy/proxy.go | 2 +-
dubboctl/pkg/registry/registry.go | 5 +-
{dubboctl/operator => operator}/dubbo/client.go | 7 +--
.../operator => operator}/dubbo/client_test.go | 0
{dubboctl/operator => operator}/dubbo/deploy.tpl | 0
{dubboctl/operator => operator}/dubbo/deployer.go | 5 +-
.../operator => operator}/dubbo/dockerfile.go | 0
{dubboctl/operator => operator}/dubbo/dubbo.go | 0
.../operator => operator}/dubbo/dubbo_test.go | 0
{dubboctl/operator => operator}/dubbo/errors.go | 0
.../operator => operator}/dubbo/repositories.go | 0
.../dubbo/repositories_test.go | 39 ++++++-------
.../operator => operator}/dubbo/repository.go | 5 +-
{dubboctl/operator => operator}/dubbo/template.go | 5 +-
{dubboctl/operator => operator}/dubbo/templates.go | 5 +-
.../dubbo/templates_embedded.go | 7 +--
.../operator => operator}/dubbo/templates_test.go | 42 +++++++-------
.../customTemplateRepo/customRuntime/.gitinclude | 0
.../customRuntime/customTemplate/custom.impl | 0
.../customTemplateRepo/go/customTemplate/custom.go | 0
.../customTemplateRepo/node/json/index.js | 0
.../customTemplateRepo/node/json/json.js | 0
.../customTemplateRepo/test/tpla/customtpl.txt | 0
.../customTemplateRepo/test/tplb/executable.sh | 0
.../customTemplateRepo/test/tplc/customtpl.txt | 0
.../dubbo/testdata/repository-a.git/COMMIT_EDITMSG | 0
.../dubbo/testdata/repository-a.git/HEAD | 0
.../dubbo/testdata/repository-a.git/config | 0
.../dubbo/testdata/repository-a.git/description | 0
.../testdata/repository-a.git/hooks/.gitinclude | 0
.../dubbo/testdata/repository-a.git/index | Bin
.../dubbo/testdata/repository-a.git/info/exclude | 0
.../dubbo/testdata/repository-a.git/logs/HEAD | 0
.../testdata/repository-a.git/logs/refs/heads/main | 0
.../repository-a.git/logs/refs/remotes/origin/HEAD | 0
.../32/bad9e3775e80ae9b7483acf6d7630bf8b945e9 | Bin
.../88/3ff23f61018546cac0c302c5c75e3c65ed832d | Bin
.../91/f1295d025a69a8ae87296ea5fda680672275d9 | Bin
.../af/e663f9ef928be2b5cb93f836c0905e60f09ab2 | 0
.../d5/c0914f5e90ce1ccc3ee90e44ab610f466c774f | Bin
.../dd/c6c5f6af77cfd92693c2b5b910b22a26379d01 | Bin
.../e7/ca8dffd312a48aac1f2aadd64a13ac34e021b9 | Bin
.../ee/f72a905e2866c0e4b4d13cb14bf118c8e8aa0b | Bin
.../ef/1e6c8ed28e25dec915e8cd7479dacf671665ed | Bin
.../repository-a.git/objects/info/.gitinclude | 0
.../repository-a.git/objects/pack/.gitinclude | 0
...ck-3cc26077b1d72f3ffb9484d7baca188936db8c5e.idx | Bin
...k-3cc26077b1d72f3ffb9484d7baca188936db8c5e.pack | Bin
.../dubbo/testdata/repository-a.git/packed-refs | 0
.../repository-a.git/refs/heads/.gitinclude | 0
.../testdata/repository-a.git/refs/heads/main | 0
.../repository-a.git/refs/remotes/origin/HEAD | 0
.../repository-a.git/refs/tags/.gitinclude | 0
.../dubbo/testdata/repository.git/HEAD | 0
.../dubbo/testdata/repository.git/config | 0
.../dubbo/testdata/repository.git/description | 0
.../repository.git/hooks/applypatch-msg.sample | 0
.../repository.git/hooks/commit-msg.sample | 0
.../repository.git/hooks/fsmonitor-watchman.sample | 0
.../repository.git/hooks/post-update.sample | 0
.../repository.git/hooks/pre-applypatch.sample | 0
.../repository.git/hooks/pre-commit.sample | 0
.../repository.git/hooks/pre-merge-commit.sample | 0
.../testdata/repository.git/hooks/pre-push.sample | 0
.../repository.git/hooks/pre-rebase.sample | 0
.../repository.git/hooks/pre-receive.sample | 0
.../repository.git/hooks/prepare-commit-msg.sample | 0
.../repository.git/hooks/push-to-checkout.sample | 0
.../testdata/repository.git/hooks/update.sample | 0
.../dubbo/testdata/repository.git/info/exclude | 0
.../00/9641334a89d30963a68442a132e5f8ef389ba8 | Bin
.../27/d75d0e58009a59e1ff8a52a3297e1e0574138b | Bin
.../43/0739f6d9930f74a6aef1a410f0f0727d171cef | Bin
.../44/788c5d0e56a8bb819c56a307b6c8de4045e020 | Bin
.../93/bd2fa63bb19bf11231dde8709672bd1428e57c | Bin
.../b2/7e306a552e80fcae0bfa959bd6e8652de70c69 | Bin
.../b7/5832d0a4a4bb0409cca573b2c97b017d088f90 | Bin
.../c8/fdee8e0a172c9e1544bc127b2bfb35829ffe1f | 0
.../e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 | Bin
.../dubbo/testdata/repository.git/refs/heads/main | 0
.../testdata/repository.git/refs/heads/master | 0
{dubboctl/operator => operator}/dubbo/validate.go | 0
{dubboctl/operator => operator}/http/transport.go | 0
{dubboctl/operator => operator}/manifest/common.go | 13 ++---
.../operator => operator}/manifest/common_test.go | 0
.../manifest/render/render.go | 9 +--
.../manifest/render/render_test.go | 2 +-
.../manifest/render/testchart/.helmignore | 0
.../manifest/render/testchart/Chart.yaml | 0
.../manifest/render/testchart/templates/NOTES.txt | 0
.../render/testchart/templates/_helpers.tpl | 0
.../render/testchart/templates/deployment.yaml | 0
.../manifest/render/testchart/templates/hpa.yaml | 0
.../render/testchart/templates/ingress.yaml | 0
.../render/testchart/templates/service.yaml | 0
.../render/testchart/templates/serviceaccount.yaml | 0
.../testchart/templates/tests/test-connection.yaml | 0
.../manifest/render/testchart/values.yaml | 0
{dubboctl/operator => operator}/manifest/tree.go | 61 ++++++++++-----------
{dubboctl/operator => operator}/manifest/util.go | 0
{dubboctl/operator => operator}/mock/builder.go | 5 +-
{dubboctl/operator => operator}/mock/client.go | 2 +-
{dubboctl/operator => operator}/mock/pusher.go | 5 +-
.../pkg}/apis/dubbo.apache.org/v1alpha1/types.go | 0
.../operator => operator/pkg}/builders/builders.go | 5 +-
.../pkg}/builders/builders_test.go | 9 +--
.../pkg}/builders/dockerfile/build.go | 7 +--
.../pkg}/builders/pack/build.go | 11 ++--
.../pkg}/builders/pack/build_test.go | 7 +--
.../pkg}/builders/pack/mirror/error.go | 0
.../pkg}/builders/pack/mirror/mirror.go | 0
.../pkg}/docker/creds/credentials.go | 5 +-
.../pkg}/docker/creds/credentials_test.go | 9 +--
.../pkg}/docker/docker_client.go | 15 ++---
.../pkg}/docker/docker_client_ssh_test.go | 5 +-
.../pkg}/docker/docker_client_test.go | 5 +-
.../pkg}/docker/docker_client_windows_test.go | 5 +-
.../operator => operator/pkg}/docker/pusher.go | 5 +-
.../pkg}/docker/pusher_test.go | 7 +--
{dubboctl/operator => operator/pkg}/envoy/envoy.go | 0
.../pkg}/envoy/memory_limit_darwin.go | 0
.../pkg}/envoy/memory_limit_linux.go | 0
.../pkg}/envoy/memory_limit_windows.go | 0
.../pkg}/envoy/remote_bootstrap.go | 0
.../pkg}/filesystem/filesystem.go | 0
.../pkg}/generated/templates/generate.go | 2 +-
.../pkg}/generated/zz_filesystem_generated.go | 0
.../operator => operator/pkg}/identifier/const.go | 0
.../operator => operator/pkg}/identifier/path.go | 2 +-
{dubboctl/operator => operator/pkg}/kube/client.go | 0
{dubboctl/operator => operator/pkg}/kube/common.go | 0
.../operator => operator/pkg}/kube/common_test.go | 0
.../operator => operator/pkg}/kube/component.go | 29 +++++-----
{dubboctl/operator => operator/pkg}/kube/object.go | 5 +-
.../operator => operator/pkg}/kube/object_test.go | 0
.../operator => operator/pkg}/kube/operator.go | 4 +-
.../operator => operator/pkg}/kube/port_foward.go | 0
.../testdata/input/ctl_client-apply_manifest.yaml | 0
.../input/ctl_client-apply_object-create.yaml | 0
.../ctl_client-apply_object-update-before.yaml | 0
.../input/ctl_client-apply_object-update.yaml | 0
.../input/ctl_client-remove_manifest-before.yaml | 0
.../testdata/input/ctl_client-remove_manifest.yaml | 0
.../ctl_client-remove_object-delete-before.yaml | 0
.../input/ctl_client-remove_object-delete.yaml | 0
.../admin_component-render_manifest.golden.yaml | 0
.../want/ctl_client-apply_object-create.yaml | 0
.../want/ctl_client-apply_object-update.yaml | 0
.../nacos_component-render_manifest.golden.yaml | 0
...rometheus_component-render_manifest.golden.yaml | 0
...kywalking_component-render_manifest.golden.yaml | 0
.../zipkin_component-render_manifest.golden.yaml | 0
...zookeeper_component-render_manifest.golden.yaml | 0
.../pkg}/ssh/ssh_agent_conf.go | 0
.../pkg}/ssh/ssh_agent_conf_windows.go | 0
.../operator => operator/pkg}/ssh/ssh_dialer.go | 0
.../operator => operator/pkg}/ssh/terminal.go | 0
{dubboctl => operator/pkg}/templates/go/README.md | 0
.../pkg}/templates/go/common/.gitignore | 0
.../pkg}/templates/go/common/api/api.pb.go | 0
.../pkg}/templates/go/common/api/api.proto | 0
.../pkg}/templates/go/common/api/api_triple.pb.go | 0
.../pkg}/templates/go/common/cmd/app.go | 0
.../pkg}/templates/go/common/conf/dubbogo.yaml | 0
.../pkg}/templates/go/common/go.mod | 0
.../pkg}/templates/go/common/go.sum | 0
.../templates/go/common/pkg/service/service.go | 0
.../pkg}/templates/java/README.md | 0
.../pkg}/templates/java/common/.gitignore | 0
.../pkg}/templates/java/common/pom.xml | 0
.../java/com/example/demo/DemoApplication.java | 0
.../example/demo/demos/web/BasicController.java | 0
.../demo/demos/web/PathVariableController.java | 0
.../main/java/com/example/demo/demos/web/User.java | 0
.../com/example/demo/dubbo/api/DemoService.java | 0
.../com/example/demo/dubbo/consumer/Consumer.java | 0
.../demo/dubbo/service/DemoServiceImpl.java | 0
.../java/common/src/main/resources/application.yml | 0
.../common/src/main/resources/log4j.properties | 0
.../common/src/main/resources/static/index.html | 0
.../com/example/demo/DemoApplicationTests.java | 0
{dubboctl => operator/pkg}/templates/manifest.yaml | 0
.../operator => operator/pkg}/testing/testing.go | 0
{dubboctl/operator => operator/pkg}/util/config.go | 0
.../operator => operator/pkg}/util/config_test.go | 7 +--
{dubboctl/operator => operator/pkg}/util/env.go | 0
{dubboctl/operator => operator/pkg}/util/file.go | 0
{dubboctl/operator => operator/pkg}/util/filter.go | 0
.../operator => operator/pkg}/util/filter_test.go | 0
{dubboctl/operator => operator/pkg}/util/golden.go | 0
.../operator => operator/pkg}/util/golden_test.go | 0
{dubboctl/operator => operator/pkg}/util/names.go | 0
.../operator => operator/pkg}/util/names_test.go | 0
{dubboctl/operator => operator/pkg}/util/path.go | 0
.../operator => operator/pkg}/util/reflect.go | 0
.../operator => operator/pkg}/util/sortedset.go | 0
.../pkg}/util/testdata/TestLoad/dubbo/config.yaml | 0
.../pkg}/util/testdata/dubbo/config.yaml | 0
{dubboctl/operator => operator/pkg}/util/yaml.go | 0
.../operator => operator/pkg}/util/yaml_test.go | 0
.../operator => operator}/registry/registry.go | 0
{dubboctl/operator => operator}/registry/zk/zk.go | 5 +-
219 files changed, 235 insertions(+), 354 deletions(-)
diff --git a/dubboctl/cmd/prompt/prompt.go b/dubboctl/cmd/prompt/prompt.go
index ee7ced8a..169762f5 100644
--- a/dubboctl/cmd/prompt/prompt.go
+++ b/dubboctl/cmd/prompt/prompt.go
@@ -18,6 +18,8 @@ package prompt
import (
"bufio"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker/creds"
"io"
"os"
"strings"
@@ -30,11 +32,6 @@ import (
"golang.org/x/term"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker/creds"
-)
-
func NewPromptForCredentials(in io.Reader, out, errOut io.Writer)
func(registry string) (docker.Credentials, error) {
firstTime := true
return func(registry string) (docker.Credentials, error) {
diff --git a/dubboctl/pkg/dashboard/all.go b/dubboctl/pkg/dashboard/all.go
index 712cc63b..c7c18372 100644
--- a/dubboctl/pkg/dashboard/all.go
+++ b/dubboctl/pkg/dashboard/all.go
@@ -18,7 +18,8 @@ package dashboard
import (
"context"
"fmt"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/identifier"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/identifier"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/kube"
"io"
"net"
"os"
@@ -40,7 +41,6 @@ import (
)
import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/kube"
"github.com/apache/dubbo-kubernetes/pkg/core/logger"
)
diff --git a/dubboctl/pkg/deploy/build.go b/dubboctl/pkg/deploy/build.go
index 5e4cbaa0..e0956c13 100644
--- a/dubboctl/pkg/deploy/build.go
+++ b/dubboctl/pkg/deploy/build.go
@@ -18,6 +18,10 @@ package deploy
import (
"fmt"
"github.com/apache/dubbo-kubernetes/dubboctl/pkg/common"
+ dubbo2 "github.com/apache/dubbo-kubernetes/operator/dubbo"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/builders/dockerfile"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/builders/pack"
+ util2 "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"os"
"strings"
)
@@ -30,13 +34,6 @@ import (
"github.com/spf13/cobra"
)
-import (
-
"github.com/apache/dubbo-kubernetes/dubboctl/operator/builders/dockerfile"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/builders/pack"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
func AddBuild(baseCmd *cobra.Command, newClient ClientFactory) {
cmd := &cobra.Command{
Use: "build",
@@ -67,11 +64,11 @@ func AddBuild(baseCmd *cobra.Command, newClient
ClientFactory) {
}
func runBuildCmd(cmd *cobra.Command, newClient ClientFactory) error {
- if err := util.CreatePaths(); err != nil {
+ if err := util2.CreatePaths(); err != nil {
return err
}
cfg := newBuildConfig(cmd)
- f, err := dubbo.NewDubbo(cfg.Path)
+ f, err := dubbo2.NewDubbo(cfg.Path)
if err != nil {
return err
}
@@ -81,7 +78,7 @@ func runBuildCmd(cmd *cobra.Command, newClient ClientFactory)
error {
return err
}
if !f.Initialized() {
- return dubbo.NewErrNotInitialized(f.Root)
+ return dubbo2.NewErrNotInitialized(f.Root)
}
cfg.Configure(f)
@@ -111,9 +108,9 @@ func runBuildCmd(cmd *cobra.Command, newClient
ClientFactory) error {
return nil
}
-func (c *buildConfig) Prompt(d *dubbo.Dubbo) (*buildConfig, error) {
+func (c *buildConfig) Prompt(d *dubbo2.Dubbo) (*buildConfig, error) {
var err error
- if !util.InteractiveTerminal() {
+ if !util2.InteractiveTerminal() {
return c, nil
}
@@ -136,13 +133,13 @@ func (c *buildConfig) Prompt(d *dubbo.Dubbo)
(*buildConfig, error) {
return c, err
}
-func (c buildConfig) buildclientOptions() ([]dubbo.Option, error) {
- var o []dubbo.Option
+func (c buildConfig) buildclientOptions() ([]dubbo2.Option, error) {
+ var o []dubbo2.Option
if c.UseDockerfile {
- o = append(o, dubbo.WithBuilder(dockerfile.NewBuilder()))
+ o = append(o, dubbo2.WithBuilder(dockerfile.NewBuilder()))
} else {
- o = append(o, dubbo.WithBuilder(pack.NewBuilder()))
+ o = append(o, dubbo2.WithBuilder(pack.NewBuilder()))
}
return o, nil
@@ -182,7 +179,7 @@ func newBuildConfig(cmd *cobra.Command) *buildConfig {
return c
}
-func (c *buildConfig) Configure(f *dubbo.Dubbo) {
+func (c *buildConfig) Configure(f *dubbo2.Dubbo) {
if c.Path == "" {
root, err := os.Getwd()
if err != nil {
@@ -210,9 +207,9 @@ func (c *buildConfig) Configure(f *dubbo.Dubbo) {
envs[parts[0]] = parts[1]
}
}
- f.Build.BuildEnvs = make([]dubbo.Env, 0, len(envs))
+ f.Build.BuildEnvs = make([]dubbo2.Env, 0, len(envs))
for k, v := range envs {
- f.Build.BuildEnvs = append(f.Build.BuildEnvs, dubbo.Env{
+ f.Build.BuildEnvs = append(f.Build.BuildEnvs,
dubbo2.Env{
Name: &k,
Value: &v,
})
diff --git a/dubboctl/pkg/deploy/client.go b/dubboctl/pkg/deploy/client.go
index 39653864..ca173238 100644
--- a/dubboctl/pkg/deploy/client.go
+++ b/dubboctl/pkg/deploy/client.go
@@ -16,18 +16,18 @@
package deploy
import (
+ dubbo2 "github.com/apache/dubbo-kubernetes/operator/dubbo"
+ dubbohttp "github.com/apache/dubbo-kubernetes/operator/http"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/builders/pack"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker/creds"
+ config "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"net/http"
"os"
)
import (
"github.com/apache/dubbo-kubernetes/dubboctl/cmd/prompt"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/builders/pack"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker/creds"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
- dubbohttp "github.com/apache/dubbo-kubernetes/dubboctl/operator/http"
- config "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
)
// ClientFactory defines a constructor which assists in the creation of a
Client
@@ -36,34 +36,34 @@ import (
// by commands by default.
// See NewClientFactory which constructs a minimal ClientFactory for use
// during testing.
-type ClientFactory func(...dubbo.Option) (*dubbo.Client, func())
+type ClientFactory func(...dubbo2.Option) (*dubbo2.Client, func())
-func NewClient(options ...dubbo.Option) (*dubbo.Client, func()) {
+func NewClient(options ...dubbo2.Option) (*dubbo2.Client, func()) {
var (
t = newTransport(false)
c = newCredentialsProvider(config.Dir(), t)
d = newDubboDeployer()
- o = []dubbo.Option{
- dubbo.WithRepositoriesPath(config.RepositoriesPath()),
- dubbo.WithBuilder(pack.NewBuilder()),
- dubbo.WithPusher(docker.NewPusher(
+ o = []dubbo2.Option{
+ dubbo2.WithRepositoriesPath(config.RepositoriesPath()),
+ dubbo2.WithBuilder(pack.NewBuilder()),
+ dubbo2.WithPusher(docker.NewPusher(
docker.WithCredentialsProvider(c),
docker.WithTransport(t))),
- dubbo.WithDeployer(d),
+ dubbo2.WithDeployer(d),
}
)
// Client is constructed with standard options plus any additional
options
// which either augment or override the defaults.
- client := dubbo.New(append(o, options...)...)
+ client := dubbo2.New(append(o, options...)...)
cleanup := func() {}
return client, cleanup
}
-func newDubboDeployer() dubbo.Deployer {
- var options []dubbo.DeployerOpt
+func newDubboDeployer() dubbo2.Deployer {
+ var options []dubbo2.DeployerOpt
- return dubbo.NewDeployer(options...)
+ return dubbo2.NewDeployer(options...)
}
// newTransport returns a transport with cluster-flavor-specific variations
diff --git a/dubboctl/pkg/deploy/create.go b/dubboctl/pkg/deploy/create.go
index b0bf8495..605124c6 100644
--- a/dubboctl/pkg/deploy/create.go
+++ b/dubboctl/pkg/deploy/create.go
@@ -19,6 +19,8 @@ import (
"errors"
"fmt"
"github.com/apache/dubbo-kubernetes/dubboctl/pkg/common"
+ dubbo2 "github.com/apache/dubbo-kubernetes/operator/dubbo"
+ util2 "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"os"
"strings"
"text/tabwriter"
@@ -33,11 +35,6 @@ import (
"github.com/spf13/cobra"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
// ErrNoRuntime indicates that the language runtime flag was not passed.
type ErrNoRuntime error
@@ -139,7 +136,7 @@ func runCreate(cmd *cobra.Command, args []string, newClient
ClientFactory) (err
// From environment variables, flags, arguments, and user prompts if
--confirm
// (in increasing levels of precedence)
client, done := newClient(
- dubbo.WithRepository(cfg.Repository))
+ dubbo2.WithRepository(cfg.Repository))
defer done()
// Validate - a deeper validation than that which is performed when
@@ -149,13 +146,13 @@ func runCreate(cmd *cobra.Command, args []string,
newClient ClientFactory) (err
}
// Create
- _, err = client.Init(&dubbo.Dubbo{
+ _, err = client.Init(&dubbo2.Dubbo{
Name: cfg.Name,
Root: cfg.Path,
Runtime: cfg.Runtime,
Template: cfg.Template,
- Build: dubbo.BuildSpec{
- CnMirror: dubbo.BooleanWithComment{
+ Build: dubbo2.BuildSpec{
+ CnMirror: dubbo2.BooleanWithComment{
Comment: "Specify `cnMirror: true` to use the
mirror in mainland China",
},
},
@@ -224,7 +221,7 @@ func newCreateConfig(cmd *cobra.Command, args []string,
newClient ClientFactory)
defer done()
// IN confirm mode. If also in an interactive terminal, run prompts.
- if util.InteractiveTerminal() {
+ if util2.InteractiveTerminal() {
createdCfg, err := cfg.prompt(client)
if err != nil {
return createdCfg, err
@@ -271,9 +268,9 @@ func singleCommand(cmd *cobra.Command, args []string, cfg
createConfig) string {
// can be used to determine possible values for runtime, templates, etc. a
// pre-client validation should not be required, as the Client does its own
// validation.
-func (c createConfig) Validate(client *dubbo.Client) (err error) {
+func (c createConfig) Validate(client *dubbo2.Client) (err error) {
dirName, _ := common.DeriveNameAndAbsolutePathFromPath(c.Path)
- if err = util.ValidateApplicationName(dirName); err != nil {
+ if err = util2.ValidateApplicationName(dirName); err != nil {
return
}
@@ -294,7 +291,7 @@ func (c createConfig) Validate(client *dubbo.Client) (err
error) {
}
// isValidRuntime determines if the given language runtime is a valid choice.
-func isValidRuntime(client *dubbo.Client, runtime string) bool {
+func isValidRuntime(client *dubbo2.Client, runtime string) bool {
runtimes, err := client.Runtimes()
if err != nil {
return false
@@ -309,7 +306,7 @@ func isValidRuntime(client *dubbo.Client, runtime string)
bool {
// isValidTemplate determines if the given template is valid for the given
// runtime.
-func isValidTemplate(client *dubbo.Client, runtime, template string) bool {
+func isValidTemplate(client *dubbo2.Client, runtime, template string) bool {
if !isValidRuntime(client, runtime) {
return false
}
@@ -325,7 +322,7 @@ func isValidTemplate(client *dubbo.Client, runtime,
template string) bool {
return false
}
-func noRuntimeError(client *dubbo.Client) error {
+func noRuntimeError(client *dubbo2.Client) error {
b := strings.Builder{}
fmt.Fprintln(&b, "Required flag \"language\" not set.")
fmt.Fprintln(&b, "Available language runtimes are:")
@@ -339,7 +336,7 @@ func noRuntimeError(client *dubbo.Client) error {
return ErrNoRuntime(errors.New(b.String()))
}
-func newInvalidRuntimeError(client *dubbo.Client, runtime string) error {
+func newInvalidRuntimeError(client *dubbo2.Client, runtime string) error {
b := strings.Builder{}
fmt.Fprintf(&b, "The language runtime '%v' is not recognized.\n",
runtime)
fmt.Fprintln(&b, "Available language runtimes are:")
@@ -353,7 +350,7 @@ func newInvalidRuntimeError(client *dubbo.Client, runtime
string) error {
return ErrInvalidRuntime(errors.New(b.String()))
}
-func newInvalidTemplateError(client *dubbo.Client, runtime, template string)
error {
+func newInvalidTemplateError(client *dubbo2.Client, runtime, template string)
error {
b := strings.Builder{}
fmt.Fprintf(&b, "The template '%v' was not found for language runtime
'%v'.\n", template, runtime)
fmt.Fprintln(&b, "Available templates for this language runtime are:")
@@ -371,7 +368,7 @@ func newInvalidTemplateError(client *dubbo.Client, runtime,
template string) err
// mutating the values. The provided clientFn is used to construct a transient
// client for use during prompt autocompletion/suggestions (such as suggesting
// valid templates)
-func (c createConfig) prompt(client *dubbo.Client) (createConfig, error) {
+func (c createConfig) prompt(client *dubbo2.Client) (createConfig, error) {
var qs []*survey.Question
runtimes, err := client.Runtimes()
@@ -405,7 +402,7 @@ func (c createConfig) prompt(client *dubbo.Client)
(createConfig, error) {
},
Validate: func(val interface{}) error {
derivedName, _ :=
common.DeriveNameAndAbsolutePathFromPath(val.(string))
- return util.ValidateApplicationName(derivedName)
+ return
util2.ValidateApplicationName(derivedName)
},
Transform: func(ans interface{}) interface{} {
_, absolutePath :=
common.DeriveNameAndAbsolutePathFromPath(ans.(string))
@@ -480,7 +477,7 @@ func newTemplateCompletionFunc(newClient ClientFactory)
flagCompletionFunc {
// return templates for language runtime whose full name (including repository)
// have the given prefix.
-func templatesWithPrefix(prefix, runtime string, client *dubbo.Client)
([]string, error) {
+func templatesWithPrefix(prefix, runtime string, client *dubbo2.Client)
([]string, error) {
var (
suggestions []string
templates, err = client.Templates().List(runtime)
@@ -511,7 +508,7 @@ func runCreateHelp(cmd *cobra.Command, args []string,
newClient ClientFactory) {
failSoft(err)
client, done := newClient(
- dubbo.WithRepository(cfg.Repository))
+ dubbo2.WithRepository(cfg.Repository))
defer done()
options, err := RuntimeTemplateOptions(client) // human-friendly
@@ -547,7 +544,7 @@ func newHelpTemplate(cmd *cobra.Command) *template.Template
{
// RuntimeTemplateOptions is a human-friendly table of valid Language Runtime
// to Template combinations.
// Exported for use in docs.
-func RuntimeTemplateOptions(client *dubbo.Client) (string, error) {
+func RuntimeTemplateOptions(client *dubbo2.Client) (string, error) {
runtimes, err := client.Runtimes()
if err != nil {
return "", err
@@ -561,7 +558,7 @@ func RuntimeTemplateOptions(client *dubbo.Client) (string,
error) {
templates, err := client.Templates().List(r)
// Not all language packs will have templates for
// all available runtimes. Without this check
- if err != nil && !errors.Is(err, dubbo.ErrTemplateNotFound) {
+ if err != nil && !errors.Is(err, dubbo2.ErrTemplateNotFound) {
return "", err
}
for _, t := range templates {
diff --git a/dubboctl/pkg/deploy/create_test.go
b/dubboctl/pkg/deploy/create_test.go
index b6169d64..60242e65 100644
--- a/dubboctl/pkg/deploy/create_test.go
+++ b/dubboctl/pkg/deploy/create_test.go
@@ -19,6 +19,8 @@ import (
"errors"
"github.com/apache/dubbo-kubernetes/dubboctl/cmd"
"github.com/apache/dubbo-kubernetes/dubboctl/pkg/deploy"
+ . "github.com/apache/dubbo-kubernetes/operator/pkg/testing"
+ "github.com/apache/dubbo-kubernetes/operator/util"
"testing"
)
@@ -26,14 +28,6 @@ import (
"github.com/ory/viper"
)
-import (
- . "github.com/apache/dubbo-kubernetes/dubboctl/operator/testing"
-)
-
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
// TestCreate_Execute ensures that an invocation of create with minimal
settings
// and valid input completes without error; degenerate case.
func TestCreate_Execute(t *testing.T) {
diff --git a/dubboctl/pkg/deploy/deploy.go b/dubboctl/pkg/deploy/deploy.go
index 37e6e63d..4f04fa2f 100644
--- a/dubboctl/pkg/deploy/deploy.go
+++ b/dubboctl/pkg/deploy/deploy.go
@@ -19,6 +19,9 @@ import (
"errors"
"fmt"
"github.com/apache/dubbo-kubernetes/dubboctl/pkg/common"
+ dubbo2 "github.com/apache/dubbo-kubernetes/operator/dubbo"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/kube"
+ util2 "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"os"
"os/exec"
"path/filepath"
@@ -38,12 +41,6 @@ import (
"k8s.io/client-go/util/homedir"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/kube"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
const (
basePort = 30000
portLimit = 32767
@@ -113,11 +110,11 @@ SYNOPSIS
}
func runDeploy(cmd *cobra.Command, newClient ClientFactory) error {
- if err := util.CreatePaths(); err != nil {
+ if err := util2.CreatePaths(); err != nil {
return err
}
cfg := newDeployConfig(cmd)
- f, err := dubbo.NewDubbo(cfg.Path)
+ f, err := dubbo2.NewDubbo(cfg.Path)
if err != nil {
return err
}
@@ -130,7 +127,7 @@ func runDeploy(cmd *cobra.Command, newClient ClientFactory)
error {
}
if !f.Initialized() {
- return dubbo.NewErrNotInitialized(f.Root)
+ return dubbo2.NewErrNotInitialized(f.Root)
}
cfg.Configure(f)
@@ -199,7 +196,7 @@ func runDeploy(cmd *cobra.Command, newClient ClientFactory)
error {
return nil
}
-func (d DeployConfig) deployclientOptions() ([]dubbo.Option, error) {
+func (d DeployConfig) deployclientOptions() ([]dubbo2.Option, error) {
o, err := d.buildclientOptions()
if err != nil {
return o, err
@@ -213,11 +210,11 @@ func (d DeployConfig) deployclientOptions()
([]dubbo.Option, error) {
if err != nil {
return o, err
}
- o = append(o, dubbo.WithKubeClient(cli))
+ o = append(o, dubbo2.WithKubeClient(cli))
return o, nil
}
-func applyTok8s(cmd *cobra.Command, d *dubbo.Dubbo) error {
+func applyTok8s(cmd *cobra.Command, d *dubbo2.Dubbo) error {
file := filepath.Join(d.Root, d.Deploy.Output)
c := exec.CommandContext(cmd.Context(), "kubectl", "apply", "-f", file)
c.Stdout = os.Stdout
@@ -234,9 +231,9 @@ func (c DeployConfig) Validate(cmd *cobra.Command) (err
error) {
return nil
}
-func (c *DeployConfig) Prompt(d *dubbo.Dubbo) (*DeployConfig, error) {
+func (c *DeployConfig) Prompt(d *dubbo2.Dubbo) (*DeployConfig, error) {
var err error
- if !util.InteractiveTerminal() {
+ if !util2.InteractiveTerminal() {
return c, nil
}
buildconfig, err := c.buildConfig.Prompt(d)
@@ -262,7 +259,7 @@ func (c *DeployConfig) Prompt(d *dubbo.Dubbo)
(*DeployConfig, error) {
return c, err
}
-func (c DeployConfig) Configure(f *dubbo.Dubbo) {
+func (c DeployConfig) Configure(f *dubbo2.Dubbo) {
c.buildConfig.Configure(f)
if c.Namespace != "" {
f.Deploy.Namespace = c.Namespace
diff --git a/dubboctl/pkg/deploy/repository.go
b/dubboctl/pkg/deploy/repository.go
index 24ee234e..73845057 100644
--- a/dubboctl/pkg/deploy/repository.go
+++ b/dubboctl/pkg/deploy/repository.go
@@ -19,6 +19,8 @@ import (
"errors"
"fmt"
"github.com/apache/dubbo-kubernetes/dubboctl/pkg/common"
+ "github.com/apache/dubbo-kubernetes/operator/dubbo"
+ util2 "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"os"
)
@@ -30,11 +32,6 @@ import (
"github.com/spf13/cobra"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
// command constructors
// --------------------
func AddRepository(baseCmd *cobra.Command, newClient ClientFactory) {
@@ -325,7 +322,7 @@ func runRepositoryAdd(_ *cobra.Command, args []string,
newClient ClientFactory)
}
// Adding a repository requires there be a config path structure on disk
- if err = util.CreatePaths(); err != nil {
+ if err = util2.CreatePaths(); err != nil {
return
}
@@ -369,7 +366,7 @@ func runRepositoryAdd(_ *cobra.Command, args []string,
newClient ClientFactory)
// This is an expected case. The empty value will be echoed to stdout,
the
// API will be invoked, and a helpful error message will indicate that
the
// request is missing required parameters.
- if cfg.Confirm && util.InteractiveTerminal() {
+ if cfg.Confirm && util2.InteractiveTerminal() {
questions := []*survey.Question{
{
Name: "Name",
@@ -440,7 +437,7 @@ func runRepositoryRename(_ *cobra.Command, args []string,
newClient ClientFactor
}
// Confirm (interactive prompt mode)
- if cfg.Confirm && util.InteractiveTerminal() {
+ if cfg.Confirm && util2.InteractiveTerminal() {
questions := []*survey.Question{
{
Name: "Old",
@@ -516,7 +513,7 @@ func runRepositoryRemove(_ *cobra.Command, args []string,
newClient ClientFactor
}
// Confirm (interactive prompt mode)
- if cfg.Confirm && util.InteractiveTerminal() {
+ if cfg.Confirm && util2.InteractiveTerminal() {
questions := []*survey.Question{
{
Name: "Name",
diff --git a/dubboctl/pkg/deploy/repository_test.go
b/dubboctl/pkg/deploy/repository_test.go
index c24afcb4..095c1487 100644
--- a/dubboctl/pkg/deploy/repository_test.go
+++ b/dubboctl/pkg/deploy/repository_test.go
@@ -17,6 +17,7 @@ package deploy_test
import (
"github.com/apache/dubbo-kubernetes/dubboctl/pkg/deploy"
+ . "github.com/apache/dubbo-kubernetes/operator/pkg/testing"
"github.com/ory/viper"
"io"
"os"
@@ -24,10 +25,6 @@ import (
"testing"
)
-import (
- . "github.com/apache/dubbo-kubernetes/dubboctl/operator/testing"
-)
-
// TestRepository_List ensures that the 'list' subcommand shows the client's
// set of repositories by name for builtin repositories, by explicitly
// setting the repositories' path to a new path which includes no others.
diff --git a/dubboctl/pkg/deploy/util.go b/dubboctl/pkg/deploy/util.go
index 94662a6a..017364df 100644
--- a/dubboctl/pkg/deploy/util.go
+++ b/dubboctl/pkg/deploy/util.go
@@ -17,6 +17,7 @@ package deploy
import (
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/dubbo"
"os"
"strings"
)
@@ -25,10 +26,6 @@ import (
"github.com/spf13/cobra"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
-)
-
func CompleteRuntimeList(cmd *cobra.Command, args []string, toComplete string,
client *dubbo.Client) (matches []string, directive cobra.ShellCompDirective) {
runtimes, err := client.Runtimes()
if err != nil {
diff --git a/dubboctl/pkg/manifest/diff.go b/dubboctl/pkg/manifest/diff.go
index 791c3e37..b62981c7 100644
--- a/dubboctl/pkg/manifest/diff.go
+++ b/dubboctl/pkg/manifest/diff.go
@@ -18,6 +18,7 @@ package manifest
import (
"errors"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/kube"
"os"
"path/filepath"
"strings"
@@ -30,7 +31,6 @@ import (
)
import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/kube"
"github.com/apache/dubbo-kubernetes/pkg/core/logger"
)
diff --git a/dubboctl/pkg/manifest/generate.go
b/dubboctl/pkg/manifest/generate.go
index 6df63f1e..6e5431fa 100644
--- a/dubboctl/pkg/manifest/generate.go
+++ b/dubboctl/pkg/manifest/generate.go
@@ -17,7 +17,12 @@ package manifest
import (
"fmt"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/identifier"
+ "github.com/apache/dubbo-kubernetes/operator/manifest"
+ "github.com/apache/dubbo-kubernetes/operator/manifest/render"
+
"github.com/apache/dubbo-kubernetes/operator/pkg/apis/dubbo.apache.org/v1alpha1"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/identifier"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/kube"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"os"
"path"
"sort"
@@ -33,11 +38,6 @@ import (
)
import (
-
"github.com/apache/dubbo-kubernetes/dubboctl/operator/apis/dubbo.apache.org/v1alpha1"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/kube"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/manifest"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/manifest/render"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
"github.com/apache/dubbo-kubernetes/pkg/core/logger"
)
diff --git a/dubboctl/pkg/manifest/install.go b/dubboctl/pkg/manifest/install.go
index cd54c6cf..972be598 100644
--- a/dubboctl/pkg/manifest/install.go
+++ b/dubboctl/pkg/manifest/install.go
@@ -16,14 +16,14 @@
package manifest
import (
+
"github.com/apache/dubbo-kubernetes/operator/pkg/apis/dubbo.apache.org/v1alpha1"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/kube"
"github.com/spf13/cobra"
"go.uber.org/zap/zapcore"
)
import (
-
"github.com/apache/dubbo-kubernetes/dubboctl/operator/apis/dubbo.apache.org/v1alpha1"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/kube"
"github.com/apache/dubbo-kubernetes/pkg/core/logger"
)
diff --git a/dubboctl/pkg/manifest/uninstall.go
b/dubboctl/pkg/manifest/uninstall.go
index d48e0881..5fefbb31 100644
--- a/dubboctl/pkg/manifest/uninstall.go
+++ b/dubboctl/pkg/manifest/uninstall.go
@@ -16,14 +16,14 @@
package manifest
import (
+
"github.com/apache/dubbo-kubernetes/operator/pkg/apis/dubbo.apache.org/v1alpha1"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/kube"
"github.com/spf13/cobra"
"go.uber.org/zap/zapcore"
)
import (
-
"github.com/apache/dubbo-kubernetes/dubboctl/operator/apis/dubbo.apache.org/v1alpha1"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/kube"
"github.com/apache/dubbo-kubernetes/pkg/core/logger"
)
diff --git a/dubboctl/pkg/profile/diff.go b/dubboctl/pkg/profile/diff.go
index 42f5a9ac..2b80d3ae 100644
--- a/dubboctl/pkg/profile/diff.go
+++ b/dubboctl/pkg/profile/diff.go
@@ -18,7 +18,9 @@ package profile
import (
"errors"
"fmt"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/identifier"
+ "github.com/apache/dubbo-kubernetes/operator/manifest"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/identifier"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/kube"
)
import (
@@ -28,8 +30,6 @@ import (
)
import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/kube"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/manifest"
"github.com/apache/dubbo-kubernetes/pkg/core/logger"
)
diff --git a/dubboctl/pkg/profile/list.go b/dubboctl/pkg/profile/list.go
index 8547f54d..89716946 100644
--- a/dubboctl/pkg/profile/list.go
+++ b/dubboctl/pkg/profile/list.go
@@ -17,7 +17,9 @@ package profile
import (
"errors"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/identifier"
+ "github.com/apache/dubbo-kubernetes/operator/manifest"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/identifier"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"strings"
)
@@ -28,8 +30,6 @@ import (
)
import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/manifest"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
"github.com/apache/dubbo-kubernetes/pkg/core/logger"
)
diff --git a/dubboctl/pkg/proxy/context.go b/dubboctl/pkg/proxy/context.go
index 32e1c0fd..69eeb578 100644
--- a/dubboctl/pkg/proxy/context.go
+++ b/dubboctl/pkg/proxy/context.go
@@ -18,6 +18,7 @@
package proxy
import (
+ "github.com/apache/dubbo-kubernetes/operator/pkg/envoy"
"os"
"path/filepath"
"runtime"
@@ -33,7 +34,6 @@ import (
)
import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/envoy"
"github.com/apache/dubbo-kubernetes/pkg/config/app/dubboctl"
"github.com/apache/dubbo-kubernetes/pkg/core/runtime/component"
core_xds "github.com/apache/dubbo-kubernetes/pkg/core/xds"
diff --git a/dubboctl/pkg/proxy/proxy.go b/dubboctl/pkg/proxy/proxy.go
index 4241c221..3247c728 100644
--- a/dubboctl/pkg/proxy/proxy.go
+++ b/dubboctl/pkg/proxy/proxy.go
@@ -21,6 +21,7 @@ import (
"context"
"fmt"
"github.com/apache/dubbo-kubernetes/dubboctl/pkg/common"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/envoy"
"io"
"os"
"path/filepath"
@@ -37,7 +38,6 @@ import (
import (
mesh_proto "github.com/apache/dubbo-kubernetes/api/mesh/v1alpha1"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/envoy"
"github.com/apache/dubbo-kubernetes/pkg/config/app/dubboctl"
"github.com/apache/dubbo-kubernetes/pkg/core"
dubbo_cmd "github.com/apache/dubbo-kubernetes/pkg/core/cmd"
diff --git a/dubboctl/pkg/registry/registry.go
b/dubboctl/pkg/registry/registry.go
index 686d1856..f7ca561b 100644
--- a/dubboctl/pkg/registry/registry.go
+++ b/dubboctl/pkg/registry/registry.go
@@ -16,13 +16,10 @@
package registry
import (
+ "github.com/apache/dubbo-kubernetes/operator/registry/zk"
"github.com/spf13/cobra"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/registry/zk"
-)
-
func AddRegistryCmd(rootCmd *cobra.Command) {
addZkRegistryCmd(rootCmd)
}
diff --git a/dubboctl/operator/dubbo/client.go b/operator/dubbo/client.go
similarity index 99%
rename from dubboctl/operator/dubbo/client.go
rename to operator/dubbo/client.go
index a87d3cbf..0cfafaf8 100644
--- a/dubboctl/operator/dubbo/client.go
+++ b/operator/dubbo/client.go
@@ -21,6 +21,8 @@ import (
"bufio"
"context"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/kube"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"io"
"os"
"path/filepath"
@@ -34,11 +36,6 @@ import (
"gopkg.in/yaml.v3"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/kube"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
const (
// DefaultTemplate is the default function signature / environmental
context
// of the resultant function. All runtimes are expected to have at
least
diff --git a/dubboctl/operator/dubbo/client_test.go
b/operator/dubbo/client_test.go
similarity index 100%
rename from dubboctl/operator/dubbo/client_test.go
rename to operator/dubbo/client_test.go
diff --git a/dubboctl/operator/dubbo/deploy.tpl b/operator/dubbo/deploy.tpl
similarity index 100%
rename from dubboctl/operator/dubbo/deploy.tpl
rename to operator/dubbo/deploy.tpl
diff --git a/dubboctl/operator/dubbo/deployer.go b/operator/dubbo/deployer.go
similarity index 97%
rename from dubboctl/operator/dubbo/deployer.go
rename to operator/dubbo/deployer.go
index 78774aaf..54d21ba5 100644
--- a/dubboctl/operator/dubbo/deployer.go
+++ b/operator/dubbo/deployer.go
@@ -21,14 +21,11 @@ import (
"context"
_ "embed"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"os"
template2 "text/template"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
const (
deployTemplateFile = "deploy.tpl"
)
diff --git a/dubboctl/operator/dubbo/dockerfile.go
b/operator/dubbo/dockerfile.go
similarity index 100%
rename from dubboctl/operator/dubbo/dockerfile.go
rename to operator/dubbo/dockerfile.go
diff --git a/dubboctl/operator/dubbo/dubbo.go b/operator/dubbo/dubbo.go
similarity index 100%
rename from dubboctl/operator/dubbo/dubbo.go
rename to operator/dubbo/dubbo.go
diff --git a/dubboctl/operator/dubbo/dubbo_test.go
b/operator/dubbo/dubbo_test.go
similarity index 100%
rename from dubboctl/operator/dubbo/dubbo_test.go
rename to operator/dubbo/dubbo_test.go
diff --git a/dubboctl/operator/dubbo/errors.go b/operator/dubbo/errors.go
similarity index 100%
rename from dubboctl/operator/dubbo/errors.go
rename to operator/dubbo/errors.go
diff --git a/dubboctl/operator/dubbo/repositories.go
b/operator/dubbo/repositories.go
similarity index 100%
rename from dubboctl/operator/dubbo/repositories.go
rename to operator/dubbo/repositories.go
diff --git a/dubboctl/operator/dubbo/repositories_test.go
b/operator/dubbo/repositories_test.go
similarity index 90%
rename from dubboctl/operator/dubbo/repositories_test.go
rename to operator/dubbo/repositories_test.go
index 1f0e9efd..203a00aa 100644
--- a/dubboctl/operator/dubbo/repositories_test.go
+++ b/operator/dubbo/repositories_test.go
@@ -18,6 +18,8 @@
package dubbo_test
import (
+ dubbo2 "github.com/apache/dubbo-kubernetes/operator/dubbo"
+ . "github.com/apache/dubbo-kubernetes/operator/pkg/testing"
"os"
"path/filepath"
"testing"
@@ -27,11 +29,6 @@ import (
"github.com/google/go-cmp/cmp"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
- . "github.com/apache/dubbo-kubernetes/dubboctl/operator/testing"
-)
-
const RepositoriesTestRepo = "repository.git"
// TestRepositories_List ensures the base case of listing
@@ -40,22 +37,22 @@ func TestRepositories_List(t *testing.T) {
root, rm := Mktemp(t)
defer rm()
- client := dubbo.New(dubbo.WithRepositoriesPath(root)) // Explicitly
empty
+ client := dubbo2.New(dubbo2.WithRepositoriesPath(root)) // Explicitly
empty
rr, err := client.Repositories().List()
if err != nil {
t.Fatal(err)
}
// Assert contains only the default repo
- if len(rr) != 1 && rr[0] != dubbo.DefaultRepositoryName {
- t.Fatalf("Expected repository list '[%v]', got %v",
dubbo.DefaultRepositoryName, rr)
+ if len(rr) != 1 && rr[0] != dubbo2.DefaultRepositoryName {
+ t.Fatalf("Expected repository list '[%v]', got %v",
dubbo2.DefaultRepositoryName, rr)
}
}
// TestRepositories_GetInvalid ensures that attempting to get an invalid repo
// results in error.
func TestRepositories_GetInvalid(t *testing.T) {
- client := dubbo.New(dubbo.WithRepositoriesPath("testdata/repositories"))
+ client :=
dubbo2.New(dubbo2.WithRepositoriesPath("testdata/repositories"))
// invalid should error
_, err := client.Repositories().Get("invalid")
@@ -66,7 +63,7 @@ func TestRepositories_GetInvalid(t *testing.T) {
// TestRepositories_Get ensures a repository can be accessed by name.
func TestRepositories_Get(t *testing.T) {
- client := dubbo.New(dubbo.WithRepositoriesPath("testdata/repositories"))
+ client :=
dubbo2.New(dubbo2.WithRepositoriesPath("testdata/repositories"))
// valid should not error
repo, err := client.Repositories().Get("customTemplateRepo")
@@ -87,14 +84,14 @@ func TestRepositories_All(t *testing.T) {
root, rm := Mktemp(t)
defer rm()
- client := dubbo.New(dubbo.WithRepositoriesPath(root))
+ client := dubbo2.New(dubbo2.WithRepositoriesPath(root))
// Assert initially only the default is included
rr, err := client.Repositories().All()
if err != nil {
t.Fatal(err)
}
- if len(rr) != 1 && rr[0].Name != dubbo.DefaultRepositoryName {
+ if len(rr) != 1 && rr[0].Name != dubbo2.DefaultRepositoryName {
t.Fatalf("Expected initial repo list to be only the default.
Got %v", rr)
}
@@ -112,7 +109,7 @@ func TestRepositories_All(t *testing.T) {
// Assert it now includes both builtin and extended
if len(repositories) != 2 ||
- repositories[0].Name != dubbo.DefaultRepositoryName ||
+ repositories[0].Name != dubbo2.DefaultRepositoryName ||
repositories[1].Name != "repository" {
t.Fatal("Repositories list does not pass shallow repository
membership check")
}
@@ -126,7 +123,7 @@ func TestRepositories_Add(t *testing.T) {
// Instantiate the client using the current temp directory as the
// repositories' root location.
- client := dubbo.New(dubbo.WithRepositoriesPath(root))
+ client := dubbo2.New(dubbo2.WithRepositoriesPath(root))
// Add the repository, explicitly specifying a name. See other tests
for
// defaulting from repository names and manifest-defined name.
@@ -162,7 +159,7 @@ func TestRepositories_AddDeafultName(t *testing.T) {
root, rm := Mktemp(t)
defer rm()
- client := dubbo.New(dubbo.WithRepositoriesPath(root))
+ client := dubbo2.New(dubbo2.WithRepositoriesPath(root))
name, err := client.Repositories().Add("", uri)
if err != nil {
@@ -197,7 +194,7 @@ func TestRepositories_AddWithManifest(t *testing.T) {
root, rm := Mktemp(t)
defer rm()
- client := dubbo.New(dubbo.WithRepositoriesPath(root))
+ client := dubbo2.New(dubbo2.WithRepositoriesPath(root))
name, err := client.Repositories().Add("", uri)
if err != nil {
@@ -230,7 +227,7 @@ func TestRepositories_AddExistingErrors(t *testing.T) {
// Instantiate the client using the current temp directory as the
// repositories' root location.
- client := dubbo.New(dubbo.WithRepositoriesPath(root))
+ client := dubbo2.New(dubbo2.WithRepositoriesPath(root))
// Add twice.
name := "example"
@@ -264,7 +261,7 @@ func TestRepositories_Rename(t *testing.T) {
// Instantiate the client using the current temp directory as the
// repositories' root location.
- client := dubbo.New(dubbo.WithRepositoriesPath(root))
+ client := dubbo2.New(dubbo2.WithRepositoriesPath(root))
// Add and Rename
if _, err := client.Repositories().Add("foo", uri); err != nil {
@@ -298,7 +295,7 @@ func TestRepositories_Remove(t *testing.T) {
// Instantiate the client using the current temp directory as the
// repositories' root location.
- client := dubbo.New(dubbo.WithRepositoriesPath(root))
+ client := dubbo2.New(dubbo2.WithRepositoriesPath(root))
// Add and Remove
name := "example"
@@ -331,7 +328,7 @@ func TestRepositories_URL(t *testing.T) {
root, rm := Mktemp(t)
defer rm()
- client := dubbo.New(dubbo.WithRepositoriesPath(root))
+ client := dubbo2.New(dubbo2.WithRepositoriesPath(root))
// Add the test repo
_, err := client.Repositories().Add("newrepo", uri)
@@ -359,7 +356,7 @@ func TestRepositories_URL(t *testing.T) {
// first moving the defaulting path logic from CLI into the client lib.
func TestRepositories_Missing(t *testing.T) {
// Client with no repositories path defined.
- client := dubbo.New()
+ client := dubbo2.New()
// Get all repositories
_, err := client.Repositories().All()
diff --git a/dubboctl/operator/dubbo/repository.go
b/operator/dubbo/repository.go
similarity index 99%
rename from dubboctl/operator/dubbo/repository.go
rename to operator/dubbo/repository.go
index 274aab6d..9080f7f7 100644
--- a/dubboctl/operator/dubbo/repository.go
+++ b/operator/dubbo/repository.go
@@ -20,6 +20,7 @@ package dubbo
import (
"errors"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/filesystem"
"net/url"
"os"
"path"
@@ -37,10 +38,6 @@ import (
"gopkg.in/yaml.v3"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/filesystem"
-)
-
const (
repositoryManifest = "manifest.yaml"
templateManifest = "manifest.yaml"
diff --git a/dubboctl/operator/dubbo/template.go b/operator/dubbo/template.go
similarity index 96%
rename from dubboctl/operator/dubbo/template.go
rename to operator/dubbo/template.go
index 7528c2c2..f331551f 100644
--- a/dubboctl/operator/dubbo/template.go
+++ b/operator/dubbo/template.go
@@ -19,13 +19,10 @@ package dubbo
import (
"context"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/filesystem"
"path"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/filesystem"
-)
-
// Template is a function project template.
// It can be used to instantiate new function project.
type Template interface {
diff --git a/dubboctl/operator/dubbo/templates.go b/operator/dubbo/templates.go
similarity index 97%
rename from dubboctl/operator/dubbo/templates.go
rename to operator/dubbo/templates.go
index c1b35a9f..5cf55355 100644
--- a/dubboctl/operator/dubbo/templates.go
+++ b/operator/dubbo/templates.go
@@ -19,13 +19,10 @@ package dubbo
import (
"context"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"strings"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
// Templates Manager
type Templates struct {
client *Client
diff --git a/dubboctl/operator/dubbo/templates_embedded.go
b/operator/dubbo/templates_embedded.go
similarity index 89%
rename from dubboctl/operator/dubbo/templates_embedded.go
rename to operator/dubbo/templates_embedded.go
index f2d6a72a..ef2a5f58 100644
--- a/dubboctl/operator/dubbo/templates_embedded.go
+++ b/operator/dubbo/templates_embedded.go
@@ -20,11 +20,8 @@ package dubbo
import (
"archive/zip"
"bytes"
-)
-
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/generated"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/filesystem"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/filesystem"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/generated"
)
//go:generate go run ../../generated/templates/generate.go
diff --git a/dubboctl/operator/dubbo/templates_test.go
b/operator/dubbo/templates_test.go
similarity index 86%
rename from dubboctl/operator/dubbo/templates_test.go
rename to operator/dubbo/templates_test.go
index cdf7b66a..70fd5688 100644
--- a/dubboctl/operator/dubbo/templates_test.go
+++ b/operator/dubbo/templates_test.go
@@ -19,6 +19,9 @@ package dubbo_test
import (
"errors"
+ dubbo2 "github.com/apache/dubbo-kubernetes/operator/dubbo"
+ client2 "github.com/apache/dubbo-kubernetes/operator/dubbo/client"
+ . "github.com/apache/dubbo-kubernetes/operator/pkg/testing"
"os"
"path/filepath"
"testing"
@@ -28,17 +31,12 @@ import (
"github.com/google/go-cmp/cmp"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
- . "github.com/apache/dubbo-kubernetes/dubboctl/operator/testing"
-)
-
// TestTemplates_List ensures that all templates are listed taking into account
// both internal and extensible (prefixed) repositories.
func TestTemplates_List(t *testing.T) {
// A client which specifies a location of extensible repositories on
disk
// will list all builtin plus extensible
- client := dubbo.New(dubbo.WithRepositoriesPath("testdata/repositories"))
+ client :=
dubbo2.New(dubbo2.WithRepositoriesPath("testdata/repositories"))
// list templates for the "go" runtime
templates, err := client.Templates().List("go")
@@ -64,7 +62,7 @@ func TestTemplates_List(t *testing.T) {
// when retrieving the list of templates for a runtime that does not exist
// in an extended repository, but does in the default.
func TestTemplates_List_ExtendedNotFound(t *testing.T) {
- client := dubbo.New(dubbo.WithRepositoriesPath("testdata/repositories"))
+ client :=
dubbo2.New(dubbo2.WithRepositoriesPath("testdata/repositories"))
// list templates for the "python" runtime -
// not supplied by the extended repos
@@ -85,7 +83,7 @@ func TestTemplates_List_ExtendedNotFound(t *testing.T) {
// TestTemplates_Get ensures that a template's metadata object can
// be retrieved by full name (full name prefix optional for embedded).
func TestTemplates_Get(t *testing.T) {
- client := dubbo.New(dubbo.WithRepositoriesPath("testdata/repositories"))
+ client :=
dubbo2.New(dubbo2.WithRepositoriesPath("testdata/repositories"))
// Check embedded
embedded, err := client.Templates().Get("go", "common")
@@ -117,12 +115,12 @@ func TestTemplates_Embedded(t *testing.T) {
defer Using(t, root)()
// Client whose internal (builtin default) templates will be used.
- client := dubbo.New()
+ client := dubbo2.New()
// write out a template
- _, err := client.Init(&dubbo.Dubbo{
+ _, err := client.Init(&dubbo2.Dubbo{
Root: root,
- Runtime: TestRuntime,
+ Runtime: client2.TestRuntime,
Template: "common",
}, false, nil)
if err != nil {
@@ -149,12 +147,12 @@ func TestTemplates_Remote(t *testing.T) {
// Create a client which explicitly specifies the Git repo at URL
// rather than relying on the default internally builtin template repo
- client := dubbo.New(
- dubbo.WithRepository(url))
+ client := dubbo2.New(
+ dubbo2.WithRepository(url))
// Create a default function, which should override builtin and use
// that from the specified url (git repo)
- _, err = client.Init(&dubbo.Dubbo{
+ _, err = client.Init(&dubbo2.Dubbo{
Root: root,
Runtime: "go",
Template: "remote",
@@ -177,11 +175,11 @@ func TestTemplates_Default(t *testing.T) {
root := "testdata/testTemplates_Default"
defer Using(t, root)()
- client := dubbo.New()
+ client := dubbo2.New()
// The runtime is specified, and explicitly includes a
// file for the default template of fn.DefaultTemplate
- _, err := client.Init(&dubbo.Dubbo{Root: root, Runtime: TestRuntime},
false, nil)
+ _, err := client.Init(&dubbo2.Dubbo{Root: root, Runtime:
client2.TestRuntime}, false, nil)
if err != nil {
t.Fatal(err)
}
@@ -200,28 +198,28 @@ func TestTemplates_InvalidErrors(t *testing.T) {
root := "testdata/testTemplates_InvalidErrors"
defer Using(t, root)()
- client := dubbo.New()
+ client := dubbo2.New()
// Error will be type-checked.
var err error
// Test for error writing an invalid runtime
- _, err = client.Init(&dubbo.Dubbo{
+ _, err = client.Init(&dubbo2.Dubbo{
Root: root,
Runtime: "invalid",
}, false, nil)
- if !errors.Is(err, dubbo.ErrRuntimeNotFound) {
+ if !errors.Is(err, dubbo2.ErrRuntimeNotFound) {
t.Fatalf("Expected ErrRuntimeNotFound, got %v", err)
}
os.Remove(filepath.Join(root, ".gitignore"))
// Test for error writing an invalid template
- _, err = client.Init(&dubbo.Dubbo{
+ _, err = client.Init(&dubbo2.Dubbo{
Root: root,
- Runtime: TestRuntime,
+ Runtime: client2.TestRuntime,
Template: "invalid",
}, false, nil)
- if !errors.Is(err, dubbo.ErrTemplateNotFound) {
+ if !errors.Is(err, dubbo2.ErrTemplateNotFound) {
t.Fatalf("Expected ErrTemplateNotFound, got %v", err)
}
}
diff --git
a/dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/customRuntime/.gitinclude
b/operator/dubbo/testdata/repositories/customTemplateRepo/customRuntime/.gitinclude
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/customRuntime/.gitinclude
rename to
operator/dubbo/testdata/repositories/customTemplateRepo/customRuntime/.gitinclude
diff --git
a/dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/customRuntime/customTemplate/custom.impl
b/operator/dubbo/testdata/repositories/customTemplateRepo/customRuntime/customTemplate/custom.impl
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/customRuntime/customTemplate/custom.impl
rename to
operator/dubbo/testdata/repositories/customTemplateRepo/customRuntime/customTemplate/custom.impl
diff --git
a/dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/go/customTemplate/custom.go
b/operator/dubbo/testdata/repositories/customTemplateRepo/go/customTemplate/custom.go
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/go/customTemplate/custom.go
rename to
operator/dubbo/testdata/repositories/customTemplateRepo/go/customTemplate/custom.go
diff --git
a/dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/node/json/index.js
b/operator/dubbo/testdata/repositories/customTemplateRepo/node/json/index.js
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/node/json/index.js
rename to
operator/dubbo/testdata/repositories/customTemplateRepo/node/json/index.js
diff --git
a/dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/node/json/json.js
b/operator/dubbo/testdata/repositories/customTemplateRepo/node/json/json.js
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/node/json/json.js
rename to
operator/dubbo/testdata/repositories/customTemplateRepo/node/json/json.js
diff --git
a/dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/test/tpla/customtpl.txt
b/operator/dubbo/testdata/repositories/customTemplateRepo/test/tpla/customtpl.txt
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/test/tpla/customtpl.txt
rename to
operator/dubbo/testdata/repositories/customTemplateRepo/test/tpla/customtpl.txt
diff --git
a/dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/test/tplb/executable.sh
b/operator/dubbo/testdata/repositories/customTemplateRepo/test/tplb/executable.sh
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/test/tplb/executable.sh
rename to
operator/dubbo/testdata/repositories/customTemplateRepo/test/tplb/executable.sh
diff --git
a/dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/test/tplc/customtpl.txt
b/operator/dubbo/testdata/repositories/customTemplateRepo/test/tplc/customtpl.txt
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repositories/customTemplateRepo/test/tplc/customtpl.txt
rename to
operator/dubbo/testdata/repositories/customTemplateRepo/test/tplc/customtpl.txt
diff --git a/dubboctl/operator/dubbo/testdata/repository-a.git/COMMIT_EDITMSG
b/operator/dubbo/testdata/repository-a.git/COMMIT_EDITMSG
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository-a.git/COMMIT_EDITMSG
rename to operator/dubbo/testdata/repository-a.git/COMMIT_EDITMSG
diff --git a/dubboctl/operator/dubbo/testdata/repository-a.git/HEAD
b/operator/dubbo/testdata/repository-a.git/HEAD
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository-a.git/HEAD
rename to operator/dubbo/testdata/repository-a.git/HEAD
diff --git a/dubboctl/operator/dubbo/testdata/repository-a.git/config
b/operator/dubbo/testdata/repository-a.git/config
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository-a.git/config
rename to operator/dubbo/testdata/repository-a.git/config
diff --git a/dubboctl/operator/dubbo/testdata/repository-a.git/description
b/operator/dubbo/testdata/repository-a.git/description
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository-a.git/description
rename to operator/dubbo/testdata/repository-a.git/description
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/hooks/.gitinclude
b/operator/dubbo/testdata/repository-a.git/hooks/.gitinclude
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository-a.git/hooks/.gitinclude
rename to operator/dubbo/testdata/repository-a.git/hooks/.gitinclude
diff --git a/dubboctl/operator/dubbo/testdata/repository-a.git/index
b/operator/dubbo/testdata/repository-a.git/index
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository-a.git/index
rename to operator/dubbo/testdata/repository-a.git/index
diff --git a/dubboctl/operator/dubbo/testdata/repository-a.git/info/exclude
b/operator/dubbo/testdata/repository-a.git/info/exclude
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository-a.git/info/exclude
rename to operator/dubbo/testdata/repository-a.git/info/exclude
diff --git a/dubboctl/operator/dubbo/testdata/repository-a.git/logs/HEAD
b/operator/dubbo/testdata/repository-a.git/logs/HEAD
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository-a.git/logs/HEAD
rename to operator/dubbo/testdata/repository-a.git/logs/HEAD
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/logs/refs/heads/main
b/operator/dubbo/testdata/repository-a.git/logs/refs/heads/main
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/logs/refs/heads/main
rename to operator/dubbo/testdata/repository-a.git/logs/refs/heads/main
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/logs/refs/remotes/origin/HEAD
b/operator/dubbo/testdata/repository-a.git/logs/refs/remotes/origin/HEAD
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/logs/refs/remotes/origin/HEAD
rename to operator/dubbo/testdata/repository-a.git/logs/refs/remotes/origin/HEAD
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/32/bad9e3775e80ae9b7483acf6d7630bf8b945e9
b/operator/dubbo/testdata/repository-a.git/objects/32/bad9e3775e80ae9b7483acf6d7630bf8b945e9
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/32/bad9e3775e80ae9b7483acf6d7630bf8b945e9
rename to
operator/dubbo/testdata/repository-a.git/objects/32/bad9e3775e80ae9b7483acf6d7630bf8b945e9
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/88/3ff23f61018546cac0c302c5c75e3c65ed832d
b/operator/dubbo/testdata/repository-a.git/objects/88/3ff23f61018546cac0c302c5c75e3c65ed832d
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/88/3ff23f61018546cac0c302c5c75e3c65ed832d
rename to
operator/dubbo/testdata/repository-a.git/objects/88/3ff23f61018546cac0c302c5c75e3c65ed832d
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/91/f1295d025a69a8ae87296ea5fda680672275d9
b/operator/dubbo/testdata/repository-a.git/objects/91/f1295d025a69a8ae87296ea5fda680672275d9
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/91/f1295d025a69a8ae87296ea5fda680672275d9
rename to
operator/dubbo/testdata/repository-a.git/objects/91/f1295d025a69a8ae87296ea5fda680672275d9
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/af/e663f9ef928be2b5cb93f836c0905e60f09ab2
b/operator/dubbo/testdata/repository-a.git/objects/af/e663f9ef928be2b5cb93f836c0905e60f09ab2
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/af/e663f9ef928be2b5cb93f836c0905e60f09ab2
rename to
operator/dubbo/testdata/repository-a.git/objects/af/e663f9ef928be2b5cb93f836c0905e60f09ab2
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/d5/c0914f5e90ce1ccc3ee90e44ab610f466c774f
b/operator/dubbo/testdata/repository-a.git/objects/d5/c0914f5e90ce1ccc3ee90e44ab610f466c774f
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/d5/c0914f5e90ce1ccc3ee90e44ab610f466c774f
rename to
operator/dubbo/testdata/repository-a.git/objects/d5/c0914f5e90ce1ccc3ee90e44ab610f466c774f
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/dd/c6c5f6af77cfd92693c2b5b910b22a26379d01
b/operator/dubbo/testdata/repository-a.git/objects/dd/c6c5f6af77cfd92693c2b5b910b22a26379d01
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/dd/c6c5f6af77cfd92693c2b5b910b22a26379d01
rename to
operator/dubbo/testdata/repository-a.git/objects/dd/c6c5f6af77cfd92693c2b5b910b22a26379d01
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/e7/ca8dffd312a48aac1f2aadd64a13ac34e021b9
b/operator/dubbo/testdata/repository-a.git/objects/e7/ca8dffd312a48aac1f2aadd64a13ac34e021b9
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/e7/ca8dffd312a48aac1f2aadd64a13ac34e021b9
rename to
operator/dubbo/testdata/repository-a.git/objects/e7/ca8dffd312a48aac1f2aadd64a13ac34e021b9
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/ee/f72a905e2866c0e4b4d13cb14bf118c8e8aa0b
b/operator/dubbo/testdata/repository-a.git/objects/ee/f72a905e2866c0e4b4d13cb14bf118c8e8aa0b
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/ee/f72a905e2866c0e4b4d13cb14bf118c8e8aa0b
rename to
operator/dubbo/testdata/repository-a.git/objects/ee/f72a905e2866c0e4b4d13cb14bf118c8e8aa0b
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/ef/1e6c8ed28e25dec915e8cd7479dacf671665ed
b/operator/dubbo/testdata/repository-a.git/objects/ef/1e6c8ed28e25dec915e8cd7479dacf671665ed
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/ef/1e6c8ed28e25dec915e8cd7479dacf671665ed
rename to
operator/dubbo/testdata/repository-a.git/objects/ef/1e6c8ed28e25dec915e8cd7479dacf671665ed
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/info/.gitinclude
b/operator/dubbo/testdata/repository-a.git/objects/info/.gitinclude
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/info/.gitinclude
rename to operator/dubbo/testdata/repository-a.git/objects/info/.gitinclude
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/pack/.gitinclude
b/operator/dubbo/testdata/repository-a.git/objects/pack/.gitinclude
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/pack/.gitinclude
rename to operator/dubbo/testdata/repository-a.git/objects/pack/.gitinclude
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/pack/pack-3cc26077b1d72f3ffb9484d7baca188936db8c5e.idx
b/operator/dubbo/testdata/repository-a.git/objects/pack/pack-3cc26077b1d72f3ffb9484d7baca188936db8c5e.idx
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/pack/pack-3cc26077b1d72f3ffb9484d7baca188936db8c5e.idx
rename to
operator/dubbo/testdata/repository-a.git/objects/pack/pack-3cc26077b1d72f3ffb9484d7baca188936db8c5e.idx
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/objects/pack/pack-3cc26077b1d72f3ffb9484d7baca188936db8c5e.pack
b/operator/dubbo/testdata/repository-a.git/objects/pack/pack-3cc26077b1d72f3ffb9484d7baca188936db8c5e.pack
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/objects/pack/pack-3cc26077b1d72f3ffb9484d7baca188936db8c5e.pack
rename to
operator/dubbo/testdata/repository-a.git/objects/pack/pack-3cc26077b1d72f3ffb9484d7baca188936db8c5e.pack
diff --git a/dubboctl/operator/dubbo/testdata/repository-a.git/packed-refs
b/operator/dubbo/testdata/repository-a.git/packed-refs
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository-a.git/packed-refs
rename to operator/dubbo/testdata/repository-a.git/packed-refs
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/refs/heads/.gitinclude
b/operator/dubbo/testdata/repository-a.git/refs/heads/.gitinclude
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/refs/heads/.gitinclude
rename to operator/dubbo/testdata/repository-a.git/refs/heads/.gitinclude
diff --git a/dubboctl/operator/dubbo/testdata/repository-a.git/refs/heads/main
b/operator/dubbo/testdata/repository-a.git/refs/heads/main
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository-a.git/refs/heads/main
rename to operator/dubbo/testdata/repository-a.git/refs/heads/main
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/refs/remotes/origin/HEAD
b/operator/dubbo/testdata/repository-a.git/refs/remotes/origin/HEAD
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/refs/remotes/origin/HEAD
rename to operator/dubbo/testdata/repository-a.git/refs/remotes/origin/HEAD
diff --git
a/dubboctl/operator/dubbo/testdata/repository-a.git/refs/tags/.gitinclude
b/operator/dubbo/testdata/repository-a.git/refs/tags/.gitinclude
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository-a.git/refs/tags/.gitinclude
rename to operator/dubbo/testdata/repository-a.git/refs/tags/.gitinclude
diff --git a/dubboctl/operator/dubbo/testdata/repository.git/HEAD
b/operator/dubbo/testdata/repository.git/HEAD
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository.git/HEAD
rename to operator/dubbo/testdata/repository.git/HEAD
diff --git a/dubboctl/operator/dubbo/testdata/repository.git/config
b/operator/dubbo/testdata/repository.git/config
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository.git/config
rename to operator/dubbo/testdata/repository.git/config
diff --git a/dubboctl/operator/dubbo/testdata/repository.git/description
b/operator/dubbo/testdata/repository.git/description
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository.git/description
rename to operator/dubbo/testdata/repository.git/description
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/applypatch-msg.sample
b/operator/dubbo/testdata/repository.git/hooks/applypatch-msg.sample
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/hooks/applypatch-msg.sample
rename to operator/dubbo/testdata/repository.git/hooks/applypatch-msg.sample
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/commit-msg.sample
b/operator/dubbo/testdata/repository.git/hooks/commit-msg.sample
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/hooks/commit-msg.sample
rename to operator/dubbo/testdata/repository.git/hooks/commit-msg.sample
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/fsmonitor-watchman.sample
b/operator/dubbo/testdata/repository.git/hooks/fsmonitor-watchman.sample
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/hooks/fsmonitor-watchman.sample
rename to operator/dubbo/testdata/repository.git/hooks/fsmonitor-watchman.sample
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/post-update.sample
b/operator/dubbo/testdata/repository.git/hooks/post-update.sample
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/hooks/post-update.sample
rename to operator/dubbo/testdata/repository.git/hooks/post-update.sample
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/pre-applypatch.sample
b/operator/dubbo/testdata/repository.git/hooks/pre-applypatch.sample
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/hooks/pre-applypatch.sample
rename to operator/dubbo/testdata/repository.git/hooks/pre-applypatch.sample
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/pre-commit.sample
b/operator/dubbo/testdata/repository.git/hooks/pre-commit.sample
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/hooks/pre-commit.sample
rename to operator/dubbo/testdata/repository.git/hooks/pre-commit.sample
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/pre-merge-commit.sample
b/operator/dubbo/testdata/repository.git/hooks/pre-merge-commit.sample
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/hooks/pre-merge-commit.sample
rename to operator/dubbo/testdata/repository.git/hooks/pre-merge-commit.sample
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/pre-push.sample
b/operator/dubbo/testdata/repository.git/hooks/pre-push.sample
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/hooks/pre-push.sample
rename to operator/dubbo/testdata/repository.git/hooks/pre-push.sample
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/pre-rebase.sample
b/operator/dubbo/testdata/repository.git/hooks/pre-rebase.sample
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/hooks/pre-rebase.sample
rename to operator/dubbo/testdata/repository.git/hooks/pre-rebase.sample
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/pre-receive.sample
b/operator/dubbo/testdata/repository.git/hooks/pre-receive.sample
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/hooks/pre-receive.sample
rename to operator/dubbo/testdata/repository.git/hooks/pre-receive.sample
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/prepare-commit-msg.sample
b/operator/dubbo/testdata/repository.git/hooks/prepare-commit-msg.sample
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/hooks/prepare-commit-msg.sample
rename to operator/dubbo/testdata/repository.git/hooks/prepare-commit-msg.sample
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/push-to-checkout.sample
b/operator/dubbo/testdata/repository.git/hooks/push-to-checkout.sample
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/hooks/push-to-checkout.sample
rename to operator/dubbo/testdata/repository.git/hooks/push-to-checkout.sample
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/hooks/update.sample
b/operator/dubbo/testdata/repository.git/hooks/update.sample
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository.git/hooks/update.sample
rename to operator/dubbo/testdata/repository.git/hooks/update.sample
diff --git a/dubboctl/operator/dubbo/testdata/repository.git/info/exclude
b/operator/dubbo/testdata/repository.git/info/exclude
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository.git/info/exclude
rename to operator/dubbo/testdata/repository.git/info/exclude
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/objects/00/9641334a89d30963a68442a132e5f8ef389ba8
b/operator/dubbo/testdata/repository.git/objects/00/9641334a89d30963a68442a132e5f8ef389ba8
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/objects/00/9641334a89d30963a68442a132e5f8ef389ba8
rename to
operator/dubbo/testdata/repository.git/objects/00/9641334a89d30963a68442a132e5f8ef389ba8
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/objects/27/d75d0e58009a59e1ff8a52a3297e1e0574138b
b/operator/dubbo/testdata/repository.git/objects/27/d75d0e58009a59e1ff8a52a3297e1e0574138b
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/objects/27/d75d0e58009a59e1ff8a52a3297e1e0574138b
rename to
operator/dubbo/testdata/repository.git/objects/27/d75d0e58009a59e1ff8a52a3297e1e0574138b
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/objects/43/0739f6d9930f74a6aef1a410f0f0727d171cef
b/operator/dubbo/testdata/repository.git/objects/43/0739f6d9930f74a6aef1a410f0f0727d171cef
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/objects/43/0739f6d9930f74a6aef1a410f0f0727d171cef
rename to
operator/dubbo/testdata/repository.git/objects/43/0739f6d9930f74a6aef1a410f0f0727d171cef
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/objects/44/788c5d0e56a8bb819c56a307b6c8de4045e020
b/operator/dubbo/testdata/repository.git/objects/44/788c5d0e56a8bb819c56a307b6c8de4045e020
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/objects/44/788c5d0e56a8bb819c56a307b6c8de4045e020
rename to
operator/dubbo/testdata/repository.git/objects/44/788c5d0e56a8bb819c56a307b6c8de4045e020
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/objects/93/bd2fa63bb19bf11231dde8709672bd1428e57c
b/operator/dubbo/testdata/repository.git/objects/93/bd2fa63bb19bf11231dde8709672bd1428e57c
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/objects/93/bd2fa63bb19bf11231dde8709672bd1428e57c
rename to
operator/dubbo/testdata/repository.git/objects/93/bd2fa63bb19bf11231dde8709672bd1428e57c
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/objects/b2/7e306a552e80fcae0bfa959bd6e8652de70c69
b/operator/dubbo/testdata/repository.git/objects/b2/7e306a552e80fcae0bfa959bd6e8652de70c69
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/objects/b2/7e306a552e80fcae0bfa959bd6e8652de70c69
rename to
operator/dubbo/testdata/repository.git/objects/b2/7e306a552e80fcae0bfa959bd6e8652de70c69
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/objects/b7/5832d0a4a4bb0409cca573b2c97b017d088f90
b/operator/dubbo/testdata/repository.git/objects/b7/5832d0a4a4bb0409cca573b2c97b017d088f90
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/objects/b7/5832d0a4a4bb0409cca573b2c97b017d088f90
rename to
operator/dubbo/testdata/repository.git/objects/b7/5832d0a4a4bb0409cca573b2c97b017d088f90
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/objects/c8/fdee8e0a172c9e1544bc127b2bfb35829ffe1f
b/operator/dubbo/testdata/repository.git/objects/c8/fdee8e0a172c9e1544bc127b2bfb35829ffe1f
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/objects/c8/fdee8e0a172c9e1544bc127b2bfb35829ffe1f
rename to
operator/dubbo/testdata/repository.git/objects/c8/fdee8e0a172c9e1544bc127b2bfb35829ffe1f
diff --git
a/dubboctl/operator/dubbo/testdata/repository.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
b/operator/dubbo/testdata/repository.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
similarity index 100%
rename from
dubboctl/operator/dubbo/testdata/repository.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
rename to
operator/dubbo/testdata/repository.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/dubboctl/operator/dubbo/testdata/repository.git/refs/heads/main
b/operator/dubbo/testdata/repository.git/refs/heads/main
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository.git/refs/heads/main
rename to operator/dubbo/testdata/repository.git/refs/heads/main
diff --git a/dubboctl/operator/dubbo/testdata/repository.git/refs/heads/master
b/operator/dubbo/testdata/repository.git/refs/heads/master
similarity index 100%
rename from dubboctl/operator/dubbo/testdata/repository.git/refs/heads/master
rename to operator/dubbo/testdata/repository.git/refs/heads/master
diff --git a/dubboctl/operator/dubbo/validate.go b/operator/dubbo/validate.go
similarity index 100%
rename from dubboctl/operator/dubbo/validate.go
rename to operator/dubbo/validate.go
diff --git a/dubboctl/operator/http/transport.go b/operator/http/transport.go
similarity index 100%
rename from dubboctl/operator/http/transport.go
rename to operator/http/transport.go
diff --git a/dubboctl/operator/manifest/common.go b/operator/manifest/common.go
similarity index 91%
rename from dubboctl/operator/manifest/common.go
rename to operator/manifest/common.go
index c3c73c04..9234cf69 100644
--- a/dubboctl/operator/manifest/common.go
+++ b/operator/manifest/common.go
@@ -17,7 +17,9 @@ package manifest
import (
"fmt"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/identifier"
+
"github.com/apache/dubbo-kubernetes/operator/pkg/apis/dubbo.apache.org/v1alpha1"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/identifier"
+ util2 "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"path"
"strings"
)
@@ -26,11 +28,6 @@ import (
"sigs.k8s.io/yaml"
)
-import (
-
"github.com/apache/dubbo-kubernetes/dubboctl/operator/apis/dubbo.apache.org/v1alpha1"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
func ReadOverlayProfileYaml(profilePath string, profile string) (string,
error) {
filePath := path.Join(profilePath, profile+".yaml")
defaultPath := path.Join(profilePath, "default.yaml")
@@ -77,7 +74,7 @@ func ReadAndOverlayYamls(filenames []string) (string, error) {
return "", err
}
// todo:// inspect that this file only contains one CR
- output, err = util.OverlayYAML(output, string(file))
+ output, err = util2.OverlayYAML(output, string(file))
if err != nil {
return "", err
}
@@ -92,7 +89,7 @@ func OverlaySetFlags(base string, setFlags []string) (string,
error) {
}
for _, setFlag := range setFlags {
key, val := SplitSetFlag(setFlag)
- pathCtx, _, err := GetPathContext(baseMap,
util.PathFromString(key), true)
+ pathCtx, _, err := GetPathContext(baseMap,
util2.PathFromString(key), true)
if err != nil {
return "", err
}
diff --git a/dubboctl/operator/manifest/common_test.go
b/operator/manifest/common_test.go
similarity index 100%
rename from dubboctl/operator/manifest/common_test.go
rename to operator/manifest/common_test.go
diff --git a/dubboctl/operator/manifest/render/render.go
b/operator/manifest/render/render.go
similarity index 98%
rename from dubboctl/operator/manifest/render/render.go
rename to operator/manifest/render/render.go
index 8eacce64..5d7673f7 100644
--- a/dubboctl/operator/manifest/render/render.go
+++ b/operator/manifest/render/render.go
@@ -18,7 +18,9 @@ package render
import (
"errors"
"fmt"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/identifier"
+ "github.com/apache/dubbo-kubernetes/operator/manifest"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/identifier"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"io/fs"
"net/url"
"os"
@@ -42,11 +44,6 @@ import (
"sigs.k8s.io/yaml"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/manifest"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
const (
YAMLSeparator = "\n---\n"
NotesFileNameSuffix = ".txt"
diff --git a/dubboctl/operator/manifest/render/render_test.go
b/operator/manifest/render/render_test.go
similarity index 99%
rename from dubboctl/operator/manifest/render/render_test.go
rename to operator/manifest/render/render_test.go
index 80848570..64fd04ca 100644
--- a/dubboctl/operator/manifest/render/render_test.go
+++ b/operator/manifest/render/render_test.go
@@ -16,7 +16,7 @@
package render
import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/identifier"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/identifier"
"os"
"testing"
)
diff --git a/dubboctl/operator/manifest/render/testchart/.helmignore
b/operator/manifest/render/testchart/.helmignore
similarity index 100%
rename from dubboctl/operator/manifest/render/testchart/.helmignore
rename to operator/manifest/render/testchart/.helmignore
diff --git a/dubboctl/operator/manifest/render/testchart/Chart.yaml
b/operator/manifest/render/testchart/Chart.yaml
similarity index 100%
rename from dubboctl/operator/manifest/render/testchart/Chart.yaml
rename to operator/manifest/render/testchart/Chart.yaml
diff --git a/dubboctl/operator/manifest/render/testchart/templates/NOTES.txt
b/operator/manifest/render/testchart/templates/NOTES.txt
similarity index 100%
rename from dubboctl/operator/manifest/render/testchart/templates/NOTES.txt
rename to operator/manifest/render/testchart/templates/NOTES.txt
diff --git a/dubboctl/operator/manifest/render/testchart/templates/_helpers.tpl
b/operator/manifest/render/testchart/templates/_helpers.tpl
similarity index 100%
rename from dubboctl/operator/manifest/render/testchart/templates/_helpers.tpl
rename to operator/manifest/render/testchart/templates/_helpers.tpl
diff --git
a/dubboctl/operator/manifest/render/testchart/templates/deployment.yaml
b/operator/manifest/render/testchart/templates/deployment.yaml
similarity index 100%
rename from
dubboctl/operator/manifest/render/testchart/templates/deployment.yaml
rename to operator/manifest/render/testchart/templates/deployment.yaml
diff --git a/dubboctl/operator/manifest/render/testchart/templates/hpa.yaml
b/operator/manifest/render/testchart/templates/hpa.yaml
similarity index 100%
rename from dubboctl/operator/manifest/render/testchart/templates/hpa.yaml
rename to operator/manifest/render/testchart/templates/hpa.yaml
diff --git a/dubboctl/operator/manifest/render/testchart/templates/ingress.yaml
b/operator/manifest/render/testchart/templates/ingress.yaml
similarity index 100%
rename from dubboctl/operator/manifest/render/testchart/templates/ingress.yaml
rename to operator/manifest/render/testchart/templates/ingress.yaml
diff --git a/dubboctl/operator/manifest/render/testchart/templates/service.yaml
b/operator/manifest/render/testchart/templates/service.yaml
similarity index 100%
rename from dubboctl/operator/manifest/render/testchart/templates/service.yaml
rename to operator/manifest/render/testchart/templates/service.yaml
diff --git
a/dubboctl/operator/manifest/render/testchart/templates/serviceaccount.yaml
b/operator/manifest/render/testchart/templates/serviceaccount.yaml
similarity index 100%
rename from
dubboctl/operator/manifest/render/testchart/templates/serviceaccount.yaml
rename to operator/manifest/render/testchart/templates/serviceaccount.yaml
diff --git
a/dubboctl/operator/manifest/render/testchart/templates/tests/test-connection.yaml
b/operator/manifest/render/testchart/templates/tests/test-connection.yaml
similarity index 100%
rename from
dubboctl/operator/manifest/render/testchart/templates/tests/test-connection.yaml
rename to
operator/manifest/render/testchart/templates/tests/test-connection.yaml
diff --git a/dubboctl/operator/manifest/render/testchart/values.yaml
b/operator/manifest/render/testchart/values.yaml
similarity index 100%
rename from dubboctl/operator/manifest/render/testchart/values.yaml
rename to operator/manifest/render/testchart/values.yaml
diff --git a/dubboctl/operator/manifest/tree.go b/operator/manifest/tree.go
similarity index 90%
rename from dubboctl/operator/manifest/tree.go
rename to operator/manifest/tree.go
index 31fce168..4446b9d2 100644
--- a/dubboctl/operator/manifest/tree.go
+++ b/operator/manifest/tree.go
@@ -33,6 +33,7 @@ import (
"encoding/json"
"errors"
"fmt"
+ util2 "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"reflect"
"regexp"
"strconv"
@@ -45,10 +46,6 @@ import (
yaml2 "sigs.k8s.io/yaml"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
// PathContext provides a means for traversing a tree towards the root.
type PathContext struct {
// Parent in the Parent of this PathContext.
@@ -78,13 +75,13 @@ func (nc *PathContext) String() string {
// a malformed path.
// It also creates a tree of PathContexts during the traversal so that Parent
nodes can be updated if required. This is
// required when (say) appending to a list, where the parent list itself must
be updated.
-func GetPathContext(root interface{}, path util.Path, createMissing bool)
(*PathContext, bool, error) {
+func GetPathContext(root interface{}, path util2.Path, createMissing bool)
(*PathContext, bool, error) {
return getPathContext(&PathContext{Node: root}, path, path,
createMissing)
}
// WritePathContext writes the given value to the Node in the given
PathContext.
func WritePathContext(nc *PathContext, value interface{}, merge bool) error {
- if !util.IsValueNil(value) {
+ if !util2.IsValueNil(value) {
return setPathContext(nc, value, merge)
}
@@ -94,23 +91,23 @@ func WritePathContext(nc *PathContext, value interface{},
merge bool) error {
switch {
case isSliceOrPtrInterface(nc.Parent.Node):
- if err := util.DeleteFromSlicePtr(nc.Parent.Node,
nc.Parent.KeyToChild.(int)); err != nil {
+ if err := util2.DeleteFromSlicePtr(nc.Parent.Node,
nc.Parent.KeyToChild.(int)); err != nil {
return err
}
if isMapOrInterface(nc.Parent.Parent.Node) {
- return util.InsertIntoMap(nc.Parent.Parent.Node,
nc.Parent.Parent.KeyToChild, nc.Parent.Node)
+ return util2.InsertIntoMap(nc.Parent.Parent.Node,
nc.Parent.Parent.KeyToChild, nc.Parent.Node)
}
// TODO: The case of deleting a list.list.node element is not
currently supported.
return fmt.Errorf("cannot delete path: unsupported
parent.parent type %T for delete", nc.Parent.Parent.Node)
- case util.IsMap(nc.Parent.Node):
- return util.DeleteFromMap(nc.Parent.Node, nc.Parent.KeyToChild)
+ case util2.IsMap(nc.Parent.Node):
+ return util2.DeleteFromMap(nc.Parent.Node, nc.Parent.KeyToChild)
default:
}
return fmt.Errorf("cannot delete path: unsupported parent type %T for
delete", nc.Parent.Node)
}
// WriteNode writes value to the tree in root at the given path, creating any
required missing internal nodes in path.
-func WriteNode(root interface{}, path util.Path, value interface{}) error {
+func WriteNode(root interface{}, path util2.Path, value interface{}) error {
pc, _, err := getPathContext(&PathContext{Node: root}, path, path, true)
if err != nil {
return err
@@ -119,7 +116,7 @@ func WriteNode(root interface{}, path util.Path, value
interface{}) error {
}
// MergeNode merges value to the tree in root at the given path, creating any
required missing internal nodes in path.
-func MergeNode(root interface{}, path util.Path, value interface{}) error {
+func MergeNode(root interface{}, path util2.Path, value interface{}) error {
pc, _, err := getPathContext(&PathContext{Node: root}, path, path, true)
if err != nil {
return err
@@ -130,7 +127,7 @@ func MergeNode(root interface{}, path util.Path, value
interface{}) error {
// Find returns the value at path from the given tree, or false if the path
does not exist.
// It behaves differently from GetPathContext in that it never creates map
entries at the leaf and does not provide
// a way to mutate the parent of the found node.
-func Find(inputTree map[string]interface{}, path util.Path) (interface{},
bool, error) {
+func Find(inputTree map[string]interface{}, path util2.Path) (interface{},
bool, error) {
if len(path) == 0 {
return nil, false, fmt.Errorf("path is empty")
}
@@ -139,7 +136,7 @@ func Find(inputTree map[string]interface{}, path util.Path)
(interface{}, bool,
}
// Delete sets value at path of input untyped tree to nil
-func Delete(root map[string]interface{}, path util.Path) (bool, error) {
+func Delete(root map[string]interface{}, path util2.Path) (bool, error) {
pc, _, err := getPathContext(&PathContext{Node: root}, path, path,
false)
if err != nil {
return false, err
@@ -149,7 +146,7 @@ func Delete(root map[string]interface{}, path util.Path)
(bool, error) {
// getPathContext is the internal implementation of GetPathContext.
// If createMissing is true, it creates any missing map (but NOT list) path
entries in root.
-func getPathContext(nc *PathContext, fullPath, remainPath util.Path,
createMissing bool) (*PathContext, bool, error) {
+func getPathContext(nc *PathContext, fullPath, remainPath util2.Path,
createMissing bool) (*PathContext, bool, error) {
if len(remainPath) == 0 {
return nc, true, nil
}
@@ -159,7 +156,7 @@ func getPathContext(nc *PathContext, fullPath, remainPath
util.Path, createMissi
if !createMissing {
return nil, false, fmt.Errorf("node %s is zero", pe)
}
- if util.IsNPathElement(pe) || util.IsKVPathElement(pe) {
+ if util2.IsNPathElement(pe) || util2.IsKVPathElement(pe) {
nc.Node = []interface{}{}
} else {
nc.Node = make(map[string]interface{})
@@ -177,8 +174,8 @@ func getPathContext(nc *PathContext, fullPath, remainPath
util.Path, createMissi
if lst, ok := ncNode.([]interface{}); ok {
// If the path element has the form [N], a list element is
being selected by index. Return the element at index
// N if it exists.
- if util.IsNPathElement(pe) {
- idx, err := util.PathN(pe)
+ if util2.IsNPathElement(pe) {
+ idx, err := util2.PathN(pe)
if err != nil {
return nil, false, fmt.Errorf("path %s, index
%s: %s", fullPath, pe, err)
}
@@ -205,7 +202,7 @@ func getPathContext(nc *PathContext, fullPath, remainPath
util.Path, createMissi
for idx, le := range lst {
// non-leaf list, expect to match item by key:value.
if lm, ok := le.(map[interface{}]interface{}); ok {
- k, v, err := util.PathKV(pe)
+ k, v, err := util2.PathKV(pe)
if err != nil {
return nil, false, fmt.Errorf("path %s:
%s", fullPath, err)
}
@@ -226,7 +223,7 @@ func getPathContext(nc *PathContext, fullPath, remainPath
util.Path, createMissi
// repeat of the block above for the case where tree
unmarshals to map[string]interface{}. There doesn't
// seem to be a way to merge this case into the above
block.
if lm, ok := le.(map[string]interface{}); ok {
- k, v, err := util.PathKV(pe)
+ k, v, err := util2.PathKV(pe)
if err != nil {
return nil, false, fmt.Errorf("path %s:
%s", fullPath, err)
}
@@ -245,7 +242,7 @@ func getPathContext(nc *PathContext, fullPath, remainPath
util.Path, createMissi
continue
}
// leaf list, expect path element [V], match based on
value V.
- v, err := util.PathV(pe)
+ v, err := util2.PathV(pe)
if err != nil {
return nil, false, fmt.Errorf("path %s: %s",
fullPath, err)
}
@@ -261,7 +258,7 @@ func getPathContext(nc *PathContext, fullPath, remainPath
util.Path, createMissi
return nil, false, fmt.Errorf("path %s: element %s not found",
fullPath, pe)
}
- if util.IsMap(ncNode) {
+ if util2.IsMap(ncNode) {
var nn interface{}
if m, ok := ncNode.(map[interface{}]interface{}); ok {
nn, ok = m[pe]
@@ -284,7 +281,7 @@ func getPathContext(nc *PathContext, fullPath, remainPath
util.Path, createMissi
if !ok {
// remainPath == 1 means the patch is creation
of a new leaf.
if createMissing || len(remainPath) == 1 {
- nextElementNPath := len(remainPath) > 1
&& util.IsNPathElement(remainPath[1])
+ nextElementNPath := len(remainPath) > 1
&& util2.IsNPathElement(remainPath[1])
if nextElementNPath {
m[pe] = make([]interface{}, 0)
} else {
@@ -302,7 +299,7 @@ func getPathContext(nc *PathContext, fullPath, remainPath
util.Path, createMissi
Node: nn,
}
// for slices, use the address so that the slice can be mutated.
- if util.IsSlice(nn) {
+ if util2.IsSlice(nn) {
npc.Node = &nn
}
nc.KeyToChild = pe
@@ -395,12 +392,12 @@ func setValueContext(nc *PathContext, value interface{},
merge bool) (bool, erro
} else {
// For map passed as string type, the root is the new
key.
if mapFromString {
- if err := util.DeleteFromMap(nc.Parent.Node,
nc.Parent.KeyToChild); err != nil {
+ if err := util2.DeleteFromMap(nc.Parent.Node,
nc.Parent.KeyToChild); err != nil {
return false, err
}
vm := vv.(map[string]interface{})
newKey := getTreeRoot(vm)
- return false,
util.InsertIntoMap(nc.Parent.Node, newKey, vm[newKey])
+ return false,
util2.InsertIntoMap(nc.Parent.Node, newKey, vm[newKey])
}
parentNode[key] = vv
nc.Node = vv
@@ -419,30 +416,30 @@ func setValueContext(nc *PathContext, value interface{},
merge bool) (bool, erro
// mergeConditional returns a merge of newVal and originalVal if merge is
true, otherwise it returns newVal.
func mergeConditional(newVal, originalVal interface{}, merge bool)
(interface{}, error) {
- if !merge || util.IsValueNilOrDefault(originalVal) {
+ if !merge || util2.IsValueNilOrDefault(originalVal) {
return newVal, nil
}
newS, err := yaml.Marshal(newVal)
if err != nil {
return nil, err
}
- if util.IsYAMLEmpty(string(newS)) {
+ if util2.IsYAMLEmpty(string(newS)) {
return originalVal, nil
}
originalS, err := yaml.Marshal(originalVal)
if err != nil {
return nil, err
}
- if util.IsYAMLEmpty(string(originalS)) {
+ if util2.IsYAMLEmpty(string(originalS)) {
return newVal, nil
}
- mergedS, err := util.OverlayYAML(string(originalS), string(newS))
+ mergedS, err := util2.OverlayYAML(string(originalS), string(newS))
if err != nil {
return nil, err
}
- if util.IsMap(originalVal) {
+ if util2.IsMap(originalVal) {
// For JSON compatibility
out := make(map[string]interface{})
if err := yaml.Unmarshal([]byte(mergedS), &out); err != nil {
@@ -459,7 +456,7 @@ func mergeConditional(newVal, originalVal interface{},
merge bool) (interface{},
}
// find returns the value at path from the given tree, or false if the path
does not exist.
-func find(treeNode interface{}, path util.Path) (interface{}, bool) {
+func find(treeNode interface{}, path util2.Path) (interface{}, bool) {
if len(path) == 0 || treeNode == nil {
return nil, false
}
diff --git a/dubboctl/operator/manifest/util.go b/operator/manifest/util.go
similarity index 100%
rename from dubboctl/operator/manifest/util.go
rename to operator/manifest/util.go
diff --git a/dubboctl/operator/mock/builder.go b/operator/mock/builder.go
similarity index 93%
rename from dubboctl/operator/mock/builder.go
rename to operator/mock/builder.go
index a9996904..d571b4b2 100644
--- a/dubboctl/operator/mock/builder.go
+++ b/operator/mock/builder.go
@@ -17,10 +17,7 @@ package mock
import (
"context"
-)
-
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
+ "github.com/apache/dubbo-kubernetes/operator/dubbo"
)
type Builder struct {
diff --git a/dubboctl/operator/mock/client.go b/operator/mock/client.go
similarity index 97%
rename from dubboctl/operator/mock/client.go
rename to operator/mock/client.go
index 0d9df1fd..d7aa53ca 100644
--- a/dubboctl/operator/mock/client.go
+++ b/operator/mock/client.go
@@ -18,7 +18,7 @@
package mock
import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
+ "github.com/apache/dubbo-kubernetes/operator/dubbo"
)
type Client struct {
diff --git a/dubboctl/operator/mock/pusher.go b/operator/mock/pusher.go
similarity index 93%
rename from dubboctl/operator/mock/pusher.go
rename to operator/mock/pusher.go
index 41792de7..ce640825 100644
--- a/dubboctl/operator/mock/pusher.go
+++ b/operator/mock/pusher.go
@@ -17,10 +17,7 @@ package mock
import (
"context"
-)
-
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
+ "github.com/apache/dubbo-kubernetes/operator/dubbo"
)
type Pusher struct {
diff --git a/dubboctl/operator/apis/dubbo.apache.org/v1alpha1/types.go
b/operator/pkg/apis/dubbo.apache.org/v1alpha1/types.go
similarity index 100%
rename from dubboctl/operator/apis/dubbo.apache.org/v1alpha1/types.go
rename to operator/pkg/apis/dubbo.apache.org/v1alpha1/types.go
diff --git a/dubboctl/operator/builders/builders.go
b/operator/pkg/builders/builders.go
similarity index 97%
rename from dubboctl/operator/builders/builders.go
rename to operator/pkg/builders/builders.go
index adb08e6a..b7829901 100644
--- a/dubboctl/operator/builders/builders.go
+++ b/operator/pkg/builders/builders.go
@@ -19,14 +19,11 @@ package builders
import (
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/dubbo"
"strconv"
"strings"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
-)
-
const (
Pack = "pack"
)
diff --git a/dubboctl/operator/builders/builders_test.go
b/operator/pkg/builders/builders_test.go
similarity index 95%
rename from dubboctl/operator/builders/builders_test.go
rename to operator/pkg/builders/builders_test.go
index b521e248..00597bfc 100644
--- a/dubboctl/operator/builders/builders_test.go
+++ b/operator/pkg/builders/builders_test.go
@@ -19,15 +19,12 @@ package builders_test
import (
"errors"
+ "github.com/apache/dubbo-kubernetes/operator/dubbo"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/builders"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/builders/pack"
"testing"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/builders"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/builders/pack"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
-)
-
// TestImage_Named ensures that a builder image is returned when
// it exists on the function for a given builder, no defaults.
func TestImage_Named(t *testing.T) {
diff --git a/dubboctl/operator/builders/dockerfile/build.go
b/operator/pkg/builders/dockerfile/build.go
similarity index 92%
rename from dubboctl/operator/builders/dockerfile/build.go
rename to operator/pkg/builders/dockerfile/build.go
index 74060b0b..46bdbfc9 100644
--- a/dubboctl/operator/builders/dockerfile/build.go
+++ b/operator/pkg/builders/dockerfile/build.go
@@ -17,6 +17,8 @@ package dockerfile
import (
"context"
+ "github.com/apache/dubbo-kubernetes/operator/dubbo"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker"
"os"
)
@@ -30,11 +32,6 @@ import (
"github.com/moby/term"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
-)
-
type Builder struct{}
func (b Builder) Build(ctx context.Context, f *dubbo.Dubbo) error {
diff --git a/dubboctl/operator/builders/pack/build.go
b/operator/pkg/builders/pack/build.go
similarity index 96%
rename from dubboctl/operator/builders/pack/build.go
rename to operator/pkg/builders/pack/build.go
index e8be4154..d2664e55 100644
--- a/dubboctl/operator/builders/pack/build.go
+++ b/operator/pkg/builders/pack/build.go
@@ -20,6 +20,10 @@ import (
"context"
"errors"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/dubbo"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/builders"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/builders/pack/mirror"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker"
"io"
"runtime"
"strings"
@@ -39,13 +43,6 @@ import (
"github.com/heroku/color"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/builders"
-
"github.com/apache/dubbo-kubernetes/dubboctl/operator/builders/pack/mirror"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
-)
-
// DefaultName when no WithName option is provided to NewBuilder
const DefaultName = builders.Pack
diff --git a/dubboctl/operator/builders/pack/build_test.go
b/operator/pkg/builders/pack/build_test.go
similarity index 97%
rename from dubboctl/operator/builders/pack/build_test.go
rename to operator/pkg/builders/pack/build_test.go
index 918f96df..c5539a0b 100644
--- a/dubboctl/operator/builders/pack/build_test.go
+++ b/operator/pkg/builders/pack/build_test.go
@@ -17,6 +17,8 @@ package pack
import (
"context"
+ "github.com/apache/dubbo-kubernetes/operator/dubbo"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/builders"
"reflect"
"testing"
)
@@ -25,11 +27,6 @@ import (
pack "github.com/buildpacks/pack/pkg/client"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/builders"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
-)
-
// TestBuild_BuilderImageUntrusted ensures that only known builder images
// are to be considered trusted.
func TestBuild_BuilderImageUntrusted(t *testing.T) {
diff --git a/dubboctl/operator/builders/pack/mirror/error.go
b/operator/pkg/builders/pack/mirror/error.go
similarity index 100%
rename from dubboctl/operator/builders/pack/mirror/error.go
rename to operator/pkg/builders/pack/mirror/error.go
diff --git a/dubboctl/operator/builders/pack/mirror/mirror.go
b/operator/pkg/builders/pack/mirror/mirror.go
similarity index 100%
rename from dubboctl/operator/builders/pack/mirror/mirror.go
rename to operator/pkg/builders/pack/mirror/mirror.go
diff --git a/dubboctl/operator/docker/creds/credentials.go
b/operator/pkg/docker/creds/credentials.go
similarity index 99%
rename from dubboctl/operator/docker/creds/credentials.go
rename to operator/pkg/docker/creds/credentials.go
index e8d06452..a4d90a02 100644
--- a/dubboctl/operator/docker/creds/credentials.go
+++ b/operator/pkg/docker/creds/credentials.go
@@ -20,6 +20,7 @@ import (
"encoding/json"
"errors"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker"
"net"
"net/http"
"net/url"
@@ -42,10 +43,6 @@ import (
"github.com/google/go-containerregistry/pkg/v1/remote/transport"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker"
-)
-
type CredentialsCallback func(registry string) (docker.Credentials, error)
var ErrUnauthorized = errors.New("bad credentials")
diff --git a/dubboctl/operator/docker/creds/credentials_test.go
b/operator/pkg/docker/creds/credentials_test.go
similarity index 99%
rename from dubboctl/operator/docker/creds/credentials_test.go
rename to operator/pkg/docker/creds/credentials_test.go
index b89f1bbe..19b46d91 100644
--- a/dubboctl/operator/docker/creds/credentials_test.go
+++ b/operator/pkg/docker/creds/credentials_test.go
@@ -26,6 +26,9 @@ import (
"encoding/json"
"errors"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker/creds"
+ . "github.com/apache/dubbo-kubernetes/operator/pkg/testing"
"io"
"math/big"
"net"
@@ -43,12 +46,6 @@ import (
"github.com/docker/docker-credential-helpers/credentials"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker/creds"
- . "github.com/apache/dubbo-kubernetes/dubboctl/operator/testing"
-)
-
func Test_registryEquals(t *testing.T) {
tests := []struct {
name string
diff --git a/dubboctl/operator/docker/docker_client.go
b/operator/pkg/docker/docker_client.go
similarity index 94%
rename from dubboctl/operator/docker/docker_client.go
rename to operator/pkg/docker/docker_client.go
index 021425ad..3b9ae3dd 100644
--- a/dubboctl/operator/docker/docker_client.go
+++ b/operator/pkg/docker/docker_client.go
@@ -19,6 +19,7 @@ import (
"crypto/tls"
"crypto/x509"
"errors"
+ ssh2 "github.com/apache/dubbo-kubernetes/operator/pkg/ssh"
"io"
"net"
"net/http"
@@ -38,10 +39,6 @@ import (
"github.com/docker/go-connections/tlsconfig"
)
-import (
- fnssh "github.com/apache/dubbo-kubernetes/dubboctl/operator/ssh"
-)
-
var ErrNoDocker = errors.New("docker API not available")
// NewClient creates a new docker client.
@@ -57,7 +54,7 @@ func NewClient(defaultHost string) (dockerClient
client.CommonAPIClient, dockerH
dockerHost := os.Getenv("DOCKER_HOST")
dockerHostSSHIdentity := os.Getenv("DOCKER_HOST_SSH_IDENTITY")
- hostKeyCallback := fnssh.NewHostKeyCbk()
+ hostKeyCallback := ssh2.NewHostKeyCbk()
if dockerHost == "" {
_url, err = url.Parse(defaultHost)
@@ -109,14 +106,14 @@ func NewClient(defaultHost string) (dockerClient
client.CommonAPIClient, dockerH
return
}
- credentialsConfig := fnssh.Config{
+ credentialsConfig := ssh2.Config{
Identity: dockerHostSSHIdentity,
PassPhrase:
os.Getenv("DOCKER_HOST_SSH_IDENTITY_PASSPHRASE"),
- PasswordCallback: fnssh.NewPasswordCbk(),
- PassPhraseCallback: fnssh.NewPassPhraseCbk(),
+ PasswordCallback: ssh2.NewPasswordCbk(),
+ PassPhraseCallback: ssh2.NewPassPhraseCbk(),
HostKeyCallback: hostKeyCallback,
}
- contextDialer, dockerHostInRemote, err := fnssh.NewDialContext(_url,
credentialsConfig)
+ contextDialer, dockerHostInRemote, err := ssh2.NewDialContext(_url,
credentialsConfig)
if err != nil {
return
}
diff --git a/dubboctl/operator/docker/docker_client_ssh_test.go
b/operator/pkg/docker/docker_client_ssh_test.go
similarity index 99%
rename from dubboctl/operator/docker/docker_client_ssh_test.go
rename to operator/pkg/docker/docker_client_ssh_test.go
index 26f7959f..0ca71949 100644
--- a/dubboctl/operator/docker/docker_client_ssh_test.go
+++ b/operator/pkg/docker/docker_client_ssh_test.go
@@ -24,6 +24,7 @@ import (
"encoding/binary"
"errors"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker"
"io"
"net"
"net/http"
@@ -41,10 +42,6 @@ import (
"golang.org/x/crypto/ssh"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker"
-)
-
func TestNewDockerClientWithSSH(t *testing.T) {
withCleanHome(t)
diff --git a/dubboctl/operator/docker/docker_client_test.go
b/operator/pkg/docker/docker_client_test.go
similarity index 98%
rename from dubboctl/operator/docker/docker_client_test.go
rename to operator/pkg/docker/docker_client_test.go
index 4d1678d2..b9f30ad5 100644
--- a/dubboctl/operator/docker/docker_client_test.go
+++ b/operator/pkg/docker/docker_client_test.go
@@ -18,6 +18,7 @@ package docker_test
import (
"context"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker"
"net"
"net/http"
"path/filepath"
@@ -31,10 +32,6 @@ import (
"github.com/docker/docker/client"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker"
-)
-
// Test that we are creating client in accordance
// with the DOCKER_HOST environment variable
func TestNewClient(t *testing.T) {
diff --git a/dubboctl/operator/docker/docker_client_windows_test.go
b/operator/pkg/docker/docker_client_windows_test.go
similarity index 95%
rename from dubboctl/operator/docker/docker_client_windows_test.go
rename to operator/pkg/docker/docker_client_windows_test.go
index 185b6ad2..6370e732 100644
--- a/dubboctl/operator/docker/docker_client_windows_test.go
+++ b/operator/pkg/docker/docker_client_windows_test.go
@@ -18,6 +18,7 @@ package docker_test
import (
"context"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker"
"testing"
"time"
)
@@ -28,10 +29,6 @@ import (
"github.com/docker/docker/client"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker"
-)
-
func TestNewClientWinPipe(t *testing.T) {
const testNPipe = "test-npipe"
diff --git a/dubboctl/operator/docker/pusher.go b/operator/pkg/docker/pusher.go
similarity index 99%
rename from dubboctl/operator/docker/pusher.go
rename to operator/pkg/docker/pusher.go
index 4b0d503c..fd87084b 100644
--- a/dubboctl/operator/docker/pusher.go
+++ b/operator/pkg/docker/pusher.go
@@ -22,6 +22,7 @@ import (
"encoding/json"
"errors"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/dubbo"
"io"
"net"
"net/http"
@@ -43,10 +44,6 @@ import (
"golang.org/x/term"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
-)
-
type Opt func(*Pusher)
type Credentials struct {
diff --git a/dubboctl/operator/docker/pusher_test.go
b/operator/pkg/docker/pusher_test.go
similarity index 98%
rename from dubboctl/operator/docker/pusher_test.go
rename to operator/pkg/docker/pusher_test.go
index 3c694fd1..ab15d7a4 100644
--- a/dubboctl/operator/docker/pusher_test.go
+++ b/operator/pkg/docker/pusher_test.go
@@ -28,6 +28,8 @@ import (
"encoding/json"
"errors"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/dubbo"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/docker"
"io"
"log"
"math/big"
@@ -46,11 +48,6 @@ import (
"github.com/google/go-containerregistry/pkg/registry"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/docker"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/dubbo"
-)
-
func TestGetRegistry(t *testing.T) {
tests := []struct {
name string
diff --git a/dubboctl/operator/envoy/envoy.go b/operator/pkg/envoy/envoy.go
similarity index 100%
rename from dubboctl/operator/envoy/envoy.go
rename to operator/pkg/envoy/envoy.go
diff --git a/dubboctl/operator/envoy/memory_limit_darwin.go
b/operator/pkg/envoy/memory_limit_darwin.go
similarity index 100%
rename from dubboctl/operator/envoy/memory_limit_darwin.go
rename to operator/pkg/envoy/memory_limit_darwin.go
diff --git a/dubboctl/operator/envoy/memory_limit_linux.go
b/operator/pkg/envoy/memory_limit_linux.go
similarity index 100%
rename from dubboctl/operator/envoy/memory_limit_linux.go
rename to operator/pkg/envoy/memory_limit_linux.go
diff --git a/dubboctl/operator/envoy/memory_limit_windows.go
b/operator/pkg/envoy/memory_limit_windows.go
similarity index 100%
rename from dubboctl/operator/envoy/memory_limit_windows.go
rename to operator/pkg/envoy/memory_limit_windows.go
diff --git a/dubboctl/operator/envoy/remote_bootstrap.go
b/operator/pkg/envoy/remote_bootstrap.go
similarity index 100%
rename from dubboctl/operator/envoy/remote_bootstrap.go
rename to operator/pkg/envoy/remote_bootstrap.go
diff --git a/dubboctl/operator/filesystem/filesystem.go
b/operator/pkg/filesystem/filesystem.go
similarity index 100%
rename from dubboctl/operator/filesystem/filesystem.go
rename to operator/pkg/filesystem/filesystem.go
diff --git a/dubboctl/generated/templates/generate.go
b/operator/pkg/generated/templates/generate.go
similarity index 98%
rename from dubboctl/generated/templates/generate.go
rename to operator/pkg/generated/templates/generate.go
index ec474415..62dff6e1 100644
--- a/dubboctl/generated/templates/generate.go
+++ b/operator/pkg/generated/templates/generate.go
@@ -28,7 +28,7 @@ import (
"path/filepath"
)
-// relative path from /dubboctl/internal/dubbo/templates_embedded.go to the
`dubboctl` folder
+// relative path from /dubboctl/operator/dubbo/templates_embedded.go to the
`dubboctl` folder
const relativePathToRoot = "../../"
var templatesPath = filepath.Join(relativePathToRoot, "templates")
diff --git a/dubboctl/generated/zz_filesystem_generated.go
b/operator/pkg/generated/zz_filesystem_generated.go
similarity index 100%
rename from dubboctl/generated/zz_filesystem_generated.go
rename to operator/pkg/generated/zz_filesystem_generated.go
diff --git a/dubboctl/operator/identifier/const.go
b/operator/pkg/identifier/const.go
similarity index 100%
rename from dubboctl/operator/identifier/const.go
rename to operator/pkg/identifier/const.go
diff --git a/dubboctl/operator/identifier/path.go
b/operator/pkg/identifier/path.go
similarity index 95%
rename from dubboctl/operator/identifier/path.go
rename to operator/pkg/identifier/path.go
index bbfd66ec..4d373d58 100644
--- a/dubboctl/operator/identifier/path.go
+++ b/operator/pkg/identifier/path.go
@@ -16,11 +16,11 @@
package identifier
import (
+ "github.com/apache/dubbo-kubernetes/operator/pkg/filesystem"
"net/url"
)
import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/filesystem"
"github.com/apache/dubbo-kubernetes/manifests"
)
diff --git a/dubboctl/operator/kube/client.go b/operator/pkg/kube/client.go
similarity index 100%
rename from dubboctl/operator/kube/client.go
rename to operator/pkg/kube/client.go
diff --git a/dubboctl/operator/kube/common.go b/operator/pkg/kube/common.go
similarity index 100%
rename from dubboctl/operator/kube/common.go
rename to operator/pkg/kube/common.go
diff --git a/dubboctl/operator/kube/common_test.go
b/operator/pkg/kube/common_test.go
similarity index 100%
rename from dubboctl/operator/kube/common_test.go
rename to operator/pkg/kube/common_test.go
diff --git a/dubboctl/operator/kube/component.go
b/operator/pkg/kube/component.go
similarity index 94%
rename from dubboctl/operator/kube/component.go
rename to operator/pkg/kube/component.go
index 885d378a..c4c931dc 100644
--- a/dubboctl/operator/kube/component.go
+++ b/operator/pkg/kube/component.go
@@ -16,7 +16,12 @@
package kube
import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/identifier"
+ manifest2 "github.com/apache/dubbo-kubernetes/operator/manifest"
+ "github.com/apache/dubbo-kubernetes/operator/manifest/render"
+
"github.com/apache/dubbo-kubernetes/operator/pkg/apis/dubbo.apache.org/v1alpha1"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/filesystem"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/identifier"
+ util2 "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"path"
"strings"
"unicode/utf8"
@@ -30,14 +35,6 @@ import (
"sigs.k8s.io/yaml"
)
-import (
-
"github.com/apache/dubbo-kubernetes/dubboctl/operator/apis/dubbo.apache.org/v1alpha1"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/filesystem"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/manifest"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/manifest/render"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
type ComponentName string
const (
@@ -533,7 +530,7 @@ func renderManifest(spec any, renderer render.Renderer,
addOn bool, name Compone
if addOn {
// see /deploy/addons
// values-*.yaml is the base yaml for addon bootstrap
- valsYaml, err = manifest.ReadAndOverlayYamls([]string{
+ valsYaml, err = manifest2.ReadAndOverlayYamls([]string{
path.Join(identifier.Addons,
"values-"+string(name)+".yaml"),
})
if err != nil {
@@ -542,12 +539,12 @@ func renderManifest(spec any, renderer render.Renderer,
addOn bool, name Compone
}
// do not use spec != nil cause spec's type is not nil
- if !util.IsValueNil(spec) {
+ if !util2.IsValueNil(spec) {
valsBytes, err = yaml.Marshal(spec)
if err != nil {
return "", err
}
- valsYaml, err = util.OverlayYAML(valsYaml, string(valsBytes))
+ valsYaml, err = util2.OverlayYAML(valsYaml, string(valsBytes))
if err != nil {
return "", err
}
@@ -610,7 +607,7 @@ func addDashboards(base string, namespace string) (string,
error) {
// setNamespace split base and set namespace.
func setNamespace(base string, namespace string) (string, error) {
var newSegs []string
- segs, err := util.SplitYAML(base)
+ segs, err := util2.SplitYAML(base)
if err != nil {
return "", err
}
@@ -622,11 +619,11 @@ func setNamespace(base string, namespace string) (string,
error) {
if err := yaml.Unmarshal([]byte(seg), &segMap); err != nil {
return "", err
}
- pathCtx, _, err := manifest.GetPathContext(segMap,
util.PathFromString("metadata.namespace"), true)
+ pathCtx, _, err := manifest2.GetPathContext(segMap,
util2.PathFromString("metadata.namespace"), true)
if err != nil {
return "", err
}
- if err := manifest.WritePathContext(pathCtx,
manifest.ParseValue(namespace), false); err != nil {
+ if err := manifest2.WritePathContext(pathCtx,
manifest2.ParseValue(namespace), false); err != nil {
return "", err
}
newSeg, err := yaml.Marshal(segMap)
@@ -635,6 +632,6 @@ func setNamespace(base string, namespace string) (string,
error) {
}
newSegs = append(newSegs, string(newSeg))
}
- final := util.JoinYAML(newSegs)
+ final := util2.JoinYAML(newSegs)
return final, nil
}
diff --git a/dubboctl/operator/kube/object.go b/operator/pkg/kube/object.go
similarity index 98%
rename from dubboctl/operator/kube/object.go
rename to operator/pkg/kube/object.go
index 9bb853ef..0c9e5e8d 100644
--- a/dubboctl/operator/kube/object.go
+++ b/operator/pkg/kube/object.go
@@ -18,6 +18,7 @@ package kube
import (
"bytes"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/util"
"sort"
"strings"
)
@@ -27,10 +28,6 @@ import (
"k8s.io/apimachinery/pkg/util/yaml"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
const (
hashPrompt = "Namespace:Kind:Name=>"
)
diff --git a/dubboctl/operator/kube/object_test.go
b/operator/pkg/kube/object_test.go
similarity index 100%
rename from dubboctl/operator/kube/object_test.go
rename to operator/pkg/kube/object_test.go
diff --git a/dubboctl/operator/kube/operator.go b/operator/pkg/kube/operator.go
similarity index 97%
rename from dubboctl/operator/kube/operator.go
rename to operator/pkg/kube/operator.go
index 9e80f50c..07ab00cf 100644
--- a/dubboctl/operator/kube/operator.go
+++ b/operator/pkg/kube/operator.go
@@ -18,11 +18,11 @@ package kube
import (
"errors"
"fmt"
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/identifier"
+
"github.com/apache/dubbo-kubernetes/operator/pkg/apis/dubbo.apache.org/v1alpha1"
+ "github.com/apache/dubbo-kubernetes/operator/pkg/identifier"
)
import (
-
"github.com/apache/dubbo-kubernetes/dubboctl/operator/apis/dubbo.apache.org/v1alpha1"
"github.com/apache/dubbo-kubernetes/pkg/core/logger"
)
diff --git a/dubboctl/operator/kube/port_foward.go
b/operator/pkg/kube/port_foward.go
similarity index 100%
rename from dubboctl/operator/kube/port_foward.go
rename to operator/pkg/kube/port_foward.go
diff --git
a/dubboctl/operator/kube/testdata/input/ctl_client-apply_manifest.yaml
b/operator/pkg/kube/testdata/input/ctl_client-apply_manifest.yaml
similarity index 100%
rename from dubboctl/operator/kube/testdata/input/ctl_client-apply_manifest.yaml
rename to operator/pkg/kube/testdata/input/ctl_client-apply_manifest.yaml
diff --git
a/dubboctl/operator/kube/testdata/input/ctl_client-apply_object-create.yaml
b/operator/pkg/kube/testdata/input/ctl_client-apply_object-create.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/input/ctl_client-apply_object-create.yaml
rename to operator/pkg/kube/testdata/input/ctl_client-apply_object-create.yaml
diff --git
a/dubboctl/operator/kube/testdata/input/ctl_client-apply_object-update-before.yaml
b/operator/pkg/kube/testdata/input/ctl_client-apply_object-update-before.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/input/ctl_client-apply_object-update-before.yaml
rename to
operator/pkg/kube/testdata/input/ctl_client-apply_object-update-before.yaml
diff --git
a/dubboctl/operator/kube/testdata/input/ctl_client-apply_object-update.yaml
b/operator/pkg/kube/testdata/input/ctl_client-apply_object-update.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/input/ctl_client-apply_object-update.yaml
rename to operator/pkg/kube/testdata/input/ctl_client-apply_object-update.yaml
diff --git
a/dubboctl/operator/kube/testdata/input/ctl_client-remove_manifest-before.yaml
b/operator/pkg/kube/testdata/input/ctl_client-remove_manifest-before.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/input/ctl_client-remove_manifest-before.yaml
rename to
operator/pkg/kube/testdata/input/ctl_client-remove_manifest-before.yaml
diff --git
a/dubboctl/operator/kube/testdata/input/ctl_client-remove_manifest.yaml
b/operator/pkg/kube/testdata/input/ctl_client-remove_manifest.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/input/ctl_client-remove_manifest.yaml
rename to operator/pkg/kube/testdata/input/ctl_client-remove_manifest.yaml
diff --git
a/dubboctl/operator/kube/testdata/input/ctl_client-remove_object-delete-before.yaml
b/operator/pkg/kube/testdata/input/ctl_client-remove_object-delete-before.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/input/ctl_client-remove_object-delete-before.yaml
rename to
operator/pkg/kube/testdata/input/ctl_client-remove_object-delete-before.yaml
diff --git
a/dubboctl/operator/kube/testdata/input/ctl_client-remove_object-delete.yaml
b/operator/pkg/kube/testdata/input/ctl_client-remove_object-delete.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/input/ctl_client-remove_object-delete.yaml
rename to operator/pkg/kube/testdata/input/ctl_client-remove_object-delete.yaml
diff --git
a/dubboctl/operator/kube/testdata/want/admin_component-render_manifest.golden.yaml
b/operator/pkg/kube/testdata/want/admin_component-render_manifest.golden.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/want/admin_component-render_manifest.golden.yaml
rename to
operator/pkg/kube/testdata/want/admin_component-render_manifest.golden.yaml
diff --git
a/dubboctl/operator/kube/testdata/want/ctl_client-apply_object-create.yaml
b/operator/pkg/kube/testdata/want/ctl_client-apply_object-create.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/want/ctl_client-apply_object-create.yaml
rename to operator/pkg/kube/testdata/want/ctl_client-apply_object-create.yaml
diff --git
a/dubboctl/operator/kube/testdata/want/ctl_client-apply_object-update.yaml
b/operator/pkg/kube/testdata/want/ctl_client-apply_object-update.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/want/ctl_client-apply_object-update.yaml
rename to operator/pkg/kube/testdata/want/ctl_client-apply_object-update.yaml
diff --git
a/dubboctl/operator/kube/testdata/want/nacos_component-render_manifest.golden.yaml
b/operator/pkg/kube/testdata/want/nacos_component-render_manifest.golden.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/want/nacos_component-render_manifest.golden.yaml
rename to
operator/pkg/kube/testdata/want/nacos_component-render_manifest.golden.yaml
diff --git
a/dubboctl/operator/kube/testdata/want/prometheus_component-render_manifest.golden.yaml
b/operator/pkg/kube/testdata/want/prometheus_component-render_manifest.golden.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/want/prometheus_component-render_manifest.golden.yaml
rename to
operator/pkg/kube/testdata/want/prometheus_component-render_manifest.golden.yaml
diff --git
a/dubboctl/operator/kube/testdata/want/skywalking_component-render_manifest.golden.yaml
b/operator/pkg/kube/testdata/want/skywalking_component-render_manifest.golden.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/want/skywalking_component-render_manifest.golden.yaml
rename to
operator/pkg/kube/testdata/want/skywalking_component-render_manifest.golden.yaml
diff --git
a/dubboctl/operator/kube/testdata/want/zipkin_component-render_manifest.golden.yaml
b/operator/pkg/kube/testdata/want/zipkin_component-render_manifest.golden.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/want/zipkin_component-render_manifest.golden.yaml
rename to
operator/pkg/kube/testdata/want/zipkin_component-render_manifest.golden.yaml
diff --git
a/dubboctl/operator/kube/testdata/want/zookeeper_component-render_manifest.golden.yaml
b/operator/pkg/kube/testdata/want/zookeeper_component-render_manifest.golden.yaml
similarity index 100%
rename from
dubboctl/operator/kube/testdata/want/zookeeper_component-render_manifest.golden.yaml
rename to
operator/pkg/kube/testdata/want/zookeeper_component-render_manifest.golden.yaml
diff --git a/dubboctl/operator/ssh/ssh_agent_conf.go
b/operator/pkg/ssh/ssh_agent_conf.go
similarity index 100%
rename from dubboctl/operator/ssh/ssh_agent_conf.go
rename to operator/pkg/ssh/ssh_agent_conf.go
diff --git a/dubboctl/operator/ssh/ssh_agent_conf_windows.go
b/operator/pkg/ssh/ssh_agent_conf_windows.go
similarity index 100%
rename from dubboctl/operator/ssh/ssh_agent_conf_windows.go
rename to operator/pkg/ssh/ssh_agent_conf_windows.go
diff --git a/dubboctl/operator/ssh/ssh_dialer.go
b/operator/pkg/ssh/ssh_dialer.go
similarity index 100%
rename from dubboctl/operator/ssh/ssh_dialer.go
rename to operator/pkg/ssh/ssh_dialer.go
diff --git a/dubboctl/operator/ssh/terminal.go b/operator/pkg/ssh/terminal.go
similarity index 100%
rename from dubboctl/operator/ssh/terminal.go
rename to operator/pkg/ssh/terminal.go
diff --git a/dubboctl/templates/go/README.md
b/operator/pkg/templates/go/README.md
similarity index 100%
rename from dubboctl/templates/go/README.md
rename to operator/pkg/templates/go/README.md
diff --git a/dubboctl/templates/go/common/.gitignore
b/operator/pkg/templates/go/common/.gitignore
similarity index 100%
rename from dubboctl/templates/go/common/.gitignore
rename to operator/pkg/templates/go/common/.gitignore
diff --git a/dubboctl/templates/go/common/api/api.pb.go
b/operator/pkg/templates/go/common/api/api.pb.go
similarity index 100%
rename from dubboctl/templates/go/common/api/api.pb.go
rename to operator/pkg/templates/go/common/api/api.pb.go
diff --git a/dubboctl/templates/go/common/api/api.proto
b/operator/pkg/templates/go/common/api/api.proto
similarity index 100%
rename from dubboctl/templates/go/common/api/api.proto
rename to operator/pkg/templates/go/common/api/api.proto
diff --git a/dubboctl/templates/go/common/api/api_triple.pb.go
b/operator/pkg/templates/go/common/api/api_triple.pb.go
similarity index 100%
rename from dubboctl/templates/go/common/api/api_triple.pb.go
rename to operator/pkg/templates/go/common/api/api_triple.pb.go
diff --git a/dubboctl/templates/go/common/cmd/app.go
b/operator/pkg/templates/go/common/cmd/app.go
similarity index 100%
rename from dubboctl/templates/go/common/cmd/app.go
rename to operator/pkg/templates/go/common/cmd/app.go
diff --git a/dubboctl/templates/go/common/conf/dubbogo.yaml
b/operator/pkg/templates/go/common/conf/dubbogo.yaml
similarity index 100%
rename from dubboctl/templates/go/common/conf/dubbogo.yaml
rename to operator/pkg/templates/go/common/conf/dubbogo.yaml
diff --git a/dubboctl/templates/go/common/go.mod
b/operator/pkg/templates/go/common/go.mod
similarity index 100%
rename from dubboctl/templates/go/common/go.mod
rename to operator/pkg/templates/go/common/go.mod
diff --git a/dubboctl/templates/go/common/go.sum
b/operator/pkg/templates/go/common/go.sum
similarity index 100%
rename from dubboctl/templates/go/common/go.sum
rename to operator/pkg/templates/go/common/go.sum
diff --git a/dubboctl/templates/go/common/pkg/service/service.go
b/operator/pkg/templates/go/common/pkg/service/service.go
similarity index 100%
rename from dubboctl/templates/go/common/pkg/service/service.go
rename to operator/pkg/templates/go/common/pkg/service/service.go
diff --git a/dubboctl/templates/java/README.md
b/operator/pkg/templates/java/README.md
similarity index 100%
rename from dubboctl/templates/java/README.md
rename to operator/pkg/templates/java/README.md
diff --git a/dubboctl/templates/java/common/.gitignore
b/operator/pkg/templates/java/common/.gitignore
similarity index 100%
rename from dubboctl/templates/java/common/.gitignore
rename to operator/pkg/templates/java/common/.gitignore
diff --git a/dubboctl/templates/java/common/pom.xml
b/operator/pkg/templates/java/common/pom.xml
similarity index 100%
rename from dubboctl/templates/java/common/pom.xml
rename to operator/pkg/templates/java/common/pom.xml
diff --git
a/dubboctl/templates/java/common/src/main/java/com/example/demo/DemoApplication.java
b/operator/pkg/templates/java/common/src/main/java/com/example/demo/DemoApplication.java
similarity index 100%
rename from
dubboctl/templates/java/common/src/main/java/com/example/demo/DemoApplication.java
rename to
operator/pkg/templates/java/common/src/main/java/com/example/demo/DemoApplication.java
diff --git
a/dubboctl/templates/java/common/src/main/java/com/example/demo/demos/web/BasicController.java
b/operator/pkg/templates/java/common/src/main/java/com/example/demo/demos/web/BasicController.java
similarity index 100%
rename from
dubboctl/templates/java/common/src/main/java/com/example/demo/demos/web/BasicController.java
rename to
operator/pkg/templates/java/common/src/main/java/com/example/demo/demos/web/BasicController.java
diff --git
a/dubboctl/templates/java/common/src/main/java/com/example/demo/demos/web/PathVariableController.java
b/operator/pkg/templates/java/common/src/main/java/com/example/demo/demos/web/PathVariableController.java
similarity index 100%
rename from
dubboctl/templates/java/common/src/main/java/com/example/demo/demos/web/PathVariableController.java
rename to
operator/pkg/templates/java/common/src/main/java/com/example/demo/demos/web/PathVariableController.java
diff --git
a/dubboctl/templates/java/common/src/main/java/com/example/demo/demos/web/User.java
b/operator/pkg/templates/java/common/src/main/java/com/example/demo/demos/web/User.java
similarity index 100%
rename from
dubboctl/templates/java/common/src/main/java/com/example/demo/demos/web/User.java
rename to
operator/pkg/templates/java/common/src/main/java/com/example/demo/demos/web/User.java
diff --git
a/dubboctl/templates/java/common/src/main/java/com/example/demo/dubbo/api/DemoService.java
b/operator/pkg/templates/java/common/src/main/java/com/example/demo/dubbo/api/DemoService.java
similarity index 100%
rename from
dubboctl/templates/java/common/src/main/java/com/example/demo/dubbo/api/DemoService.java
rename to
operator/pkg/templates/java/common/src/main/java/com/example/demo/dubbo/api/DemoService.java
diff --git
a/dubboctl/templates/java/common/src/main/java/com/example/demo/dubbo/consumer/Consumer.java
b/operator/pkg/templates/java/common/src/main/java/com/example/demo/dubbo/consumer/Consumer.java
similarity index 100%
rename from
dubboctl/templates/java/common/src/main/java/com/example/demo/dubbo/consumer/Consumer.java
rename to
operator/pkg/templates/java/common/src/main/java/com/example/demo/dubbo/consumer/Consumer.java
diff --git
a/dubboctl/templates/java/common/src/main/java/com/example/demo/dubbo/service/DemoServiceImpl.java
b/operator/pkg/templates/java/common/src/main/java/com/example/demo/dubbo/service/DemoServiceImpl.java
similarity index 100%
rename from
dubboctl/templates/java/common/src/main/java/com/example/demo/dubbo/service/DemoServiceImpl.java
rename to
operator/pkg/templates/java/common/src/main/java/com/example/demo/dubbo/service/DemoServiceImpl.java
diff --git a/dubboctl/templates/java/common/src/main/resources/application.yml
b/operator/pkg/templates/java/common/src/main/resources/application.yml
similarity index 100%
rename from dubboctl/templates/java/common/src/main/resources/application.yml
rename to operator/pkg/templates/java/common/src/main/resources/application.yml
diff --git a/dubboctl/templates/java/common/src/main/resources/log4j.properties
b/operator/pkg/templates/java/common/src/main/resources/log4j.properties
similarity index 100%
rename from dubboctl/templates/java/common/src/main/resources/log4j.properties
rename to operator/pkg/templates/java/common/src/main/resources/log4j.properties
diff --git
a/dubboctl/templates/java/common/src/main/resources/static/index.html
b/operator/pkg/templates/java/common/src/main/resources/static/index.html
similarity index 100%
rename from dubboctl/templates/java/common/src/main/resources/static/index.html
rename to
operator/pkg/templates/java/common/src/main/resources/static/index.html
diff --git
a/dubboctl/templates/java/common/src/test/java/com/example/demo/DemoApplicationTests.java
b/operator/pkg/templates/java/common/src/test/java/com/example/demo/DemoApplicationTests.java
similarity index 100%
rename from
dubboctl/templates/java/common/src/test/java/com/example/demo/DemoApplicationTests.java
rename to
operator/pkg/templates/java/common/src/test/java/com/example/demo/DemoApplicationTests.java
diff --git a/dubboctl/templates/manifest.yaml
b/operator/pkg/templates/manifest.yaml
similarity index 100%
rename from dubboctl/templates/manifest.yaml
rename to operator/pkg/templates/manifest.yaml
diff --git a/dubboctl/operator/testing/testing.go
b/operator/pkg/testing/testing.go
similarity index 100%
rename from dubboctl/operator/testing/testing.go
rename to operator/pkg/testing/testing.go
diff --git a/dubboctl/operator/util/config.go b/operator/pkg/util/config.go
similarity index 100%
rename from dubboctl/operator/util/config.go
rename to operator/pkg/util/config.go
diff --git a/dubboctl/operator/util/config_test.go
b/operator/pkg/util/config_test.go
similarity index 95%
rename from dubboctl/operator/util/config_test.go
rename to operator/pkg/util/config_test.go
index a76487eb..92ca1ffa 100644
--- a/dubboctl/operator/util/config_test.go
+++ b/operator/pkg/util/config_test.go
@@ -18,16 +18,13 @@
package util_test
import (
+ . "github.com/apache/dubbo-kubernetes/operator/pkg/testing"
+ config "github.com/apache/dubbo-kubernetes/operator/util"
"os"
"path/filepath"
"testing"
)
-import (
- . "github.com/apache/dubbo-kubernetes/dubboctl/operator/testing"
- config "github.com/apache/dubbo-kubernetes/dubboctl/operator/util"
-)
-
// TestPath ensures that the Path accessor returns
// XDG_CONFIG_HOME/.config/dubbo
func TestPath(t *testing.T) {
diff --git a/dubboctl/operator/util/env.go b/operator/pkg/util/env.go
similarity index 100%
rename from dubboctl/operator/util/env.go
rename to operator/pkg/util/env.go
diff --git a/dubboctl/operator/util/file.go b/operator/pkg/util/file.go
similarity index 100%
rename from dubboctl/operator/util/file.go
rename to operator/pkg/util/file.go
diff --git a/dubboctl/operator/util/filter.go b/operator/pkg/util/filter.go
similarity index 100%
rename from dubboctl/operator/util/filter.go
rename to operator/pkg/util/filter.go
diff --git a/dubboctl/operator/util/filter_test.go
b/operator/pkg/util/filter_test.go
similarity index 100%
rename from dubboctl/operator/util/filter_test.go
rename to operator/pkg/util/filter_test.go
diff --git a/dubboctl/operator/util/golden.go b/operator/pkg/util/golden.go
similarity index 100%
rename from dubboctl/operator/util/golden.go
rename to operator/pkg/util/golden.go
diff --git a/dubboctl/operator/util/golden_test.go
b/operator/pkg/util/golden_test.go
similarity index 100%
rename from dubboctl/operator/util/golden_test.go
rename to operator/pkg/util/golden_test.go
diff --git a/dubboctl/operator/util/names.go b/operator/pkg/util/names.go
similarity index 100%
rename from dubboctl/operator/util/names.go
rename to operator/pkg/util/names.go
diff --git a/dubboctl/operator/util/names_test.go
b/operator/pkg/util/names_test.go
similarity index 100%
rename from dubboctl/operator/util/names_test.go
rename to operator/pkg/util/names_test.go
diff --git a/dubboctl/operator/util/path.go b/operator/pkg/util/path.go
similarity index 100%
rename from dubboctl/operator/util/path.go
rename to operator/pkg/util/path.go
diff --git a/dubboctl/operator/util/reflect.go b/operator/pkg/util/reflect.go
similarity index 100%
rename from dubboctl/operator/util/reflect.go
rename to operator/pkg/util/reflect.go
diff --git a/dubboctl/operator/util/sortedset.go
b/operator/pkg/util/sortedset.go
similarity index 100%
rename from dubboctl/operator/util/sortedset.go
rename to operator/pkg/util/sortedset.go
diff --git a/dubboctl/operator/util/testdata/TestLoad/dubbo/config.yaml
b/operator/pkg/util/testdata/TestLoad/dubbo/config.yaml
similarity index 100%
rename from dubboctl/operator/util/testdata/TestLoad/dubbo/config.yaml
rename to operator/pkg/util/testdata/TestLoad/dubbo/config.yaml
diff --git a/dubboctl/operator/util/testdata/dubbo/config.yaml
b/operator/pkg/util/testdata/dubbo/config.yaml
similarity index 100%
rename from dubboctl/operator/util/testdata/dubbo/config.yaml
rename to operator/pkg/util/testdata/dubbo/config.yaml
diff --git a/dubboctl/operator/util/yaml.go b/operator/pkg/util/yaml.go
similarity index 100%
rename from dubboctl/operator/util/yaml.go
rename to operator/pkg/util/yaml.go
diff --git a/dubboctl/operator/util/yaml_test.go
b/operator/pkg/util/yaml_test.go
similarity index 100%
rename from dubboctl/operator/util/yaml_test.go
rename to operator/pkg/util/yaml_test.go
diff --git a/dubboctl/operator/registry/registry.go
b/operator/registry/registry.go
similarity index 100%
rename from dubboctl/operator/registry/registry.go
rename to operator/registry/registry.go
diff --git a/dubboctl/operator/registry/zk/zk.go b/operator/registry/zk/zk.go
similarity index 97%
rename from dubboctl/operator/registry/zk/zk.go
rename to operator/registry/zk/zk.go
index 09a21c6f..f6d2b7cd 100644
--- a/dubboctl/operator/registry/zk/zk.go
+++ b/operator/registry/zk/zk.go
@@ -18,6 +18,7 @@ package zk
import (
"context"
"fmt"
+ "github.com/apache/dubbo-kubernetes/operator/registry"
"net/url"
"strings"
"time"
@@ -27,10 +28,6 @@ import (
"github.com/dubbogo/go-zookeeper/zk"
)
-import (
- "github.com/apache/dubbo-kubernetes/dubboctl/operator/registry"
-)
-
type zkRegistry struct {
client *zk.Conn
}