Skip to content

Commit

Permalink
feat: delete invalid package and package api (#5141) (#5142)
Browse files Browse the repository at this point in the history
* feat: remove useless data

* feat: comment provider.Run

* feat: projectID

* feat: hepa openapi

* feat: permission

* feat: runtime cli

* feat: fatal

* feat: typo

* feat: more info

* feat: do clearing async

* fix: NotFoundError

Co-authored-by: 悟空 <[email protected]>
  • Loading branch information
erda-bot and dspo authored Jun 28, 2022
1 parent b0d59c0 commit 350ed36
Show file tree
Hide file tree
Showing 23 changed files with 1,402 additions and 33 deletions.
10 changes: 10 additions & 0 deletions api/proto/common/status.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto3";

package erda.common;

option go_package = "github.com/erda-project/erda-proto-go/common/pb";

enum StatusEnum {
unknown_status = 0;
not_found = 404;
}
37 changes: 36 additions & 1 deletion api/proto/core/hepa/endpoint_api/endpoint_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ option go_package = "github.com/erda-project/erda-proto-go/core/hepa/endpoint_ap
import "google/api/annotations.proto";
import "google/protobuf/struct.proto";
import "core/hepa/hepa.proto";
import "common/http.proto";
import "common/openapi.proto";

// +publish service:"hepa"
service EndpointApiService {
Expand Down Expand Up @@ -90,6 +92,23 @@ service EndpointApiService {
};
}

rpc ListInvalidEndpointApi(common.VoidRequest) returns(ListInvalidEndpointApiResp) {
option(google.api.http) = {
get: "/api/gateway/openapi/invalid-endpoints",
};
option(erda.common.openapi) = {
path: "/api/gateway/openapi/invalid-endpoints",
};
}

rpc ClearInvalidEndpointApi(common.VoidRequest) returns (common.VoidResponse) {
option(google.api.http) = {
delete: "/api/gateway/openapi/invalid-endpoints",
};
option(erda.common.openapi) = {
path: "/api/gateway/openapi/invalid-endpoints",
};
}
}

message ChangeEndpointRootResponse {
Expand Down Expand Up @@ -129,7 +148,7 @@ message EndpointApi {
string redirectType = 2;
string redirectAddr = 3;
string redirectPath = 4;
string redirectApp = 5;
string redirectApp = 5;
string redirectService = 6;
string redirectRuntimeId = 7;
string redirectRuntimeName = 8;
Expand Down Expand Up @@ -234,4 +253,20 @@ message GetEndpointRequest {

message GetEndpointResponse {
Endpoint data = 1;
}

message ListInvalidEndpointApiResp {
repeated ListInvalidEndpointApiItem list = 1;
}

message ListInvalidEndpointApiItem {
string invalidReason = 1;
string type = 2;
string projectID = 3;
string packageID = 4;
string packageApiID = 5;
string upstreamApiID = 6;
string upstreamID = 7;
string upstreamName = 8;
string runtimeID = 9;
}
78 changes: 78 additions & 0 deletions api/proto/core/project/core-project.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
syntax = "proto3";

package erda.core.project;

import "google/protobuf/timestamp.proto";
import "common/status.proto";

option go_package = "github.com/erda-project/erda-proto-go/core/project/pb";

service Project {
rpc CheckProjectExist(CheckProjectExistReq)returns(CheckProjectExistResp){}
rpc GetProjectByID(GetProjectByIDReq)returns(ProjectDto){}
}

message CheckProjectExistReq {
uint64 id = 1;
}

message CheckProjectExistResp {
bool ok = 1;
}

message GetProjectByIDReq {
uint64 id = 1;
optional string userID = 2;
}

message ProjectDto {
// project primary key
uint64 id = 1;
// project identifies
string name = 2;
// project display name
string displayName = 3;
// for string ddHook
reserved 4;
// org primary key
uint64 orgID = 5;
// the project creator userID
string creatorID = 6;
// the project logo url
string logo = 7;
// the project description
string desc = 8;
// the owners' userIDs of the project
// for owners
reserved 9;
// project active time
google.protobuf.Timestamp activeTime = 10;
// for string joined
reserved 11;
// for bool canUnblock
reserved 12;
// for string blockStatus
reserved 13;
// for bool CanManage
reserved 14;
// is the project public
bool isPublic = 15;
// for ProjectStats stats
reserved 16;
// for ProjectResourceUsage
reserved 17, 18, 19, 20;
// for clusterConfig
reserved 21;
// for ResourceConfigsInfo resourceConfig
reserved 22;
// for map<string, int> RollbackConfig
reserved 23;
// for float64 cpuQuota
reserved 24;
// for float64 memQuota
reserved 25;
google.protobuf.Timestamp createdTime = 26;
google.protobuf.Timestamp updatedTime = 27;
// project type
string type = 28;
}
12 changes: 12 additions & 0 deletions api/proto/orchestrator/runtime/runtime.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "google/protobuf/struct.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
import "common/http.proto";
import "common/status.proto";

option go_package = "github.com/erda-project/erda-proto-go/orchestrator/runtime/pb";

Expand Down Expand Up @@ -98,12 +99,23 @@ message Runtime {
repeated ErrorResponse errors = 13;
}

message CheckRuntimeExistReq {
uint64 id = 1;
}

message CheckRuntimeExistResp {
bool ok = 1;
}

service RuntimeService {
rpc GetRuntime (GetRuntimeRequest) returns (RuntimeInspect) {
option (google.api.http) = {
get: "/api/runtimes/{nameOrID}?applicationId={appID}&workspace={workspace}",
};
}

rpc CheckRuntimeExist (CheckRuntimeExistReq) returns (CheckRuntimeExistResp) {}

rpc DelRuntime (DelRuntimeRequest) returns (Runtime) {
option (google.api.http) = {
delete: "/api/runtimes/{id}",
Expand Down
19 changes: 0 additions & 19 deletions cmd/core-services/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,6 @@ import (

"github.com/erda-project/erda-infra/base/servicehub"
"github.com/erda-project/erda/pkg/common"

// providers
_ "github.com/erda-project/erda-infra/providers/grpcclient"
_ "github.com/erda-project/erda-infra/providers/pprof"
_ "github.com/erda-project/erda-infra/providers/redis"
_ "github.com/erda-project/erda-proto-go/core/pipeline/cms/client"
_ "github.com/erda-project/erda/internal/core/legacy"
_ "github.com/erda-project/erda/internal/core/legacy/providers/token"
_ "github.com/erda-project/erda/internal/core/legacy/services/dingtalk/api"
_ "github.com/erda-project/erda/internal/core/messenger/eventbox"
_ "github.com/erda-project/erda/internal/core/messenger/notify"
_ "github.com/erda-project/erda/internal/core/messenger/notify-channel"
_ "github.com/erda-project/erda/internal/core/messenger/notifygroup"

// infra
_ "github.com/erda-project/erda-infra/providers/grpcserver"
_ "github.com/erda-project/erda-infra/providers/httpserver"
_ "github.com/erda-project/erda-infra/providers/mysql"
_ "github.com/erda-project/erda-infra/providers/serviceregister"
)

//go:embed bootstrap.yaml
Expand Down
39 changes: 39 additions & 0 deletions cmd/core-services/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (c) 2021 Terminus, Inc.
//
// Licensed 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 (
_ "embed"

// providers
_ "github.com/erda-project/erda-infra/providers/grpcclient"
_ "github.com/erda-project/erda-infra/providers/pprof"
_ "github.com/erda-project/erda-infra/providers/redis"
_ "github.com/erda-project/erda-proto-go/core/pipeline/cms/client"
_ "github.com/erda-project/erda/internal/core/legacy"
_ "github.com/erda-project/erda/internal/core/legacy/providers/token"
_ "github.com/erda-project/erda/internal/core/legacy/services/dingtalk/api"
_ "github.com/erda-project/erda/internal/core/messenger/eventbox"
_ "github.com/erda-project/erda/internal/core/messenger/notify"
_ "github.com/erda-project/erda/internal/core/messenger/notify-channel"
_ "github.com/erda-project/erda/internal/core/messenger/notifygroup"
_ "github.com/erda-project/erda/internal/core/project"

// infra
_ "github.com/erda-project/erda-infra/providers/grpcserver"
_ "github.com/erda-project/erda-infra/providers/httpserver"
_ "github.com/erda-project/erda-infra/providers/mysql"
_ "github.com/erda-project/erda-infra/providers/serviceregister"
)
8 changes: 8 additions & 0 deletions cmd/hepa/bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ [email protected]:
addr: "${CLUSTER_MANAGER_GRPC_ADDR:cluster-manager:9095}"
erda.core.clustermanager.cluster-client: {}

[email protected]:
addr: "${CORE_SERVICES_GRPC_ADDR:core-services:9537}"
erda.core.project-client: {}

[email protected]:
addr: "${ORCHESTRATOR_GRPC_ADDR:orchestrator:7080}"
erda.orchestrator.runtime-client: {}

[email protected]:
addr: "${MSP_GRPC_ADDR:msp:7080}"
erda.msp.tenant-client: {}
Loading

0 comments on commit 350ed36

Please sign in to comment.