diff --git a/internal/web/actions/default/clusters/cluster/init.go b/internal/web/actions/default/clusters/cluster/init.go
index 114ec276..bf3646d2 100644
--- a/internal/web/actions/default/clusters/cluster/init.go
+++ b/internal/web/actions/default/clusters/cluster/init.go
@@ -14,6 +14,7 @@ func init() {
Helper(clusters.NewClusterHelper()).
Prefix("/clusters/cluster").
Get("", new(IndexAction)).
+ GetPost("/installNodes", new(InstallNodesAction)).
// 节点相关
Get("/node", new(node.NodeAction)).
diff --git a/internal/web/actions/default/clusters/cluster/installNodes.go b/internal/web/actions/default/clusters/cluster/installNodes.go
new file mode 100644
index 00000000..eb0f9642
--- /dev/null
+++ b/internal/web/actions/default/clusters/cluster/installNodes.go
@@ -0,0 +1,72 @@
+package cluster
+
+import (
+ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
+ "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
+ "github.com/iwind/TeaGo/maps"
+ "strings"
+)
+
+type InstallNodesAction struct {
+ actionutils.ParentAction
+}
+
+func (this *InstallNodesAction) Init() {
+ this.Nav("", "node", "install")
+ this.SecondMenu("nodes")
+}
+
+func (this *InstallNodesAction) RunGet(params struct {
+ ClusterId int64
+}) {
+ clusterResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeCluster(this.AdminContext(), &pb.FindEnabledNodeClusterRequest{ClusterId: params.ClusterId})
+ if err != nil {
+ this.ErrorPage(err)
+ return
+ }
+ if clusterResp.Cluster == nil {
+ this.NotFound("nodeCluster", params.ClusterId)
+ return
+ }
+
+ cluster := clusterResp.Cluster
+
+ clusterAPINodesResp, err := this.RPC().NodeClusterRPC().FindAPINodesWithNodeCluster(this.AdminContext(), &pb.FindAPINodesWithNodeClusterRequest{ClusterId: params.ClusterId})
+ if err != nil {
+ this.ErrorPage(err)
+ return
+ }
+ if err != nil {
+ this.ErrorPage(err)
+ return
+ }
+ apiNodeAddrs := []string{}
+ if clusterAPINodesResp.UseAllAPINodes {
+ apiNodesResp, err := this.RPC().APINodeRPC().FindAllEnabledAPINodes(this.AdminContext(), &pb.FindAllEnabledAPINodesRequest{})
+ if err != nil {
+ this.ErrorPage(err)
+ return
+ }
+ for _, apiNode := range apiNodesResp.Nodes {
+ if !apiNode.IsOn {
+ continue
+ }
+ apiNodeAddrs = append(apiNodeAddrs, apiNode.AccessAddrs...)
+ }
+ } else {
+ for _, apiNode := range clusterAPINodesResp.ApiNodes {
+ if !apiNode.IsOn {
+ continue
+ }
+ apiNodeAddrs = append(apiNodeAddrs, apiNode.AccessAddrs...)
+ }
+ }
+
+ this.Data["cluster"] = maps.Map{
+ "uniqueId": cluster.UniqueId,
+ "secret": cluster.Secret,
+ "endpoints": "\"" + strings.Join(apiNodeAddrs, "\", \"") + "\"",
+ }
+
+ this.Show()
+}
diff --git a/web/public/js/components/common/download-link.js b/web/public/js/components/common/download-link.js
index cc79df0e..03f15721 100644
--- a/web/public/js/components/common/download-link.js
+++ b/web/public/js/components/common/download-link.js
@@ -33,5 +33,5 @@ Vue.component("download-link", {
})
}
},
- template: `
可以通过节点安装包中的
| cluster.yaml + |
+
+ rpc:
+ endpoints: [ {{cluster.endpoints}} ]
+clusterId: "{{cluster.uniqueId}}"
+secret: "{{cluster.secret}}"
+ |
+