Skip to content

Commit

Permalink
Merge pull request #123 from Poorunga/remove-docker0-new2
Browse files Browse the repository at this point in the history
Remove docker0 dependency
  • Loading branch information
kubeedge-bot authored Oct 13, 2021
2 parents e705c8e + 9bb7528 commit d16b496
Show file tree
Hide file tree
Showing 1,642 changed files with 148,167 additions and 34,098 deletions.

This file was deleted.

25 changes: 0 additions & 25 deletions LICENSES/vendor/github.com/sirupsen/logrus/LICENSE

This file was deleted.

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

205 changes: 205 additions & 0 deletions LICENSES/vendor/k8s.io/dns/LICENSE

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

20 changes: 20 additions & 0 deletions agent/cmd/edgemesh-agent/app/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ const (
GroupName = "agent.edgemesh.config.kubeedge.io"
APIVersion = "v1alpha1"
Kind = "EdgeMeshAgent"

DefaultDummyDeviceName = "edgemesh0"
DefaultDummyDeviceIP = "169.254.96.16"
)

// EdgeMeshAgentConfig indicates the config of edgeMeshAgent which get from edgeMeshAgent config file
type EdgeMeshAgentConfig struct {
metav1.TypeMeta
// CommonConfig indicates common config for all modules
// +Required
CommonConfig *CommonConfig `json:"commonConfig,omitempty"`
// KubeAPIConfig indicates the kubernetes cluster info which edgeMeshAgent will connected
// +Required
KubeAPIConfig *v1alpha1.KubeAPIConfig `json:"kubeAPIConfig,omitempty"`
Expand All @@ -38,6 +44,16 @@ type EdgeMeshAgentConfig struct {
Modules *Modules `json:"modules,omitempty"`
}

// CommonConfig defines some common configuration items
type CommonConfig struct {
// DummyDeviceName indicates the name of the dummy device will be created
// default edgemesh0
DummyDeviceName string `json:"dummyDeviceName,omitempty"`
// DummyDeviceIP indicates the IP bound to the dummy device
// default "169.254.96.16"
DummyDeviceIP string `json:"dummyDeviceIP,omitempty"`
}

// Modules indicates the modules of edgeMeshAgent will be use
type Modules struct {
// EdgeDNSConfig indicates edgedns module config
Expand All @@ -57,6 +73,10 @@ func NewEdgeMeshAgentConfig() *EdgeMeshAgentConfig {
Kind: Kind,
APIVersion: path.Join(GroupName, APIVersion),
},
CommonConfig: &CommonConfig{
DummyDeviceName: DefaultDummyDeviceName,
DummyDeviceIP: DefaultDummyDeviceIP,
},
KubeAPIConfig: &v1alpha1.KubeAPIConfig{
Master: "",
ContentType: runtime.ContentTypeJSON,
Expand Down
23 changes: 23 additions & 0 deletions agent/cmd/edgemesh-agent/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/kubeedge/edgemesh/agent/pkg/proxy"
"github.com/kubeedge/edgemesh/agent/pkg/tunnel"
"github.com/kubeedge/edgemesh/common/informers"
commonutil "github.com/kubeedge/edgemesh/common/util"
"github.com/kubeedge/kubeedge/pkg/util"
"github.com/kubeedge/kubeedge/pkg/util/flag"
"github.com/kubeedge/kubeedge/pkg/version"
Expand Down Expand Up @@ -92,6 +93,12 @@ func Run(cfg *config.EdgeMeshAgentConfig) error {
}
trace++

klog.Infof("[%d] Prepare agent to run", trace)
if err = prepareRun(cfg, ifm); err != nil {
return err
}
trace++

klog.Infof("[%d] Register beehive modules", trace)
if errs := registerModules(cfg, ifm); len(errs) > 0 {
return fmt.Errorf(util.SpliceErrors(errs))
Expand Down Expand Up @@ -143,3 +150,19 @@ func registerModules(c *config.EdgeMeshAgentConfig, ifm *informers.Manager) []er
}
return errs
}

// prepareRun prepares edgemesh-agent to run
func prepareRun(c *config.EdgeMeshAgentConfig, ifm *informers.Manager) error {
if err := commonutil.CreateDummyDevice(c.CommonConfig.DummyDeviceName, c.CommonConfig.DummyDeviceIP); err != nil {
return fmt.Errorf("create dummy device %s err: %v", c.CommonConfig.DummyDeviceName, err)
}
// set dns and proxy modules listenInterface
if c.Modules.EdgeDNSConfig.Enable {
c.Modules.EdgeDNSConfig.ListenInterface = c.CommonConfig.DummyDeviceName
}
if c.Modules.EdgeProxyConfig.Enable {
c.Modules.EdgeProxyConfig.ListenInterface = c.CommonConfig.DummyDeviceName
}

return nil
}
9 changes: 4 additions & 5 deletions agent/pkg/dns/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ type EdgeDNSConfig struct {
// default true
Enable bool `json:"enable,omitempty"`
// ListenInterface indicates the listen interface of edgedns
// default "docker0"
ListenInterface string `json:"listenInterface,omitempty"`
// do not allow users to configure manually
ListenInterface string
// ListenPort indicates the listen port of edgedns
// default 53
ListenPort int `json:"listenPort,omitempty"`
}

func NewEdgeDNSConfig() *EdgeDNSConfig {
return &EdgeDNSConfig{
Enable: true,
ListenInterface: "docker0",
ListenPort: 53,
Enable: true,
ListenPort: 53,
}
}
11 changes: 5 additions & 6 deletions agent/pkg/proxy/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ type EdgeProxyConfig struct {
// default "10.96.0.0/12", equals to k8s default service-cluster-ip-range
SubNet string `json:"subNet,omitempty"`
// ListenInterface indicates the listen interface of edgeproxy
// default "docker0"
ListenInterface string `json:"listenInterface,omitempty"`
// do not allow users to configure manually
ListenInterface string
// ListenPort indicates the listen port of edgeproxy
// default 40001
ListenPort int `json:"listenPort,omitempty"`
}

func NewEdgeProxyConfig() *EdgeProxyConfig {
return &EdgeProxyConfig{
Enable: true,
SubNet: "10.96.0.0/12",
ListenInterface: "docker0",
ListenPort: 40001,
Enable: true,
SubNet: "10.96.0.0/12",
ListenPort: 40001,
}
}
Loading

0 comments on commit d16b496

Please sign in to comment.