27 Commits
Author SHA1 Message Date
Raj Chaudhuri c1d3107418 Changed module name, edited default manifests in prog/weave-kube
* Module name changed to `github.com/rajch/weave`
* Added environment variable `CHECKPOINT_DISABLE=1` to default manifests, to bypass weaveworks telemetry
2024-03-01 18:05:19 +05:30
Bryan Boreham 8c52698222 Move egress logging rule beside drop rule
Otherwise we might log a blocked connection even though the packet
was not dropped.
2020-08-26 10:02:32 +00:00
Bryan Boreham b3d387fb86 Update Kubernetes client packages to 0.18.6
Lots of functions need Context parameters added
2020-08-04 10:11:30 +00:00
Bryan Boreham f9e27f76d6 Merge remote-tracking branch 'gobomb/fix-nil-ns-pointer'
Needed a few modifications to resolve conflicts due to changed
datatype of UID.
2020-08-03 12:32:31 +00:00
gobomb 0789670344 add namespaceLabels and namespaceUID, remove namespace in ns struct 2020-08-02 21:06:17 +08:00
Bryan Boreham ca4f93d0d7 Remove the dependency of 'ipset' package on Kubernetes
We don't want everyone that uses the `net` package to get a transitive
dependency on the Kubernetes APIs, so have it define the `UID` type.

Conceptually this is a simple change because `UID` is a `string`, but
unfortunately it is used in a lot of places.
2020-07-29 13:08:35 +00:00
Bryan Boreham a3c76e141b Move name constants to separate 'chains' package, to reduce dependencies
We don't want everyone that uses the `net` package to get a transitive
dependency on the Kubernetes APIs required by `npc`.
2020-07-29 12:55:46 +00:00
Murali Reddy a6f2ee5ccc add seperate match function to matach pod/namespace/namespacedpod selectors 2019-06-07 11:52:40 +05:30
Murali Reddy 7a6ba40982 fix unit test failures 2019-05-30 15:58:18 +05:30
Murali Reddy 75e106b667 using an explicti selector set for network policies with both namespace and pod lable selectors 2019-05-30 12:03:28 +05:30
Murali Reddy bb4f51499d add support for combination of podSelector and namespaceSelector
in network policies

- enhance selectorSpec to accomodate both pod and namespace selectors
- enhance analysePolicy to handle policies with both selectors

Fixes #3312
2019-05-28 12:40:39 +05:30
Murali Reddy ea2084d871 return from further processign networkpolicy if base rule failed to gets created 2019-05-06 16:27:38 +05:30
Murali Reddy 4a1fbc7c38 lazily add iptables rule to drop egress traffic from the pods only
if network policies are applied

does not address #3464 but just avoids the issue atleast for those who
dont use network policies
2019-05-03 18:40:59 +05:30
Martynas Pumputis 07d31a8558 npc: Get rid of the legacy netpol 2018-07-24 10:06:55 +02:00
Martynas Pumputis d474c1c26d npc: Add policyType to selectorSpec
This allows us to distinguish between ingress and egress
dst selectors (required when managing entries in default-allow
ipsets).
2018-07-24 10:06:23 +02:00
Martynas Pumputis 27c98070e8 Move npc/ipset package to net/ipset
It's going to be used by net/bridge.go.
2018-06-04 14:08:24 +02:00
Martynas Pumputis 0a0dbe115a npc: Track ipset entries per user
There was a bug in handling "default-allow" ipsets - it could not
cope with out of order receive of Pod updates. E.g:

    1) AddPod(Pod_A, PodIP_A),
    2) AddPod(Pod_B, PodIP_A),
    3) DeletePod(Pod_A),

would result with PodIP_A being removed from "default-allow" ipset,
as such ipset entries were not refcounted. Bypassing of refcounting
was due to the fact that adding a netpol which dst-selects a Pod which
IP addr is in "default-allow" ipset has to remove the IP addr from
the ipset regardless of refcount value of the IP addr entry in the
ipset. So, refcounting in such case didn't make sense and it was
bypassed.

This commit changes the way entries are refcounted in ipsets, and
it makes "default-allow" ipset the same citizen as other ipsets, so
from now "default-allow" ipset is refcounted.
2017-11-21 14:41:29 +02:00
Martynas Pumputis 7c39f96d08 npc: Implement networking.k8s.io/v1/NetworkPolicy semantics (k8s 1.7)
The main difference between new and legacy (pre-1.7) netpol semantics
are the following:

    * The DenyDefault ingress isolation annotation is obsoleted.
    * Traffic is allowed to a pod if there are no netpol selecting
      the pod.

See https://kubernetes.io/docs/api-reference/v1.6/#networkpolicyspec-v1beta1-extensions
vs https://kubernetes.io/docs/api-reference/v1.7/#networkpolicyspec-v1-networking
for more details.

weave-npc can operate either in the legacy or the new mode (default). To
use the legacy, pass "--use-legacy-netpol" arg when starting the npc.

In non-legacy mode we create for each Namespace a default-allow ipset
which stores IP addrs of such Pods which are not selected by any
NetworkPolicy.The ipsets are dst's in rules of the WEAVE-NPC-DEFAULT chain.
2017-10-22 19:37:18 +02:00
Ayodele Abejide 1ac543aba7 Upgrading client go and vendoring it's extra dependencies. 2017-10-10 16:48:35 +00:00
Mike Bryant e10ce2345b Add comments to iptables rules and ipsets
Fixes #2621
2017-07-17 11:00:08 +01:00
Mike Bryant c33cd2657c Refactor iptables usage in weave-npc to make it testable 2017-07-14 14:45:41 +01:00
Bryan Boreham ced84955d3 Stop ignoring local pods
This behaviour was breaking the use of pod selectors for the 'from'
part of a rule.

Move checking of local pods into namespace.go so we can maintain
LocalIpSet correctly
2017-06-22 14:16:53 +00:00
Bryan Boreham a2b674e094 Ignore updates for pods on other nodes 2017-05-19 15:17:20 +00:00
Bryan Boreham 6a04c6c7bd Change to weave common logging 2016-12-07 11:53:31 +00:00
Bryan Boreham 8530528dd5 Drop pod log messages to Debug level 2016-12-07 11:51:53 +00:00
Bryan Boreham 8a45292e24 Log objects via JSON for better debugging 2016-12-06 17:40:17 +00:00
Adam Harrison 19088ba8bc Import from weave-npc repo 2016-11-02 11:28:59 +00:00