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

Support the multiple network when creating Pod #111

Merged
merged 14 commits into from
Jul 18, 2018
Merged

Conversation

hwchiu
Copy link
Contributor

@hwchiu hwchiu commented Jul 17, 2018

  1. 支援 Network 參數,可將該 Pod 與先前創立的 Network 綁定
  2. 參考該 Yaml
    https://github.com/linkernetworks/network-controller/blob/master/deploy/client/clientpodtest.yaml

@codecov-io
Copy link

codecov-io commented Jul 17, 2018

Codecov Report

Merging #111 into develop will increase coverage by 1.59%.
The diff coverage is 95.9%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #111      +/-   ##
===========================================
+ Coverage    72.77%   74.36%   +1.59%     
===========================================
  Files           35       37       +2     
  Lines         1620     1740     +120     
===========================================
+ Hits          1179     1294     +115     
- Misses         379      381       +2     
- Partials        62       65       +3
Impacted Files Coverage Δ
src/utils/net.go 100% <100%> (ø)
src/utils/intersection.go 86.66% <86.66%> (ø)
src/pod/pod.go 96.44% <97.08%> (+0.86%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b7508a...26e3e82. Read the comment docs.

@John-Lin
Copy link
Contributor

打開Linuc capability. NET ADMIN 可能要考慮進去

@John-Lin
Copy link
Contributor

哦哦 應該是要在create pod那邊,這裡不應該是做Linux capability

@hwchiu
Copy link
Contributor Author

hwchiu commented Jul 18, 2018

capability 開一個額外task來做,包含 vlan* 這個都額外開

@hwchiu hwchiu changed the title [WIP]Support the multiple network when creating Pod Support the multiple network when creating Pod Jul 18, 2018
@hwchiu hwchiu requested review from John-Lin and chenyunchen July 18, 2018 06:06
@@ -16,6 +16,15 @@ type Container struct {
Command []string `bson:"command" json:"command" validate:"required,dive,required"`
}

type PodNetwork struct {
Name string `bson:"name" json:"name"`
IFName string `bson:"ifName" json:"ifName"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IfName

type PodNetwork struct {
Name string `bson:"name" json:"name"`
IFName string `bson:"ifName" json:"ifName"`
VLAN int `bson:"vlan" json:"vlan"`
Copy link
Contributor

@John-Lin John-Lin Jul 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vlanTag       int32    `bson:"vlanTag" json:"vlanTag"`

src/pod/pod.go Outdated
for i, v := range networks {
containers = append(containers, corev1.Container{
Name: fmt.Sprintf("init-network-client-%d", i),
Image: "sdnvortex/network-controller:latest",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

先固定在 v0.2.1?

src/pod/pod.go Outdated
return containers, nil
}

//For the network, we will generate two thins
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

things

src/pod/pod.go Outdated
//For the network, we will generate two thins
//[]string => a list of nodes and it will apply on nodeaffinity
//[]corev1.Container => a list of init container we will apply on pod
func generateNetwork(pod *entity.Pod, session *mongo.Session) ([]string, []corev1.Container, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

session *mongo.Session 可以放第一個嗎

src/pod/pod.go Outdated
return []string{
"-s=unix:///tmp/vortex.sock",
"-b=" + network.BridgeName,
"-n=" + network.IFName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ifName

@@ -16,6 +16,15 @@ type Container struct {
Command []string `bson:"command" json:"command" validate:"required,dive,required"`
}

type PodNetwork struct {
Name string `bson:"name" json:"name"`
IfName string `bson:"ifName" json:"ifName"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要不要改叫IfaceName?IfName有點看不懂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我覺得 IfName 因為linux有慣例也是取名IfName

src/pod/pod.go Outdated
if err != nil {
return fmt.Errorf("check the network name error:%v", err)
} else if count == 0 {
return fmt.Errorf("the network name %s doesn't exist", v.Name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the network named %s doesn't exist

src/pod/pod.go Outdated
@@ -79,6 +91,123 @@ func generateVolume(pod *entity.Pod, session *mongo.Session) ([]corev1.Volume, [
return volumes, volumeMounts, nil
}

//Get the intersecion of nodes' name
Copy link
Contributor

@WakeupTsai WakeupTsai Jul 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intersection

@hwchiu hwchiu merged commit aa080c1 into develop Jul 18, 2018
@hwchiu hwchiu deleted the hwchiu/VX-169 branch July 18, 2018 10:15
John-Lin pushed a commit that referenced this pull request Jul 25, 2018
Support the multiple network when creating Pod

Former-commit-id: d53e9023c5cabd4d27185cf9b2533826955ba221 [formerly aa080c1]
Former-commit-id: 52cfd8f83d35e0521715b4fc534a8e0d866e51f7
John-Lin pushed a commit that referenced this pull request Jul 25, 2018
Support the multiple network when creating Pod

Former-commit-id: d53e9023c5cabd4d27185cf9b2533826955ba221 [formerly d53e9023c5cabd4d27185cf9b2533826955ba221 [formerly aa080c1]]
Former-commit-id: 52cfd8f83d35e0521715b4fc534a8e0d866e51f7
Former-commit-id: 3b31489
John-Lin pushed a commit that referenced this pull request Jul 25, 2018
Support the multiple network when creating Pod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants