Commit Graph

315 Commits (f061f74f563010990c32bd9aa958200d78636b04)

Author SHA1 Message Date
Brendan Burns 0f60d7bca3 Reset the resourceVersion so that we poll again for non-timeout errors. 2015-01-06 11:45:03 -08:00
Tim Hockin ca27fb259c Don't use pointers for session affinity 2014-12-29 14:43:17 -08:00
Tim Hockin e045c6ce2f Split portals into host and container
After this DNS is resolvable from the host, if the DNS server is targetted
explicitly.  This does NOT add the cluster DNS to the host's resolv.conf.  That
is a larger problem, with distro-specific tie-ins and circular deps.
2014-12-29 09:18:12 -08:00
Mike Foley c4e94efe16 Sticky Session Implementation
- Added process to cleanup stale session affinity records
- Automatically set cloud provided load balancer for sticky session if the service requires it - Note, this only works on GCE right now.
- Changed sessionAffinityMap a map to pointers instead of structs to improve performance
- Commented out cookie and protocol from sessionAffinityDetail to avoid confusion as it is not yet implemented.
2014-12-18 18:46:10 -05:00
Eric Tune 64f1084c1a Rename util.config.Watcher -> util.config.Broadcaster.
Watch is a widely used term in the codebase, which doesn't capture
the key feature of this type: broadcasting a change to several
listeners.
2014-12-04 00:10:27 -08:00
Daniel Smith 6cb26e17a4 Merge pull request #2697 from erictune/no_accept_err
Proxy: Avoid log error.  Simplify locking.
2014-12-03 14:06:17 -08:00
Daniel Smith 5466c06b3a Merge pull request #2733 from erictune/handle_error
Handle error from watch.
2014-12-03 14:02:54 -08:00
Eric Tune 909f82f463 Proxy: Avoid log error. Simplify locking.
Don't log an error when Accept failed because the interface (portal)
was just removed.

Don't pass around a pointer to a serviceInfo since another thread
deletes those.  Instead, just check if service name is still in the
service map.

Delete the locking on the serviceInfo object since it is only used
by the "main" proxier thread.
2014-12-03 12:34:54 -08:00
Eric Tune deb101a1fb Handle error from watch.
A watch of the API can return an api.Status rather than the watched
obejct type.  This code didn't handle that.

Tested with services e2e test (in conjunction with other PR).
2014-12-03 12:33:26 -08:00
Eric Tune 9964410f77 Use plus-v format for some complex structures. 2014-12-02 22:13:08 -08:00
Brendan Burns 6b009f06cd Merge pull request #2635 from thockin/public-ip
Enable public IPs even in not createExternal...
2014-12-01 14:56:22 -08:00
Meir Fischer d1c93384e9 Set initial timeout on UDP proxy connection creation 2014-11-29 21:32:45 -05:00
Tim Hockin e925deccb0 Fix iptables for old systems
The iptables args list needs to include all fields as they are eventually spit
out by iptables-save.  This is because some systems do not support the
'iptables -C' arg, and so fall back on parsing iptables-save output.  If this
does not match, it will not pass the check.  For example: adding the /32 on
the destination IP arg is not strictly required, but causes this list to not
match the final iptables-save output.  This is fragile and I hope one day we
can stop supporting such old iptables versions.
2014-11-26 12:50:44 -08:00
Tim Hockin 0c03f6e784 Enable public IPs even in not createExternal...
This allows the proxier to portal Public IPs even if the
createExternalLoadBalancer flag is not set.

This also fixes what appears to be a bug in the createExternalLoadBalancer path
wherein multiple PublicIPs would get truncated.
2014-11-26 10:54:28 -08:00
Meir Fischer 9b441d01ab reset err value to SetDeadline return 2014-11-22 23:48:27 -05:00
Tim Hockin 95a9098311 fix 'go vet' warnings 2014-11-21 09:45:28 +08:00
Tim Hockin ea960711ff Clean up error logs.
Use %v for errors, tidy some messages, make error messages start lowe-case
(as per go guidelines).  Just accumulated nits.
2014-11-21 09:45:26 +08:00
Brendan Burns 4a8a2b5a9f Address comments. 2014-11-14 17:23:13 -08:00
Brendan Burns 2aa52d043b Add external services v2 support. 2014-11-14 11:32:54 -08:00
Brendan Burns c2485a4056 Merge pull request #2147 from justinsb/ipv6
Initial ipv6 / iptables work
2014-11-14 10:34:37 -08:00
Brendan Burns 3b5029c673 Add some retry to the service proxy. 2014-11-12 16:48:27 -08:00
Tim Hockin bc072206c0 UDP services need UDP portals 2014-11-05 17:47:40 -08:00
markturansky bd7643c033 refactor services to v1beta3 2014-11-04 14:23:53 -05:00
Justin SB 9a053a4b59 Initial ipv6 / iptables work 2014-11-03 15:23:04 -08:00
derekwaynecarr c6eb371c93 Fixup unit tests 2014-10-24 11:49:04 -04:00
derekwaynecarr 580cb5ea4f Rework client.Interface 2014-10-24 11:47:30 -04:00
Clayton Coleman 644eb70085 Refactor tests to split ObjectMeta from TypeMeta 2014-10-24 11:22:21 -04:00
Clayton Coleman 7550c146dc Replace struct initializers for TypeMeta with ObjectMeta 2014-10-24 11:22:21 -04:00
Clayton Coleman bb77a5d15f Rename ID -> Name 2014-10-22 15:00:26 -04:00
derekwaynecarr d4e1076306 Fix etcd in proxy for namespace awareness 2014-10-16 16:28:06 -07:00
Daniel Smith 1f9a4750b5 Fix dangerous Sprintf 2014-10-16 14:36:36 -07:00
Tim Hockin e907011111 Core support for ip-per-service 2014-10-16 08:36:47 -07:00
Daniel Smith 8007614085 Remove untested and unused code 2014-10-13 16:06:44 -07:00
Clayton Coleman a5462c0678 Change test cases to verify the client sends the received resourceVersion 2014-10-07 19:00:26 -04:00
Clayton Coleman 82bcdd3b3b Make ResourceVersion a string internally instead of uint64
Allows us to define different watch versioning regimes in the future
as well as to encode information with the resource version.

This changes /watch/resources?resourceVersion=3 to start the watch at
4 instead of 3, which means clients can read a resource version and
then send it back to the server. Clients should no longer do math on
resource versions.
2014-10-07 19:00:26 -04:00
Daniel Smith 2dde76bd03 Fix struct tag in apparently untested config struct 2014-10-07 14:01:45 -07:00
Clayton Coleman d3e51a0f24 Rename JSONBase -> TypeMeta in preparation for v1beta3
Will make subsequent refactor much easier
2014-10-07 11:12:16 -04:00
Tim Hockin 0ad0a247c4 Flag-compatible IP type 2014-10-06 11:29:22 -07:00
derekwaynecarr fc67d822c6 Add context as parameter to client interface functions 2014-10-02 12:51:36 -04:00
Tim Hockin 04cdf286a4 Make and use api.Protocol type 2014-09-27 20:31:37 -07:00
Clayton Coleman 4e56dafecc Introduce some default log verbosity control
Move a lot of common error logging into better buckets:

glog.Errorf() - Always an error
glog.Warningf() - Something unexpected, but probably not an error
glog.V(0) - Generally useful for this to ALWAYS be visible
            to an operator
            * Programmer errors
            * Logging extra info about a panic
            * CLI argument handling
glog.V(1) - A reasonable default log level if you don't want
            verbosity
            * Information about config (listening on X, watching Y)
            * Errors that repeat frequently that relate to conditions
              that can be corrected (pod detected as unhealthy)
glog.V(2) - Useful steady state information about the service
            * Logging HTTP requests and their exit code
            * System state changing (killing pod)
            * Controller state change events (starting pods)
            * Scheduler log messages
glog.V(3) - Extended information about changes
            * More info about system state changes
glog.V(4) - Debug level verbosity (for now)
            * Logging in particularly thorny parts of code where
              you may want to come back later and check it
2014-09-25 16:30:14 -04:00
Tim Hockin dd9c562769 Get rid of un-needed lock 2014-09-20 11:40:02 -07:00
Tim Hockin a559d8d9b2 Move some test-only code into the test 2014-09-20 11:38:05 -07:00
Tim Hockin 20826e6d50 Move copyBytes closer to use-sites 2014-09-20 11:31:13 -07:00
Tim Hockin cf6ccaee54 Proxy: delete serviceInfo when stopping a service 2014-09-20 11:29:04 -07:00
Tim Hockin 450ccde521 Don't store name twice in proxy 2014-09-16 17:04:23 -07:00
Clayton Coleman 61e3ce7ddc Make runtime less global for Codec
* Make Codec separate from Scheme
* Move EncodeOrDie off Scheme to take a Codec
* Make Copy work without a Codec
* Create a "latest" package that imports all versions and
  sets global defaults for "most recent encoding"
  * v1beta1 is the current "latest", v1beta2 exists
  * Kill DefaultCodec, replace it with "latest.Codec"
  * This updates the client and etcd to store the latest known version
* EmbeddedObject is per schema and per package now
* Move runtime.DefaultScheme to api.Scheme
* Split out WatchEvent since it's not an API object today, treat it
like a special object in api
* Kill DefaultResourceVersioner, instead place it on "latest" (as the
  package that understands all packages)
* Move objDiff to runtime.ObjectDiff
2014-09-16 16:26:43 -04:00
Clayton Coleman fe614aeda2 Simple refactor for ease of readability
runtime.DefaultCodec -> latest.Codec
2014-09-16 16:12:35 -04:00
Deyuan Deng d5eb731b3f Fix leaking FD. 2014-09-15 19:12:32 -04:00
Tim Hockin 3181f3555d Wrap goroutines in HandleCrash() 2014-09-12 16:47:40 -07:00
Tim Hockin 1e50f118fd Move UDP backend setup to a function 2014-09-12 16:47:40 -07:00
Tim Hockin 86d12681f2 Inject UDP timeout to enable testing 2014-09-12 16:47:40 -07:00
Tim Hockin 38416f6a23 Implement UDP proxying in kube-proxy 2014-09-12 16:47:40 -07:00
Tim Hockin cad6122fe4 Refactor proxy code to make room for UDP 2014-09-12 16:38:17 -07:00
Brendan Burns a343a93b2d Fix a bug where we don't return an error. 2014-09-09 10:29:00 -07:00
Brian Ketelsen 83d3da1436 changed address variable to bindAddress. Used net.JoinHostPort() instead of fmt.Sprintf() 2014-09-07 23:50:36 -07:00
Brian Ketelsen 34922226fd allow proxy to accept a listen address. fixes #1220 2014-09-07 23:27:43 -07:00
Daniel Smith 48ce23ac91 Make client use pointers 2014-09-07 22:19:24 -07:00
Daniel Smith 1c2b65788d Rename Codec and ResourceVersioner to add Default in front, to allow for types of those names 2014-09-07 22:19:24 -07:00
Clayton Coleman 01e668187c Services and Endpoints weren't properly sync'ing
They need incremental changes and a resync on start.
2014-09-03 16:04:55 -04:00
Daniel Smith a63966e73c Combine pkg/apitools and pkg/api/common and call the result pkg/runtime 2014-09-02 11:15:44 -07:00
Daniel Smith 099c8fd36f Propagate rename; tests pass again. 2014-09-02 10:42:06 -07:00
Vojtech Vitek (V-Teq) 59f58cd043 Unify Godoc formatting, fix various typos
Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
2014-09-02 13:41:03 +02:00
Clayton Coleman 9006eadcfe kube-proxy can read config from the apiserver
All clients that talk to a "master" as a host:port or URL
(scheme://host:port) parameter.  Add tests.
2014-08-27 15:49:01 -04:00
Tim Hockin 23fc00be5c Fix a race in proxy.
addService() eventually calls getServiceInfo(), but the serviceInfo object may
not be installed yet (race).
2014-08-25 21:38:16 -07:00
Brendan Burns da74625ac6 Fix the proxier when a service with the same port is re-created, actually restart the proxy. 2014-08-19 12:24:10 -07:00
Joe Beda 8092a80ad9 Merge pull request #903 from erictune/cleanup4
Pass obj with lock by reference.
2014-08-14 14:29:01 -07:00
Eric Tune ee91a19f90 Pass obj with lock by reference. Methods->funcs.
Fixes "lock passed by value" issues raised by "go vet".
2014-08-14 14:01:27 -07:00
Brendan Burns 7ea2a37219 deflake tests. 2014-08-13 15:41:42 -07:00
Clayton Coleman 7d24615d8e Etcd can close the watch channel for services
Need to loop and reopen if it's closed.
2014-08-13 14:21:16 -04:00
Michal Fojtik afbd7a6147 Make proxy/config/etcd.go less verbose when etcd is not available 2014-08-12 11:51:44 +02:00
Kouhei Ueno 2e02967aca Avoid data race in Proxier.OnUpdate
The bug was that the proxier is passed as value on method decleration.
This caused a copy of Proxier to be created when the method was invoked.
The copy being a shallow copy turned out to have them both reference
a same map instance, but their mutexes were different instances.
This turned out to use different mutexes before operating on a same map
instance, which didn't make sense.
2014-08-06 04:34:54 +09:00
brendandburns f87a93af7a Merge pull request #754 from kelseyhightower/proxy-cleanup
proxy: cleanup and minor refactoring
2014-08-05 11:46:52 -07:00
Kelsey Hightower 1d3e660248 proxy: cleanup and minor refactoring
This change includes minor refactoring and cleanup of the proxy
package including the following items:

 * Rename source files with misspelling of round robin
 * Remove unnecessary and redundant comments
 * Update comments for clarity
 * Add locking when updating the round-robin index
 * Improve method receiver names
 * Rename the LoadBalance method to NextEndpoint to add clarity

No changes in behaviour have been introduced.
2014-08-05 07:18:12 -07:00
Clayton Coleman 0c33ed09d4 Remove long sleeps from proxy tests 2014-08-04 15:35:03 -04:00
Clayton Coleman 786b0399c3 Make interval a constant on proxy/config/etcd
Allow future testing of intervals
2014-08-04 15:34:43 -04:00
Brendan Burns 2cbe2c18d4 Add a comment to tickle travis. 2014-07-30 15:06:56 -07:00
Brendan Burns 9519a8049b Fixed tests. 2014-07-30 15:02:36 -07:00
Brendan Burns 448a4b7d69 Revert "Revert "Add support for stopping a proxier.""
This reverts commit 19beaf71b5.
2014-07-30 06:52:03 -07:00
Daniel Smith 19beaf71b5 Revert "Add support for stopping a proxier." 2014-07-29 23:24:57 -07:00
Daniel Smith 00bdeecb63 Merge pull request #682 from brendandburns/proxy
Add support for stopping a proxier.
2014-07-29 23:20:55 -07:00
brendandburns b0d18b2af0 Merge pull request #571 from lavalamp/master
Decode/Encode everywhere
2014-07-29 17:19:33 -07:00
Brendan Burns 99f0d2e807 Add support for stopping a proxier. 2014-07-29 15:40:47 -07:00
Brendan Burns aa703a4e72 Make file error logging edge triggered to reduce log spam. 2014-07-29 05:38:07 -07:00
Daniel Smith b3cc696486 All types stored in etcd are now API objects.
This means I made an api.ContainerManifestList, and added a JSONBase to
endpoints (and changed Name -> JSONBase.ID).
2014-07-28 11:27:36 -07:00
Dan McPherson 7bbc5e2a19 Fixing typos 2014-07-28 15:15:50 +02:00
Jonathan Boulle c43035088b assorted formatting and typo fixes 2014-07-24 15:10:36 -07:00
Daniel Smith 05f01a3654 Revert "assorted formatting and typo fixes" 2014-07-18 17:16:30 -07:00
Jonathan Boulle 9e63c3a633 assorted formatting and typo fixes 2014-07-18 13:02:59 -07:00
Brendan Burns 744072a71e Insert a couple of sleeps to slow things down. 2014-07-18 09:24:01 -07:00
Clayton Coleman 021cf64808 Change proxy config to reuse util/config
Splits endpoint and service configuration into their own objects.  Also makes
the endpoint and service configuration tests correct - there was a race condition
previously that meant tests were passing but not checking correct code.
2014-07-16 14:13:25 -04:00
Yuki Yugui Sonoda 2861955025 Corrects wording of godoc comments. 2014-07-15 22:03:08 +09:00
Yuki Yugui Sonoda 1bd7276aca Correct the style of nested conditionals 2014-07-15 20:58:03 +09:00
Yuki Yugui Sonoda 60dd1f7cc0 Eliminates tautological comments 2014-07-15 20:58:01 +09:00
Yuki Yugui Sonoda 41febcee5e Merge branch 'master' into fix/golint
Conflicts:
	pkg/master/master.go
	pkg/master/pod_cache.go
	pkg/proxy/config/file.go
	pkg/proxy/proxier.go
	pkg/proxy/roundrobbin.go
	pkg/scheduler/randomfit.go
	pkg/scheduler/randomfit_test.go
2014-07-15 20:57:47 +09:00
Clayton Coleman f84a948c9c Merge pull request #426 from claire921/cleanup
pkg/proxy/config: clean up file.Run()
2014-07-12 15:12:05 -04:00
Clayton Coleman 1af753a396 Merge pull request #420 from claire921/proxy
pkg/proxy: remove unnecessary go routine
2014-07-12 13:58:42 -04:00
Claire Li 78cad3fd5e pkg/proxy/config: clean up file.Run() 2014-07-11 22:41:06 -07:00
brendandburns 89655584eb Merge pull request #423 from claire921/onpudate
pkg/proxy: filtering before comparing
2014-07-11 22:33:09 -07:00
brendandburns cde7b5841b Merge pull request #422 from claire921/use_splithostport
pkg/proxy: use net.SplitHostPort instead of strings.Split
2014-07-11 22:32:50 -07:00
Claire Li 094b78d7de pkg/proxy: filtering before comparing 2014-07-11 22:13:29 -07:00
Claire Li ba07dc804c pkg/proxy: use net.SplitHostPort instead of strings.Split 2014-07-11 22:08:53 -07:00
Claire Li abcbce55ce pkg/proxy: remove unnecessary io.EOF checking 2014-07-11 21:51:24 -07:00
Claire Li 4d47db8b5f pkg/proxy: remove unnecessary go routine 2014-07-11 21:34:42 -07:00
Yuki Yugui Sonoda 7373695e33 Fixes golint errors in pkg/proxy 2014-07-11 22:35:57 +09:00
Burcu Dogan 1816a63d55 proxy: lock should be above the fields it protects. 2014-07-11 00:23:43 -07:00
Burcu Dogan e4d966744d proxy: fixing linting errors. 2014-07-10 22:36:06 -07:00
Nan Deng b351578ddd fix data race in config.go. This is a hard one. 2014-07-02 23:23:14 -07:00
Tim Hockin 9f9e75f508 Switch to glog for logging, bridge logging to glog.
1) imported glog to third_party (previous commit)
2) add support for third_party/update.sh to update just one pkg
3) search-and-replace:
  s/log.Printf/glog.Infof/
  s/log.Print/glog.Info/
  s/log.Fatalf/glog.Fatalf/
  s/log.Fatal/glog.Fatal/
4) convert glog.Info.*, err into glog.Error*

Adds some util interfaces to logging and calls them from each cmd, which
will set the default log output to write to glog.  Pass glog-wrapped
Loggers to etcd for logging.

Log files will go to /tmp - we should probably follow this up with a
default log dir for each cmd.

The glog lib is sort of weak in that it only flushes every 30 seconds, so
we spin up our own flushing goroutine.
2014-06-24 20:51:57 -07:00
Daniel Smith b850d36166 Fix boilerplate everywhere 2014-06-23 11:32:11 -07:00
Joe Beda 239e1273cf The Mac is picky about the syntax for listening on ephemeral ports. 2014-06-13 16:04:17 -07:00
Daniel Smith e1bc4d2eba Port 2223 is in use on my machine sometimes, so this test was flaky. 2014-06-12 21:55:55 -07:00
Brendan Burns 164160adef Address package level comments for readability. 2014-06-12 20:26:12 -07:00
Johan Euphrosine 4f6bed03ae gofmt -s pkg/ cmd/ 2014-06-12 14:16:19 -07:00
Joe Beda 2c4b3a562c First commit 2014-06-06 16:40:48 -07:00