Commit Graph

351 Commits

Author SHA1 Message Date
Dan Williams
5633d7423a kubelet: add network plugin manager with per-pod operation locking
The PluginManager almost duplicates the network plugin interface, but
not quite since the Init() function should be called by whatever
actually finds and creates the network plugin instance.  Only then
does it get passed off to the PluginManager.

The Manager synchronizes pod-specific network operations like setup,
teardown, and pod network status.  It passes through all other
operations so that runtimes don't have to cache the network plugin
directly, but can use the PluginManager as a wrapper.
2017-02-16 13:48:32 -06:00
Minhan Xia
be9eca6b51 teach kubenet to use hostport_manager 2017-02-08 09:35:04 -08:00
Minhan Xia
bd05e1af2b add portmapping getter into network host 2017-02-08 09:35:04 -08:00
Minhan Xia
8e7219cbb4 add hostport manager 2017-02-08 09:26:52 -08:00
Minhan Xia
aabdaa984f refactor hostport logic 2017-02-08 09:26:52 -08:00
Kubernetes Submit Queue
1b7bdde40b Merge pull request #38796 from chentao1596/kubelet-cni-log
Automatic merge from submit-queue (batch tested with PRs 38796, 40823, 40756, 41083, 41105)

kubelet/network-cni-plugin: modify the log's info

**What this PR does / why we need it**:

  Checking the startup logs of kubelet, i can always find a error like this:
    "E1215 10:19:24.891724    2752 cni.go:163] error updating cni config: No networks found in /etc/cni/net.d"
 
 It will appears, neither i use cni network-plugin or not. 
After analysis codes, i thought it should be a warn log, because it will not produce any actions like as exit or abort, and just ignored when not any valid plugins exit.

 thank you!
2017-02-08 00:49:44 -08:00
Minhan Xia
51526d3103 Add checkpointHandler to DockerService 2017-02-02 10:19:34 -08:00
Kubernetes Submit Queue
32d79c3461 Merge pull request #39443 from freehan/cri-hostport
Automatic merge from submit-queue (batch tested with PRs 40111, 40368, 40342, 40274, 39443)

refactor hostport logic

Refactor hostport logic to avoid using api.Pod object directly.
2017-01-31 19:18:44 -08:00
Minhan Xia
548a6122c5 rename HostportHandler to HostportSyncer 2017-01-30 16:30:06 -08:00
PI-Victor
388144f769
fix a typo in cni log 2017-01-26 21:27:38 +01:00
Minhan Xia
8e318b8d9b refactor hostport logic 2017-01-25 14:52:33 -08:00
deads2k
5a8f075197 move authoritative client-go utils out of pkg 2017-01-24 08:59:18 -05:00
Clayton Coleman
469df12038
refactor: move ListOptions references to metav1 2017-01-23 17:52:46 -05:00
deads2k
ee6752ef20 find and replace 2017-01-20 08:04:53 -05:00
Clayton Coleman
9a2a50cda7
refactor: use metav1.ObjectMeta in other types 2017-01-17 16:17:19 -05:00
NickrenREN
a12dea14e0 fix redundant alias clientset 2017-01-12 10:21:05 +08:00
deads2k
6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Jeff Grafton
20d221f75c Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
Kubernetes Submit Queue
d97f125ddf Merge pull request #39050 from mikedanese/gazel-bump
Automatic merge from submit-queue

bump gazel: pick up some new unit tests
2016-12-29 15:19:18 -08:00
Mike Danese
161c391f44 autogenerated 2016-12-29 13:04:10 -08:00
Pengfei Ni
25dee7dd83 kubenet: define KubenetPluginName for all platforms 2016-12-29 15:39:16 +08:00
Kubernetes Submit Queue
281053d666 Merge pull request #38155 from freehan/cleanup-txqueue
Automatic merge from submit-queue (batch tested with PRs 39218, 38155)

clean up logic that configs TX queue length

fix: #25143
2016-12-28 16:10:03 -08:00
Minhan Xia
ff6cdeb9b8 clean up logic that configs TX queue length 2016-12-27 14:43:47 -08:00
Minhan Xia
5e39b3d9c3 clean up exec network plugin 2016-12-27 14:04:57 -08:00
chentao1596
a359287a1b change log to warn 2016-12-16 15:02:30 +08:00
Chao Xu
03d8820edc rename /release_1_5 to /clientset 2016-12-14 12:39:48 -08:00
Mike Danese
c87de85347 autoupdate BUILD files 2016-12-12 13:30:07 -08:00
Bryan Boreham
0cfd09e161 Abandon setting hairpin mode if finding the peer interface fails
Instead of setting it on every bridge-connected interface which may
have unwanted effects on unrelated things installed on the machine.
2016-12-06 14:33:43 +00:00
Cao Shufeng
ab43e2b809 [hairpin] fix argument of nsenter
We should use:
	nsenter --net=netnsPath -- -F some_command
instend of:
	nsenter -n netnsPath -- -F some_command
Because "nsenter -n netnsPath" get an error output:
	# nsenter -n /proc/67197/ns/net ip addr
	nsenter: neither filename nor target pid supplied for ns/net

If we really want use -n, we need to use -n in such format:
	# sudo nsenter -n/proc/67197/ns/net ip addr
2016-12-05 07:40:29 -05:00
Clayton Coleman
3454a8d52c
refactor: update bazel, codec, and gofmt 2016-12-03 19:10:53 -05:00
Clayton Coleman
5df8cc39c9
refactor: generated 2016-12-03 19:10:46 -05:00
Cao Shufeng
04bc58b6e5 Keep host port socket open for kubenet
When cni is set to kubenet, kubelet should hold the host port socket,
so that other application in this node could not listen/bind this port
any more. However, the sockets are closed accidentally, because
kubelet forget to reconcile the protocol format before comparing.
2016-11-24 04:19:03 -05:00
Chao Xu
bcc783c594 run hack/update-all.sh 2016-11-23 15:53:09 -08:00
Chao Xu
5e1adf91df cmd/kubelet 2016-11-23 15:53:09 -08:00
bprashanth
11638e9ee1 Unittests 2016-10-31 13:05:20 -07:00
bprashanth
aee5b8099c Skip legacy features (hostport, bwshaping) 2016-10-31 13:05:19 -07:00
bprashanth
48db726342 Split network.Host into LegacyHost and NamespaceGetter 2016-10-31 13:05:19 -07:00
bprashanth
37bc34c567 periodically GC pod ips 2016-10-27 22:15:35 -07:00
Mike Danese
3b6a067afc autogenerated 2016-10-21 17:32:32 -07:00
Kubernetes Submit Queue
3f8b03aafd Merge pull request #32349 from lojies/execerrnil
Automatic merge from submit-queue

when err is nil,remove it from glog

err can be nil here.
2016-10-15 09:31:45 -07:00
Dan Williams
e2c96db72b kubenet: make it more apparent that kubenet ignores PodCIDR updates
https://github.com/kubernetes/kubernetes/issues/32900
2016-10-05 11:24:02 -05:00
Kubernetes Submit Queue
9c5bf904c2 Merge pull request #32217 from freehan/kubenetcheck
Automatic merge from submit-queue

nit fixes

Do not merge yet. Wait till it gets bigger. 

fix included:
1. use golang native util to list dir
2016-09-24 03:28:28 -07:00
Yifan Gu
5389a74388 kubenet: SyncHostports for both running and ready to run pods.
This fixes the race that happens in rktnetes when pod B invokes
'kubenet.SetUpPod()' before another pod A becomes actually running.

The second 'kubenet.SetUpPod()' call will not pick up the pod A
and thus overwrite the host port iptable rules that breaks pod A.

This PR fixes the case by listing all 'active pods' (all non-exited
pods) instead of only running pods.
2016-09-16 17:29:44 -07:00
Kubernetes Submit Queue
c4893df894 Merge pull request #32151 from bboreham/fix-cni-on-gci
Automatic merge from submit-queue

Add flag to set CNI bin dir, and use it on gci nodes

**What this PR does / why we need it**:

When using `kube-up` on GCE, following #31023 which moved the workers from debian to gci, CNI just isn't working.  The root cause is basically as discussed in #28563: one flag (`--network-plugin-dir`) means two different things, and the `configure-helper` script uses it for the wrong purpose.

This PR adds a new flag `--cni-bin-dir`, then uses it to configure CNI as desired.

As discussed at #28563, I have also added a flag `--cni-conf-dir` so users can be explicit 

**Which issue this PR fixes** : fixes #28563

**Special notes for your reviewer**:

I left the old flag largely alone for backwards-compatibility, with the exception that I stop setting the default when CNI is in use.  The value of `"/usr/libexec/kubernetes/kubelet-plugins/net/exec/"` is unlikely to be what is wanted there.

**Release note**:
```release-note
Added new kubelet flags `--cni-bin-dir` and `--cni-conf-dir` to specify where CNI files are located.
Fixed CNI configuration on GCI platform when using CNI.
```
2016-09-13 16:42:06 -07:00
Bryan Boreham
db5fa5297d Fix unit tests and known flags list 2016-09-13 20:42:52 +00:00
Kubernetes Submit Queue
6538912013 Merge pull request #31322 from feiskyer/killpod
Automatic merge from submit-queue

Kubelet: add KillPod for new runtime API

This PR adds implements of KillPod for new runtime API.

CC @yujuhong @Random-Liu @kubernetes/sig-node @kubernetes/sig-rktnetes
2016-09-10 03:10:32 -07:00
Minhan Xia
118ebd57aa fix a bug in hostport where it flushes KUBE-MARK-MASQ chain 2016-09-09 14:39:47 -07:00
Bryan Boreham
a2e583a86c Move default directory for exec plugin into exec plugin 2016-09-09 11:43:16 +01:00
Bryan Boreham
4e961e2bf5 Add options to set CNI config and binary directories
Also make clearer the function of --network-plugin-dir when using CNI
2016-09-09 11:43:16 +01:00
lojies
e687f58dbc when err is nil,remove err from glog 2016-09-09 10:50:49 +08:00
Pengfei Ni
277070e267 Kubelet: add KillPod for new runtime API 2016-09-08 20:56:50 +08:00
Minhan Xia
8031c8d97b use golang native util to list dir 2016-09-07 10:42:27 -07:00
Kubernetes Submit Queue
2a7d0df30d Merge pull request #30727 from asalkeld/iptables-caps
Automatic merge from submit-queue

Clean up IPTables caps i.e.: sed -i "s/Iptables/IPTables/g"

Fixes #30651
2016-09-06 09:01:27 -07:00
Kubernetes Submit Queue
1e21eda604 Merge pull request #31197 from freehan/kubenethairpin
Automatic merge from submit-queue

Deprecate the old cbr0 and flannel networking modes

fixes: #19766
2016-09-02 18:51:05 -07:00
Minhan Xia
fd4c947de9 correct typo in kubenet config 2016-09-02 14:33:34 -07:00
Minhan Xia
20ed879faa kubenet checks required cni plugins are present 2016-09-01 17:16:05 -07:00
Angus Salkeld
f785f3d3ef Clean up IPTables caps i.e.: sed -i "s/Iptables/IPTables/g" 2016-08-29 10:34:42 +10:00
Kubernetes Submit Queue
d3ecad111e Merge pull request #28717 from freehan/ebtable
Automatic merge from submit-queue

Filter duplicate network packets in promiscuous bridge mode (with ebtables)

also fixes: #30783
2016-08-25 19:12:09 -07:00
Minhan Xia
c1d3c89cfa fix #30376 that broken cross-build 2016-08-24 13:18:18 -07:00
Minhan Xia
42a554ec0d add ebtables rules to filter duplicate packets 2016-08-24 10:19:29 -07:00
Minhan Xia
950e689637 kubenet set cbr0 mac address 2016-08-24 10:18:48 -07:00
Justin Santa Barbara
902ba4e249 Add network-plugin-mtu option for MTU selection
MTU selection is difficult, and if there is a transport such as IPSEC in
use may be impossible.  So we allow specification of the MTU with the
network-plugin-mtu flag, and we pass this down into the network
provider.

Currently implemented by kubenet.
2016-08-23 01:50:58 -04:00
Justin Santa Barbara
2c103af2b6 Create testable implementation of sysctl
This is so we can test kubenet Init, which calls sysctl
2016-08-23 01:42:37 -04:00
Wojciech Tyczynski
0459574450 Revert "Use netlink.SetPromiscOn instead of iproute2 command" 2016-08-22 10:28:11 +02:00
Kubernetes Submit Queue
ada5669c7f Merge pull request #30346 from dshulyak/promisc
Automatic merge from submit-queue

Use netlink.SetPromiscOn instead of iproute2 command

Depends on https://github.com/vishvananda/netlink/pull/157
Related https://github.com/kubernetes/kubernetes/issues/26093
2016-08-21 23:34:21 -07:00
Minhan Xia
85b2f9047a update godep to pull from containernetworking/cni 2016-08-19 13:31:50 -07:00
Dmitry Shulyak
b79a12c7ce Use netlink.SetPromiscOn instead of iproute2 command 2016-08-14 14:58:14 +03:00
Minhan Xia
7964148059 move syncNetworkConfig to Init for cni network plugin 2016-08-12 16:49:25 -07:00
k8s-merge-robot
63602348a4 Merge pull request #29009 from bboreham/hairpin-via-cni
Automatic merge from submit-queue

Use the CNI bridge plugin to set hairpin mode

Following up this part of #23711:

>  I'd like to wait until containernetworking/cni#175 lands and then just pass the request through to CNI.

The code here just
 * passes the required setting down from kubenet to CNI
 * disables `DockerManager` from doing hairpin-veth, if kubenet is in use

Note to test you need a very recent version of the CNI `bridge` plugin; the one brought in by #28799 should be OK.

Also relates to https://github.com/kubernetes/kubernetes/issues/19766#issuecomment-232722864
2016-07-31 10:08:06 -07:00
Mike Danese
792868c743 periodically reload the cni plugin config
Signed-off-by: Mike Danese <mikedanese@google.com>
2016-07-27 10:07:52 -07:00
Euan Kemp
6aed2a0b1d network/cni: Search vendorDir for lo plugin too
Though frankly the vendor dir thing should probably be removed in a
followup PR.
2016-07-22 14:40:44 -07:00
Euan Kemp
8f7b5bcfd3 network/cni: Always setup 'lo'
See issue #28561
2016-07-22 14:40:35 -07:00
Bryan Boreham
26a53fcd47 Use the CNI bridge plugin to set hairpin mode
Pass the flag down in kubenet, and disable it in DockerManager
2016-07-14 17:52:51 +01:00
David McMahon
ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
k8s-merge-robot
8ed6c8eeb8 Merge pull request #27914 from yifan-gu/fix_kubenet_hostport
Automatic merge from submit-queue

kubenet: Fix host port for rktnetes.

Because rkt pod runs after plugin.SetUpPod() is called, so
getRunningPods() does not return the newly created pod, which
causes the hostport iptable rules to be missing for this new pod.

cc @dcbw @freehan 

A follow up fix for https://github.com/kubernetes/kubernetes/pull/27878#issuecomment-227898936
2016-06-23 18:48:45 -07:00
Yifan Gu
9140ce07bc kubenet: Fix host port for rktnetes.
Because rkt pod runs after plugin.SetUpPod() is called, so
getRunningPods() does not return the newly created pod, which
causes the hostport iptable rules to be missing for this new pod.
2016-06-23 13:17:01 -07:00
Minhan Xia
48169ce736 avoid deleting cbr0 address due to subnet string mismatch 2016-06-22 16:45:04 -07:00
Dan Williams
e47d020cb6 kubelet/kubenet: simplify getting nsenter path 2016-06-22 14:26:11 -05:00
Dan Williams
a657d0587b kubelet/kubenet: Fix getRunningPods() to support rkt pods
Don't assume there's an infra container.
2016-06-22 13:45:13 -05:00
Dan Williams
db078dbea4 kubelet/cni/kubenet: use common container IP address functions 2016-06-22 11:36:10 -05:00
Dan Williams
9865ac325c kubelet/cni: make cni plugin runtime agnostic
Use the generic runtime method to get the netns path.  Also
move reading the container IP address into cni (based off kubenet)
instead of having it in the Docker manager code.  Both old and new
methods use nsenter and /sbin/ip and should be functionally
equivalent.
2016-06-22 11:36:10 -05:00
Dan Williams
a519e8a403 kubenet: clean up networking when setup errors occur
Relying on the runtime to later call cleanup is fragile, so make sure
that everything gets nicely cleaned up when setup errors occur.
2016-06-16 13:53:28 -05:00
Dan Williams
965492fdd0 kubelet/kubenet: split hostport handling into separate module 2016-06-16 13:44:32 -05:00
k8s-merge-robot
64da66bab4 Merge pull request #24983 from Arvinderpal/cni_args_ignoreunknown
Automatic merge from submit-queue

Sets IgnoreUnknown=1 in CNI_ARGS

```release-note
release-note-none
```

K8 uses CNI_ARGS to pass pod namespace, name and infra container
id to the CNI network plugin. CNI logic will throw an error
if these args are not known to it, unless the user specifies
IgnoreUnknown as part of CNI_ARGS. This PR sets IgnoreUnknown=1
to prevent the CNI logic from erroring and blocking pod setup.
https://github.com/appc/cni/pull/158
https://github.com/appc/cni/issues/126
2016-06-11 05:38:30 -07:00
k8s-merge-robot
805a0aae71 Merge pull request #27141 from freehan/hpfix
Automatic merge from submit-queue

only handled non host network pods for hostports in kubenet

attempt to fix: #27118
2016-06-09 22:08:10 -07:00
Minhan Xia
1276a91638 kubenet masqurade for outbound traffic 2016-06-09 18:43:34 -07:00
Minhan Xia
1b2386f1ce only handled non host network pods for hostports in kubenet 2016-06-09 11:32:16 -07:00
Minhan Xia
e9f8c70eaf pass NetworkPluginDir to kubenet 2016-06-03 10:22:49 -07:00
k8s-merge-robot
98af443209 Merge pull request #26398 from euank/various-kubenet-fixes
Automatic merge from submit-queue

Various kubenet fixes (panics and bugs and cidrs, oh my)

This PR fixes the following issues:

1. Corrects an inverse error-check that prevented `shaper.Reset` from ever being called with a correct ip address
2. Fix an issue where `parseCIDR` would fail after a kubelet restart due to an IP being stored instead of a CIDR being stored in the cache.
3. Fix an issue where kubenet could panic in TearDownPod if it was called before SetUpPod (e.g. after a kubelet restart).. because of bug number 1, this didn't happen except in rare situations (see 2 for why such a rare situation might happen)

This adds a test, but more would definitely be useful.
The commits are also granular enough I could split this up more if desired.

I'm also not super-familiar with this code, so review and feedback would be welcome.

Testing done:
```
$ cat examples/egress/egress.yml
 apiVersion: v1
kind: Pod
metadata:
  labels:
    name: egress
  name: egress-output
  annotations: {"kubernetes.io/ingress-bandwidth": "300k"}
spec:
  restartPolicy: Never
  containers:
    - name: egress
      image: busybox
      command: ["sh", "-c", "sleep 60"]
$ cat kubelet.log
...
Running: tc filter add dev cbr0 protocol ip parent 1:0 prio 1 u32 match ip dst 10.0.0.5/32 flowid 1:1
# setup
...
Running: tc filter del dev cbr0 parent 1:proto ip prio 1 handle 800::800 u32
# teardown
```

I also did various other bits of manual testing and logging to hunt down the panic and other issues, but don't have anything to paste for that 

cc @dcbw @kubernetes/sig-network
2016-05-29 04:04:22 -07:00
k8s-merge-robot
350efaf13d Merge pull request #26096 from euank/set-pod-ip
Automatic merge from submit-queue

rkt: Pass through podIP

This is needed for the /etc/hosts mount and the downward API to work.
Furthermore, this is required for the reported `PodStatus` to be
correct.

The `Status` bit mostly worked prior to #25062, and this restores that
functionality in addition to the new functionality.

In retrospect, the regression in status is large enough the prior PR should have included at least some of this; my bad for not realizing the full implications there.

#25902 is needed for downwards api stuff, but either merge order is fine as neither will break badly by itself.

cc @yifan-gu @dcbw
2016-05-28 12:40:39 -07:00
Euan Kemp
c83ad19ae9 kubenet: Fix ipv4 validity check
The length of an IP can be 4 or 16, and even if 16 it can be a valid
ipv4 address. This check is the more-correct way to handle this, and it
also provides more granular error messages.
2016-05-27 16:25:14 -07:00
Euan Kemp
93487867ac kubenet: Update empty ip check
The previous check was incorrect because the `IP.String` method returns
`<nil>` and other non-empty-strings on error conditions.
2016-05-27 10:47:13 -07:00
Euan Kemp
c4b8959a75 kubenet: Reduce loglevel of spammy message
When no shaping is enabled, that warning would always be printed.
2016-05-27 10:47:12 -07:00
Euan Kemp
7e0b9bfa66 kubenet: Fix panic when teardown run before setup
Teardown can run before Setup when the kubelet is restarted... in that
case, the shaper was nil and thus calling the shaper resulted in a panic

This fixes that by ensuring the shaper is always set... +1 level of
indirection and all that.
2016-05-27 10:47:12 -07:00
Euan Kemp
2f5e738dc1 kubenet: Fix inconsistent cidr usage/parsing
Before this change, the podCIDRs map contained both cidrs and ips
depending on which code path entered a container into it.

Specifically, SetUpPod would enter a CIDR while GetPodNetworkStatus
would enter an IP.

This normalizes both of them to always enter just IP addresses.

This also removes the now-redundant cidr parsing that was used to get
the ip before
2016-05-27 10:47:12 -07:00
Euan Kemp
766eb6f0f7 kubenet: Fix bug where shaper.Reset wasn't called
The error check was inverse what it should have been, causing
shaper.Reset to only get called with invalid cidrs.
2016-05-27 10:20:43 -07:00
Alex Robinson
07d9dff83c Merge pull request #26208 from freehan/kubenetteardownfix
do not return error if TearDownPod is called twice
2016-05-27 09:59:03 -07:00
Minhan Xia
0834dc489a do not return error if TearDownPod is called twice 2016-05-26 11:57:22 -07:00
Euan Kemp
be0ccab5c5 networkplugins: Add mock network plugin 2016-05-25 10:07:54 -07:00
Minhan Xia
6a3ad1d66d add hostport support for kubenet 2016-05-22 22:18:58 -07:00
Dan Williams
552b648caf kubenet: implement fake execer for testcases
When the IP isn't in the internal map, GetPodNetworkStatus() needs
to call the execer for the 'nsenter' program.  That  means the execer
needs to be !nil, which it wasn't before.
2016-05-18 11:28:05 -05:00
Dan Williams
3dbbe26316 kubenet: fix log message text 2016-05-18 11:28:05 -05:00
Dan Williams
5de7b561e3 kubenet: ensure loopback interface is up and consolidate CNI setup 2016-05-18 11:28:05 -05:00
Dan Williams
9b85d20c73 kubelet/runtime: add method to return pod network namespace path
Some runtimes (eg, Hypernetes) don't create network namespaces for pods,
so network plugins must correctly handle any error returned from the
runtime.
2016-05-18 09:26:01 -05:00
Dan Williams
55e6eb2ce3 Allow using netns path instead of container PID to change hairpin mode 2016-05-18 09:25:42 -05:00
Tim Hockin
66d0d87829 Make IsValidLabelValue return error strings 2016-05-17 21:36:10 -07:00
k8s-merge-robot
4ac32179bf Merge pull request #24798 from thockin/validation_pt8-1
Automatic merge from submit-queue

Make IsQualifiedName return error strings

Part of the larger validation PR, broken out for easier review and merge.

@lavalamp FYI, but I know you're swamped, too.
2016-05-14 22:14:17 -07:00
Yifan Gu
9d5bcf4251 rkt: Add tests for GarbageCollect(). 2016-05-13 15:13:52 -07:00
k8s-merge-robot
fd3ef234de Merge pull request #23711 from dcbw/kubenet-promiscuous
Automatic merge from submit-queue

kubenet: set bridge promiscuous mode based on hairpinMode

Closes: https://github.com/kubernetes/kubernetes/issues/23657
Closes: https://github.com/kubernetes/kubernetes/issues/20475

<!-- Reviewable:start -->
---
This change is [<img src="http://reviewable.k8s.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](http://reviewable.k8s.io/reviews/kubernetes/kubernetes/23711)
<!-- Reviewable:end -->
2016-05-12 10:33:18 -07:00
Dan Williams
b749902b42 kubenet: set bridge promiscuous mode based on hairpinMode
Closes: https://github.com/kubernetes/kubernetes/issues/23657
Closes: https://github.com/kubernetes/kubernetes/issues/20475
2016-05-12 10:02:33 -05:00
Ed Robinson
afdbad078a
Corrects some misspellings in comments
This should help to make
https://goreportcard.com/report/k8s.io/kubernetes#misspell
look a little nicer.
2016-05-11 08:16:13 +01:00
k8s-merge-robot
9f00ed6075 Merge pull request #25377 from freehan/kubenetmutex
Automatic merge from submit-queue

modify kubenet mutex and add timer
2016-05-10 17:22:15 -07:00
k8s-merge-robot
3894c7972c Merge pull request #25185 from freehan/kubenetgetpodstatus
Automatic merge from submit-queue

kubenet try to retrieve ip inside pod net namespace

Kubenet currently stores the ips of pods inside a map. Kubelet gets pod ip from kubenet during syncpod. If Kubelet restarts, all pods on the node lost their ips in podStatus. This PR adds logic to retrieve pod IP from pod netns. 

cc: @yujuhong
2016-05-10 16:08:45 -07:00
Tim Hockin
72955770f3 Make IsQualifiedName return error strings 2016-05-10 11:23:23 -07:00
Minhan Xia
3573903a8d modify kubenet mutex and add timer 2016-05-09 14:54:15 -07:00
Minhan Xia
1252f5695b add unit tests for kubenet 2016-05-06 12:10:45 -07:00
k8s-merge-robot
32256d53aa Merge pull request #25136 from dcbw/kubenet-fixup-txqueuelen
Automatic merge from submit-queue

kubenet: fix up CNI bridge TX queue length if needed

CNI's bridge plugin mis-handles the TxQLen when creating the bridge,
leading to a zero-length TX queue.  This doesn't typically cause
problems (since virtual interfaces don't have hard queue limits)
but when adding traffic shaping, some qdiscs pull their packet
limits from the TX queue length, leading to a packet limit of 0
in some cases.  Until we can depend on a new enough version of
CNI, fix up the TX queue length internally.

Closes: https://github.com/kubernetes/kubernetes/issues/25092
2016-05-06 06:29:31 -07:00
Minhan Xia
ae6f9ab970 kubenet try to retrieve ip inside pod net namespace 2016-05-05 17:57:32 -07:00
Minhan Xia
04b80f7fb8 rename Status interface to GetPodNetworkStatus 2016-05-04 13:46:31 -07:00
Minhan Xia
265fdd9344 add NetworkStatus in NetworkPlugin interface for kubelet to consume 2016-05-04 13:46:31 -07:00
Dan Williams
aad6535a00 kubenet: fix up CNI bridge TX queue length if needed
CNI's bridge plugin mis-handles the TxQLen when creating the bridge,
leading to a zero-length TX queue.  This doesn't typically cause
problems (since virtual interfaces don't have hard queue limits)
but when adding traffic shaping, some qdiscs pull their packet
limits from the TX queue length, leading to a packet limit of 0
in some cases.  Until we can depend on a new enough version of
CNI, fix up the TX queue length internally.
2016-05-04 10:14:40 -05:00
Arvinderpal
dede4d507c Sets IgnoreUnknown=1 in CNI_ARGS
K8 uses CNI_ARGS to pass pod namespace, name and infra container
id to the CNI network plugin. CNI logic will throw an error
if these args are not known to it, unless the user specifies
IgnoreUnknown as part of CNI_ARGS. This PR sets IgnoreUnknown=1
to prevent the CNI logic from erroring and blocking pod setup.
https://github.com/appc/cni/pull/158
https://github.com/appc/cni/issues/126
2016-04-29 07:40:15 -07:00
Minhan Xia
c8470c49ac add mutex for kubenet 2016-04-26 13:58:10 -07:00
k8s-merge-robot
a586177360 Merge pull request #23740 from dcbw/kubenet-shaper
Automatic merge from submit-queue

kubenet: hook pod bandwidth resources up to shaper

@bprashanth @thockin Last bit for shaping.
2016-04-25 22:15:42 -07:00
goltermann
3fa6c6f6d9 Enable vet 2016-04-20 09:48:24 -07:00
Minhan Xia
a7783e5334 add log line before invoking network plugin 2016-04-19 15:34:06 -07:00
Dan Williams
8086d64131 kubenet: hook pod bandwidth resources up to shaper 2016-04-19 15:32:46 -05:00
k8s-merge-robot
d0b52dd8b3 Merge pull request #24107 from yifan-gu/load_bridge
Automatic merge from submit-queue

kubenet: Load bridge netfilter module in Init().

This lets the kubenet loads the bridge netfilter module and set bridge-nf-call-iptables=1

Fix #24018 

Follow up PRs would be appreciate if we also load the module in the bridge plugin binary itself. Ref https://github.com/kubernetes/kubernetes/issues/24018#issuecomment-207682514

cc @kubernetes/sig-node @sjpotter @euank
2016-04-18 00:08:25 -07:00
k8s-merge-robot
8990897ce6 Merge pull request #23940 from freehan/netinterface
Automatic merge from submit-queue

switch to use ContainerID instead of DockerID in network plugin interface

fix: #15663
2016-04-17 01:12:51 -07:00
Yifan Gu
02c0f41c88 kubenet: Load bridge netfilter module in Init().
Also set 'bridge-nf-call-iptables' to true.
2016-04-14 18:43:22 -07:00
Random-Liu
da07fa9dd5 Refactor InspectContainer. 2016-04-14 17:05:46 -07:00
Minhan Xia
3c58d1ffd3 switch to use ContainerID instead of DockerID in network plugin interface 2016-04-06 16:04:52 -07:00
Minhan Xia
f690220b5c Merge pull request #23704 from freehan/kubenet
Update cni binary

#23712 is depending on this. Not sure why this one gets in first. Hand merging this
2016-04-06 15:47:42 -07:00
Minhan Xia
d026d7ecbc Update cni binary 2016-03-31 13:57:51 -07:00
Dan Williams
fb97b8cdaa Implement network plugin capabilities hook and shaping capability
Allow network plugins to declare that they handle shaping and that
Kuberenetes should not.  Will be first used by openshift-sdn which
handles shaping through OVS, but this triggers a warning when
kubelet notices the bandwidth annotations.
2016-03-30 11:51:21 -05:00
Dan Williams
f1323103db Embed NoopNetworkPlugin into other network plugins
Let Noop handle common functions.
2016-03-30 11:51:21 -05:00
k8s-merge-robot
2a690cc5e2 Merge pull request #23059 from luxas/auto_arch_pause
Automatic merge from submit-queue

Make kubelet use an arch-specific pause image depending on GOARCH

Related to: #22876, #22683 and #15140
@ixdy @pwittrock @brendandburns @mikedanese @yujuhong @thockin @zmerlynn
2016-03-29 23:27:42 -07:00
Lucas Käldström
c6172e58cf Make kubelet use an arch-specific pause image depending on GOARCH 2016-03-25 23:45:59 +02:00
goltermann
34d4eaea08 Fixing several (but not all) go vet errors. Most are around string formatting, or unreachable code. 2016-03-22 17:26:50 -07:00
Tim St. Clair
3b9feb561c Use the default interface for reporting network stats. 2016-03-01 16:17:04 -08:00
Tim St. Clair
7b6d843309 Move test-only files to test-only packages 2016-03-01 09:11:32 -08:00
Dan Williams
6248939e11 Push responsibility for bridge-nf-call-iptables to kubelet network plugins
bridge-nf-call-iptables appears to only be relevant when the containers are
attached to a Linux bridge, which is usually the case with default Kubernetes
setups, docker, and flannel.  That ensures that the container traffic is
actually subject to the iptables rules since it traverses a Linux bridge
and bridged traffic is only subject to iptables when bridge-nf-call-iptables=1.

But with other networking solutions (like openshift-sdn) that don't use Linux
bridges, bridge-nf-call-iptables may not be not relevant, because iptables is
invoked at other points not involving a Linux bridge.

The decision to set bridge-nf-call-iptables should be influenced by networking
plugins, so push the responsiblity out to them.  If no network plugin is
specified, fall back to the existing bridge-nf-call-iptables=1 behavior.
2016-02-23 09:34:59 -06:00
Chao Xu
184440f8ef rename release_1_2 to internalclientset 2016-02-05 14:02:28 -08:00
k8s-merge-robot
65ebe19164 Merge pull request #20584 from caesarxuchao/release_1_2
Auto commit by PR queue bot
2016-02-03 19:46:27 -08:00
Chao Xu
f9f5736b01 grep sed 2016-02-03 13:06:07 -08:00
Dan Williams
fabb65c13f Add a network plugin that duplicates "configureCBR0" functionality 2016-02-03 10:08:08 -06:00
Dan Williams
67414afd11 Send PodCIDR to network plugins as an event 2016-02-03 10:08:07 -06:00
k8s-merge-robot
843c11e06a Merge pull request #20452 from caesarxuchao/replace-client-kubelet
Auto commit by PR queue bot
2016-02-02 23:46:58 -08:00
Chao Xu
cddd7b56a4 replace client with clientset in kubelet and other places 2016-02-02 20:28:45 -08:00
k8s-merge-robot
c0fd002fbb Merge pull request #20019 from thockin/dont-cni-hostnet-pods
Auto commit by PR queue bot
2016-02-02 01:43:24 -08:00
k8s-merge-robot
a68f952a61 Merge pull request #19490 from danwinship/hairpin-error
Auto commit by PR queue bot
2016-02-01 11:20:26 -08:00
Fabio Yeon
7205a160ac Remove all instances of "/tmp" from unit tests and replace with a common
tmp directory creator. Exception is documented.
2016-01-27 16:11:22 -08:00
Tim Hockin
df4c1ccd14 Don't apply net plugins to net=host pods 2016-01-27 15:43:33 -08:00
Tim Hockin
c924533e45 Add logs to try to diagnose #17181 2016-01-25 15:01:03 -08:00
Dan Winship
70a904d10e Don't print hairpin_mode error when not using Linux bridges
(eg, with network plugins that use Open vSwitch)
2016-01-25 09:01:34 -05:00
Clayton Coleman
791d160b42 Split the Kubelet flag options and struct
Reduces the size of the app/server.go file and ensures that the flags
and their defaults are clearly separated.
2016-01-06 21:23:06 -05:00
feihujiang
5cfdcfd8f6 Fix the doc of network plugin version 2015-12-10 16:57:27 +08:00
Lantao Liu
90ac508524 Cleanup fake_docker_client.go and manager_test.go 2015-11-19 19:03:35 -08:00
feihujiang
eac8d6a997 Cleanup the content of deprecated V1beta1 2015-11-06 13:42:51 +08:00
k8s-merge-robot
034f7ccb1d Merge pull request #15885 from ashcrow/fix-import-package-names-15319
Auto commit by PR queue bot
2015-10-20 09:37:13 -07:00
k8s-merge-robot
f5da178738 Merge pull request #15275 from timstclair/liveness-workers
Auto commit by PR queue bot
2015-10-20 06:39:40 -07:00
Steve Milner
8da2d4002f Fixes remaining imports per #15319 2015-10-20 07:13:13 -04:00
k8s-merge-robot
c4779fbc4f Merge pull request #15475 from jijun2/fix-cni_test
Auto commit by PR queue bot
2015-10-20 01:30:24 -07:00
Tim St. Clair
a263c77b65 Refactor liveness probing
This commit builds on previous work and creates an independent
worker for every liveness probe. Liveness probes behave largely the same
as readiness probes, so much of the code is shared by introducing a
probeType paramater to distinguish the type when it matters. The
circular dependency between the runtime and the prober is broken by
exposing a shared liveness ResultsManager, owned by the
kubelet. Finally, an Updates channel is introduced to the ResultsManager
so the kubelet can react to unhealthy containers immediately.
2015-10-19 15:15:59 -07:00
k8s-merge-robot
75c977d200 Merge pull request #15596 from zhengguoyong/alias_util_errors_packagename
Auto commit by PR queue bot
2015-10-19 02:35:37 -07:00
k8s-merge-robot
09a3871506 Merge pull request #15755 from zhengguoyong/del_capatical_packagename_for_cadvisorApi2
Auto commit by PR queue bot
2015-10-18 04:04:11 -07:00
eulerzgy
f8f9afb874 alias local packagename for pkg/util/errors 2015-10-18 09:37:46 +08:00
k8s-merge-robot
6269e22858 Merge pull request #15194 from MikaelCluseau/wip-issue-15187
Auto commit by PR queue bot
2015-10-16 06:46:20 -07:00
k8s-merge-robot
668cb5de48 Merge pull request #14983 from dcbw/cni-fixes
Auto commit by PR queue bot
2015-10-16 05:28:12 -07:00
Mikaël Cluseau
2067641284 hairpin: include command output when unable to query container's interface 2015-10-16 16:06:35 +11:00
eulerzgy
31c09bdcb8 Del capatical local packagename for cadvisorApi 2015-10-16 11:03:50 +08:00
jijun2
bf6e8cbff7 test: using ioutil.TempDir in unit tests per #15176
update

update mode

delete /tmp

update

use ioutil.TempDir instead of static tmp dir

use ioutil.TempDir instead of static tmp dir
2015-10-16 09:21:46 +08:00
Yu-Ju Hong
a3e60cc32e Rename imported package local name kubeletTypes to kubetypes
According to the naming guidelines, package name should not include mixedCaps.
2015-10-09 10:24:31 -07:00
Piotr Szczesniak
95b293c615 Merge pull request #13516 from samsabed/backoff-image-reason
backoff image pulling on failure
2015-10-08 13:05:32 +02:00
Dan Williams
823242d9a8 Add some more debugging to the CNI testcase
Let's attempt to find out why it's failing some small percentage of the time.
2015-10-07 17:24:44 -05:00
Tim St. Clair
551eff63b8 Use strong type for container ID
Change all references to the container ID in pkg/kubelet/... to the
strong type defined in pkg/kubelet/container: ContainerID

The motivation for this change is to make the format of the ID
unambiguous, specifically whether or not it includes the runtime
prefix (e.g. "docker://").
2015-10-07 10:58:05 -07:00
Sam Abed
fdf712cd84 back-off image pull on failure
Signed-off-by: Sam Abed <samabed@gmail.com>
2015-10-07 21:12:42 +11:00
k8s-merge-robot
5979655da1 Merge pull request #14949 from brendandburns/flakes10
Auto commit by PR queue bot
2015-10-06 21:01:33 -07:00
Tim St. Clair
52ece0c34e Refactor readiness probing
Each container with a readiness has an individual go-routine which
handles periodic probing for that container. The results are cached, and
written to the status.Manager in the pod sync path.
2015-10-02 15:37:10 -07:00
Brendan Burns
2afddde027 Deflake an exec test by removing global paths and making conflicts impossible 2015-10-01 16:16:06 -07:00
Rajat Chopra
01dd813ce3 CNI network plugin
Add an experimental network plugin implementation named "cni" that
uses the Container Networking Interface (CNI) specification for
configuring networking for pods.

https://github.com/appc/cni/blob/master/SPEC.md
2015-09-25 22:30:37 -05:00
Brian Grant
bd3a3f1443 Revert "cni network plugin" 2015-09-24 23:24:21 -07:00
Rajat Chopra
fef621a254 TODO added to optimize Status call to plugin 2015-09-23 09:19:31 -07:00
Rajat Chopra
4dc7485d94 cni network plugin 2015-09-22 11:16:41 -07:00
Kris
f4ad00d9ae Moving Status object to a common package 2015-09-17 14:09:53 -07:00
tummychow
a21c52a766 Move util/validation files to their own package 2015-09-13 00:46:52 -07:00
Mikaël Cluseau
1ab520a59b pkg/util/exec: allow mocking of LookPath 2015-09-12 08:43:45 +11:00
Mikaël Cluseau
99a1cfa8ff hairpin support 2015-09-12 08:43:45 +11:00
Kris Rousey
ae6c64d9bb Moving everyone to unversioned client 2015-08-18 10:23:03 -07:00
Veres Lajos
9f77e49109 typofix - https://github.com/vlajos/misspell_fixer 2015-08-08 22:31:48 +01:00
Rajat Chopra
1ce6d80a89 ipv6 test 2015-08-06 15:46:05 -07:00
Rajat Chopra
58a742e667 status hook for the container network 2015-08-06 15:46:04 -07:00
Mike Danese
17defc7383 run gofmt on everything we touched 2015-08-05 17:52:56 -07:00
Mike Danese
8e33cbfa28 rewrite go imports 2015-08-05 17:30:03 -07:00
Casey D
aeb7dc6b30 Allow specification of network plugins directory when starting kubelet 2015-07-23 11:21:39 -07:00
Eric Paris
6b3a6e6b98 Make copyright ownership statement generic
Instead of saying "Google Inc." (which is not always correct) say "The
Kubernetes Authors", which is generic.
2015-05-01 17:49:56 -04:00
Victor Marmol
de0957ccb1 Create Kubelet types package for common shared types. 2015-04-28 16:57:45 -07:00
Tim Hockin
4ee6eb8c73 Make net plugins build on non-unix 2015-03-19 16:15:33 -07:00
CJ Cullen
7ddcecfd1c Revert "Revert "[WIP] southbound networking hooks in kubelet"" 2015-03-19 16:14:13 -07:00
Zach Loafman
b5d1e538df Revert "[WIP] southbound networking hooks in kubelet" 2015-03-19 16:08:08 -07:00