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

sdn: disable hostports when CRI-O is used #16463

Merged
merged 1 commit into from
Sep 26, 2017

Conversation

dcbw
Copy link
Contributor

@dcbw dcbw commented Sep 20, 2017

For now...

@openshift/networking @knobunc @rajatchopra

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 20, 2017
This is a workaround because CRIO's CNI driver has different
hostport behavior than Kubernetes' CNI driver.  Kube leaves all
hostport handling to the CNI plugin itself, while CRIO does
hostport handling internally, leading to duplicate work if the
plugin also handles hostports.

For now, detect the runtime based on socket path and disable
openshift-sdn hostport handling if the runtime is CRIO.

The real fix for this is to add hostport handling to Kube's CNI
driver, but in the "split" mode discussed upstream where kube's
CNI driver handles the port reservations on the host, while the
plugin handles the actual iptables rules.  CRIO should be converted
to this scheme as well, and plugins will indicate with capabilities
in the CNI JSON whether they support this scheme or not.  At
that point we can remove this hack and just have openshift-sdn
advertise portmapping support via the CNI JSON.
@imcsk8
Copy link
Contributor

imcsk8 commented Sep 21, 2017

LGTM

@danwinship
Copy link
Contributor

The real fix for this is to add hostport handling to Kube's CNI
driver, but in the "split" mode discussed upstream where kube's
CNI driver handles the port reservations on the host, while the
plugin handles the actual iptables rules. CRIO should be converted
to this scheme as well

Are there kube and CNI bugs filed about this?
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 21, 2017
Copy link
Contributor

@rajatchopra rajatchopra left a comment

Choose a reason for hiding this comment

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

/lgtm
Non critical nit. Feel free to ignore the ask.

@@ -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 {
Copy link
Contributor

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?

@@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above.

@@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

as pointed above

@dcbw
Copy link
Contributor Author

dcbw commented Sep 22, 2017

Are there kube and CNI bugs filed about this?

It's mostly about CRIO. In yesterday's SIG Net meeting Tim indicated he'd like to punt all this out to runtimes and plugins. Kube's CNI driver doesn't do anything related to hostports at all. And CRIO probably shouldn't either, that's what the CNI 'portmap' plugin is for.

CRIO issue filed as cri-o/cri-o#941

@0xmichalis
Copy link
Contributor

cc @runcom @mrunalp

/approve

@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danwinship, dcbw, kargakis, rajatchopra

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 26, 2017
@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants