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

Drop cluster-internal endpoint filtering / pod monitoring #9982

Merged
merged 1 commit into from Aug 10, 2016

Conversation

Projects
None yet
7 participants
@danwinship
Contributor

danwinship commented Jul 21, 2016

With #9383 merged, we no longer need to sanity-check cluster-internal service endpoints, so we can drop the pod monitor.

Unfortunately, for the moment at least, we still need to filter out cluster-external endpoints that violate EgressFirewall rules (#9227). Eventually we will hopefully be able to get rid of that. For now, this branch is based on top of the EgressFirewall branch (since otherwise we'd be completely dropping the endpoint filter in this branch, and then bringing it back in the EgressFirewall branch). It can land after that does.

Closes #9255.

@openshift/networking PTAL. Only the last commit is new; the rest is from 9227.

@@ -52,12 +47,6 @@ func (proxy *ovsProxyPlugin) Start(baseHandler pconfig.EndpointsConfigHandler) e
proxy.baseEndpointsHandler = baseHandler
// Populate pod info map synchronously so that kube proxy can filter endpoints to support isolation
pods, err := proxy.registry.GetAllPods()

This comment has been minimized.

@dcbw

dcbw Jul 22, 2016

Member

Don't need GetAllPods() anymore now either.

@dcbw

dcbw Jul 22, 2016

Member

Don't need GetAllPods() anymore now either.

@dcbw

This comment has been minimized.

Show comment
Hide comment
@dcbw

dcbw Jul 22, 2016

Member

Last commit removing pod watch LGTM though we can remove some additional registry code too.

Member

dcbw commented Jul 22, 2016

Last commit removing pod watch LGTM though we can remove some additional registry code too.

@liggitt

This comment has been minimized.

Show comment
Hide comment
@liggitt

liggitt Jul 23, 2016

Contributor

Old clusters can still have old data with manually created endpoints with now-disallowed addresses. Need to at least document the need to check/delete such endpoints on upgrade, even though the admission plugin will keep new ones from being created

Contributor

liggitt commented Jul 23, 2016

Old clusters can still have old data with manually created endpoints with now-disallowed addresses. Need to at least document the need to check/delete such endpoints on upgrade, even though the admission plugin will keep new ones from being created

@danwinship

This comment has been minimized.

Show comment
Hide comment
@danwinship

danwinship Jul 25, 2016

Contributor

Old clusters can still have old data with manually created endpoints with now-disallowed addresses. Need to at least document the need to check/delete such endpoints on upgrade, even though the admission plugin will keep new ones from being created

Added a coment to the release notes bug

Contributor

danwinship commented Jul 25, 2016

Old clusters can still have old data with manually created endpoints with now-disallowed addresses. Need to at least document the need to check/delete such endpoints on upgrade, even though the admission plugin will keep new ones from being created

Added a coment to the release notes bug

"hostSubnets": hostSubnetStorage,
"netNamespaces": netNamespaceStorage,
"clusterNetworks": clusterNetworkStorage,
"egressNetworkPolicies": egressNetworkPolicyStorage,

This comment has been minimized.

@pravisankar

pravisankar Jul 28, 2016

Contributor

Enable this resource only if openshift-sdn plugin is used?

@pravisankar

pravisankar Jul 28, 2016

Contributor

Enable this resource only if openshift-sdn plugin is used?

}
}
if len(policy.Spec.Egress) > 50 {

This comment has been minimized.

@pravisankar

pravisankar Jul 28, 2016

Contributor

We are limiting number of egress rules to avoid/reduce network performance degradation?

@pravisankar

pravisankar Jul 28, 2016

Contributor

We are limiting number of egress rules to avoid/reduce network performance degradation?

policy.Spec.Egress = nil
}
proxy.updateNetworkPolicy(*policy)
// FIXME: poke the endpoint-syncer somehow...

This comment has been minimized.

@pravisankar

pravisankar Jul 28, 2016

Contributor

Stale comment or something needs to be done here?

@pravisankar

pravisankar Jul 28, 2016

Contributor

Stale comment or something needs to be done here?

}
func (plugin *OsdnNode) UpdateEgressNetworkPolicy(policy osapi.EgressNetworkPolicy, vnid uint32) error {
if policy.Name != "default" {

This comment has been minimized.

@pravisankar

pravisankar Jul 28, 2016

Contributor

Where are we creating the 'default' egress policy?

@pravisankar

pravisankar Jul 28, 2016

Contributor

Where are we creating the 'default' egress policy?

dst = fmt.Sprintf(", nw_dst=%s", rule.To.CIDRSelector)
}
otx.AddFlow("table=9, reg0=%d, priority=%d, ip%s, actions=%s", vnid, priority, dst, action)

This comment has been minimized.

@pravisankar

pravisankar Jul 28, 2016

Contributor

This has some side effects.
(1) Let's say we have 2 projects A and B
(2) Apply some egress policy to project A
(3) For some reason, project B needs to have access to pods in project A. So project networks for A and B are merged.
Since project A and B are sharing the same vnid, egress policy in (2) will be applied to project B as well which was not intended. I can't think of easy way to deal with this as source IP may not match originated pod IP. May be for now, document this limitation and tackle this case in the next release?
@knobunc @dcbw what do you think?

@pravisankar

pravisankar Jul 28, 2016

Contributor

This has some side effects.
(1) Let's say we have 2 projects A and B
(2) Apply some egress policy to project A
(3) For some reason, project B needs to have access to pods in project A. So project networks for A and B are merged.
Since project A and B are sharing the same vnid, egress policy in (2) will be applied to project B as well which was not intended. I can't think of easy way to deal with this as source IP may not match originated pod IP. May be for now, document this limitation and tackle this case in the next release?
@knobunc @dcbw what do you think?

if err != nil {
// should have been caught by validation
glog.Errorf("Illegal CIDR value %q in EgressNetworkPolicy rule", rule.To.CIDRSelector)
return

This comment has been minimized.

@pravisankar

pravisankar Jul 28, 2016

Contributor

continue?

@pravisankar

pravisankar Jul 28, 2016

Contributor

continue?

// Update namespace references in egress firewall rules
for _, policy := range policies {
if err = node.UpdateEgressNetworkPolicy(policy, netID); err != nil {

This comment has been minimized.

@pravisankar

pravisankar Jul 28, 2016

Contributor

Do we need to delete egress related ovs rules with old-netid...DeleteFlows("table=9, reg0=%d", Old-vnid) or it's already done by UpdatePod()?

@pravisankar

pravisankar Jul 28, 2016

Contributor

Do we need to delete egress related ovs rules with old-netid...DeleteFlows("table=9, reg0=%d", Old-vnid) or it's already done by UpdatePod()?

return fmt.Errorf("Could not get EgressNetworkPolicies: %s", err)
}
for _, policy := range policies {
proxy.updateNetworkPolicy(policy)

This comment has been minimized.

@pravisankar

pravisankar Jul 28, 2016

Contributor

There could be multiple policies on the same namespace. We need to consolidate all the policies for the namespace before assigning it to proxy.firewall[namespace]?
799ce2b#diff-39f5aa4f9b871145d31267e2f480b6adR110 will override existing policy for the namespace.

@pravisankar

pravisankar Jul 28, 2016

Contributor

There could be multiple policies on the same namespace. We need to consolidate all the policies for the namespace before assigning it to proxy.firewall[namespace]?
799ce2b#diff-39f5aa4f9b871145d31267e2f480b6adR110 will override existing policy for the namespace.

if err != nil {
allErrs = append(allErrs, field.Invalid(field.NewPath("spec").Child("egress").Index(i).Child("to"), rule.To.CIDRSelector, err.Error()))
}
}

This comment has been minimized.

@pravisankar

pravisankar Jul 28, 2016

Contributor

There may be other policies for the namespace with conflicting egress rules. Check for any rule conflicts here?

@pravisankar

pravisankar Jul 28, 2016

Contributor

There may be other policies for the namespace with conflicting egress rules. Check for any rule conflicts here?

Drop the SDN endpoint filter pod watch
We no longer need to do any filtering of cluster network / service
network IPs, because the endpoint admission controller does it for us.
@smarterclayton

This comment has been minimized.

Show comment
Hide comment
@smarterclayton

smarterclayton Aug 2, 2016

Member

Any reason this can't be merged? Changes look ok to me.

Member

smarterclayton commented Aug 2, 2016

Any reason this can't be merged? Changes look ok to me.

@liggitt

This comment has been minimized.

Show comment
Hide comment
@liggitt

liggitt Aug 2, 2016

Contributor

Can we add information to the release note that would help an admin who wanted to find/remove old illegal endpoints?

Contributor

liggitt commented Aug 2, 2016

Can we add information to the release note that would help an admin who wanted to find/remove old illegal endpoints?

continue EndpointLoop
}
} else {
if !ni.ClusterNetwork.Contains(IP) && !ni.ServiceNetwork.Contains(IP) {

This comment has been minimized.

@liggitt

liggitt Aug 2, 2016

Contributor

this is pre-existing, but if an endpoint contains any address outside the allowed range, we drop the entire endpoint object?

@liggitt

liggitt Aug 2, 2016

Contributor

this is pre-existing, but if an endpoint contains any address outside the allowed range, we drop the entire endpoint object?

This comment has been minimized.

@danwinship

danwinship Aug 2, 2016

Contributor

yeah... with the old (cluster-internal) filtering, you could really only hit this case if you were pretty explicitly trying to be evil, so there wasn't really any reason for us to be forgiving. I guess with the cluster-external filtering maybe you're more likely to do this accidentally so it might be better to delete just the bad addresses...

@danwinship

danwinship Aug 2, 2016

Contributor

yeah... with the old (cluster-internal) filtering, you could really only hit this case if you were pretty explicitly trying to be evil, so there wasn't really any reason for us to be forgiving. I guess with the cluster-external filtering maybe you're more likely to do this accidentally so it might be better to delete just the bad addresses...

This comment has been minimized.

@liggitt

liggitt Aug 2, 2016

Contributor

yeah, not sure what the right thing to do is, can you spawn a follow-up issue to track?

@liggitt

liggitt Aug 2, 2016

Contributor

yeah, not sure what the right thing to do is, can you spawn a follow-up issue to track?

This comment has been minimized.

@danwinship

danwinship Aug 4, 2016

Contributor

filed #10212

@danwinship

danwinship Aug 4, 2016

Contributor

filed #10212

@liggitt

This comment has been minimized.

Show comment
Hide comment
@liggitt

liggitt Aug 2, 2016

Contributor

lgtm as well, doc request and question notwithstanding

Contributor

liggitt commented Aug 2, 2016

lgtm as well, doc request and question notwithstanding

@danwinship danwinship changed the title from Drop cluster-internal endpoint filtering / pod monitoring [DO NOT MERGE] to Drop cluster-internal endpoint filtering / pod monitoring Aug 2, 2016

@danwinship

This comment has been minimized.

Show comment
Hide comment
@danwinship

danwinship Aug 2, 2016

Contributor

Any reason this can't be merged? Changes look ok to me.

It was blocking on the egress-firewall merge, but that has happened now

Contributor

danwinship commented Aug 2, 2016

Any reason this can't be merged? Changes look ok to me.

It was blocking on the egress-firewall merge, but that has happened now

@danwinship

This comment has been minimized.

Show comment
Hide comment
@danwinship

danwinship Aug 2, 2016

Contributor

Can we add information to the release note that would help an admin who wanted to find/remove old illegal endpoints?

The suggestion that's already there ("look in your logs from before you upgraded") is really the only easy answer. There's no way to search for "all endpoints corresponding to services that don't have selectors and that have addresses that match a particular CIDR" so you'd basically have to just manually examine every endpoint. Or we could provide a script or something, but it would basically just be the code we're deleting here.

We could move the illegal-endpoint-checking code so that it only gets run once, at startup, on the master, and have it output suggested "oc delete" commands along with the warnings. (And then drop it in 3.4?)

Contributor

danwinship commented Aug 2, 2016

Can we add information to the release note that would help an admin who wanted to find/remove old illegal endpoints?

The suggestion that's already there ("look in your logs from before you upgraded") is really the only easy answer. There's no way to search for "all endpoints corresponding to services that don't have selectors and that have addresses that match a particular CIDR" so you'd basically have to just manually examine every endpoint. Or we could provide a script or something, but it would basically just be the code we're deleting here.

We could move the illegal-endpoint-checking code so that it only gets run once, at startup, on the master, and have it output suggested "oc delete" commands along with the warnings. (And then drop it in 3.4?)

@smarterclayton

This comment has been minimized.

Show comment
Hide comment
@smarterclayton

smarterclayton Aug 2, 2016

Member

I would recommend coming up with simple bash snippet that would find the
affected ones and document that:

oc get endpoints --all-namespaces --template '{{ range .items }}{{ .
metadata.name }} {{ range .subsets }}{{ range .addresses }}{{ .ip }} {{ end
}}{{ end }}{{ end }}' | grep -v ' 172.30.' | cut -f 1-1 -d ' '

or something

On Tue, Aug 2, 2016 at 10:41 AM, Dan Winship notifications@github.com
wrote:

Can we add information to the release note that would help an admin who
wanted to find/remove old illegal endpoints?

The suggestion that's already there ("look in your logs from before you
upgraded") is really the only easy answer. There's no way to search for
"all endpoints corresponding to services that don't have selectors and that
have addresses that match a particular CIDR" so you'd basically have to
just manually examine every endpoint. Or we could provide a script or
something, but it would basically just be the code we're deleting here.

We could move the illegal-endpoint-checking code so that it only gets run
once, at startup, on the master, and have it output suggested "oc delete"
commands along with the warnings. (And then drop it in 3.4?)


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#9982 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABG_p-xqEC9cpgCvZjBHauALCWLkjH5Qks5qb1cwgaJpZM4JSM_g
.

Member

smarterclayton commented Aug 2, 2016

I would recommend coming up with simple bash snippet that would find the
affected ones and document that:

oc get endpoints --all-namespaces --template '{{ range .items }}{{ .
metadata.name }} {{ range .subsets }}{{ range .addresses }}{{ .ip }} {{ end
}}{{ end }}{{ end }}' | grep -v ' 172.30.' | cut -f 1-1 -d ' '

or something

On Tue, Aug 2, 2016 at 10:41 AM, Dan Winship notifications@github.com
wrote:

Can we add information to the release note that would help an admin who
wanted to find/remove old illegal endpoints?

The suggestion that's already there ("look in your logs from before you
upgraded") is really the only easy answer. There's no way to search for
"all endpoints corresponding to services that don't have selectors and that
have addresses that match a particular CIDR" so you'd basically have to
just manually examine every endpoint. Or we could provide a script or
something, but it would basically just be the code we're deleting here.

We could move the illegal-endpoint-checking code so that it only gets run
once, at startup, on the master, and have it output suggested "oc delete"
commands along with the warnings. (And then drop it in 3.4?)


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#9982 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABG_p-xqEC9cpgCvZjBHauALCWLkjH5Qks5qb1cwgaJpZM4JSM_g
.

@danwinship

This comment has been minimized.

Show comment
Hide comment
@danwinship

danwinship Aug 2, 2016

Contributor

That works for IPs in the service network, but for IPs in the cluster network, you only want to look at the endpoints that weren't generated by the endpoints controller, but you can only figure that out by comparing against the service table... so it would have to be something like

for endpoint in $(oc get services --template '[something that selects only selectorless services]'); do
    oc get endpoint $endpoint --template '[...]' | grep ' 10\.(12[8-9]|1[3-9][0-9]|2[0-5][0-9])\.' | ...

(assuming they're using the default 3.2 ClusterNetworkCIDR and not the 3.1 default or a custom value). This is already gross and it's not complete yet. And they've already got a list of all the bad endpoints repeated every 30 seconds in their logs...

Contributor

danwinship commented Aug 2, 2016

That works for IPs in the service network, but for IPs in the cluster network, you only want to look at the endpoints that weren't generated by the endpoints controller, but you can only figure that out by comparing against the service table... so it would have to be something like

for endpoint in $(oc get services --template '[something that selects only selectorless services]'); do
    oc get endpoint $endpoint --template '[...]' | grep ' 10\.(12[8-9]|1[3-9][0-9]|2[0-5][0-9])\.' | ...

(assuming they're using the default 3.2 ClusterNetworkCIDR and not the 3.1 default or a custom value). This is already gross and it's not complete yet. And they've already got a list of all the bad endpoints repeated every 30 seconds in their logs...

@danwinship

This comment has been minimized.

Show comment
Hide comment
@danwinship

danwinship Aug 2, 2016

Contributor

noticing the "init containers" release note... maybe we need a upgrade migration/helper script?

Contributor

danwinship commented Aug 2, 2016

noticing the "init containers" release note... maybe we need a upgrade migration/helper script?

@danwinship

This comment has been minimized.

Show comment
Hide comment
@danwinship

danwinship Aug 4, 2016

Contributor
for ep in $(oc get services --all-namespaces --template '{{ range .items}}{{ range .spec.selector }}{{ else }}{{ .metadata.namespace}}:{{ .metadata.name }} {{ end }}{{ end }}'); do
    oc get endpoints --namespace $(echo $ep | sed -e 's/:.*//') $(echo $ep | sed -e 's/.*://') --template '{{ .metadata.namespace }}:{{ .metadata.name }} {{ range .subsets }}{{ range .addresses }}{{ .ip }} {{ end }}{{ end }}{{ "\n" }}' | awk '/ 10\.(12[8-9]|1[3-9][0-9]|2[0-5][0-9])\./ { print $1 }'
done
Contributor

danwinship commented Aug 4, 2016

for ep in $(oc get services --all-namespaces --template '{{ range .items}}{{ range .spec.selector }}{{ else }}{{ .metadata.namespace}}:{{ .metadata.name }} {{ end }}{{ end }}'); do
    oc get endpoints --namespace $(echo $ep | sed -e 's/:.*//') $(echo $ep | sed -e 's/.*://') --template '{{ .metadata.namespace }}:{{ .metadata.name }} {{ range .subsets }}{{ range .addresses }}{{ .ip }} {{ end }}{{ end }}{{ "\n" }}' | awk '/ 10\.(12[8-9]|1[3-9][0-9]|2[0-5][0-9])\./ { print $1 }'
done
@smarterclayton

This comment has been minimized.

Show comment
Hide comment
@smarterclayton

smarterclayton Aug 9, 2016

Member

LGTM [merge] - please remember to add the release note

Member

smarterclayton commented Aug 9, 2016

LGTM [merge] - please remember to add the release note

@openshift-bot

This comment has been minimized.

Show comment
Hide comment
@openshift-bot

openshift-bot Aug 9, 2016

[Test]ing while waiting on the merge queue

openshift-bot commented Aug 9, 2016

[Test]ing while waiting on the merge queue

@openshift-bot

This comment has been minimized.

Show comment
Hide comment
@openshift-bot

openshift-bot Aug 9, 2016

Evaluated for origin test up to aeee7c8

openshift-bot commented Aug 9, 2016

Evaluated for origin test up to aeee7c8

@openshift-bot

This comment has been minimized.

Show comment
Hide comment
@openshift-bot

openshift-bot Aug 9, 2016

continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/7684/)

openshift-bot commented Aug 9, 2016

continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/7684/)

@openshift-bot

This comment has been minimized.

Show comment
Hide comment
@openshift-bot

openshift-bot Aug 9, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/7719/) (Image: devenv-rhel7_4797)

openshift-bot commented Aug 9, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/7719/) (Image: devenv-rhel7_4797)

@smarterclayton

This comment has been minimized.

Show comment
Hide comment
@smarterclayton

smarterclayton Aug 9, 2016

Member
Member

smarterclayton commented Aug 9, 2016

@danwinship

This comment has been minimized.

Show comment
Hide comment
Contributor

danwinship commented Aug 10, 2016

@openshift-bot

This comment has been minimized.

Show comment
Hide comment
@openshift-bot

openshift-bot Aug 10, 2016

Evaluated for origin merge up to aeee7c8

openshift-bot commented Aug 10, 2016

Evaluated for origin merge up to aeee7c8

@openshift-bot openshift-bot merged commit 1c1cb0b into openshift:master Aug 10, 2016

2 of 3 checks passed

continuous-integration/openshift-jenkins/test Failed
Details
continuous-integration/openshift-jenkins/merge Passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@danwinship danwinship deleted the danwinship:drop-endpoint-filtering branch Aug 10, 2016

@bmeng

This comment has been minimized.

Show comment
Hide comment
@bmeng

bmeng Aug 11, 2016

Contributor

@danwinship Does this mean that the endpoint points to pod/svc in other project which created by an user with system:endpoint-controller role can be accessed from the user's project under multitenant plugin?

Contributor

bmeng commented Aug 11, 2016

@danwinship Does this mean that the endpoint points to pod/svc in other project which created by an user with system:endpoint-controller role can be accessed from the user's project under multitenant plugin?

@danwinship

This comment has been minimized.

Show comment
Hide comment
@danwinship

danwinship Aug 11, 2016

Contributor

@danwinship Does this mean that the endpoint points to pod/svc in other project which created by an user with system:endpoint-controller role can be accessed from the user's project under multitenant plugin?

Yes, but this is not intentional/supported, and it might not work that way in the future if we manage to implement the idea in #9255 (comment). (If that happened, then the privileged user would still be able to create the endpoint, but trying to connect to the endpoint would fail, just like trying to connect to the other user's pod directly would.)

Contributor

danwinship commented Aug 11, 2016

@danwinship Does this mean that the endpoint points to pod/svc in other project which created by an user with system:endpoint-controller role can be accessed from the user's project under multitenant plugin?

Yes, but this is not intentional/supported, and it might not work that way in the future if we manage to implement the idea in #9255 (comment). (If that happened, then the privileged user would still be able to create the endpoint, but trying to connect to the endpoint would fail, just like trying to connect to the other user's pod directly would.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment