Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20919fd6db | ||
|
|
ada2af04ff | ||
|
|
fcb6f762a9 | ||
|
|
5645f31934 | ||
|
|
a7295e2d03 | ||
|
|
c3e6ac2cac | ||
|
|
f1f3c8c8fe | ||
|
|
81b2f2e15a | ||
|
|
f6fdaf6492 | ||
|
|
519c5d686a | ||
|
|
f7e62ccbcc | ||
|
|
19161c0c92 | ||
|
|
c528303841 | ||
|
|
a439288765 | ||
|
|
416410912d | ||
|
|
b3f26f00e2 | ||
|
|
90e6ecdd11 | ||
|
|
842354bc5a | ||
|
|
4d3875cec2 | ||
|
|
74dfe49046 | ||
|
|
d0f23ed9e0 | ||
|
|
8a0992315e | ||
|
|
18b5cb10dc | ||
|
|
8afc6f208d | ||
|
|
d35d931179 | ||
|
|
093174e757 | ||
|
|
ac78762910 | ||
|
|
fff656f7e4 | ||
|
|
83b36e4c76 | ||
|
|
b42895b5c0 | ||
|
|
42e4b9addc | ||
|
|
91ab0e4a76 | ||
|
|
51feec3785 | ||
|
|
20eee3818e | ||
|
|
94cd6226ea | ||
|
|
5534ecf1b1 | ||
|
|
d498df3933 | ||
|
|
75bf62ca80 | ||
|
|
ad42357dd6 | ||
|
|
2de899342a | ||
|
|
8df48dc69d | ||
|
|
0f2809d2e9 | ||
|
|
aa44153af7 | ||
|
|
ce9c5162bd | ||
|
|
5c0da56ad5 | ||
|
|
08858c2a10 | ||
|
|
0268aeb25f | ||
|
|
ea3aba8971 | ||
|
|
265bfcf9d7 |
No files matched your search
@@ -1,3 +1,49 @@
|
|||||||
|
## Release 2.3.0
|
||||||
|
|
||||||
|
### Security fixes
|
||||||
|
|
||||||
|
* By default, do not expose Weave "/status" and "/report" to all (0.0.0.0) when
|
||||||
|
running on Kubernetes #3271
|
||||||
|
|
||||||
|
### Other improvements
|
||||||
|
|
||||||
|
* Increase the default connection limit for Weave peers (from 30 to 100) when
|
||||||
|
running on Kubernetes, so that more peers could directly connect #3265
|
||||||
|
|
||||||
|
## Build and test
|
||||||
|
|
||||||
|
* Build Weave Net with Go 1.10.1 #3273
|
||||||
|
* Run integration tests against Kubernetes 1.10.0 #3266
|
||||||
|
|
||||||
|
[Full list of changes](https://github.com/weaveworks/weave/milestone/70?closed=1)
|
||||||
|
|
||||||
|
## Release 2.2.1
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
* Fix a bug in weave-npc which would allow ingress traffic to Kubernetes Pods selected
|
||||||
|
by a NetworkPolicy in which source and destination selectors were the same #3222,#3237
|
||||||
|
* Fix a bug in weave-npc which would crash if a previously deleted Kubernetes Namespace
|
||||||
|
has been created again #3247,#3250
|
||||||
|
|
||||||
|
### Other improvements
|
||||||
|
|
||||||
|
* Increase the default connection limit for Weave peers (from 30 to 100), so that
|
||||||
|
more peers could directly connect #3234
|
||||||
|
* When doing a rolling update of Weave Net on Kubernetes, allow each node five seconds
|
||||||
|
to initialize before rolling next Weave Net Pod, so that issues at startup will halt
|
||||||
|
the rollout and not spread across the whole cluster #3235
|
||||||
|
* Install common CA certificates from Alpine Linux package instead of copying
|
||||||
|
them manually #3236
|
||||||
|
|
||||||
|
### External contributors
|
||||||
|
|
||||||
|
Thanks to the following contributors:
|
||||||
|
|
||||||
|
* @alok87
|
||||||
|
|
||||||
|
[Full list of changes](https://github.com/weaveworks/weave/milestone/71?closed=1)
|
||||||
|
|
||||||
## Release 2.2.0
|
## Release 2.2.0
|
||||||
|
|
||||||
This release improves the way Weave Net configures Linux network
|
This release improves the way Weave Net configures Linux network
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
DOCKER_VERSION=17.06
|
DOCKER_VERSION=17.06
|
||||||
KUBERNETES_VERSION=1.9.2
|
KUBERNETES_VERSION=1.10.0
|
||||||
KUBERNETES_CNI_VERSION=0.6.0
|
KUBERNETES_CNI_VERSION=0.6.0
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.8.1
|
FROM golang:1.10.1-stretch
|
||||||
|
|
||||||
# Support Raspberry Pi 2 and newer
|
# Support Raspberry Pi 2 and newer
|
||||||
ENV GOARM 7
|
ENV GOARM 7
|
||||||
|
|||||||
@@ -127,6 +127,28 @@ Finally, for **Mainline** releases only:
|
|||||||
|
|
||||||
* Images tagged `latest` are updated on DockerHub
|
* Images tagged `latest` are updated on DockerHub
|
||||||
|
|
||||||
|
### Docker Store
|
||||||
|
|
||||||
|
Weave Net is [available in Docker Store](https://store.docker.com/plugins/weave-net-plugin) and should also be released there.
|
||||||
|
|
||||||
|
* Go to https://store.docker.com/ and log in.
|
||||||
|
* Go to "[_Publish_](https://store.docker.com/publisher/center)".
|
||||||
|
* Under "_My Products_", select "_owners (weaveworks)_". Weave Net should be listed among our products.
|
||||||
|
* Click "_Actions_" > "_Edit Product_".
|
||||||
|
* Go to "_Plans & Pricing_" > "_Free Tier_".
|
||||||
|
* Under "_Source Repositories & Tags_", click on "_Add Source_", select "_net-plugin_" under "_Repository_" and the version to release under "_Tag_".
|
||||||
|
* Under "_Resources_" > "_Installation Instructions_", update the lines containing `export NET_VERSION=<version>`.
|
||||||
|
* Click "_Submit For Review_". You should see a message like: "_Your product has been submitted for approval. [...] We'll be in touch with next steps soon!_".
|
||||||
|
* You should receive an email saying:
|
||||||
|
|
||||||
|
> This email confirms that we received your submission on \<date\> of Weave Net to the Docker Store.
|
||||||
|
>
|
||||||
|
> We're reviewing your submission to ensure that it meets our [security guidelines](https://success.docker.com/Store#Security_and_Audit_Policies) and complies with our [best practices](https://success.docker.com/Store#Create_Great_Content). Don't worry! We'll let you know if there's anything you need to change before we publish your submission. You should hear back from us within the next 14 days.
|
||||||
|
>
|
||||||
|
> Thanks for submitting your content to the Docker Store!
|
||||||
|
|
||||||
|
* Hope Docker eventually performs the release or contacts us. If nothing happens within 14 days, contact their support team: publisher-support@docker.com.
|
||||||
|
|
||||||
### Finish up
|
### Finish up
|
||||||
|
|
||||||
* If not on master, merge branch into master and push to GitHub.
|
* If not on master, merge branch into master and push to GitHub.
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ func CheckAllExpectedMessagesSent(allocs ...*Allocator) {
|
|||||||
m := alloc.gossip.(*mockGossipComms)
|
m := alloc.gossip.(*mockGossipComms)
|
||||||
m.RLock()
|
m.RLock()
|
||||||
if len(m.messages) > 0 {
|
if len(m.messages) > 0 {
|
||||||
require.FailNow(m, fmt.Sprintf("%s: Gossip message(s) not sent as expected: \n%x", m.name, m.messages))
|
require.FailNow(m, fmt.Sprintf("%s: Gossip message(s) not sent as expected: \n%v", m.name, m.messages))
|
||||||
}
|
}
|
||||||
m.RUnlock()
|
m.RUnlock()
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-2
@@ -108,7 +108,12 @@ func (ns *ns) analysePolicy(policy *networkingv1.NetworkPolicy) (
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
podSelectors[dstSelector.key] = dstSelector
|
|
||||||
|
// To prevent dstSelector being overwritten by a subsequent selector with
|
||||||
|
// the same key, addIfNotExist MUST be used when adding to podSelectors.
|
||||||
|
// Otherwise, dstSelector' "dst" property might be lost resulting in
|
||||||
|
// an invalid content of the "default-allow" ipset.
|
||||||
|
addIfNotExist(dstSelector, podSelectors)
|
||||||
|
|
||||||
// If ingress is empty then this NetworkPolicy does not allow any traffic
|
// If ingress is empty then this NetworkPolicy does not allow any traffic
|
||||||
if policy.Spec.Ingress == nil || len(policy.Spec.Ingress) == 0 {
|
if policy.Spec.Ingress == nil || len(policy.Spec.Ingress) == 0 {
|
||||||
@@ -142,7 +147,7 @@ func (ns *ns) analysePolicy(policy *networkingv1.NetworkPolicy) (
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
podSelectors[srcSelector.key] = srcSelector
|
addIfNotExist(srcSelector, podSelectors)
|
||||||
|
|
||||||
} else if peer.NamespaceSelector != nil {
|
} else if peer.NamespaceSelector != nil {
|
||||||
srcSelector, err = newSelectorSpec(peer.NamespaceSelector, false, "", ipset.ListSet)
|
srcSelector, err = newSelectorSpec(peer.NamespaceSelector, false, "", ipset.ListSet)
|
||||||
@@ -168,6 +173,12 @@ func (ns *ns) analysePolicy(policy *networkingv1.NetworkPolicy) (
|
|||||||
return rules, nsSelectors, podSelectors, nil
|
return rules, nsSelectors, podSelectors, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func addIfNotExist(s *selectorSpec, ss map[string]*selectorSpec) {
|
||||||
|
if _, ok := ss[s.key]; !ok {
|
||||||
|
ss[s.key] = s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func withNormalisedProtoAndPortLegacy(npps []extnapi.NetworkPolicyPort, f func(proto, port string)) {
|
func withNormalisedProtoAndPortLegacy(npps []extnapi.NetworkPolicyPort, f func(proto, port string)) {
|
||||||
for _, npp := range npps {
|
for _, npp := range npps {
|
||||||
f(proto(npp.Protocol), port(npp.Port))
|
f(proto(npp.Protocol), port(npp.Port))
|
||||||
|
|||||||
@@ -294,6 +294,11 @@ func TestDefaultAllow(t *testing.T) {
|
|||||||
controller.DeletePod(podFoo)
|
controller.DeletePod(podFoo)
|
||||||
// Should remove foo pod from default-allow
|
// Should remove foo pod from default-allow
|
||||||
require.False(t, m.entryExists(defaultAllowIPSetName, fooPodIP))
|
require.False(t, m.entryExists(defaultAllowIPSetName, fooPodIP))
|
||||||
|
|
||||||
|
controller.DeleteNamespace(defaultNamespace)
|
||||||
|
// Should remove default ipset
|
||||||
|
require.NotContains(t, m.sets, defaultAllowIPSetName)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOutOfOrderPodEvents(t *testing.T) {
|
func TestOutOfOrderPodEvents(t *testing.T) {
|
||||||
@@ -376,3 +381,76 @@ func TestOutOfOrderPodEvents(t *testing.T) {
|
|||||||
require.Equal(t, 0, len(m.sets[defaultAllowIPSetName].subSets))
|
require.Equal(t, 0, len(m.sets[defaultAllowIPSetName].subSets))
|
||||||
require.False(t, m.entryExists(runBarIPSetName, podIP))
|
require.False(t, m.entryExists(runBarIPSetName, podIP))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test case for https://github.com/weaveworks/weave/issues/3222
|
||||||
|
func TestNewDstSelector(t *testing.T) {
|
||||||
|
const (
|
||||||
|
defaultAllowIPSetName = "weave-E.1.0W^NGSp]0_t5WwH/]gX@L"
|
||||||
|
podIP = "10.32.0.10"
|
||||||
|
)
|
||||||
|
|
||||||
|
m := newMockIPSet()
|
||||||
|
controller := New("baz", false, &mockIPTables{}, &m)
|
||||||
|
|
||||||
|
defaultNamespace := &coreapi.Namespace{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
controller.AddNamespace(defaultNamespace)
|
||||||
|
|
||||||
|
podFoo := &coreapi.Pod{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
UID: "foo",
|
||||||
|
Namespace: "default",
|
||||||
|
Name: "foo",
|
||||||
|
Labels: map[string]string{"run": "foo"}},
|
||||||
|
Status: coreapi.PodStatus{PodIP: podIP}}
|
||||||
|
controller.AddPod(podFoo)
|
||||||
|
|
||||||
|
require.True(t, m.entryExists(defaultAllowIPSetName, podIP))
|
||||||
|
|
||||||
|
netpolBar := &networkingv1.NetworkPolicy{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
UID: "netpol-bar",
|
||||||
|
Name: "allow-from-default-1",
|
||||||
|
Namespace: "default",
|
||||||
|
},
|
||||||
|
Spec: networkingv1.NetworkPolicySpec{
|
||||||
|
PodSelector: metav1.LabelSelector{},
|
||||||
|
Ingress: []networkingv1.NetworkPolicyIngressRule{{
|
||||||
|
From: []networkingv1.NetworkPolicyPeer{{
|
||||||
|
PodSelector: &metav1.LabelSelector{},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
controller.AddNetworkPolicy(netpolBar)
|
||||||
|
|
||||||
|
// netpolBar dst selector selects podFoo
|
||||||
|
require.False(t, m.entryExists(defaultAllowIPSetName, podIP))
|
||||||
|
|
||||||
|
netpolFoo := &networkingv1.NetworkPolicy{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
UID: "netpol-foo",
|
||||||
|
Name: "allow-from-default-2",
|
||||||
|
Namespace: "default",
|
||||||
|
},
|
||||||
|
Spec: networkingv1.NetworkPolicySpec{
|
||||||
|
PodSelector: metav1.LabelSelector{},
|
||||||
|
Ingress: []networkingv1.NetworkPolicyIngressRule{{
|
||||||
|
From: []networkingv1.NetworkPolicyPeer{{
|
||||||
|
PodSelector: &metav1.LabelSelector{},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
controller.AddNetworkPolicy(netpolFoo)
|
||||||
|
|
||||||
|
controller.DeleteNetworkPolicy(netpolBar)
|
||||||
|
// netpolFoo dst-selects podFoo
|
||||||
|
require.False(t, m.entryExists(defaultAllowIPSetName, podIP))
|
||||||
|
controller.DeleteNetworkPolicy(netpolFoo)
|
||||||
|
// No netpol dst-selects podFoo
|
||||||
|
require.True(t, m.entryExists(defaultAllowIPSetName, podIP))
|
||||||
|
}
|
||||||
+10
-1
@@ -471,7 +471,16 @@ func (ns *ns) deleteNamespace(obj *coreapi.Namespace) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove namespace ipset from any matching namespace selectors
|
// Remove namespace ipset from any matching namespace selectors
|
||||||
return ns.nsSelectors.delFromMatching(obj.ObjectMeta.UID, obj.ObjectMeta.Labels, string(ns.allPods.ipsetName))
|
err := ns.nsSelectors.delFromMatching(obj.ObjectMeta.UID, obj.ObjectMeta.Labels, string(ns.allPods.ipsetName))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !ns.legacy {
|
||||||
|
return ns.ips.Destroy(ns.defaultAllowIPSet)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ns *ns) isDefaultDeny(namespace *coreapi.Namespace) bool {
|
func (ns *ns) isDefaultDeny(namespace *coreapi.Namespace) bool {
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ xt_set_exists() {
|
|||||||
# Default if not supplied - same as weave net default
|
# Default if not supplied - same as weave net default
|
||||||
IPALLOC_RANGE=${IPALLOC_RANGE:-10.32.0.0/12}
|
IPALLOC_RANGE=${IPALLOC_RANGE:-10.32.0.0/12}
|
||||||
HTTP_ADDR=${WEAVE_HTTP_ADDR:-127.0.0.1:6784}
|
HTTP_ADDR=${WEAVE_HTTP_ADDR:-127.0.0.1:6784}
|
||||||
STATUS_ADDR=${WEAVE_STATUS_ADDR:-0.0.0.0:6782}
|
METRICS_ADDR=${WEAVE_METRICS_ADDR:-0.0.0.0:6782}
|
||||||
HOST_ROOT=${HOST_ROOT:-/host}
|
HOST_ROOT=${HOST_ROOT:-/host}
|
||||||
CONN_LIMIT=${CONN_LIMIT:-30}
|
CONN_LIMIT=${CONN_LIMIT:-100}
|
||||||
DB_PREFIX=${DB_PREFIX:-/weavedb/weave-net}
|
DB_PREFIX=${DB_PREFIX:-/weavedb/weave-net}
|
||||||
|
|
||||||
# Check if the IP range overlaps anything existing on the host
|
# Check if the IP range overlaps anything existing on the host
|
||||||
@@ -54,6 +54,12 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
STATUS_OPTS="--metrics-addr=$METRICS_ADDR"
|
||||||
|
# --status-addr exposes internal information, so only turn it on if asked to.
|
||||||
|
if [ -n "${WEAVE_STATUS_ADDR}" ]; then
|
||||||
|
STATUS_OPTS="$STATUS_OPTS --status-addr=$WEAVE_STATUS_ADDR"
|
||||||
|
fi
|
||||||
|
|
||||||
# Default is that npc will be running; allow caller to override
|
# Default is that npc will be running; allow caller to override
|
||||||
WEAVE_NPC_OPTS="--expect-npc"
|
WEAVE_NPC_OPTS="--expect-npc"
|
||||||
if [ "${EXPECT_NPC}" = "0" ]; then
|
if [ "${EXPECT_NPC}" = "0" ]; then
|
||||||
@@ -144,7 +150,7 @@ post_start_actions &
|
|||||||
/home/weave/weaver $EXTRA_ARGS --port=6783 $(router_bridge_opts) \
|
/home/weave/weaver $EXTRA_ARGS --port=6783 $(router_bridge_opts) \
|
||||||
--name="$PEERNAME" \
|
--name="$PEERNAME" \
|
||||||
--host-root=$HOST_ROOT \
|
--host-root=$HOST_ROOT \
|
||||||
--http-addr=$HTTP_ADDR --status-addr=$STATUS_ADDR --docker-api='' --no-dns \
|
--http-addr=$HTTP_ADDR $STATUS_OPTS --docker-api='' --no-dns \
|
||||||
--db-prefix="$DB_PREFIX" \
|
--db-prefix="$DB_PREFIX" \
|
||||||
--ipalloc-range=$IPALLOC_RANGE $NICKNAME_ARG \
|
--ipalloc-range=$IPALLOC_RANGE $NICKNAME_ARG \
|
||||||
--ipalloc-init $IPALLOC_INIT \
|
--ipalloc-init $IPALLOC_INIT \
|
||||||
|
|||||||
@@ -101,6 +101,8 @@ items:
|
|||||||
name: weave-net
|
name: weave-net
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
spec:
|
spec:
|
||||||
|
# Wait 5 seconds to let pod connect before rolling next pod
|
||||||
|
minReadySeconds: 5
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ RUN apk add --update \
|
|||||||
util-linux \
|
util-linux \
|
||||||
conntrack-tools \
|
conntrack-tools \
|
||||||
bind-tools \
|
bind-tools \
|
||||||
|
ca-certificates \
|
||||||
&& rm -rf /var/cache/apk/*
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
ADD ./weave ./weaver /home/weave/
|
ADD ./weave ./weaver /home/weave/
|
||||||
ADD ./weaveutil /usr/bin/
|
ADD ./weaveutil /usr/bin/
|
||||||
ADD weavedata.db /weavedb/
|
ADD weavedata.db /weavedb/
|
||||||
COPY ca-certificates.crt /etc/ssl/certs/
|
|
||||||
ENTRYPOINT ["/home/weave/weaver"]
|
ENTRYPOINT ["/home/weave/weaver"]
|
||||||
WORKDIR /home/weave
|
WORKDIR /home/weave
|
||||||
File diff suppressed because it is too large.
Load diff
+11
-2
@@ -155,6 +155,7 @@ func main() {
|
|||||||
noDiscovery bool
|
noDiscovery bool
|
||||||
httpAddr string
|
httpAddr string
|
||||||
statusAddr string
|
statusAddr string
|
||||||
|
metricsAddr string
|
||||||
ipamConfig ipamConfig
|
ipamConfig ipamConfig
|
||||||
dockerAPI string
|
dockerAPI string
|
||||||
peers []string
|
peers []string
|
||||||
@@ -186,12 +187,13 @@ func main() {
|
|||||||
mflag.StringVar(&logLevel, []string{"-log-level"}, "info", "logging level (debug, info, warning, error)")
|
mflag.StringVar(&logLevel, []string{"-log-level"}, "info", "logging level (debug, info, warning, error)")
|
||||||
mflag.BoolVar(&pktdebug, []string{"-pkt-debug"}, false, "enable per-packet debug logging")
|
mflag.BoolVar(&pktdebug, []string{"-pkt-debug"}, false, "enable per-packet debug logging")
|
||||||
mflag.StringVar(&prof, []string{"-profile"}, "", "enable profiling and write profiles to given path")
|
mflag.StringVar(&prof, []string{"-profile"}, "", "enable profiling and write profiles to given path")
|
||||||
mflag.IntVar(&config.ConnLimit, []string{"-conn-limit"}, 30, "connection limit (0 for unlimited)")
|
mflag.IntVar(&config.ConnLimit, []string{"-conn-limit"}, 100, "connection limit (0 for unlimited)")
|
||||||
mflag.BoolVar(&noDiscovery, []string{"-no-discovery"}, false, "disable peer discovery")
|
mflag.BoolVar(&noDiscovery, []string{"-no-discovery"}, false, "disable peer discovery")
|
||||||
mflag.IntVar(&bufSzMB, []string{"-bufsz"}, 8, "capture buffer size in MB")
|
mflag.IntVar(&bufSzMB, []string{"-bufsz"}, 8, "capture buffer size in MB")
|
||||||
mflag.IntVar(&bridgeConfig.MTU, []string{"-mtu"}, 0, "MTU size")
|
mflag.IntVar(&bridgeConfig.MTU, []string{"-mtu"}, 0, "MTU size")
|
||||||
mflag.StringVar(&httpAddr, []string{"-http-addr"}, "", "address to bind HTTP interface to (disabled if blank, absolute path indicates unix domain socket)")
|
mflag.StringVar(&httpAddr, []string{"-http-addr"}, "", "address to bind HTTP interface to (disabled if blank, absolute path indicates unix domain socket)")
|
||||||
mflag.StringVar(&statusAddr, []string{"-status-addr"}, "", "address to bind status+metrics interface to (disabled if blank, absolute path indicates unix domain socket)")
|
mflag.StringVar(&statusAddr, []string{"-status-addr"}, "", "address to bind status+metrics interface to (disabled if blank, absolute path indicates unix domain socket)")
|
||||||
|
mflag.StringVar(&metricsAddr, []string{"-metrics-addr"}, "", "address to bind metrics interface to (disabled if blank, absolute path indicates unix domain socket)")
|
||||||
mflag.StringVar(&ipamConfig.Mode, []string{"-ipalloc-init"}, "", "allocator initialisation strategy (consensus, seed or observer)")
|
mflag.StringVar(&ipamConfig.Mode, []string{"-ipalloc-init"}, "", "allocator initialisation strategy (consensus, seed or observer)")
|
||||||
mflag.StringVar(&ipamConfig.IPRangeCIDR, []string{"-ipalloc-range"}, "", "IP address range reserved for automatic allocation, in CIDR notation")
|
mflag.StringVar(&ipamConfig.IPRangeCIDR, []string{"-ipalloc-range"}, "", "IP address range reserved for automatic allocation, in CIDR notation")
|
||||||
mflag.StringVar(&ipamConfig.IPSubnetCIDR, []string{"-ipalloc-default-subnet"}, "", "subnet to allocate within by default, in CIDR notation")
|
mflag.StringVar(&ipamConfig.IPSubnetCIDR, []string{"-ipalloc-default-subnet"}, "", "subnet to allocate within by default, in CIDR notation")
|
||||||
@@ -474,10 +476,17 @@ func main() {
|
|||||||
muxRouter.Methods("GET").Path("/metrics").Handler(metricsHandler(router, allocator, ns, dnsserver))
|
muxRouter.Methods("GET").Path("/metrics").Handler(metricsHandler(router, allocator, ns, dnsserver))
|
||||||
statusMux := http.NewServeMux()
|
statusMux := http.NewServeMux()
|
||||||
statusMux.Handle("/", muxRouter)
|
statusMux.Handle("/", muxRouter)
|
||||||
Log.Println("Listening for metrics requests on", statusAddr)
|
Log.Println("Listening for status+metrics requests on", statusAddr)
|
||||||
go listenAndServeHTTP(statusAddr, statusMux)
|
go listenAndServeHTTP(statusAddr, statusMux)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if metricsAddr != "" {
|
||||||
|
metricsMux := http.NewServeMux()
|
||||||
|
metricsMux.Handle("/metrics", metricsHandler(router, allocator, ns, dnsserver))
|
||||||
|
Log.Println("Listening for metrics requests on", metricsAddr)
|
||||||
|
go listenAndServeHTTP(metricsAddr, metricsMux)
|
||||||
|
}
|
||||||
|
|
||||||
if plugin != nil {
|
if plugin != nil {
|
||||||
go plugin.Start(httpAddr, dockerCli, waitReady.Add())
|
go plugin.Start(httpAddr, dockerCli, waitReady.Add())
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-15
@@ -6,27 +6,28 @@ search_type: Documentation
|
|||||||
You only need to build Weave Net if you want to work on the Weave Net codebase
|
You only need to build Weave Net if you want to work on the Weave Net codebase
|
||||||
(or you just enjoy building software).
|
(or you just enjoy building software).
|
||||||
|
|
||||||
Apart from the `weave` shell script, weave is delivered as a set of
|
Apart from the `weave` shell script, Weave Net is delivered as a set of
|
||||||
container images. There is no distribution-specific packaging, so in
|
container images. There is no distribution-specific packaging, so in
|
||||||
principle it shouldn't matter which Linux distribution you build
|
principle it shouldn't matter which Linux distribution you build
|
||||||
under. But naturally, Docker is a prerequisite (version 1.6.0 or
|
under. But naturally, Docker is a prerequisite (version 1.6.0 or
|
||||||
later).
|
later).
|
||||||
|
|
||||||
The only way to build is by using the the build container; the
|
The only way to build is by using the the build container; the
|
||||||
Makefile is setup to make this transparent. This method is
|
`Makefile` is setup to make this transparent. This method is
|
||||||
documented below, and can be run directly on your machine or using
|
documented below, and can be run directly on your machine or using
|
||||||
a Vagrant VM.
|
a Vagrant VM.
|
||||||
|
|
||||||
## <a name="ubuntu"></a>Building directly on your machine
|
## <a name="ubuntu"></a>Building directly on your machine
|
||||||
|
|
||||||
The weave git repository should be cloned into
|
The weave git repository should be cloned into
|
||||||
`$GOPATH/src/github.com/weaveworks/weave`, in accordance with [the go
|
`$GOPATH/src/github.com/weaveworks/weave`, in accordance with [the Go
|
||||||
workspace conventions](https://golang.org/doc/code.html#Workspaces):
|
workspace conventions](https://golang.org/doc/code.html#Workspaces):
|
||||||
|
|
||||||
```
|
```
|
||||||
$ WEAVE=github.com/weaveworks/weave
|
$ WEAVE=github.com/weaveworks/weave
|
||||||
$ git clone https://$WEAVE $GOPATH/src/$WEAVE
|
$ git clone https://$WEAVE $GOPATH/src/$WEAVE
|
||||||
$ cd $GOPATH/src/$WEAVE
|
$ cd $GOPATH/src/$WEAVE
|
||||||
|
$ git submodule update --init
|
||||||
```
|
```
|
||||||
|
|
||||||
Next install Docker if you haven't already, by following the instructions
|
Next install Docker if you haven't already, by following the instructions
|
||||||
@@ -44,7 +45,7 @@ On a fresh repository, the Makefile will do the following:
|
|||||||
- build the weave components in the build container
|
- build the weave components in the build container
|
||||||
- package them into two Docker images (`weaveworks/weave`,
|
- package them into two Docker images (`weaveworks/weave`,
|
||||||
`weaveworks/weaveexec`)
|
`weaveworks/weaveexec`)
|
||||||
- Exported these images as `weave.tar.gz`
|
- export these images as `weave.tar.gz`.
|
||||||
|
|
||||||
The first two steps may take a while - don't worry, they are
|
The first two steps may take a while - don't worry, they are
|
||||||
are cached and should not need to be redone very often.
|
are cached and should not need to be redone very often.
|
||||||
@@ -63,18 +64,19 @@ First, check out the code:
|
|||||||
```
|
```
|
||||||
$ git clone https://github.com/weaveworks/weave
|
$ git clone https://github.com/weaveworks/weave
|
||||||
$ cd weave
|
$ cd weave
|
||||||
|
$ git submodule update --init
|
||||||
```
|
```
|
||||||
|
|
||||||
The `Vagrantfile` in the top directory constructs a VM that has
|
The `Vagrantfile` in the top directory constructs a VM that has:
|
||||||
|
|
||||||
* docker installed
|
* Docker installed
|
||||||
* go tools installed
|
* Go tools installed
|
||||||
* weave dependencies installed
|
* Weave's dependencies installed
|
||||||
* $GOPATH set to ~
|
* `$GOPATH` set to `~`
|
||||||
* the local working directory mapped as a synced folder into the
|
* the local working directory mapped as a synced folder into the
|
||||||
right place in $GOPATH
|
right place in `$GOPATH`.
|
||||||
|
|
||||||
Once you are in the working directory you can issue
|
Once you are in the working directory you can issue:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ vagrant up
|
$ vagrant up
|
||||||
@@ -86,7 +88,7 @@ installation is done just once). The working directory is sync'ed with
|
|||||||
use git and so on in the regular filesystem.
|
use git and so on in the regular filesystem.
|
||||||
|
|
||||||
To build and run the code, you need to use the VM. To log in and build
|
To build and run the code, you need to use the VM. To log in and build
|
||||||
the weave image, do
|
the weave image, do:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ vagrant ssh
|
$ vagrant ssh
|
||||||
@@ -94,7 +96,7 @@ vm$ cd src/github.com/weaveworks/weave
|
|||||||
vm$ make
|
vm$ make
|
||||||
```
|
```
|
||||||
|
|
||||||
The Docker daemon is also running in this VM, so you can then do
|
The Docker daemon is also running in this VM, so you can then do:
|
||||||
|
|
||||||
```
|
```
|
||||||
vm$ sudo ./weave launch
|
vm$ sudo ./weave launch
|
||||||
@@ -104,7 +106,7 @@ vm$ sudo docker ps
|
|||||||
and so on.
|
and so on.
|
||||||
|
|
||||||
If you are looking to just do a build and not run anything on this VM,
|
If you are looking to just do a build and not run anything on this VM,
|
||||||
you can do so with
|
you can do so with:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ vagrant ssh -c 'make -C src/github.com/weaveworks/weave'
|
$ vagrant ssh -c 'make -C src/github.com/weaveworks/weave'
|
||||||
@@ -112,7 +114,7 @@ $ vagrant ssh -c 'make -C src/github.com/weaveworks/weave'
|
|||||||
|
|
||||||
you should then find a `weave.tar.gz` container snapshot tarball in the
|
you should then find a `weave.tar.gz` container snapshot tarball in the
|
||||||
top-level directory. You can use that snapshot with `docker load`
|
top-level directory. You can use that snapshot with `docker load`
|
||||||
against a different host, e.g.
|
against a different host, e.g.:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ export DOCKER_HOST=tcp://<HOST:PORT>
|
$ export DOCKER_HOST=tcp://<HOST:PORT>
|
||||||
|
|||||||
+12
@@ -40,6 +40,18 @@ A simple way to accomplish this would be to run Weave on the host and then run,
|
|||||||
Yet another option is to expose a port from the container on host B and then connect to it. You can read about exposing ports in [Exporting Services](/site/tasks/manage/service-management.md#exporting).
|
Yet another option is to expose a port from the container on host B and then connect to it. You can read about exposing ports in [Exporting Services](/site/tasks/manage/service-management.md#exporting).
|
||||||
|
|
||||||
|
|
||||||
|
<a name="duplicate-peer"></a>
|
||||||
|
**Q: Why am I seeing "peer names collision" and failed connections?**
|
||||||
|
|
||||||
|
This sometimes happens when machines are cloned; we require each
|
||||||
|
machine in your cluster to have a unique identity.
|
||||||
|
|
||||||
|
For more information see [Peer Names](/site/operational-guide/concepts.md#peer-name).
|
||||||
|
|
||||||
|
Depending on your Linux distribution you may need to [set up
|
||||||
|
machine-id](https://www.freedesktop.org/software/systemd/man/machine-id.html)
|
||||||
|
or [generate a dbus id](https://dbus.freedesktop.org/doc/dbus-uuidgen.1.html).
|
||||||
|
|
||||||
<a name="duplicate-ip"></a>
|
<a name="duplicate-ip"></a>
|
||||||
**Q: Why am I seeing the same IP address assigned to two different containers on different hosts?**
|
**Q: Why am I seeing the same IP address assigned to two different containers on different hosts?**
|
||||||
|
|
||||||
|
|||||||
@@ -311,11 +311,11 @@ UDP connection from 10.32.0.7:56648 to 10.32.0.11:80 blocked by Weave NPC.
|
|||||||
You can customise the YAML you get from `cloud.weave.works` by passing some of Weave Net's options, arguments and environment variables as query parameters:
|
You can customise the YAML you get from `cloud.weave.works` by passing some of Weave Net's options, arguments and environment variables as query parameters:
|
||||||
|
|
||||||
- `version`: Weave Net's version. Default: `latest`, i.e. latest release. *N.B.*: This only changes the specified version inside the generated YAML file, it does not ensure that the rest of the YAML is compatible with that version. To freeze the YAML version save a copy of the YAML file from the [release page](https://github.com/weaveworks/weave/releases) and use that copy instead of downloading it each time from `cloud.weave.works`.
|
- `version`: Weave Net's version. Default: `latest`, i.e. latest release. *N.B.*: This only changes the specified version inside the generated YAML file, it does not ensure that the rest of the YAML is compatible with that version. To freeze the YAML version save a copy of the YAML file from the [release page](https://github.com/weaveworks/weave/releases) and use that copy instead of downloading it each time from `cloud.weave.works`.
|
||||||
- `password-secret`: name of the Kubernetes secret containing your password.
|
- `password-secret`: name of the Kubernetes secret containing your password. *N.B*: The Kubernetes secret name must correspond to a name of a file containing your password.
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
$ echo "s3cr3tp4ssw0rd" > /var/lib/weave/weave-passwd.txt
|
$ echo "s3cr3tp4ssw0rd" > /var/lib/weave/weave-passwd
|
||||||
$ kubectl create secret -n kube-system generic weave-passwd --from-file=/var/lib/weave/weave-passwd.txt
|
$ kubectl create secret -n kube-system generic weave-passwd --from-file=/var/lib/weave/weave-passwd
|
||||||
$ kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')&password-secret=weave-passwd"
|
$ kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')&password-secret=weave-passwd"
|
||||||
|
|
||||||
- `known-peers`: comma-separated list of hosts. Default: empty.
|
- `known-peers`: comma-separated list of hosts. Default: empty.
|
||||||
@@ -346,6 +346,10 @@ The list of variables you can set is:
|
|||||||
* `WEAVE_EXPOSE_IP` - set the IP address used as a gateway from the
|
* `WEAVE_EXPOSE_IP` - set the IP address used as a gateway from the
|
||||||
Weave network to the host network - this is useful if you are
|
Weave network to the host network - this is useful if you are
|
||||||
configuring the addon as a static pod.
|
configuring the addon as a static pod.
|
||||||
|
* `WEAVE_METRICS_ADDR` - address and port that the Weave Net
|
||||||
|
daemon will serve Prometheus-style metrics on (defaults to 0.0.0.0:6782)
|
||||||
|
* `WEAVE_STATUS_ADDR` - address and port that the Weave Net
|
||||||
|
daemon will serve status requests on (defaults to disabled)
|
||||||
* `WEAVE_MTU` - Weave Net defaults to 1376 bytes, but you can set a
|
* `WEAVE_MTU` - Weave Net defaults to 1376 bytes, but you can set a
|
||||||
smaller size if your underlying network has a tighter limit, or set
|
smaller size if your underlying network has a tighter limit, or set
|
||||||
a larger size for better performance if your network supports jumbo
|
a larger size for better performance if your network supports jumbo
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ controller](/site/kubernetes/kube-addon.md#npc).
|
|||||||
|
|
||||||
### Router Metrics
|
### Router Metrics
|
||||||
|
|
||||||
The endpoint address is `localhost:6782`; the following metrics are
|
|
||||||
exposed:
|
|
||||||
|
|
||||||
* `weave_connections` - Number of peer-to-peer connections.
|
* `weave_connections` - Number of peer-to-peer connections.
|
||||||
* `weave_connection_terminations_total` - Number of peer-to-peer
|
* `weave_connection_terminations_total` - Number of peer-to-peer
|
||||||
connections terminated.
|
connections terminated.
|
||||||
@@ -25,27 +22,35 @@ exposed:
|
|||||||
* `weave_ipam_pending_allocates` - Number of pending allocates.
|
* `weave_ipam_pending_allocates` - Number of pending allocates.
|
||||||
* `weave_ipam_pending_claims` - Number of pending claims.
|
* `weave_ipam_pending_claims` - Number of pending claims.
|
||||||
|
|
||||||
#### Publish Router Metrics Endpoint
|
|
||||||
|
|
||||||
By default, when started via `weave launch`, weave listens on its local
|
|
||||||
interface to serve metrics. To publish your metrics throughout your cluster,
|
|
||||||
e.g. if your prometheus server is installed on a different host machine,
|
|
||||||
you need to set `WEAVE_STATUS_ADDR` to your corresponding IP and port.
|
|
||||||
Default port is 6782.
|
|
||||||
|
|
||||||
`WEAVE_STATUS_ADDR=X.X.X.X:PORT`
|
|
||||||
|
|
||||||
You can set `WEAVE_STATUS_ADDR=0.0.0.0:6782` to listen on all interfaces,
|
|
||||||
but be aware, this may expose your metrics to the public internet.
|
|
||||||
|
|
||||||
### Kubernetes Network Policy Controller Metrics
|
### Kubernetes Network Policy Controller Metrics
|
||||||
|
|
||||||
The endpoint address is `localhost:6781`; the following metric is
|
The following metric is
|
||||||
exposed:
|
exposed:
|
||||||
|
|
||||||
* `weavenpc_blocked_connections_total` - Connection attempts blocked
|
* `weavenpc_blocked_connections_total` - Connection attempts blocked
|
||||||
by policy controller.
|
by policy controller.
|
||||||
|
|
||||||
|
### Metrics Endpoint Addresses
|
||||||
|
|
||||||
|
When installed as a Kubernetes Addon, the router listens for metrics
|
||||||
|
requests on 0.0.0.0:6782 and the Network Policy Controller listens on
|
||||||
|
0.0.0.0:6781. No other requests are served on these endpoints.
|
||||||
|
|
||||||
|
>Note: If your Kubernetes hosts are exposed to the public internet
|
||||||
|
then these metrics endpoints will also be exposed.
|
||||||
|
|
||||||
|
When started via `weave launch`, by default weave listens on its local
|
||||||
|
interface to serve metrics and other read-only status requests. To
|
||||||
|
publish your metrics throughout your cluster, you can set
|
||||||
|
`WEAVE_STATUS_ADDR`:
|
||||||
|
|
||||||
|
`WEAVE_STATUS_ADDR=X.X.X.X:PORT`
|
||||||
|
|
||||||
|
Set it to an empty string to disable.
|
||||||
|
|
||||||
|
You can also pass the parameter `--metrics-addr=X.X.X.X:PORT` to
|
||||||
|
`weave launch` to specify an address to listen for metrics only.
|
||||||
|
|
||||||
# Static Configuration for Weave Net
|
# Static Configuration for Weave Net
|
||||||
|
|
||||||
The following YAML fragment can be used in your Prometheus configuration to
|
The following YAML fragment can be used in your Prometheus configuration to
|
||||||
|
|||||||
@@ -34,11 +34,10 @@ docker_on $HOST1 run --rm --privileged --net=host --entrypoint=/usr/sbin/ipset w
|
|||||||
|
|
||||||
# kubeadm init upgrades to latest Kubernetes version by default, therefore we try to lock the version using the below option:
|
# kubeadm init upgrades to latest Kubernetes version by default, therefore we try to lock the version using the below option:
|
||||||
k8s_version="$(run_on $HOST1 "kubelet --version" | grep -oP "(?<=Kubernetes )v[\d\.\-beta]+")"
|
k8s_version="$(run_on $HOST1 "kubelet --version" | grep -oP "(?<=Kubernetes )v[\d\.\-beta]+")"
|
||||||
k8s_version_option="$([[ "$k8s_version" > "v1.6" ]] && echo "kubernetes-version" || echo "use-kubernetes-version")"
|
|
||||||
|
|
||||||
for host in $HOSTS; do
|
for host in $HOSTS; do
|
||||||
if [ $host = $HOST1 ] ; then
|
if [ $host = $HOST1 ] ; then
|
||||||
run_on $host "sudo systemctl start kubelet && sudo kubeadm init --$k8s_version_option=$k8s_version --token=$TOKEN --pod-network-cidr=$WEAVE_NETWORK"
|
run_on $host "sudo systemctl start kubelet && sudo kubeadm init --kubernetes-version=$k8s_version --token=$TOKEN --pod-network-cidr=$WEAVE_NETWORK"
|
||||||
else
|
else
|
||||||
run_on $host "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN --discovery-token-unsafe-skip-ca-verification $HOST1IP:$KUBE_PORT"
|
run_on $host "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN --discovery-token-unsafe-skip-ca-verification $HOST1IP:$KUBE_PORT"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -38,11 +38,10 @@ function setup_kubernetes_cluster {
|
|||||||
|
|
||||||
# kubeadm init upgrades to latest Kubernetes version by default, therefore we try to lock the version using the below option:
|
# kubeadm init upgrades to latest Kubernetes version by default, therefore we try to lock the version using the below option:
|
||||||
k8s_version="$(run_on $HOST1 "kubelet --version" | grep -oP "(?<=Kubernetes )v[\d\.\-beta]+")"
|
k8s_version="$(run_on $HOST1 "kubelet --version" | grep -oP "(?<=Kubernetes )v[\d\.\-beta]+")"
|
||||||
k8s_version_option="$([[ "$k8s_version" > "v1.6" ]] && echo "kubernetes-version" || echo "use-kubernetes-version")"
|
|
||||||
|
|
||||||
for host in $HOSTS; do
|
for host in $HOSTS; do
|
||||||
if [ $host = $HOST1 ] ; then
|
if [ $host = $HOST1 ] ; then
|
||||||
run_on $host "sudo systemctl start kubelet && sudo kubeadm init --$k8s_version_option=$k8s_version --token=$TOKEN"
|
run_on $host "sudo systemctl start kubelet && sudo kubeadm init --kubernetes-version=$k8s_version --token=$TOKEN"
|
||||||
else
|
else
|
||||||
run_on $host "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN --discovery-token-unsafe-skip-ca-verification $HOST1IP:$KUBE_PORT"
|
run_on $host "sudo systemctl start kubelet && sudo kubeadm join --token=$TOKEN --discovery-token-unsafe-skip-ca-verification $HOST1IP:$KUBE_PORT"
|
||||||
fi
|
fi
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ def ansibleize(h)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_go_version_from_build_dockerfile()
|
def get_go_version_from_build_dockerfile()
|
||||||
go_regexp = /FROM golang:(\S*).*?/
|
go_regexp = /FROM golang:([\d\.]*).*?/
|
||||||
dockerfile_path = File.expand_path(File.join(File.dirname(__FILE__), 'build', 'Dockerfile'))
|
dockerfile_path = File.expand_path(File.join(File.dirname(__FILE__), 'build', 'Dockerfile'))
|
||||||
go_version = File.readlines(dockerfile_path).select { |line| line.match(go_regexp) }.first.match(go_regexp).captures.first
|
go_version = File.readlines(dockerfile_path).select { |line| line.match(go_regexp) }.first.match(go_regexp).captures.first
|
||||||
if go_version.nil?
|
if go_version.nil?
|
||||||
|
|||||||
Reference in new issue
Block a user