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

[Task] Support the dpdk network with veth offloading #311

Merged
merged 2 commits into from
Sep 6, 2018
Merged
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
21 changes: 21 additions & 0 deletions src/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package deployment
import (
"fmt"
"strconv"
"strings"

"github.com/linkernetworks/mongo"
"github.com/linkernetworks/vortex/src/entity"
Expand All @@ -20,6 +21,8 @@ var allCapabilities = []corev1.Capability{"NET_ADMIN", "SYS_ADMIN", "NET_RAW"}

// VolumeNamePrefix will set prefix of volumename
const VolumeNamePrefix = "volume-"

// DefaultLabel is the label we used for our deploying application/deployment/pods
const DefaultLabel = "vortex"

// CheckDeploymentParameter will Check Deployment's Parameter
Expand Down Expand Up @@ -124,6 +127,7 @@ func generateClientCommand(network entity.DeploymentNetwork) (command []string)
func generateInitContainer(networks []entity.DeploymentNetwork) ([]corev1.Container, error) {
containers := []corev1.Container{}

ethtools := []string{}
for i, v := range networks {
containers = append(containers, corev1.Container{
Name: fmt.Sprintf("init-network-client-%d", i),
Expand Down Expand Up @@ -163,6 +167,23 @@ func generateInitContainer(networks []entity.DeploymentNetwork) ([]corev1.Contai
},
},
})

if strings.HasPrefix(v.BridgeName, "netdev") {
ethtools = append(ethtools, v.IfName)
}
}

if len(ethtools) != 0 {
privileged := true
containers = append(containers, corev1.Container{
Name: "init-ethtool",
Image: "sdnvortex/ethtool:latest",
Command: []string{"/usr/bin/ethtool.sh"},
Args: ethtools,
SecurityContext: &corev1.SecurityContext{
Privileged: &privileged,
},
})
}

return containers, nil
Expand Down