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

feat: genesis delete invalid code #8855

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
109 changes: 0 additions & 109 deletions message/trident.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ service Synchronizer {
rpc AnalyzerSync(SyncRequest) returns (SyncResponse) {}
rpc Upgrade(UpgradeRequest) returns (stream UpgradeResponse) {}
rpc Query(NtpRequest) returns (NtpResponse) {}
rpc GenesisSync(GenesisSyncRequest) returns (GenesisSyncResponse) {}
rpc KubernetesAPISync(KubernetesAPISyncRequest) returns (KubernetesAPISyncResponse) {}
rpc GetKubernetesClusterID(KubernetesClusterIDRequest) returns (KubernetesClusterIDResponse) {}
rpc GPIDSync(GPIDSyncRequest) returns (GPIDSyncResponse) {}
rpc ShareGPIDLocalData(ShareGPIDSyncRequests) returns (ShareGPIDSyncRequests) {}
Expand Down Expand Up @@ -665,113 +663,6 @@ message PluginResponse {
optional uint32 update_time = 6 [default = 0]; // plugin update epoch
}

message GenesisPlatformData {
repeated Ip ips = 7;

optional bool platform_enabled = 10;
optional string raw_hostname = 11;
optional string raw_all_vm_xml = 12;
optional string raw_vm_states = 13;
optional string raw_ovs_interfaces = 14;
optional string raw_ovs_ports = 15;
optional string raw_brctl_show = 16;
optional string raw_vlan_config = 17;

repeated Lldp lldp_info = 20;

repeated string raw_ip_netns = 30;
repeated string raw_ip_addrs = 31;
repeated InterfaceInfo interfaces = 32;
}

message Ip {
optional uint32 last_seen = 2;
optional uint64 mac = 3;
optional bytes ip = 4;

optional string port_uuid = 9;
}

message Lldp {
optional string interface = 1;
optional string system_name = 2;
optional string management_address = 5;
optional string port_id = 10;
optional string port_description = 11;
}

message InterfaceInfo {
optional uint64 mac = 1;
// ip/masklen
repeated string ip = 2;
optional string name = 3;
optional string device_id = 4;

optional uint32 tap_index = 5;

optional string device_name = 6;

optional string netns = 7 [default = ""];
optional uint32 netns_id = 8 [default = 0];

optional string if_type = 9 [default = ""];
}

message Tag {
optional string key = 1;
optional string value = 2;
}

message ProcessInfo {
optional string name = 1;
optional uint64 pid = 2;
optional string process_name = 3;
optional string cmdline = 4;
optional string user = 5;
optional uint32 start_time = 6;
optional uint32 netns_id = 7 [default = 0];
optional string container_id = 8 [default = ""];
repeated Tag os_app_tags = 11;
}

message GenesisProcessData {
repeated ProcessInfo process_entries = 5;
}

message GenesisSyncRequest {
optional uint64 version = 1 [default = 0];

optional common.TridentType trident_type = 2;

optional string source_ip = 3;
optional uint32 vtap_id = 4;
optional string kubernetes_cluster_id = 5; // 仅对容器类型的采集器有意义

optional string nat_ip = 6;
optional string team_id = 7; // agent team identity

optional GenesisPlatformData platform_data = 9;
optional GenesisProcessData process_data = 10;
}

message GenesisSyncResponse {
optional uint64 version = 1 [default = 0];
}

message KubernetesAPISyncRequest {
optional string cluster_id = 1;
optional uint64 version = 2;
optional string error_msg = 3;
optional uint32 vtap_id = 4;
optional string source_ip = 5;
optional string team_id = 6; // agent team identity
repeated common.KubernetesAPIInfo entries = 10;
}

message KubernetesAPISyncResponse {
optional uint64 version = 1;
}

message KubernetesClusterIDRequest {
optional string ca_md5 = 1; // md5 of /run/secrets/[kubernetes.io/serviceaccount/ca.crt
optional string team_id = 2; // agent team identity
Expand Down
15 changes: 6 additions & 9 deletions server/controller/genesis/common/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

"github.com/deepflowio/deepflow/message/agent"
"github.com/deepflowio/deepflow/message/common"
"github.com/deepflowio/deepflow/message/trident"
"github.com/deepflowio/deepflow/server/controller/model"
)

Expand Down Expand Up @@ -65,12 +64,11 @@ type KubernetesInfo struct {
}

type K8SRPCMessage struct {
ORGID int
MessageType int
VtapID uint32
Peer string
Message *trident.KubernetesAPISyncRequest
AgentMessage *agent.KubernetesAPISyncRequest
ORGID int
MessageType int
VtapID uint32
Peer string
Message *agent.KubernetesAPISyncRequest
}

type VIFRPCMessage struct {
Expand All @@ -80,6 +78,5 @@ type VIFRPCMessage struct {
VtapID uint32
Peer string
K8SClusterID string
Message *trident.GenesisSyncRequest
AgentMessage *agent.GenesisSyncRequest
Message *agent.GenesisSyncRequest
}
11 changes: 11 additions & 0 deletions server/controller/genesis/common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
simplejson "github.com/bitly/go-simplejson"
"inet.af/netaddr"

"github.com/deepflowio/deepflow/message/agent"
"github.com/deepflowio/deepflow/server/controller/common"
"github.com/deepflowio/deepflow/server/controller/db/metadb"
metadbmodel "github.com/deepflowio/deepflow/server/controller/db/metadb/model"
Expand Down Expand Up @@ -546,3 +547,13 @@ func GetTeamShortLcuuidToInfo() (map[string]TeamInfo, error) {
}
return teamIDToOrgID, nil
}

func IsAgentInterestedHost(aType agent.AgentType) bool {
types := []agent.AgentType{agent.AgentType_TT_PROCESS, agent.AgentType_TT_HOST_POD, agent.AgentType_TT_VM_POD, agent.AgentType_TT_PHYSICAL_MACHINE, agent.AgentType_TT_PUBLIC_CLOUD, agent.AgentType_TT_K8S_SIDECAR}
for _, t := range types {
if t == aType {
return true
}
}
return false
}
Loading
Loading