Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add crd tests, queue and move dubboctl #1202

Merged
merged 6 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .run/Admin.run.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Admin" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="dubbo-admin" />
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,4 @@ golangci-lint-install: $(LOCALBIN) ## Download golangci lint locally if necessar
.PHONY: gofumpt-install
gofumpt-install: $(LOCALBIN) ## Download gofumpt locally if necessary.
test -s $(LOCALBIN)/gofumpt || \
GOBIN=$(LOCALBIN) go install mvdan.cc/gofumpt@$(GOFUMPT_VERSION)
GOBIN=$(LOCALBIN) go install mvdan.cc/gofumpt@$(GOFUMPT_VERSION)
3 changes: 2 additions & 1 deletion app/dubbo-cp/cmd/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ package cmd

import (
"fmt"
"time"

"github.com/apache/dubbo-admin/pkg/admin"
"github.com/apache/dubbo-admin/pkg/config"
dubbo_cp "github.com/apache/dubbo-admin/pkg/config/app/dubbo-cp"
"github.com/apache/dubbo-admin/pkg/core/bootstrap"
"github.com/apache/dubbo-admin/pkg/core/cmd"
"github.com/apache/dubbo-admin/pkg/core/logger"
"github.com/spf13/cobra"
"time"
)

func newConsoleCmdWithOpts(opts cmd.RunCmdOpts) *cobra.Command {
Expand Down
13 changes: 7 additions & 6 deletions app/dubbo-cp/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
package cmd

import (
"os"

cmd2 "github.com/apache/dubbo-admin/pkg/core/cmd"
"github.com/apache/dubbo-admin/pkg/core/cmd/version"
"github.com/apache/dubbo-admin/pkg/core/logger"
"github.com/spf13/cobra"
"os"
)

func GetRootCmd(args []string) *cobra.Command {
Expand All @@ -46,11 +47,11 @@ func GetRootCmd(args []string) *cobra.Command {
cmd.SetOut(os.Stdout)

// root flags
//cmd.PersistentFlags().StringVar(&args.logLevel, "log-level", kuma_log.InfoLevel.String(), kuma_cmd.UsageOptions("log level", kuma_log.OffLevel, kuma_log.InfoLevel, kuma_log.DebugLevel))
//cmd.PersistentFlags().StringVar(&args.outputPath, "log-output-path", args.outputPath, "path to the file that will be filled with logs. Example: if we set it to /tmp/admin.log then after the file is rotated we will have /tmp/admin-2021-06-07T09-15-18.265.log")
//cmd.PersistentFlags().IntVar(&args.maxBackups, "log-max-retained-files", 1000, "maximum number of the old log files to retain")
//cmd.PersistentFlags().IntVar(&args.maxSize, "log-max-size", 100, "maximum size in megabytes of a log file before it gets rotated")
//cmd.PersistentFlags().IntVar(&args.maxAge, "log-max-age", 30, "maximum number of days to retain old log files based on the timestamp encoded in their filename")
// cmd.PersistentFlags().StringVar(&args.logLevel, "log-level", kuma_log.InfoLevel.String(), kuma_cmd.UsageOptions("log level", kuma_log.OffLevel, kuma_log.InfoLevel, kuma_log.DebugLevel))
// cmd.PersistentFlags().StringVar(&args.outputPath, "log-output-path", args.outputPath, "path to the file that will be filled with logs. Example: if we set it to /tmp/admin.log then after the file is rotated we will have /tmp/admin-2021-06-07T09-15-18.265.log")
// cmd.PersistentFlags().IntVar(&args.maxBackups, "log-max-retained-files", 1000, "maximum number of the old log files to retain")
// cmd.PersistentFlags().IntVar(&args.maxSize, "log-max-size", 100, "maximum size in megabytes of a log file before it gets rotated")
// cmd.PersistentFlags().IntVar(&args.maxAge, "log-max-age", 30, "maximum number of days to retain old log files based on the timestamp encoded in their filename")

// sub-commands
cmd.AddCommand(newRunCmdWithOpts(cmd2.DefaultRunCmdOpts))
Expand Down
3 changes: 2 additions & 1 deletion app/dubbo-cp/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package cmd

import (
"fmt"
"time"

"github.com/apache/dubbo-admin/pkg/admin"
"github.com/apache/dubbo-admin/pkg/authority"
"github.com/apache/dubbo-admin/pkg/config"
Expand All @@ -30,7 +32,6 @@ import (
"github.com/apache/dubbo-admin/pkg/cp-server"
"github.com/apache/dubbo-admin/pkg/rule"
"github.com/spf13/cobra"
"time"
)

const gracefullyShutdownDuration = 3 * time.Second
Expand Down
14 changes: 14 additions & 0 deletions app/dubbo-ui/dist/echarts-en.min.js

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion app/dubbo-ui/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Dubbo Admin</title><link href=/admin/OpenSans.css rel=stylesheet type=text/css><link rel="/admin/shortcut icon" href=dubbo.ico type=image/x-icon><script src=/admin/echarts-en.min.js></script><link href=/admin/static/css/app.be67f7a9.css rel=preload as=style><link href=/admin/static/css/chunk-vendors.52f99f04.css rel=preload as=style><link href=/admin/static/js/app.97288c91.js rel=preload as=script><link href=/admin/static/js/braceBase.39ce0e20.js rel=preload as=script><link href=/admin/static/js/chunk-vendors.491fd433.js rel=preload as=script><link href=/admin/static/css/chunk-vendors.52f99f04.css rel=stylesheet><link href=/admin/static/css/app.be67f7a9.css rel=stylesheet></head><body><div id=app></div><script src=/admin/static/js/braceBase.39ce0e20.js></script><script src=/admin/static/js/chunk-vendors.491fd433.js></script><script src=/admin/static/js/app.97288c91.js></script></body></html>
<!--Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.-->
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Dubbo Admin</title><link href=/admin/OpenSans.css rel=stylesheet type=text/css><link rel="/admin/shortcut icon" href=dubbo.ico type=image/x-icon><script src=/admin/echarts-en.min.js></script><link href=/admin/static/css/app.4de6ac6b.css rel=preload as=style><link href=/admin/static/css/chunk-vendors.52f99f04.css rel=preload as=style><link href=/admin/static/js/app.29227e12.js rel=preload as=script><link href=/admin/static/js/braceBase.39ce0e20.js rel=preload as=script><link href=/admin/static/js/chunk-vendors.491fd433.js rel=preload as=script><link href=/admin/static/css/chunk-vendors.52f99f04.css rel=stylesheet><link href=/admin/static/css/app.4de6ac6b.css rel=stylesheet></head><body><div id=app></div><script src=/admin/static/js/braceBase.39ce0e20.js></script><script src=/admin/static/js/chunk-vendors.491fd433.js></script><script src=/admin/static/js/app.29227e12.js></script></body></html>
18 changes: 18 additions & 0 deletions app/dubbo-ui/dist/static/css/app.4de6ac6b.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion app/dubbo-ui/dist/static/css/app.be67f7a9.css

This file was deleted.

17 changes: 17 additions & 0 deletions app/dubbo-ui/dist/static/css/chunk-vendors.52f99f04.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions app/dubbo-ui/dist/static/js/app.29227e12.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions app/dubbo-ui/dist/static/js/app.29227e12.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions app/dubbo-ui/dist/static/js/app.97288c91.js

This file was deleted.

1 change: 0 additions & 1 deletion app/dubbo-ui/dist/static/js/app.97288c91.js.map

This file was deleted.

14 changes: 14 additions & 0 deletions app/dubbo-ui/dist/static/js/braceBase.39ce0e20.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions app/dubbo-ui/dist/static/js/braceBase.39ce0e20.js.map

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions app/dubbo-ui/dist/static/js/chunk-vendors.491fd433.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions app/dubbo-ui/dist/static/js/chunk-vendors.491fd433.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package cmd

import (
"github.com/apache/dubbo-admin/pkg/dubboctl/cmd/subcmd"
"github.com/apache/dubbo-admin/app/dubboctl/cmd/subcmd"
"github.com/spf13/cobra"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,24 @@
import (
"context"
"fmt"
"github.com/apache/dubbo-admin/pkg/dubboctl/identifier"
"github.com/apache/dubbo-admin/pkg/dubboctl/internal/kube"
"github.com/apache/dubbo-admin/pkg/dubboctl/internal/operator"
"github.com/apache/dubbo-admin/pkg/logger"
"github.com/spf13/cobra"
"go.uber.org/zap/zapcore"
"io"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"net"
"os"
"os/exec"
"os/signal"
"runtime"
"strconv"
"strings"

"github.com/apache/dubbo-admin/app/dubboctl/identifier"
"github.com/apache/dubbo-admin/app/dubboctl/internal/kube"
"github.com/apache/dubbo-admin/app/dubboctl/internal/operator"
"github.com/apache/dubbo-admin/pkg/core/logger"
"github.com/spf13/cobra"
"go.uber.org/zap/zapcore"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
)

var (
Expand Down Expand Up @@ -165,7 +167,7 @@
if err != nil {
return fmt.Errorf("create kube RESTClient failed, err: %s", err)
}
pods, err := cli.CoreV1().Pods(args.namespace).List(context.Background(), metav1.ListOptions{

Check failure on line 170 in app/dubboctl/cmd/subcmd/dashboard_all_cmds.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to err (ineffassign)
LabelSelector: labelSelector,
})
if len(pods.Items) < 1 {
Expand Down
3 changes: 2 additions & 1 deletion app/dubboctl/cmd/subcmd/manifest_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ package subcmd
import (
"errors"
"fmt"
"github.com/apache/dubbo-admin/pkg/core/logger"
"os"
"path/filepath"
"strings"

"github.com/apache/dubbo-admin/pkg/core/logger"

"github.com/apache/dubbo-admin/app/dubboctl/internal/kube"
"github.com/spf13/cobra"
"go.uber.org/zap/zapcore"
Expand Down
3 changes: 2 additions & 1 deletion app/dubboctl/cmd/subcmd/manifest_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ package subcmd

import (
"fmt"
"github.com/apache/dubbo-admin/pkg/core/logger"
"os"
"path"
"sort"
"strings"

"github.com/apache/dubbo-admin/pkg/core/logger"

"go.uber.org/zap/zapcore"

"github.com/apache/dubbo-admin/app/dubboctl/identifier"
Expand Down
1 change: 1 addition & 0 deletions app/dubboctl/cmd/subcmd/profile_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package subcmd
import (
"errors"
"fmt"

"github.com/apache/dubbo-admin/pkg/core/logger"

"github.com/apache/dubbo-admin/app/dubboctl/identifier"
Expand Down
3 changes: 2 additions & 1 deletion app/dubboctl/cmd/subcmd/profile_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ package subcmd

import (
"errors"
"github.com/apache/dubbo-admin/pkg/core/logger"
"strings"

"github.com/apache/dubbo-admin/pkg/core/logger"

"github.com/apache/dubbo-admin/app/dubboctl/identifier"
"github.com/apache/dubbo-admin/app/dubboctl/internal/manifest"
"github.com/apache/dubbo-admin/app/dubboctl/internal/util"
Expand Down
5 changes: 3 additions & 2 deletions app/dubboctl/internal/kube/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ package kube

import (
"fmt"
"k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"os"
"strconv"
"strings"

"k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"

jsonpatch "github.com/evanphx/json-patch/v5"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ package kube
import (
"context"
"fmt"
"github.com/apache/dubbo-admin/pkg/logger"
"io"
"net/http"
"net/url"
"os"

"github.com/apache/dubbo-admin/pkg/core/logger"

v1 "k8s.io/api/core/v1"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/portforward"
"k8s.io/client-go/transport/spdy"
"net/http"
"net/url"
"os"
)

type PortForward struct {
Expand Down
16 changes: 0 additions & 16 deletions app/dubboctl/internal/operator/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,6 @@ func TestRenderManifest(t *testing.T) {
return admin
},
},
{
name: "GrafanaComponent",
golden: "grafana_component-render_manifest.golden.yaml",
componentFunc: func(t *testing.T) Component {
testSpec := &v1alpha1.GrafanaSpec{}
grafana, err := NewGrafanaComponent(testSpec, []ComponentOption{
WithNamespace(identifier.DubboSystemNamespace),
WithRepoURL("https://grafana.github.io/helm-charts"),
WithVersion("6.52.4"),
}...)
if err != nil {
t.Fatalf("NewGrafanaComponent failed, err: %s", err)
}
return grafana
},
},
{
name: "NacosComponent",
golden: "nacos_component-render_manifest.golden.yaml",
Expand Down
1 change: 1 addition & 0 deletions app/dubboctl/internal/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package operator
import (
"errors"
"fmt"

"github.com/apache/dubbo-admin/pkg/core/logger"

"github.com/apache/dubbo-admin/app/dubboctl/internal/kube"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,36 @@ subjects:
---
apiVersion: v1
data:
application.properties: |-
admin.registry.address: zookeeper://zookeeper:2181
admin.metadata-report.address: zookeeper://zookeeper:2181
admin.config-center: zookeeper://zookeeper:2181
admin.root.user.name: root
admin.root.user.password: root
admin.check.sessionTimeoutMilli: 3600000
admin.check.tokenTimeoutMilli: 3600000
admin.check.signSecret: 86295dd0c4ef69a1036b0b0c15158d77
server.compression.enabled: true
server.compression.mime-types: text/css,text/javascript,application/javascript
server.compression.min-response-size: 10240
dubbo.application.name: dubbo-admin
dubbo.application.logger: slf4j
dubbo.registry.address: ${admin.registry.address}
mybatis-plus.global-config.db-config.id-type: none
admin.yml: |-
dubbo:
application:
logger: slf4j
name: null
enabled: true
registry:
address: ${admin.registry.address}
grafana:
address: grafana.dubbo-system.svc.cluster.local
mysql-dsn: root:password@tcp(127.0.0.1:3306)/dubbo-admin?charset=utf8&parseTime=true
nacos:
address: nacos://nacos:8848?group=DEFAULT_GROUP&namespace=public
center: nacos://nacos:8848?group=dubbo
enabled: false
group: dubbo
namespace: public
prometheus:
address: prometheus.dubbo-system.svc.cluster.local:3000
report:
nacos:
address: nacos://nacos:8848?group=dubbo
group: dubbo
namespace: public
zookeeper:
address: zookeeper://zookeeper:2181
zookeeper:
address: zookeeper://zookeeper:2181
center: zookeeper://zookeeper:2181
enabled: true
kind: ConfigMap
metadata:
labels:
Expand Down Expand Up @@ -122,7 +136,10 @@ spec:
app.kubernetes.io/name: dubbo-admin
spec:
containers:
- image: apache/dubbo-admin:0.5.0
- env:
- name: ADMIN_CONFIG_PATH
value: /config/admin.yml
image: apache/dubbo-admin:0.5.0
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
Expand Down Expand Up @@ -283,3 +300,4 @@ spec:
app.kubernetes.io/name: dubbo-admin
type: ClusterIP
---

Loading
Loading