Commit Graph

724 Commits (46a5a1f25b810038f75d790f9667c79e0b4e5a78)

Author SHA1 Message Date
k8s-merge-robot 16159b8bd0 Merge pull request #24344 from derekwaynecarr/kubelet-lifecycle-callouts
Automatic merge from submit-queue

Define interfaces for kubelet pod admission and eviction

There is too much code and logic in `kubelet.go` that makes it hard to test functions in discrete pieces.

I propose an interface that an internal module can implement that will let it make an admission decision for a pod.  If folks are ok with the pattern, I want to move the a) predicate checking, b) out of disk, c) eviction preventing best-effort pods being admitted into their own dedicated handlers that would be easier for us to mock test.  We can then just write tests to ensure that the `Kubelet` calls a call-out, and we can write easier unit tests to ensure that dedicated handlers do the right thing.

The second interface I propose was a `PodEvictor` that is invoked in the main kubelet sync loop to know if pods should be pro-actively evicted from the machine.  The current active deadline check should move into a simple evictor implementation, and I want to plug the out of resource killer code path as an implementation of the same interface.

 @vishh @timothysc - if you guys can ack on this, I will add some unit testing to ensure we do the call-outs.

/cc @kubernetes/sig-node @kubernetes/rh-cluster-infra
2016-05-06 08:53:35 -07:00
Paul Morie bc5d7a1bca Reduce kubelet LOC: extract cadvisor 2016-05-06 00:26:48 -04:00
k8s-merge-robot 03e7e08e70 Merge pull request #25124 from pmorie/kubelet-getters
Automatic merge from submit-queue

Reduce kubelet LOC: extract getters

Step 1 of #25028 as discussed in @kubernetes/sig-node meeting
2016-05-05 16:52:09 -07:00
Minhan Xia 265fdd9344 add NetworkStatus in NetworkPlugin interface for kubelet to consume 2016-05-04 13:46:31 -07:00
Sami Wagiaalla 71e7dba845 Abstract node side functionality of attachable plugins
- Expand Attacher/Detacher interfaces to break up work more
  explicitly.
- Add arguments to all functions to avoid having implementers store
  the data needed for operations.
- Expand unit tests to check that Attach, Detach, WaitForAttach,
  WaitForDetach, MountDevice, and UnmountDevice get call where
  appropriet.
2016-05-04 10:18:39 -04:00
Paul Morie 7521503ab9 Reduce kubelet LOC: extract getters 2016-05-04 02:25:22 -04:00
Paul Morie d1e0e726f2 Reduce LOC in kubelet tests 2016-05-03 22:45:08 -04:00
Random-Liu 4cca5b2290 Use fake clock in TestGetPodsToSync to fix flake. 2016-05-02 16:05:36 -07:00
feisky 831203c19b Remove RunInContainer interface in Kuberlete Runtime interface 2016-05-01 20:21:15 +08:00
derekwaynecarr 033ae3e37e Define interfaces for kubelet observing admission, sync loop, sync pod 2016-04-29 10:16:03 -04: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
gmarek e0712f7e57 Fix MaxPods feature in scheduler 2016-04-22 22:49:50 +02:00
Chao Xu 8537095415 use fully qualified resource in fake clients actions 2016-04-20 19:44:40 -07:00
Dan Williams 8086d64131 kubenet: hook pod bandwidth resources up to shaper 2016-04-19 15:32:46 -05:00
Lantao Liu 41953bae49 Add unit test for generateAPIPodStatus 2016-04-12 16:37:26 -07:00
k8s-merge-robot e93c0d727f Merge pull request #20204 from HaiyangDING/predlib
Automatic merge from submit-queue

Move predicates into library

This PR tries to implement #12744 

Any suggestions/ideas are welcome. @davidopp 

current state: integration test fails if including podCount check in Kubelet.
    
DONE:
    1. refactor all predicates: predicates return fitOrNot(bool) and error(Error) in which the latter is of type PredicateFailureError or InsufficientResourceError
    2. GeneralPredicates() is a predicate function, which includes serveral other predicate functions (PodFitsResource, PodFitsHost, PodFitsHostPort). It is registered as one of the predicates in DefaultAlgorithmProvider, and is also called in canAdmitPod() in Kubelet and should be called by other components (like rescheduler, etc if necessary. See discussion in issue #12744
TODO:
    1. determine which predicates should be included in GeneralPredicates()
    2. separate GeneralPredicates() into: a.) GeneralPredicatesEvictPod() and b.) GeneralPredicatesNotEvictPod()
    3. DaemonSet should use GeneralPredicates()
2016-04-12 07:44:45 -07:00
HaiyangDING 41ed85479a move predicates into library (address #12744)
DONE:
1. refactor all predicates: predicates return fitOrNot(bool) and error(Error) in which the latter is of type
	PredicateFailureError or InsufficientResourceError. (For violation of either MaxEBSVolumeCount or
        MaxGCEPDVolumeCount, returns one same error type as ErrMaxVolumeCountExceeded)
2. GeneralPredicates() is a predicate function, which includes serveral other predicate functions (PodFitsResource,
        PodFitsHost, PodFitsHostPort). It is registered as one of the predicates in DefaultAlgorithmProvider, and
        is also called in canAdmitPod() in Kubelet and should be called by other components (like rescheduler, etc)
        if necessary. See discussion in issue #12744
3. remove podNumber check from GeneralPredicates
4. HostName is now verified in Kubelet's canAdminPod(). add TestHostNameConflicts in kubelet_test.go
5. add getNodeAnyWay() method in Kubelet to get node information in standaloneMode

TODO:
1. determine which predicates should be included in GeneralPredicates()
2. separate GeneralPredicates() into:
	a. GeneralPredicatesEvictPod() and
	b. GeneralPredicatesNotEvictPod()
3. DaemonSet should use GeneralPredicates()
2016-04-11 00:57:03 +08:00
harry 5fe773d37c Add flow control pkg
Refactor pkg names in flow control related files
2016-04-03 11:28:03 +08:00
k8s-merge-robot 2205a30348 Merge pull request #23368 from saad-ali/renameBuilderCleaner
Auto commit by PR queue bot
2016-03-26 13:01:25 -07:00
goltermann 32d569d6c7 Fixing all the "composite literal uses unkeyed fields" Vet errors. 2016-03-25 15:25:09 -07:00
saadali 79012f6d53 Rename volume.Builder to Mounter and volume.Cleaner to Unmounter 2016-03-25 11:29:58 -07: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
harry b0900bf0d4 Refactor diff into sub pkg 2016-03-21 20:21:39 +08:00
Paul Morie 5194c12d9e Fix flake in pod IP as env var e2e 2016-03-10 16:32:03 -05:00
k8s-merge-robot fa0bf812d6 Merge pull request #22467 from Random-Liu/push-down-runtime-version-check
Auto commit by PR queue bot
2016-03-05 22:34:19 -08:00
Random-Liu 07b21c50fa Add Status in runtime interface and use it for runtime health check. 2016-03-04 21:26:41 -08:00
Abhishek Shah a3c00aadd5 Specify hostname, subdomain via annotation on podspec.
The hostname is a DNS A record, if the subdomain maps to a service name
in the same namespace
2016-03-04 13:28:33 -08:00
Yu-Ju Hong 4846c1e1b2 pleg: add an internal clock for testability
Also add tests for the health check.
2016-03-01 17:53:03 -08:00
Saad Ali f9b1a33b12 Merge pull request #21953 from timstclair/testing
Move kubelet test-only files to test-only packages
2016-03-01 15:48:10 -08:00
Tim St. Clair 7b6d843309 Move test-only files to test-only packages 2016-03-01 09:11:32 -08:00
Tim St. Clair 246b389275 Move test-only volume files to test-only volume package 2016-02-29 14:44:28 -08:00
Sami Wagiaalla 8c21967dd8 Only call Detacher after the final unmount 2016-02-25 14:11:07 -05:00
k8s-merge-robot dcbeacded0 Merge pull request #21521 from mesosphere/jdef_kubelet_options1
Auto commit by PR queue bot
2016-02-24 18:35:10 -08:00
dingh 40f6032d33 fix typo in test 2016-02-22 15:08:02 +08:00
James DeFelice 6c09689c60 add functional Option type to Kubelet, add SetNodeStatus Option, migrate node statue update funcs to slice of callbacks 2016-02-20 02:09:54 +00:00
k8s-merge-robot 057b8352ec Merge pull request #21182 from vishh/repoTagsRename
Auto commit by PR queue bot
2016-02-19 08:56:09 -08:00
Chao Xu ad46715f51 generate fake client for release_1_2 2016-02-17 16:10:02 -08:00
Vishnu kannan 2623fdde17 Improve the naming of fields in ContainerImage struct used in NodeStatus.
Signed-off-by: Vishnu kannan <vishnuk@google.com>
2016-02-16 15:45:22 -08:00
markturansky a242a3d5fe Added Attacher/Detacher interfaces and support to kubelet 2016-02-07 16:55:58 -05:00
Jan Chaloupka 4389b3f0d6 Rewritte util.* -> wait.* wherever reasonable 2016-02-07 12:02:20 +01:00
k8s-merge-robot bd67b8a5db Merge pull request #20192 from Random-Liu/remove-get-api-podstatus
Auto commit by PR queue bot
2016-02-05 11:00:42 -08:00
Dan Williams 67414afd11 Send PodCIDR to network plugins as an event 2016-02-03 10:08:07 -06:00
Jan Safranek e90de3f985 Fixed cleanup of persistent volumes.
Kubelet.cleanupOrphanedVolumes() compares list of volumes mounted to a node
with list of volumes that are required by pods scheduled on the node
("scheduled volume").

Both lists should contain real volumes, i.e. when a pod uses
PersistentVolumeClaim, the list must contain name of the bound volume instead
of name of the claim.
2016-02-03 10:00:09 +01: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
Jeff Lowdermilk ae2aece9af Merge pull request #20202 from caesarxuchao/skip-update
skip update when deleting with grace-period=0
2016-02-02 18:24:57 -08:00
Jeff Lowdermilk caa9433234 Merge pull request #20433 from lavalamp/fix-bad-rv
Add timeout, fix potential startup hang
2016-02-02 17:27:23 -08:00
Random-Liu 7b4cdb6f8f Remove GetAPIPodStatus from runtime interface 2016-02-02 23:41:55 +00:00
Random-Liu 41b12a18d9 Remove GetAPIPodStatus usage 2016-02-02 23:41:55 +00:00
Chao Xu a6d96a04d0 make kubelet.HandlePodsDeletion aware of api.Pod 2016-02-02 13:01:17 -08:00
k8s-merge-robot 71ae2736c0 Merge pull request #19889 from yujuhong/replace_cache
Auto commit by PR queue bot
2016-02-02 00:41:06 -08:00
k8s-merge-robot 126f798699 Merge pull request #19942 from yujuhong/mirror_creation
Auto commit by PR queue bot
2016-02-01 22:55:38 -08:00
Yu-Ju Hong ff04de4fc0 Remove RuntimeCache from sync path
This change removes RuntimeCache in the pod workers and the syncPod() function.
Note that it doesn't deprecate RuntimeCache completely as other components
still rely on the cache.
2016-02-01 21:32:41 -08:00
k8s-merge-robot 32ab64ce5b Merge pull request #19778 from resouer/runtime
Auto commit by PR queue bot
2016-02-01 21:05:05 -08:00
k8s-merge-robot 348858061d Merge pull request #20258 from smarterclayton/get_logs_for_any_container
Auto commit by PR queue bot
2016-02-01 16:24:20 -08:00
Daniel Smith 4a7d70aef1 extend fake clock 2016-02-01 15:36:15 -08:00
harry 1032067ff9 Replace runtime reference by pkg 2016-02-01 21:06:44 +08:00
Clayton Coleman d6d4a17db6 Allow clients to request most recent container logs
Many users attempt to use 'kubectl logs' in order to find the logs
for a container, but receive no logs or an error telling them their
container is not running. The fix in this case is to run with '--previous',
but  this does not match user expectations for the logs command.

This commit changes the behavior of the Kubelet to return the logs of
the currently running container or the previous running container unless
the user provides the "previous" flag. If the user specifies "follow"
the logs of the most recent container will be displayed, and if it is
a terminated container the logs will come to an end (the user can
repeatedly invoke 'kubectl logs --follow' and see the same output).

Clean up error messages in the kubelet log path to be consistent and
give users a more predictable experience.

Have the Kubelet return 400 on invalid requests
2016-01-31 17:47:29 -05:00
Random-Liu e9dceb36e9 Start using reason cache in kubelet 2016-01-30 00:25:50 -08:00
k8s-merge-robot 3f5e417999 Merge pull request #19502 from swagiaal/internalize-ownership
Auto commit by PR queue bot
2016-01-26 23:06:39 -08:00
Ken Robertson fff8a7c371 kubelet: Update engine version parsing to handle semantic versioning
This updates the dockertools.dockerVersion to use a semantic versioning
library to more gracefully support engine versions which include
additional version fields.

Previously, go-dockerclient's APIVersion struct was use which only
handles plain numeric x.y.z version strings. With #19675, the library
was now used on the Docker engine string, however it is possible for the
engine string to include include additional information for beta, rc, or
distro specific builds.

This PR also enables the TestDockerRuntimeVersion test which was
previously just a FIXME and updates it to pass, and be used to test the
version string that cause #20005.

This negates the need for fsouza/go-dockerclient#451, since even with
that change, if a user was running Docker 1.10.0-rc1, this would cause
the kubelet to report it as simply 1.10.0.
2016-01-22 13:18:52 -08:00
Yu-Ju Hong 25f2c6f330 Improve mirror pod creation/deletion
- Ignore the "not found" error on deletion.
 - Recognize the "already exists" error on creation and check if the existing
   pod meets requirement. If so, don't report an error.
 - Immediately create a mirror pod after a successful deletion, if needed.
2016-01-21 16:01:14 -08:00
Ken Robertson a7b07c01df Update container runtime to properly report the engine and version
This address a TODO when collecting the node version information so it
will properly report the configured runtime and its version. Previously,
this was hardcoded to "docker://" and the docker version, and would show
"docker://1.9.1" even when the kubelet was configured to use rkt.

With this change, it will use the runtime's Type() and Version() data.

This also changes the container.Runtime interface to add an APIVersion()
method. This can be used when the runtime has separate versions for the
engine and the API, such as with Docker. The Docker minimum version
validation has been updated to use APIVersion(), and
DockerManager.Version() now returns the engine version.
2016-01-20 16:42:25 -08:00
Mike Danese 9745d1cbf0 Merge pull request #19626 from mikedanese/kubelet-labels
kubelet: use ConfigurationMap instead of json
2016-01-14 14:08:53 -08:00
Mike Danese 35a3785cf6 kubelet: use ConfigurationMap instead of json 2016-01-14 09:32:42 -08:00
k8s-merge-robot 5462a37dfe Merge pull request #17700 from yujuhong/status_cache
Auto commit by PR queue bot
2016-01-13 22:47:57 -08:00
Yu-Ju Hong b56ed1a8c2 Support populating the runtime cache in PLEG
This changes does not turn on this feature (cache) for kubelet.
2016-01-13 10:19:47 -08:00
Sami Wagiaalla f650648aae Add fsGroup to SetUp and SetUpAt 2016-01-13 10:37:10 -05:00
Tim St. Clair e2ffd007f7 Implement node Allocatable
Add `kube-reserved` and `system-reserved` flags for configuration
reserved resources for usage outside of kubernetes pods. Allocatable is
provided by the Kubelet according to the formula:
```
Allocatable = Capacity - KubeReserved - SystemReserved
```

Also provides a method for estimating a reasonable default for
`KubeReserved`, but the current implementation probably is low and needs
more tuning.
2016-01-12 17:00:43 -08:00
Mike Danese bf763bba95 Merge pull request #19498 from pwittrock/nodelabels
Node labels: Remove node-labels-file command line option.  Change --n…
2016-01-12 15:12:57 -08:00
Phillip Wittrock f1c8384ff4 Node labels: Remove node-labels-file command line option. Change --node-label format from key=value to key:value to be consitent with how the header key:value is specified on command line. 2016-01-12 12:57:12 -08:00
k8s-merge-robot c255181509 Merge pull request #18248 from resouer/images-dev
Auto commit by PR queue bot
2016-01-11 23:53:43 -08:00
Yu-Ju Hong 712612c2dc Treat first-seen, non-pending pods as updates
Kubelet doesn't perform checkpointing and loses all its internal states after
restarts. It'd then mistaken pods from the api server as new pods and attempt
to go through the admission process. This may result in pods being rejected
even though they are running on the node (e.g., out of disk situation). This
change adds a condition to check whether the pod was seen before and categorize
such pods as updates. The change also removes freeze/unfreeze mechanism used to
work around such cases, since it is no longer needed and it stopped working
correctly ever since we switched to incremental updates.
2016-01-08 17:21:43 -08:00
harry zhang 27ca7dc71e Expose image list in node status
Change image manager to use repotag
2016-01-08 17:01:31 +08:00
Madhusudan.C.S 059c2aa799 Mitigate node out of disk status oscillation by delaying it.
Implement a flag that defines the frequency at which a node's out of
disk condition can change its status. Use this flag to suspend out of
disk status changes in the time period specified by the flag, after
the status is changed once.

Set the flag to 0 in e2e tests so that we can predictably test out of
disk node condition.

Also, use util.Clock interface for all time related functionality in
the kubelet. Calling time functions in unversioned package or time
package such as unversioned.Now() or time.Now() makes it really hard
to test such code. It also makes the tests flaky and sometimes
unnecessarily slow due to time.Sleep() calls used to simulate the
time elapsed. So use util.Clock interface instead which can be faked
in the tests.
2016-01-04 12:23:38 -08:00
Ravi Sankar Penta d0dd6c844b Allow node IP to be passed as optional config for kubelet
In case of multiple IPs on the node, this will allow admin to
specify desired IP to be used for the node.
2016-01-03 09:29:07 -08:00
k8s-merge-robot 674e24a16e Merge pull request #18617 from mqliang/OSImage
Auto commit by PR queue bot
2015-12-17 08:50:48 -08:00
Tim St. Clair 89bc7992f9 Refactor kubelet server into its own package
Refactor Kubelet's server functionality into a server package. Most
notably, move pkg/kubelet/server.go into
pkg/kubelet/server/server.go. This will lead to better separation of
concerns and a more readable code hierarchy.
2015-12-15 10:20:38 -08:00
mqliang a21dd8a32b replace OsImage to OSImage 2015-12-12 15:53:34 +08:00
k8s-merge-robot 23baca87b5 Merge pull request #18232 from pwittrock/fsacct
Auto commit by PR queue bot
2015-12-11 00:48:09 -08:00
k8s-merge-robot caf4b1e47f Merge pull request #18191 from thockin/ingress-egress-annotations
Auto commit by PR queue bot
2015-12-10 23:01:26 -08:00
Phillip Wittrock c67ce887f2 Volume Metrics Interface and base implementation.
- Add volume.MetricsProvider function to Volume interface.
- Add volume.MetricsDu for providing metrics via executing "du".
- Add volulme.MetricsNil for unsupported Volumes.
2015-12-09 16:06:24 -08:00
deads2k 2ee3dfe415 update testapi to eliminate redundant fields 2015-12-07 15:54:26 -05:00
Fabio Yeon 5457f5ace2 Merge pull request #18240 from timstclair/readiness
Update PodReady condition when updating container readiness
2015-12-07 10:43:22 -08:00
Abhi Shah bb3f49e526 Merge pull request #18089 from ArtfulCoder/oneNSAgain
SkyDNS is the only NS for Pods with DNSPolicy=ClusterFirst
2015-12-07 10:20:29 -08:00
Random-Liu 3cbdf79f8c Change original PodStatus to APIPodStatus, and start using kubelet internal PodStatus in dockertools 2015-12-04 17:37:39 -08:00
Tim St. Clair 2430454eea Update PodReady condition when updating container readiness 2015-12-04 15:40:33 -08:00
Tim Hockin 29a2fded52 Revert "Change to alpha/beta for bandwidth annotations"
This reverts commit 2f4c3035be.
2015-12-03 17:20:23 -08:00
Abhishek Shah 6c3a88cb3a SkyDNS is the only NS for Pods with DNSPolicy=ClusterFirst 2015-12-02 10:26:49 -08:00
Fabio Yeon 7100d278e3 Revert "SkyDNS is the only NS for Pods with DNSPolicy=ClusterFirst" 2015-12-01 20:58:27 -08:00
k8s-merge-robot 4602220ad0 Merge pull request #15645 from ArtfulCoder/oneNS
Auto commit by PR queue bot
2015-12-01 13:51:37 -08:00
jiangyaoguo f4c5d00b0c Implement a cachedNodeInfo in predicates 2015-11-27 21:49:14 +08:00
Abhishek Shah 015df14a4a SkyDNS is the only NS for Pods with DNSPolicy=ClusterFirst 2015-11-25 15:02:40 -08:00
Aaron Levy 3dc7c64ce9 kubelet: report NodeReady last in status list
Addresses a version skew issue where the last condition status is always
evaluated as the NodeReady status. As a workaround force the NodeReady
condition to be the last in the list of node conditions.

ref: https://github.com/kubernetes/kubernetes/issues/16961
2015-11-25 11:53:31 -08:00
Rohith c2526c93fa - adding the -node-label flag to the kubelet which allows for a initial tagging / labelling of the node on cluster registration
- the labels can come from a series of key=pair value or file:///path_to_file which contains key pairs
2015-11-18 23:20:58 +00:00
Jeff Lowdermilk 70d89a3541 Merge pull request #13571 from yujuhong/lifecycle_v0
kubelet: add a generic pod lifecycle event generator
2015-11-16 14:59:40 -08:00
k8s-merge-robot 7fa85d430b Merge pull request #16614 from pmorie/ro-managed
Auto commit by PR queue bot
2015-11-16 10:46:44 -08:00
k8s-merge-robot 081b21687e Merge pull request #16261 from zhengguoyong/update_condition
Auto commit by PR queue bot
2015-11-16 02:34:18 -08:00
Paul Morie 911757486d Refactor volume.Builder.IsReadOnly() to volume.Builder.GetAttributes() 2015-11-13 23:34:48 -05:00
Yu-Ju Hong bc6414a873 kubelet: add a generic pod lifecycle event generator
This change introduces pod lifecycle event generator (PLEG), and adds a generic
PLEG. The generic PLEG relies on relisting to discover container events, and is
container-runtime-agnostic. Both docker and rkt are changed to use generic
PLEG.
2015-11-13 09:55:36 -08:00
k8s-merge-robot e88593d788 Merge pull request #14542 from vishh/kubelet-refactor
Auto commit by PR queue bot
2015-11-12 15:24:22 -08:00
Vishnu kannan b1770537ab Make cadvisor startup synchronous with container runtime initialization.
This is hopefully a temporary workaround.

Signed-off-by: Vishnu kannan <vishnuk@google.com>
2015-11-11 15:20:13 -08:00
Vishnu kannan 4ad3d6f5fe Move container manager into a separate package.
Inject container manager into Kubelet. This lets us stub out container
manager during integration testing.
2015-11-11 15:00:37 -08:00
Vishnu kannan 89c3cb2f43 refactor podCIDR handling in kubelet to runtime state 2015-11-11 15:00:37 -08:00
Vishnu kannan 5f4570b764 handling locks and update tests. Fail node if network is not initialized 2015-11-11 15:00:37 -08:00
Vishnu kannan cf56f7a8ef Refactoring kubelet to separate object creation from object logical initialization. 2015-11-11 15:00:34 -08:00
Lantao Liu d6b93cdfe1 Move active deadline check into main syncLoop of kubelet. 2015-11-11 10:05:04 -08:00
eulerzgy 3f630d8ad7 when pod has successed, update condition to PodCompleted 2015-11-10 15:37:44 +08:00
k8s-merge-robot fb571e3e2e Merge pull request #16545 from timstclair/mirrorpods
Auto commit by PR queue bot
2015-11-05 02:56:23 -08:00
Tim St. Clair 858126b42a Clean up static/mirror pod status logic
- status.Manager always deals with the local (static) pod, but gets the
  mirror pod when syncing
  - This lets components like the probe workers ignore mirror pods
2015-11-04 11:42:25 -08:00
Yu-Ju Hong b734155954 Clean up housekeeping routine in kubelet
Now that kubelet checks sources seen correctly, there is no need to enforce the
initial order of pod updates and housekeeping. Use a ticker for housekeeping to
simplify the code.
2015-11-04 08:12:18 -08:00
Yu-Ju Hong 2eb17df46b kubelet: independent pod syncs and backoff on error
Currently kubelet syncs all pods every 10s. This is not preferred because
 * Some pods may have been sync'd recently.
 * This may cause all the pods to be sync'd at once, causing undesirable
   CPU spikes.

This PR replaces the global syncs with independent, periodic pod syncs. At the
end of syncing, each pod worker will enqueue itslef with a future timestamp (
current time + sync interval), when it will be due for another sync.
 * If the pod worker encoutners an sync error, it may requeue with a different
   timestamp to retry sooner.
 * If a sync is triggered by the update channel (events or spec changes), the
   pod worker would enqueue a new sync time.

This change is necessary for moving to long or no periodic sync period once pod
lifecycle event generator is completed. We will still rely on the mechanism to
requeue the pod on sync error.

This change also makes sure that if a sync does not succeed (either due to
real error or the per-container backoff mechanism), an error would be propagated
back to the pod worker, which is responsible for requeuing.
2015-11-03 13:29:08 -08:00
Dawn Chen a39e1e96dc Mark NodeNotReady for docker version below 1.6.2 2015-10-30 13:48:51 -07:00
Sami Wagiaalla 1d352a16b8 Support volume relabling for pods which specify an SELinux label 2015-10-28 09:26:58 -04:00
Daniel Smith 8524d392bf Merge pull request #16178 from madhusudancs/kubelet-out-of-disk-no-master
Report node out of disk condition in the kubelet.
2015-10-27 14:28:03 -07:00
k8s-merge-robot 0a7a9f3535 Merge pull request #16340 from timstclair/flaky-prober
Auto commit by PR queue bot
2015-10-27 12:10:22 -07:00
k8s-merge-robot df265b2d6e Merge pull request #15510 from aveshagarwal/master-selflink-objref
Auto commit by PR queue bot
2015-10-27 00:37:21 -07:00
Tim St. Clair 17b0a964f4 Always resync after resyncInterval 2015-10-26 18:50:57 -07:00
Madhusudan.C.S 9c4424f0bd Report out of disk as a node condition when node goes out of disk.
Define a new out of disk node condition and use it to report when node
goes out of disk.

Make a copy of loop range clause variable in node listers so that it
is available outside the for loop.

Also update/implement unit tests.
2015-10-26 15:01:20 -07:00
Tim Hockin 42c7fec490 Add a cloud-provider hook to scrub DNS for pods
GCE needs this hook and it seems general enough to include.
2015-10-23 17:01:49 -07:00
Abhishek Shah ba6469d478 kubelet manages /etc/hosts file 2015-10-22 13:27:05 -07:00
k8s-merge-robot 6dc3dcf36a Merge pull request #15414 from thockin/exp-beta-annotations
Auto commit by PR queue bot
2015-10-20 17:45:32 -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 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
Dawn Chen 6f46780cbf Add tests to reproduce the issue and verify the fix. 2015-10-16 15:16:07 -07:00
eulerzgy 31c09bdcb8 Del capatical local packagename for cadvisorApi 2015-10-16 11:03:50 +08:00
Tim Hockin 2f4c3035be Change to alpha/beta for bandwidth annotations 2015-10-14 15:33:19 -07:00
Yu-Ju Hong 2c76c55bb9 kubelet: move PodManager and MirrorClient to a subpackage
This change moves pod_manager.go and mirror_client.go to a separate package.
Also made necessary, minor changes to facilitate testing.
2015-10-12 16:34:18 -07:00
Avesh Agarwal 8e4a8b7260 Addresses issue #6596.
Removes ForTesting_ReferencesAllowBlankSelfLinks.
Fixes controller's persistentvolumes unit tests.
2015-10-12 19:21:48 -04: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
k8s-merge-robot 45cca144cb Merge pull request #15167 from yujuhong/sources_seen
Auto commit by PR queue bot
2015-10-09 08:35:40 -07:00
Yu-Ju Hong 098ab05997 kubelet: move common types to kubelet/types
This would faciliate tasks such as moving code in pkg/kubelet to sub packages.
2015-10-08 14:38:01 -07: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
Yu-Ju Hong 5abdfcdfe6 kubelet: fix all sources ready condition
The current implementation considers a source seen when it receives a SET at
kubelet/config/config.go. However, the main kubelet sync loop may not have
received the pod update from the source via the channel. This change ensures
that kubelet would consider all sources are ready only after the sync loop has
seen all the sources.
2015-10-06 10:13:04 -07:00
Paul Morie 227dd82119 Add PodSecurityContext and backward compatibility tests 2015-10-05 21:05:27 -04: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
nikhiljindal b99d225d19 Setting PodReadyCondition.LastTransitionTime 2015-09-29 17:23:32 -07:00
Vishnu kannan 77be271ed0 Linux container manager initialization will now fail if cpu and memory cgroups are not mounted. 2015-09-24 15:34:42 -07:00
Eric Tune de38de0c1a Merge pull request #14064 from brendandburns/flakes
Increase a bunch of timeouts to reduce flakes
2015-09-23 12:56:27 -07:00
Brendan Burns 77fd388485 Increase a bunch of timeouts to reduce flakes 2015-09-23 11:09:03 -07:00
gmarek 66ca7fcc92 Functionally revert #12894 2015-09-23 12:15:38 +02:00
Eric Tune f92da0c714 Merge pull request #14323 from brendandburns/flakes2
Fix a flake in the kubelet test.
2015-09-22 13:36:22 -07:00
Brendan Burns e845c6a4e6 Fix a flake in the kubelet test. 2015-09-21 16:45:21 -07:00
Yu-Ju Hong 077158ef86 Rebase to use unversioned api 2015-09-21 11:14:14 -07:00
Yu-Ju Hong 7bdf9bfdfa Revert "Move and fix nodeManager related unit tests"
This reverts commit 865dc19957.
2015-09-21 10:58:54 -07:00
nikhiljindal 6523ec142b Adding more fields to PodCondition 2015-09-18 05:26:13 -07:00
Daniel Martí 586cb9126a Move pkg/util.Time to pkg/api/unversioned.Time
Along with our time.Duration wrapper, as suggested by @lavalamp.
2015-09-17 17:51:27 -07:00
k8s-merge-robot 7cee028497 Merge pull request #13778 from smarterclayton/unready_endpoints
Auto commit by PR queue bot
2015-09-17 11:36:17 -07:00
Clayton Coleman bf2decce81 Add NotReadyAddresses to Endpoints
In many cases clients may wish to view not ready addresses for endpoints
in order to do set membership prior to a pod being ready. For instance,
a pod that uses the service endpoints to connect to other pods under
the same service, but does not want to signal ready before it has
contacted at least a minimal number of other pods.

This is backwards compatible with old servers and clients. There is
an additional cost in size of endpoints before services ramp up, which
will add minor CPU and memory use for services that have a significant
number of pods which have not become ready.
2015-09-17 09:41:56 -04:00
Yu-Ju Hong 865dc19957 Move and fix nodeManager related unit tests 2015-09-16 17:41:40 -07:00
k8s-merge-robot f6fb0a58b6 Merge pull request #13874 from timstclair/status-manager
Auto commit by PR queue bot
2015-09-16 00:46:01 -07:00
gmarek 4b8ddf3d7e Add information about ports opened by Kubelet to API 2015-09-15 14:24:55 -04:00
k8s-merge-robot 6f01200188 Merge pull request #13727 from jiangyaoguo/fix-reason-reporting-in-kubelet
Auto commit by PR queue bot
2015-09-11 12:32:20 -07:00
Tim St. Clair 1f91fffb57 Move kubelet.statusManager to status.Manager
This refactor is in preparation for moving more state handling to the
status manager. It will become the canonical cache for the latest
information on running containers and probe status, as part of the
prober refactoring.
2015-09-11 12:22:01 -07:00
jiangyaoguo 62c0c35307 Fix reporting reason in kubelet
1. Make reason field of StatusReport objects in kubelet in CamelCase format.
2. Add Message field for ContainerStateWaiting to describe detail about Reason.
3. Make reason field of Events in kubelet in CamelCase format.
4. Update swagger,deep-copy and so on.
2015-09-11 10:01:08 +08:00
Daniel Smith 15b30b8b09 Move version agnostic parts of client
pkg/client/unversioned/cache -> pkg/client/cache
pkg/client/unversioned/record -> pkg/client/record
2015-09-10 17:17:59 -07:00
Bobby Abbott 9a5f43e16d Kubelet#GetNode now uses GetNodeInfo instead of List
Both GetNode and the cache.ListWatch listfunc in the
kubelet package call List unnecessary.

GetNodeInfo is sufficient for GetNode and makes looping
through a list of nodes to check for a matching name
unnecessary.

resolves #13476
2015-09-10 10:50:41 -07:00
k8s-merge-robot 2e2def36a9 Merge pull request #13581 from caesarxuchao/APIGroup-testapi-2
Auto commit by PR queue bot
2015-09-04 20:38:45 -07:00
Chao Xu 9fc79e9d99 refactor testapi and test scripts to prepare for multiple API groups. 2015-09-04 18:01:32 -07:00
James DeFelice de064f4254 fix kubelet syncLoop busy loop upon close of updates chan 2015-09-04 17:56:02 +00:00
Brendan Burns ac958e5320 Merge pull request #12513 from brendandburns/tc2
integrate bandwidth shaping and the kubelet.
2015-09-02 09:44:10 -07:00
deads2k 7e180c258d update testclient for delegating reaction chain 2015-09-01 12:58:35 -04:00
Brendan Burns 9f3ef68ebc integrate bandwidth shaping and the kubelet. 2015-08-30 22:24:09 -07:00
k8s-merge-robot 4a7115d272 Merge pull request #11955 from pedro-r-marques/flag_resolv_conf
Auto commit by PR queue bot
2015-08-30 21:03:54 -07:00
Yu-Ju Hong 697197d383 Kubelet: do not remove pod directory if any container is still running
If there are any running container in the pod, we cannot remove the volume.
Therefore, we should not attempt to remove the pod directory.
2015-08-27 18:19:13 -07:00
Pedro Roque Marques 99b1da848d Add kubelet '--resolv-conf' flag.
Allow the user to specify the resolver configuration file that is used
to determine the default DNS parameters. This defaults to the system's
/etc/resolv.conf.
2015-08-26 15:41:36 -07:00
Yu-Ju Hong c237ac4c84 Merge pull request #13003 from yujuhong/decouple_workers
kubelet: trigger pod workers independently
2015-08-26 09:53:25 -07:00
Yu-Ju Hong b906e34576 kubelet: trigger pod workers independently
Currently, whenever there is any update, kubelet would force all pod workers to
sync again, causing resource contention and hence performance degradation.

This commit flips kubelet to use incremental updates (as opposed to snapshots).
This allows us to know what pods have changed and send updates to those pod
workers only. The `SyncPods` function has been replaced with individual
handlers, each handling an operation (ADD, REMOVE, UPDATE). Pod workers are
still triggered periodically, and kubelet performs periodic cleanup as well.

This commit also spawns a new goroutine solely responsible for killing pods.
This is necessary because pod killing could hold up the sync loop for
indefinitely long amount of time now user can define the graceful termination
period in the container spec.
2015-08-25 17:52:01 -07:00
Yu-Ju Hong 3bc2157889 Merge pull request #13100 from pweil-/cap-priv-sources
use privileged source object
2015-08-25 16:10:50 -07:00
Nikhil Jindal 8846c841a8 Merge pull request #12648 from samsabed/crashloop
back off restarts of crashlooping containers
2015-08-24 18:54:13 -07:00
Paul Weil 709e654686 use privileged source object 2015-08-24 16:53:43 -04:00
Sam Abed 995cb15bb6 back off restarts of crashlooping containers
Signed-off-by: Sam Abed <samabed@gmail.com>
2015-08-24 21:43:17 +10:00
Yu-Ju Hong 0c84b837cf kubelet: switch to using pod UID as the key in status manager
We chose to use podFullName (name_namespace) as key in the status manager
because mirror pod and static pod share the same status. This is no longer
needed because we do not store statuses for static pods anymore (we only
store statuses for their mirror pods). Also, reviously, a few fixes were
merged to ensure statuses are cleaned up so that a new pod with the same
name would not resuse an old status.

This change cleans up the code by using UID as key so that the code would
become less brittle.
2015-08-18 14:39:02 -07:00
Kris Rousey ae6c64d9bb Moving everyone to unversioned client 2015-08-18 10:23:03 -07:00
Clayton Coleman 01f3785426 Add status.podIP as a valid downward API target
Getting the public IP a container is supposed to use is O(hard),
and usually involves ugly gyrations in python or with interfaces.
Using the downward API means that the IP Kube is announcing to
other endpoints is also visible inside the container for pods to
identify themselves.
2015-08-14 17:51:55 -04:00
Kris Rousey 565189f5b8 Correcting all go vet errors 2015-08-11 13:55:37 -07:00
Marek Grabowski 5f9cefc1d8 Merge pull request #12441 from vlajos/typofixes-vlajos-20150807
typofix - https://github.com/vlajos/misspell_fixer
2015-08-10 16:33:52 +02:00
Marek Grabowski 8580e17ff1 Merge pull request #12374 from wulonghui/wulonghui-patch-1
Add NodeInternalIP for Node's Addresses when cloud provider is nil
2015-08-10 15:01:00 +02:00
Veres Lajos 9f77e49109 typofix - https://github.com/vlajos/misspell_fixer 2015-08-08 22:31:48 +01:00
Satnam Singh bee48f4ce5 Merge pull request #12035 from AnanyaKumar/requests
Add support for request
2015-08-07 14:27:34 -07:00
wulonghui b50e736184 Add NodeInternalIP for Node's Addresses when cloud provider is nil 2015-08-07 09:08:56 +08:00
Ananya Kumar ef1e576810 Add support for request 2015-08-05 19:00:19 -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
deads2k 182885e897 make testclient more precise 2015-08-04 13:35:59 -04:00
Mike Danese 1b84fb7d74 make testclient threadsafe by guarding internal state with accessors 2015-07-29 16:17:17 -07:00
nikhiljindal 274792d7bb Stop exposing v1beta3 by default 2015-07-01 14:38:02 -07:00
Dawn Chen 6ddfa512de Revert "Revert "Fix the race between configuring cbr0 and restarting static pods""
This reverts commit fd0a95dd12.
2015-06-24 11:10:10 -07:00
Piotr Szczesniak fd0a95dd12 Revert "Fix the race between configuring cbr0 and restarting static pods" 2015-06-24 09:56:49 +02:00
Dawn Chen 23200d303f Fix several issues on running syncPods until network is configured.
Also fixed unittests and compiling.
2015-06-23 12:11:19 -07:00
Abhishek Shah 3556993179 Augmented kubelet healthz with syncLoop check.
Monit uses read-only port for health monitoring.
2015-06-19 18:14:01 -07:00
Yifan Gu 40e46bbb37 kubelet: Remove newTestKubeletWithFakeRuntime() and other depreciated functions.
This cleans up the kubelet tests. Almost no docker specified tests now.
2015-06-19 10:28:27 -07:00
Yifan Gu 91e198cb70 kubelet: Move TestSyncPodWithTerminationLog() to dockertools package.
Update the fakeOptionGenerator to create the pod container directory,
so that fake docker client can see and record the termination log path.
2015-06-19 10:28:27 -07:00
Yifan Gu 6ddffdd736 kubelet: Move TestPortForwardNoSuchContainer() to dockertools package.
Also refactor TestPortForward() to be neutral to container runtime.
2015-06-19 10:28:27 -07:00
Justin Santa Barbara 27b02d0913 Fix kubelet unit test; populate NodeName
When we build a Kubelet directly we need to populate NodeName
as well as hostname, because we bypass the functions that normally
do this for us.
2015-06-18 12:40:55 -07:00
Dawn Chen ca95eb75e9 Configured resource-only container /docker-daemon with 70% of node memory
capacity. This is a workaround to docker memory leakage issue.
2015-06-17 11:40:30 -07:00
Dawn Chen 14f78b74cc Fix the unittests cause by applying oom_score_adj (0) to the user containers. 2015-06-15 16:16:34 -07:00
Abhi Shah 928971cea4 Merge pull request #9710 from mesosphere/public-get-phase
export kubelet.GetPhase
2015-06-12 13:46:35 -07:00
James DeFelice 3cf7739b42 export kubelet.GetPhase 2015-06-12 11:11:53 +00:00
Prashanth Balasubramanian b5ed0e9b13 Dont generatePodStatus twice for new pods 2015-06-11 17:18:16 -07:00