-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
sdn: disable hostports when CRI-O is used #16463
Merged
openshift-merge-robot
merged 1 commit into
openshift:master
from
dcbw:sdn-crio-hostports
Sep 26, 2017
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,20 +67,23 @@ type podManager struct { | |
mtu uint32 | ||
ovs *ovsController | ||
|
||
enableHostports bool | ||
|
||
// Things only accessed through the processCNIRequests() goroutine | ||
// and thus can be set from Start() | ||
ipamConfig []byte | ||
hostportSyncer kubehostport.HostportSyncer | ||
} | ||
|
||
// Creates a new live podManager; used by node code0 | ||
func newPodManager(kClient kclientset.Interface, policy osdnPolicy, mtu uint32, ovs *ovsController) *podManager { | ||
func newPodManager(kClient kclientset.Interface, policy osdnPolicy, mtu uint32, ovs *ovsController, enableHostports bool) *podManager { | ||
pm := newDefaultPodManager() | ||
pm.kClient = kClient | ||
pm.policy = policy | ||
pm.mtu = mtu | ||
pm.podHandler = pm | ||
pm.ovs = ovs | ||
pm.enableHostports = enableHostports | ||
return pm | ||
} | ||
|
||
|
@@ -150,7 +153,9 @@ func getIPAMConfig(clusterNetwork *net.IPNet, localSubnet string) ([]byte, error | |
|
||
// Start the CNI server and start processing requests from it | ||
func (m *podManager) Start(socketPath string, localSubnetCIDR string, clusterNetwork *net.IPNet) error { | ||
m.hostportSyncer = kubehostport.NewHostportSyncer() | ||
if m.enableHostports { | ||
m.hostportSyncer = kubehostport.NewHostportSyncer() | ||
} | ||
|
||
var err error | ||
if m.ipamConfig, err = getIPAMConfig(clusterNetwork, localSubnetCIDR); err != nil { | ||
|
@@ -499,8 +504,10 @@ func (m *podManager) setup(req *cniserver.PodRequest) (cnitypes.Result, *running | |
defer func() { | ||
if !success { | ||
m.ipamDel(req.SandboxID) | ||
if err := m.hostportSyncer.SyncHostports(Tun0, m.getRunningPods()); err != nil { | ||
glog.Warningf("failed syncing hostports: %v", err) | ||
if m.hostportSyncer != nil { | ||
if err := m.hostportSyncer.SyncHostports(Tun0, m.getRunningPods()); err != nil { | ||
glog.Warningf("failed syncing hostports: %v", err) | ||
} | ||
} | ||
} | ||
}() | ||
|
@@ -511,8 +518,10 @@ func (m *podManager) setup(req *cniserver.PodRequest) (cnitypes.Result, *running | |
return nil, nil, err | ||
} | ||
podPortMapping := kubehostport.ConstructPodPortMapping(&v1Pod, podIP) | ||
if err := m.hostportSyncer.OpenPodHostportsAndSync(podPortMapping, Tun0, m.getRunningPods()); err != nil { | ||
return nil, nil, err | ||
if m.hostportSyncer != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above. |
||
if err := m.hostportSyncer.OpenPodHostportsAndSync(podPortMapping, Tun0, m.getRunningPods()); err != nil { | ||
return nil, nil, err | ||
} | ||
} | ||
|
||
var hostVethName, contVethMac string | ||
|
@@ -631,8 +640,10 @@ func (m *podManager) teardown(req *cniserver.PodRequest) error { | |
errList = append(errList, err) | ||
} | ||
|
||
if err := m.hostportSyncer.SyncHostports(Tun0, m.getRunningPods()); err != nil { | ||
errList = append(errList, err) | ||
if m.hostportSyncer != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as pointed above |
||
if err := m.hostportSyncer.SyncHostports(Tun0, m.getRunningPods()); err != nil { | ||
errList = append(errList, err) | ||
} | ||
} | ||
|
||
return kerrors.NewAggregate(errList) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chain of booleans. Can we check for enableHostports here?