Skip to content

Commit

Permalink
add license
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmshsh committed Aug 13, 2023
1 parent fda7604 commit bf4bdea
Show file tree
Hide file tree
Showing 136 changed files with 1,962 additions and 1,327 deletions.
11 changes: 7 additions & 4 deletions api/resource/v1alpha1/ca_deepcopy.go

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

11 changes: 7 additions & 4 deletions api/resource/v1alpha1/servicemapping_deepcopy.go

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

11 changes: 7 additions & 4 deletions api/resource/v1alpha1/traffic_deepcopy.go

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

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,10 +19,11 @@ package cmd

import (
"fmt"
"time"

"github.com/apache/dubbo-admin/pkg/admin"
"github.com/apache/dubbo-admin/pkg/core/kubeclient"
"github.com/apache/dubbo-admin/pkg/snp"
"time"

"github.com/apache/dubbo-admin/pkg/authority"
"github.com/apache/dubbo-admin/pkg/config"
Expand Down
129 changes: 129 additions & 0 deletions app/dubbo-cp/dubbo-admin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/*
* 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.
*/

package main

import (
"context"
"fmt"
"os"
"os/signal"
"syscall"
"time"

"github.com/apache/dubbo-admin/pkg/authority"
"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/cert"
"github.com/apache/dubbo-admin/pkg/core/kubeclient"
"github.com/apache/dubbo-admin/pkg/core/logger"
cp_server "github.com/apache/dubbo-admin/pkg/cp-server"
"github.com/apache/dubbo-admin/pkg/dds"
"github.com/apache/dubbo-admin/pkg/snp"
)

const gracefullyShutdownDuration = 3 * time.Second

var SetupSignalHandler = func() (context.Context, context.Context) {
gracefulCtx, gracefulCancel := context.WithCancel(context.Background())
ctx, cancel := context.WithCancel(context.Background())
c := make(chan os.Signal, 3)
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
go func() {
s := <-c
logger.Sugar().Info("Received signal, stopping instance gracefully", "signal", s.String())
gracefulCancel()
s = <-c
logger.Sugar().Info("Received second signal, stopping instance", "signal", s.String())
cancel()
s = <-c
logger.Sugar().Info("Received third signal, force exit", "signal", s.String())
os.Exit(1)
}()
return gracefulCtx, ctx
}

func main() {

Check failure on line 61 in app/dubbo-cp/dubbo-admin.go

View workflow job for this annotation

GitHub Actions / lint

other declaration of main (typecheck)
cfg := dubbo_cp.DefaultConfig()
err := config.Load("", &cfg)
if err != nil {
logger.Sugar().Error(err, "could not load the configuration")
return
}
gracefulCtx, ctx := SetupSignalHandler()

rt, err := bootstrap.Bootstrap(gracefulCtx, &cfg)
if err != nil {
logger.Sugar().Error(err, "unable to set up Control Plane runtime")
return
}
cfgForDisplay, err := config.ConfigForDisplay(&cfg)
if err != nil {
logger.Sugar().Error(err, "unable to prepare config for display")
return
}
cfgBytes, err := config.ToJson(cfgForDisplay)
if err != nil {
logger.Sugar().Error(err, "unable to convert config to json")
return
}
logger.Sugar().Info(fmt.Sprintf("Current config %s", cfgBytes))

//if err := admin.Setup(rt); err != nil {
// logger.Sugar().Error(err, "unable to set up Metrics")
//}

if err := cert.Setup(rt); err != nil {
logger.Sugar().Error(err, "unable to set up certProvider")
}

if err := authority.Setup(rt); err != nil {
logger.Sugar().Error(err, "unable to set up authority")
}

if err := dds.Setup(rt); err != nil {
logger.Sugar().Error(err, "unable to set up dds")
}

if err := snp.Setup(rt); err != nil {
logger.Sugar().Error(err, "unable to set up snp")
}

if err := cp_server.Setup(rt); err != nil {
logger.Sugar().Error(err, "unable to set up grpc server")
}

// This must be last, otherwise we will not know which informers to register
if err := kubeclient.Setup(rt); err != nil {
logger.Sugar().Error(err, "unable to set up kube client")
}

logger.Sugar().Info("starting Control Plane")
if err := rt.Start(gracefulCtx.Done()); err != nil {
logger.Sugar().Error(err, "problem running Control Plane")
return
}

logger.Sugar().Info("Stop signal received. Waiting 3 seconds for components to stop gracefully...")
select {
case <-ctx.Done():
case <-time.After(gracefullyShutdownDuration):
}
logger.Sugar().Info("Stopping Control Plane")
return
}
16 changes: 16 additions & 0 deletions app/dubbo-ui/dist/echarts-en.min.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions app/dubbo-ui/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
<!--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="shortcut icon" href=/admin/dubbo.ico type=image/x-icon><script src=/admin/echarts-en.min.js></script><link href=/admin/static/css/app.4791f1de.css rel=preload as=style><link href=/admin/static/css/chunk-vendors.52f99f04.css rel=preload as=style><link href=/admin/static/js/app.74d999b7.js rel=preload as=script><link href=/admin/static/js/braceBase.39ce0e20.js rel=preload as=script><link href=/admin/static/js/chunk-vendors.604d7b41.js rel=preload as=script><link href=/admin/static/css/chunk-vendors.52f99f04.css rel=stylesheet><link href=/admin/static/css/app.4791f1de.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.604d7b41.js></script><script src=/admin/static/js/app.74d999b7.js></script></body></html>
16 changes: 16 additions & 0 deletions app/dubbo-ui/dist/static/css/app.4791f1de.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/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.74d999b7.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions app/dubbo-ui/dist/static/js/app.74d999b7.js.map

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions app/dubbo-ui/dist/static/js/chunk-vendors.604d7b41.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions app/dubbo-ui/dist/static/js/chunk-vendors.604d7b41.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

module github.com/apache/dubbo-admin

go 1.19
go 1.20

require (
dubbo.apache.org/dubbo-go/v3 v3.0.6-0.20230516071747-5b2397c8b0b0
dubbo.apache.org/dubbo-go/v3 v3.0.5
github.com/apache/dubbo-go-hessian2 v1.12.2
github.com/davecgh/go-spew v1.1.1
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5
Expand Down
Loading

0 comments on commit bf4bdea

Please sign in to comment.