Revise our code to only call Request.Namespace() if a namespace
*should* be present. For root scoped resources, namespace should
be ignored. For namespaced resources, it is an error to have
Namespace=="".
# *** ERROR: *** Some API files are missing the required field descriptions
# Add description tags to all non-inline fields in the following files:
# pkg/api/v1beta1/types.go
# pkg/api/v1beta2/types.go
#
# Your commit will be aborted unless you fix these.
# COMMIT_BLOCKED_ON_DESCRIPTION
Form:
kube-controller-manager/v0.10.0 (linux/amd64) kubernetes/550b98e
<basename(os.Argv)>/<gitVersion> (<GOOS>/<GOARCH>) kubernetes/<shortGitCommit>
Can be set by other clients
Currently, the validation logic validates fields in an object and supply default
values wherever applies. This change factors out defaulting to a set of
defaulting callback functions for decoding (see #1502 for more discussion).
* This change is based on pull request 2587.
* Most defaulting has been migrated to defaults.go where the defaulting
functions are added.
* validation_test.go and converter_test.go have been adapted to not testing the
default values.
* Fixed all tests with that create invalid objects with the absence of
defaulting logic.
Without the ability to retrieve underlying items by key (instead of
the object passed to KeyFunc) it is impossible to build wrappers
around cache.Store that want to make decisions about keys, because
they would need to reconstruct the object passed to Get.
This allows retrieval by key, and makes sure Get(obj) uses it.
OpenShift currently uses '-n', so opening up the potential for downstream
to set a short namespace. However, this should only be used in general for
commands that want to work across namespaces frequently - such as admin
level operations on entire namespaces like quota or cleanup behavior where
you have permissions and need to rapidly switch.
client.Config describes how to make a client connection to a server
for HTTP traffic, but for connection upgrade scenarios cannot be
used because the underlying http.Transport object can't allow the
connection to be hijacked. Reorganize the TLS and connection wrapper
methods so that a sophisticated client can do:
cfg := &client.Config{...} // from somewhere
tlsConfig, _ := client.TLSConfigFor(cfg)
_ := conn.Dial(...)
rt := MyRoundTripper() // some func that implements grabbing requests
wrapper, _ := client.HTTPWrappersFor(cfg)
req := &http.Request{}
req.Header.Set("Connection-Upgrade", ...)
_, := wrapper.RoundTrip(req)
// rt has been invoked with a fully formed Req with auth
rt.Req.Write(conn)
// read response for upgrade
It would be good to have utility function that does more of this,
but mostly enabling the HTTP2/SPDY client exec function right now.
Support namespacing in cache.Store by framing the interface functions
around interface{} and providing a key function to each Store implementation.
Implementation of a fix for #2294.
There is no need to check for an empty string and call StringVar or
StringVarP depending on the case, since StringVar is essentially the
same as a call to StringVarP with an empty string.
This turns 6 lines of code back into 1.
Remove the TODO comments since removing the short flags will no longer
simplify this code significantly.
# *** ERROR: *** Some files have not been gofmt'd. To fix these
# errors, run gofmt -s -w <file>, or cut and paste the following:
# gofmt -s -w pkg/kubecfg/resource_printer.go pkg/proxy/config/config.go pkg/runtime/types.go
#
# Your commit will be aborted unless you override this warning. To
# commit in spite of these format errors, delete the following line:
# COMMIT_BLOCKED_ON_GOFMT
(1) less likely to drop events if the master is unavailable
(2) less likely to have goroutines block while trying to record an
event.
Done as part of #3163 to ensure that minions operate well even while the
master is down.
This exposes the proper v1beta3 API endpoint when the user specifies
the --runtime_config=api/v1beta3 argument to the apiserver. v1beta3
is still considered experimental and subject to change.
--runtime_config is a map of string keys and values, that can be
specified by providing
--runtime_config=a=b,b=c,d,e
Only the key must be specified, the value can be omitted.
Enables v1beta3 in hack/local-up-cluster.sh and hack/test-cmd.sh
I would like to use these in kubelet and kube-proxy.
This is the minimal change to get them moved.
I will follow up with changes to make interfaces consistent
and add Listers for other resources.
RESTClient is an abstraction on top of arbitrary HTTP endpoints that
follow the Kubernetes API conventions. Refactored RESTClientFor so that
assumptions that are Kube specific happen outside of that method (so
others can reuse the RESTClient). Added more validation to client.New
to ensure clients give good input. Exposed APIVersion on RESTClient
as a method so that wrapper code (code that adds typed / structured
methods over rest endpoints like client.Client) can more easily make
decisions about what APIVersion it is running under.
Scheduler uses Reflector from pkg/client/cache.
It defines some helper classes.
I'd like to use those helpers with pkg/client/cache
in kube-proxy and kubelet too.
There are quite a few 'composite literal uses unkeyed fields' errors that I have kept out of this patch.
And there's a couple where vet just seems confused. These are the easiest ones.
RESTClient is an abstraction for simplifying access to resources that
follow the Kubernetes API pattern. Currently, both Namespace and Path
are coupled, which means changes across versions is complex. In general,
most access to resources should be to a resource collection (e.g.
"services") with a name (e.g. "foo"). Other constructs, like prefix sections
("watch") or proposed suffix sections ("/pods/foo/spec") only modify this
core pattern.
This commit removes the Path() helper from Request and introduces:
* Prefix(segments ...string) - segments that should go to the beginning of the path.
* Suffix(segments ...string) - segments that should go to the end of the path.
* Resource(string) - collection name, should be after prefix
* Namespace(string) - if specified, should be set after resource but before name
* Name(string) - if specified, should be after namespace
Now, only Prefix and Suffix are order dependent (and with variadics, should be
simpler). Resource, Namespace, and Name may be specified in any order.
Path() has been removed to prevent downstream consumers of RESTClient from experiencing
behavior change.
Watch depends on long running connections, which intervening proxies
may break without the control of the remote server. Specific errors
handled are io.EOF, io.EOF wrapped by *url.Error, http connection
reset errors (caused by race conditions in golang http code), and
connection reset by peer (simply tolerated).
Add a Visitor pattern on top of ResourcesFromArgs
Allows ResourcesFromArgs to return an opaque list of items and have client
commands react to them.
Change request.go to return apiserver errors for arbitrary status codes to
better respond to generic actions that don't make sense (kubectl delete operations foo)