GoogleCloudPlatform/kubernetes — pull request #1241 by derekwaynecarr (2014-09-09 21:01:29+00:00)
Title: DO NOT MERGE: Namespace support (Part 1)

Assuming #1114 is accepted, this PR is attempting to provide the first stage of namespace support.

1. Introduce Namespace concept on affected resource types
2. Modify RESTStorage interface to be namespace-aware
3. Default our HTTP handlers to hard-code to always work in the "default" namespace for now
4. Keep unit tests functional

The idea is to keep our code-reviews in small enough chunks so they are understandable, and to get agreement on the initial pattern before taking on the additional work of:

1. Updating kubeclient to build namespace aware URIs
2. Updating kubecfg to set client specific ns
3. Updating etcd storage keys to use namespace

Right now, I treat ID as "Name" per the #1216 proposal, but I could rename it as part of this initial PR once things settle.

I am not certain if I like always passing into RESTStorage interface:

namespace string, id string

versus having an interface in the future like:
```
ResourceIdentifier{
Uid() string
Namespace() string
Name() string
}
```

Using that pattern would be nice, but it requires more work on the indexing solution because we would need the storage interface to be capable of building me ResourceIdentifier objects for my resource type based on either Namespace/Name or Uid, and conceptually it could automate the process of index-lookup to find the alternate field for me.