Skip to content

Commit

Permalink
feat: remove security domain (#2285)
Browse files Browse the repository at this point in the history
* feat: remove security domain

Remove security domain in dfdaemon and scheduler.
Remove SecurityGroup and SecurityRule table in manager.

Signed-off-by: Gaius <gaius.qi@gmail.com>
  • Loading branch information
gaius-qi committed Jun 28, 2023
1 parent 4c68146 commit 37c5886
Show file tree
Hide file tree
Showing 48 changed files with 92 additions and 3,730 deletions.
754 changes: 0 additions & 754 deletions api/manager/docs.go

Large diffs are not rendered by default.

754 changes: 0 additions & 754 deletions api/manager/swagger.json

Large diffs are not rendered by default.

502 changes: 0 additions & 502 deletions api/manager/swagger.yaml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion build/package/nfpm/config/dfget.yaml
Expand Up @@ -39,7 +39,6 @@ host:
# geographical location and network topology
location: ""
idc: ""
securityDomain: ""

# download service option
download:
Expand Down
5 changes: 2 additions & 3 deletions client/config/dynconfig_manager.go
Expand Up @@ -279,9 +279,8 @@ func (mc *managerClient) Get() (any, error) {
Version: version.GitVersion,
Commit: version.GitCommit,
HostInfo: map[string]string{
searcher.ConditionSecurityDomain: mc.config.Host.SecurityDomain,
searcher.ConditionIDC: mc.config.Host.IDC,
searcher.ConditionLocation: mc.config.Host.Location,
searcher.ConditionIDC: mc.config.Host.IDC,
searcher.ConditionLocation: mc.config.Host.Location,
},
})
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions client/config/peerhost.go
Expand Up @@ -281,8 +281,6 @@ type KeepAliveOption struct {
}

type HostOption struct {
// SecurityDomain is the security domain
SecurityDomain string `mapstructure:"securityDomain" yaml:"securityDomain"`
// IDC for scheduler
IDC string `mapstructure:"idc" yaml:"idc"`
// Location for scheduler
Expand Down
7 changes: 3 additions & 4 deletions client/config/peerhost_darwin.go
Expand Up @@ -50,10 +50,9 @@ var peerHostConfig = func() *DaemonOption {
ScheduleTimeout: util.Duration{Duration: DefaultScheduleTimeout},
},
Host: HostOption{
Hostname: fqdn.FQDNHostname,
SecurityDomain: "",
Location: "",
IDC: "",
Hostname: fqdn.FQDNHostname,
Location: "",
IDC: "",
},
Download: DownloadOption{
CalculateDigest: true,
Expand Down
7 changes: 3 additions & 4 deletions client/config/peerhost_linux.go
Expand Up @@ -50,10 +50,9 @@ var peerHostConfig = func() *DaemonOption {
ScheduleTimeout: util.Duration{Duration: DefaultScheduleTimeout},
},
Host: HostOption{
Hostname: fqdn.FQDNHostname,
SecurityDomain: "",
Location: "",
IDC: "",
Hostname: fqdn.FQDNHostname,
Location: "",
IDC: "",
},
Download: DownloadOption{
CalculateDigest: true,
Expand Down
9 changes: 4 additions & 5 deletions client/config/peerhost_test.go
Expand Up @@ -285,11 +285,10 @@ func TestPeerHostOption_Load(t *testing.T) {
DisableAutoBackSource: true,
},
Host: HostOption{
Hostname: "d7y.io",
SecurityDomain: "d7y.io",
Location: "0.0.0.0",
IDC: "d7y",
AdvertiseIP: net.IPv4zero,
Hostname: "d7y.io",
Location: "0.0.0.0",
IDC: "d7y",
AdvertiseIP: net.IPv4zero,
},
Download: DownloadOption{
TotalRateLimit: util.RateLimit{
Expand Down
1 change: 0 additions & 1 deletion client/config/testdata/config/daemon.yaml
Expand Up @@ -36,7 +36,6 @@ host:
advertiseIP: 0.0.0.0
location: 0.0.0.0
idc: d7y
securityDomain: d7y.io

download:
calculateDigest: true
Expand Down
1 change: 0 additions & 1 deletion client/daemon/announcer/announcer.go
Expand Up @@ -261,7 +261,6 @@ func (a *announcer) newAnnounceHostRequest() (*schedulerv1.AnnounceHostRequest,
Network: &schedulerv1.Network{
TcpConnectionCount: uint32(len(tcpConnections)),
UploadTcpConnectionCount: uint32(len(uploadTCPConnections)),
SecurityDomain: a.config.Host.SecurityDomain,
Location: a.config.Host.Location,
Idc: a.config.Host.IDC,
},
Expand Down
15 changes: 7 additions & 8 deletions client/daemon/daemon.go
Expand Up @@ -127,14 +127,13 @@ func New(opt *config.DaemonOption, d dfpath.Dfpath) (Daemon, error) {
}

host := &schedulerv1.PeerHost{
Id: idgen.HostIDV2(opt.Host.AdvertiseIP.String(), opt.Host.Hostname),
Ip: opt.Host.AdvertiseIP.String(),
RpcPort: int32(opt.Download.PeerGRPC.TCPListen.PortRange.Start),
DownPort: 0,
Hostname: opt.Host.Hostname,
SecurityDomain: opt.Host.SecurityDomain,
Location: opt.Host.Location,
Idc: opt.Host.IDC,
Id: idgen.HostIDV2(opt.Host.AdvertiseIP.String(), opt.Host.Hostname),
Ip: opt.Host.AdvertiseIP.String(),
RpcPort: int32(opt.Download.PeerGRPC.TCPListen.PortRange.Start),
DownPort: 0,
Hostname: opt.Host.Hostname,
Location: opt.Host.Location,
Idc: opt.Host.IDC,
}

var (
Expand Down
2 changes: 0 additions & 2 deletions client/daemon/peer/peertask_conductor.go
Expand Up @@ -1387,7 +1387,6 @@ func (pt *peerTaskConductor) done() {
TaskId: pt.GetTaskID(),
PeerId: pt.GetPeerID(),
SrcIp: pt.PeerHost.Ip,
SecurityDomain: pt.PeerHost.SecurityDomain,
Idc: pt.PeerHost.Idc,
Url: pt.request.Url,
ContentLength: pt.GetContentLength(),
Expand Down Expand Up @@ -1467,7 +1466,6 @@ func (pt *peerTaskConductor) fail() {
TaskId: pt.GetTaskID(),
PeerId: pt.GetPeerID(),
SrcIp: pt.PeerHost.Ip,
SecurityDomain: pt.PeerHost.SecurityDomain,
Idc: pt.PeerHost.Idc,
Url: pt.request.Url,
ContentLength: pt.GetContentLength(),
Expand Down
2 changes: 0 additions & 2 deletions deploy/docker-compose/template/dfget.template.yaml
Expand Up @@ -74,8 +74,6 @@ host:
location: ""
# idc deployed by daemon
idc: ""
# security domain deployed by daemon, network isolation between different security domains
securityDomain: ""
# daemon hostname
# hostname: ""

Expand Down
2 changes: 0 additions & 2 deletions deploy/docker-compose/template/seed-peer.template.yaml
Expand Up @@ -86,8 +86,6 @@ host:
location: ''
# IDC deployed by daemon.
idc: ''
# Security domain deployed by daemon, network isolation between different security domains.
securityDomain: ''
# Daemon hostname.
# hostname: ""

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -3,7 +3,7 @@ module d7y.io/dragonfly/v2
go 1.20

require (
d7y.io/api v1.8.7
d7y.io/api v1.8.8
github.com/RichardKnop/machinery v1.10.6
github.com/Showmax/go-fqdn v1.0.0
github.com/VividCortex/mysqlerr v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -51,8 +51,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
d7y.io/api v1.8.7 h1:raANUY3biOBRfaaGo3dqWeGeKfbsEfNBL9YIXJEzG54=
d7y.io/api v1.8.7/go.mod h1:HIJMfhqiBHJ0yNVuOASQe6X0IVzOkxdLiWzcMM0xo2c=
d7y.io/api v1.8.8 h1:4JxGj+uvrqAYB3o8odxbcA6PySxuR4D6oOgAwqbq0HY=
d7y.io/api v1.8.8/go.mod h1:HIJMfhqiBHJ0yNVuOASQe6X0IVzOkxdLiWzcMM0xo2c=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U=
Expand Down
2 changes: 0 additions & 2 deletions manager/database/database.go
Expand Up @@ -84,8 +84,6 @@ func migrate(db *gorm.DB) error {
&models.SeedPeer{},
&models.SchedulerCluster{},
&models.Scheduler{},
&models.SecurityRule{},
&models.SecurityGroup{},
&models.User{},
&models.Oauth{},
&models.Config{},
Expand Down

0 comments on commit 37c5886

Please sign in to comment.