Skip to content

Commit

Permalink
Support the dpdk network veth offloading
Browse files Browse the repository at this point in the history
  • Loading branch information
hwchiu committed Sep 4, 2018
1 parent bec580c commit 87c566c
Showing 1 changed file with 21 additions and 0 deletions.
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/set-ethtool:v0.1.0",
Command: []string{"./ethtool.sh"},
Args: ethtools,
SecurityContext: &corev1.SecurityContext{
Privileged: &privileged,
},
})
}

return containers, nil
Expand Down

0 comments on commit 87c566c

Please sign in to comment.