| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"flag" |
| 5 | 5 |
"time" |
| 6 | 6 |
|
| 7 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 7 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/verflag" |
| 10 | 10 |
"github.com/golang/glog" |
| ... | ... |
@@ -30,8 +30,8 @@ func main() {
|
| 30 | 30 |
glog.Fatal("usage: openshift-router -master <master>")
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 |
- config := &kubeclient.Config{Host: *master}
|
|
| 34 |
- kubeClient, err := kubeclient.New(config) |
|
| 33 |
+ config := &kclient.Config{Host: *master}
|
|
| 34 |
+ kubeClient, err := kclient.New(config) |
|
| 35 | 35 |
if err != nil {
|
| 36 | 36 |
glog.Fatalf("Invalid -master: %v", err)
|
| 37 | 37 |
} |
| ... | ... |
@@ -3,14 +3,14 @@ package validation |
| 3 | 3 |
import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
errs "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 8 | 8 |
"github.com/openshift/origin/pkg/build/api" |
| 9 | 9 |
) |
| 10 | 10 |
|
| 11 | 11 |
func TestBuildValdationSuccess(t *testing.T) {
|
| 12 | 12 |
build := &api.Build{
|
| 13 |
- TypeMeta: kubeapi.TypeMeta{ID: "buildId"},
|
|
| 13 |
+ TypeMeta: kapi.TypeMeta{ID: "buildId"},
|
|
| 14 | 14 |
Input: api.BuildInput{
|
| 15 | 15 |
SourceURI: "http://github.com/my/repository", |
| 16 | 16 |
ImageTag: "repository/data", |
| ... | ... |
@@ -24,7 +24,7 @@ func TestBuildValdationSuccess(t *testing.T) {
|
| 24 | 24 |
|
| 25 | 25 |
func TestBuildValidationFailure(t *testing.T) {
|
| 26 | 26 |
build := &api.Build{
|
| 27 |
- TypeMeta: kubeapi.TypeMeta{ID: ""},
|
|
| 27 |
+ TypeMeta: kapi.TypeMeta{ID: ""},
|
|
| 28 | 28 |
Input: api.BuildInput{
|
| 29 | 29 |
SourceURI: "http://github.com/my/repository", |
| 30 | 30 |
ImageTag: "repository/data", |
| ... | ... |
@@ -38,7 +38,7 @@ func TestBuildValidationFailure(t *testing.T) {
|
| 38 | 38 |
|
| 39 | 39 |
func TestBuildConfigValidationSuccess(t *testing.T) {
|
| 40 | 40 |
buildConfig := &api.BuildConfig{
|
| 41 |
- TypeMeta: kubeapi.TypeMeta{ID: "configId"},
|
|
| 41 |
+ TypeMeta: kapi.TypeMeta{ID: "configId"},
|
|
| 42 | 42 |
DesiredInput: api.BuildInput{
|
| 43 | 43 |
SourceURI: "http://github.com/my/repository", |
| 44 | 44 |
ImageTag: "repository/data", |
| ... | ... |
@@ -51,7 +51,7 @@ func TestBuildConfigValidationSuccess(t *testing.T) {
|
| 51 | 51 |
|
| 52 | 52 |
func TestBuildConfigValidationFailure(t *testing.T) {
|
| 53 | 53 |
buildConfig := &api.BuildConfig{
|
| 54 |
- TypeMeta: kubeapi.TypeMeta{ID: ""},
|
|
| 54 |
+ TypeMeta: kapi.TypeMeta{ID: ""},
|
|
| 55 | 55 |
DesiredInput: api.BuildInput{
|
| 56 | 56 |
SourceURI: "http://github.com/my/repository", |
| 57 | 57 |
ImageTag: "repository/data", |
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
"time" |
| 7 | 7 |
|
| 8 | 8 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 9 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 9 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
| 12 | 12 |
|
| ... | ... |
@@ -24,13 +24,13 @@ type BuildJobStrategy interface {
|
| 24 | 24 |
// BuildController watches build resources and manages their state |
| 25 | 25 |
type BuildController struct {
|
| 26 | 26 |
osClient osclient.Interface |
| 27 |
- kubeClient kubeclient.Interface |
|
| 27 |
+ kubeClient kclient.Interface |
|
| 28 | 28 |
buildStrategies map[api.BuildType]BuildJobStrategy |
| 29 | 29 |
timeout int |
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 | 32 |
// NewBuildController creates a new build controller |
| 33 |
-func NewBuildController(kc kubeclient.Interface, |
|
| 33 |
+func NewBuildController(kc kclient.Interface, |
|
| 34 | 34 |
oc osclient.Interface, |
| 35 | 35 |
strategies map[api.BuildType]BuildJobStrategy, |
| 36 | 36 |
timeout int) *BuildController {
|
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
"time" |
| 7 | 7 |
|
| 8 | 8 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 9 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 9 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 11 | 11 |
"github.com/openshift/origin/pkg/build/api" |
| 12 | 12 |
) |
| ... | ... |
@@ -44,7 +44,7 @@ func (_ *errStrategy) CreateBuildPod(build *api.Build) (*kapi.Pod, error) {
|
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
type errKubeClient struct {
|
| 47 |
- kubeclient.Fake |
|
| 47 |
+ kclient.Fake |
|
| 48 | 48 |
} |
| 49 | 49 |
|
| 50 | 50 |
func (_ *errKubeClient) CreatePod(ctx kapi.Context, pod *kapi.Pod) (*kapi.Pod, error) {
|
| ... | ... |
@@ -56,7 +56,7 @@ func (_ *errKubeClient) GetPod(ctx kapi.Context, name string) (*kapi.Pod, error) |
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
type errExistsKubeClient struct {
|
| 59 |
- kubeclient.Fake |
|
| 59 |
+ kclient.Fake |
|
| 60 | 60 |
} |
| 61 | 61 |
|
| 62 | 62 |
func (_ *errExistsKubeClient) CreatePod(ctx kapi.Context, pod *kapi.Pod) (*kapi.Pod, error) {
|
| ... | ... |
@@ -64,7 +64,7 @@ func (_ *errExistsKubeClient) CreatePod(ctx kapi.Context, pod *kapi.Pod) (*kapi. |
| 64 | 64 |
} |
| 65 | 65 |
|
| 66 | 66 |
type okKubeClient struct {
|
| 67 |
- kubeclient.Fake |
|
| 67 |
+ kclient.Fake |
|
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 | 70 |
func (_ *okKubeClient) GetPod(ctx kapi.Context, name string) (*kapi.Pod, error) {
|
| ... | ... |
@@ -74,7 +74,7 @@ func (_ *okKubeClient) GetPod(ctx kapi.Context, name string) (*kapi.Pod, error) |
| 74 | 74 |
} |
| 75 | 75 |
|
| 76 | 76 |
type termKubeClient struct {
|
| 77 |
- kubeclient.Fake |
|
| 77 |
+ kclient.Fake |
|
| 78 | 78 |
} |
| 79 | 79 |
|
| 80 | 80 |
func (_ *termKubeClient) GetPod(ctx kapi.Context, name string) (*kapi.Pod, error) {
|
| ... | ... |
@@ -277,7 +277,7 @@ func setup() (buildController *BuildController, build *api.Build, ctx kapi.Conte |
| 277 | 277 |
buildStrategies: map[api.BuildType]BuildJobStrategy{
|
| 278 | 278 |
api.DockerBuildType: &okStrategy{},
|
| 279 | 279 |
}, |
| 280 |
- kubeClient: &kubeclient.Fake{},
|
|
| 280 |
+ kubeClient: &kclient.Fake{},
|
|
| 281 | 281 |
timeout: 1000, |
| 282 | 282 |
} |
| 283 | 283 |
build = &api.Build{
|
| ... | ... |
@@ -10,10 +10,10 @@ import ( |
| 10 | 10 |
"testing" |
| 11 | 11 |
"time" |
| 12 | 12 |
|
| 13 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 13 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 14 | 14 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 15 | 15 |
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest" |
| 16 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 16 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 17 | 17 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 18 | 18 |
|
| 19 | 19 |
"github.com/openshift/origin/pkg/api/latest" |
| ... | ... |
@@ -35,7 +35,7 @@ func TestGetBuild(t *testing.T) {
|
| 35 | 35 |
expectedBuild := mockBuild() |
| 36 | 36 |
mockRegistry := test.BuildRegistry{Build: expectedBuild}
|
| 37 | 37 |
storage := REST{&mockRegistry}
|
| 38 |
- buildObj, err := storage.Get(kubeapi.NewDefaultContext(), "foo") |
|
| 38 |
+ buildObj, err := storage.Get(kapi.NewDefaultContext(), "foo") |
|
| 39 | 39 |
if err != nil {
|
| 40 | 40 |
t.Errorf("Unexpected error returned: %v", err)
|
| 41 | 41 |
} |
| ... | ... |
@@ -51,7 +51,7 @@ func TestGetBuild(t *testing.T) {
|
| 51 | 51 |
func TestGetBuildError(t *testing.T) {
|
| 52 | 52 |
mockRegistry := test.BuildRegistry{Err: fmt.Errorf("get error")}
|
| 53 | 53 |
storage := REST{&mockRegistry}
|
| 54 |
- buildObj, err := storage.Get(kubeapi.NewDefaultContext(), "foo") |
|
| 54 |
+ buildObj, err := storage.Get(kapi.NewDefaultContext(), "foo") |
|
| 55 | 55 |
if err != mockRegistry.Err {
|
| 56 | 56 |
t.Errorf("Expected %#v, Got %#v", mockRegistry.Err, err)
|
| 57 | 57 |
} |
| ... | ... |
@@ -64,17 +64,17 @@ func TestDeleteBuild(t *testing.T) {
|
| 64 | 64 |
mockRegistry := test.BuildRegistry{}
|
| 65 | 65 |
buildId := "test-build-id" |
| 66 | 66 |
storage := REST{&mockRegistry}
|
| 67 |
- channel, err := storage.Delete(kubeapi.NewDefaultContext(), buildId) |
|
| 67 |
+ channel, err := storage.Delete(kapi.NewDefaultContext(), buildId) |
|
| 68 | 68 |
if err != nil {
|
| 69 | 69 |
t.Errorf("Unexpected error when deleting: %v", err)
|
| 70 | 70 |
} |
| 71 | 71 |
select {
|
| 72 | 72 |
case result := <-channel: |
| 73 |
- status, ok := result.(*kubeapi.Status) |
|
| 73 |
+ status, ok := result.(*kapi.Status) |
|
| 74 | 74 |
if !ok {
|
| 75 | 75 |
t.Errorf("Unexpected operation result: %v", result)
|
| 76 | 76 |
} |
| 77 |
- if status.Status != kubeapi.StatusSuccess {
|
|
| 77 |
+ if status.Status != kapi.StatusSuccess {
|
|
| 78 | 78 |
t.Errorf("Unexpected failure status: %v", status)
|
| 79 | 79 |
} |
| 80 | 80 |
if mockRegistry.DeletedBuildId != buildId {
|
| ... | ... |
@@ -90,10 +90,10 @@ func TestDeleteBuildError(t *testing.T) {
|
| 90 | 90 |
mockRegistry := test.BuildRegistry{Err: fmt.Errorf("Delete error")}
|
| 91 | 91 |
buildId := "test-build-id" |
| 92 | 92 |
storage := REST{&mockRegistry}
|
| 93 |
- channel, _ := storage.Delete(kubeapi.NewDefaultContext(), buildId) |
|
| 93 |
+ channel, _ := storage.Delete(kapi.NewDefaultContext(), buildId) |
|
| 94 | 94 |
select {
|
| 95 | 95 |
case result := <-channel: |
| 96 |
- status, ok := result.(*kubeapi.Status) |
|
| 96 |
+ status, ok := result.(*kapi.Status) |
|
| 97 | 97 |
if !ok {
|
| 98 | 98 |
t.Errorf("Unexpected operation result: %#v", channel)
|
| 99 | 99 |
} |
| ... | ... |
@@ -110,7 +110,7 @@ func TestListBuildsError(t *testing.T) {
|
| 110 | 110 |
Err: fmt.Errorf("test error"),
|
| 111 | 111 |
} |
| 112 | 112 |
storage := REST{&mockRegistry}
|
| 113 |
- builds, err := storage.List(kubeapi.NewDefaultContext(), nil, nil) |
|
| 113 |
+ builds, err := storage.List(kapi.NewDefaultContext(), nil, nil) |
|
| 114 | 114 |
if err != mockRegistry.Err {
|
| 115 | 115 |
t.Errorf("Expected %#v, Got %#v", mockRegistry.Err, err)
|
| 116 | 116 |
} |
| ... | ... |
@@ -120,9 +120,9 @@ func TestListBuildsError(t *testing.T) {
|
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 | 122 |
func TestListEmptyBuildList(t *testing.T) {
|
| 123 |
- mockRegistry := test.BuildRegistry{Builds: &api.BuildList{TypeMeta: kubeapi.TypeMeta{ResourceVersion: "1"}}}
|
|
| 123 |
+ mockRegistry := test.BuildRegistry{Builds: &api.BuildList{TypeMeta: kapi.TypeMeta{ResourceVersion: "1"}}}
|
|
| 124 | 124 |
storage := REST{&mockRegistry}
|
| 125 |
- builds, err := storage.List(kubeapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 125 |
+ builds, err := storage.List(kapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 126 | 126 |
if err != nil {
|
| 127 | 127 |
t.Errorf("unexpected error: %v", err)
|
| 128 | 128 |
} |
| ... | ... |
@@ -140,12 +140,12 @@ func TestListBuilds(t *testing.T) {
|
| 140 | 140 |
Builds: &api.BuildList{
|
| 141 | 141 |
Items: []api.Build{
|
| 142 | 142 |
{
|
| 143 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 143 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 144 | 144 |
ID: "foo", |
| 145 | 145 |
}, |
| 146 | 146 |
}, |
| 147 | 147 |
{
|
| 148 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 148 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 149 | 149 |
ID: "bar", |
| 150 | 150 |
}, |
| 151 | 151 |
}, |
| ... | ... |
@@ -153,7 +153,7 @@ func TestListBuilds(t *testing.T) {
|
| 153 | 153 |
}, |
| 154 | 154 |
} |
| 155 | 155 |
storage := REST{registry: &mockRegistry}
|
| 156 |
- buildsObj, err := storage.List(kubeapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 156 |
+ buildsObj, err := storage.List(kapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 157 | 157 |
builds := buildsObj.(*api.BuildList) |
| 158 | 158 |
if err != nil {
|
| 159 | 159 |
t.Errorf("unexpected error: %v", err)
|
| ... | ... |
@@ -174,7 +174,7 @@ func TestBuildDecode(t *testing.T) {
|
| 174 | 174 |
mockRegistry := test.BuildRegistry{}
|
| 175 | 175 |
storage := REST{&mockRegistry}
|
| 176 | 176 |
build := &api.Build{
|
| 177 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 177 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 178 | 178 |
ID: "foo", |
| 179 | 179 |
}, |
| 180 | 180 |
} |
| ... | ... |
@@ -236,14 +236,14 @@ func TestCreateBuild(t *testing.T) {
|
| 236 | 236 |
mockRegistry := test.BuildRegistry{}
|
| 237 | 237 |
storage := REST{&mockRegistry}
|
| 238 | 238 |
build := mockBuild() |
| 239 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), build) |
|
| 239 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), build) |
|
| 240 | 240 |
if err != nil {
|
| 241 | 241 |
t.Errorf("unexpected error: %v", err)
|
| 242 | 242 |
} |
| 243 | 243 |
select {
|
| 244 | 244 |
case result := <-channel: |
| 245 | 245 |
switch obj := result.(type) {
|
| 246 |
- case *kubeapi.Status: |
|
| 246 |
+ case *kapi.Status: |
|
| 247 | 247 |
t.Errorf("Unexpected operation error: %v", obj)
|
| 248 | 248 |
|
| 249 | 249 |
case *api.Build: |
| ... | ... |
@@ -263,14 +263,14 @@ func TestUpdateBuild(t *testing.T) {
|
| 263 | 263 |
mockRegistry := test.BuildRegistry{}
|
| 264 | 264 |
storage := REST{&mockRegistry}
|
| 265 | 265 |
build := mockBuild() |
| 266 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), build) |
|
| 266 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), build) |
|
| 267 | 267 |
if err != nil {
|
| 268 | 268 |
t.Errorf("unexpected error: %v", err)
|
| 269 | 269 |
} |
| 270 | 270 |
select {
|
| 271 | 271 |
case result := <-channel: |
| 272 | 272 |
switch obj := result.(type) {
|
| 273 |
- case *kubeapi.Status: |
|
| 273 |
+ case *kapi.Status: |
|
| 274 | 274 |
t.Errorf("Unexpected operation error: %v", obj)
|
| 275 | 275 |
|
| 276 | 276 |
case *api.Build: |
| ... | ... |
@@ -290,14 +290,14 @@ func TestUpdateBuildError(t *testing.T) {
|
| 290 | 290 |
mockRegistry := test.BuildRegistry{Err: fmt.Errorf("Update error")}
|
| 291 | 291 |
storage := REST{&mockRegistry}
|
| 292 | 292 |
build := mockBuild() |
| 293 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), build) |
|
| 293 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), build) |
|
| 294 | 294 |
if err != nil {
|
| 295 | 295 |
t.Errorf("unexpected error: %v", err)
|
| 296 | 296 |
} |
| 297 | 297 |
select {
|
| 298 | 298 |
case result := <-channel: |
| 299 | 299 |
switch obj := result.(type) {
|
| 300 |
- case *kubeapi.Status: |
|
| 300 |
+ case *kapi.Status: |
|
| 301 | 301 |
if obj.Message != mockRegistry.Err.Error() {
|
| 302 | 302 |
t.Errorf("Unexpected error result: %v", obj)
|
| 303 | 303 |
} |
| ... | ... |
@@ -314,12 +314,12 @@ func TestBuildRESTValidatesCreate(t *testing.T) {
|
| 314 | 314 |
storage := REST{&mockRegistry}
|
| 315 | 315 |
failureCases := map[string]api.Build{
|
| 316 | 316 |
"empty input": {
|
| 317 |
- TypeMeta: kubeapi.TypeMeta{ID: "abc"},
|
|
| 317 |
+ TypeMeta: kapi.TypeMeta{ID: "abc"},
|
|
| 318 | 318 |
Input: api.BuildInput{},
|
| 319 | 319 |
}, |
| 320 | 320 |
} |
| 321 | 321 |
for desc, failureCase := range failureCases {
|
| 322 |
- c, err := storage.Create(kubeapi.NewDefaultContext(), &failureCase) |
|
| 322 |
+ c, err := storage.Create(kapi.NewDefaultContext(), &failureCase) |
|
| 323 | 323 |
if c != nil {
|
| 324 | 324 |
t.Errorf("%s: Expected nil channel", desc)
|
| 325 | 325 |
} |
| ... | ... |
@@ -334,19 +334,19 @@ func TestBuildRESTValidatesUpdate(t *testing.T) {
|
| 334 | 334 |
storage := REST{&mockRegistry}
|
| 335 | 335 |
failureCases := map[string]api.Build{
|
| 336 | 336 |
"empty ID": {
|
| 337 |
- TypeMeta: kubeapi.TypeMeta{ID: ""},
|
|
| 337 |
+ TypeMeta: kapi.TypeMeta{ID: ""},
|
|
| 338 | 338 |
Input: api.BuildInput{
|
| 339 | 339 |
SourceURI: "http://my.build.com/the/build/Dockerfile", |
| 340 | 340 |
ImageTag: "repository/dataBuild", |
| 341 | 341 |
}, |
| 342 | 342 |
}, |
| 343 | 343 |
"empty build input": {
|
| 344 |
- TypeMeta: kubeapi.TypeMeta{ID: "abc"},
|
|
| 344 |
+ TypeMeta: kapi.TypeMeta{ID: "abc"},
|
|
| 345 | 345 |
Input: api.BuildInput{},
|
| 346 | 346 |
}, |
| 347 | 347 |
} |
| 348 | 348 |
for desc, failureCase := range failureCases {
|
| 349 |
- c, err := storage.Update(kubeapi.NewDefaultContext(), &failureCase) |
|
| 349 |
+ c, err := storage.Update(kapi.NewDefaultContext(), &failureCase) |
|
| 350 | 350 |
if c != nil {
|
| 351 | 351 |
t.Errorf("%s: Expected nil channel", desc)
|
| 352 | 352 |
} |
| ... | ... |
@@ -358,9 +358,9 @@ func TestBuildRESTValidatesUpdate(t *testing.T) {
|
| 358 | 358 |
|
| 359 | 359 |
func mockBuild() *api.Build {
|
| 360 | 360 |
return &api.Build{
|
| 361 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 361 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 362 | 362 |
ID: "dataBuild", |
| 363 |
- Namespace: kubeapi.NamespaceDefault, |
|
| 363 |
+ Namespace: kapi.NamespaceDefault, |
|
| 364 | 364 |
}, |
| 365 | 365 |
Input: api.BuildInput{
|
| 366 | 366 |
SourceURI: "http://my.build.com/the/build/Dockerfile", |
| ... | ... |
@@ -377,8 +377,8 @@ func mockBuild() *api.Build {
|
| 377 | 377 |
func TestCreateBuildConflictingNamespace(t *testing.T) {
|
| 378 | 378 |
storage := REST{}
|
| 379 | 379 |
|
| 380 |
- channel, err := storage.Create(kubeapi.WithNamespace(kubeapi.NewContext(), "legal-name"), &api.Build{
|
|
| 381 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo", Namespace: "some-value"},
|
|
| 380 |
+ channel, err := storage.Create(kapi.WithNamespace(kapi.NewContext(), "legal-name"), &api.Build{
|
|
| 381 |
+ TypeMeta: kapi.TypeMeta{ID: "foo", Namespace: "some-value"},
|
|
| 382 | 382 |
}) |
| 383 | 383 |
|
| 384 | 384 |
if channel != nil {
|
| ... | ... |
@@ -393,7 +393,7 @@ func TestUpdateBuildConflictingNamespace(t *testing.T) {
|
| 393 | 393 |
storage := REST{&mockRegistry}
|
| 394 | 394 |
|
| 395 | 395 |
build := mockBuild() |
| 396 |
- channel, err := storage.Update(kubeapi.WithNamespace(kubeapi.NewContext(), "legal-name"), build) |
|
| 396 |
+ channel, err := storage.Update(kapi.WithNamespace(kapi.NewContext(), "legal-name"), build) |
|
| 397 | 397 |
|
| 398 | 398 |
if channel != nil {
|
| 399 | 399 |
t.Error("Expected a nil channel, but we got a value")
|
| ... | ... |
@@ -407,7 +407,7 @@ func checkExpectedNamespaceError(t *testing.T, err error) {
|
| 407 | 407 |
if err == nil {
|
| 408 | 408 |
t.Errorf("Expected '" + expectedError + "', but we didn't get one")
|
| 409 | 409 |
} else {
|
| 410 |
- e, ok := err.(kubeclient.APIStatus) |
|
| 410 |
+ e, ok := err.(kclient.APIStatus) |
|
| 411 | 411 |
if !ok {
|
| 412 | 412 |
t.Errorf("error was not a statusError: %v", err)
|
| 413 | 413 |
} |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package buildconfig |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 6 | 6 |
"github.com/openshift/origin/pkg/build/api" |
| 7 | 7 |
) |
| ... | ... |
@@ -9,13 +9,13 @@ import ( |
| 9 | 9 |
// Registry is an interface for things that know how to store BuildConfigs. |
| 10 | 10 |
type Registry interface {
|
| 11 | 11 |
// ListBuildConfigs obtains list of buildConfigs that match a selector. |
| 12 |
- ListBuildConfigs(ctx kubeapi.Context, labels labels.Selector) (*api.BuildConfigList, error) |
|
| 12 |
+ ListBuildConfigs(ctx kapi.Context, labels labels.Selector) (*api.BuildConfigList, error) |
|
| 13 | 13 |
// GetBuildConfig retrieves a specific buildConfig. |
| 14 |
- GetBuildConfig(ctx kubeapi.Context, id string) (*api.BuildConfig, error) |
|
| 14 |
+ GetBuildConfig(ctx kapi.Context, id string) (*api.BuildConfig, error) |
|
| 15 | 15 |
// CreateBuildConfig creates a new buildConfig. |
| 16 |
- CreateBuildConfig(ctx kubeapi.Context, buildConfig *api.BuildConfig) error |
|
| 16 |
+ CreateBuildConfig(ctx kapi.Context, buildConfig *api.BuildConfig) error |
|
| 17 | 17 |
// UpdateBuildConfig updates a buildConfig. |
| 18 |
- UpdateBuildConfig(ctx kubeapi.Context, buildConfig *api.BuildConfig) error |
|
| 18 |
+ UpdateBuildConfig(ctx kapi.Context, buildConfig *api.BuildConfig) error |
|
| 19 | 19 |
// DeleteBuildConfig deletes a buildConfig. |
| 20 |
- DeleteBuildConfig(ctx kubeapi.Context, id string) error |
|
| 20 |
+ DeleteBuildConfig(ctx kapi.Context, id string) error |
|
| 21 | 21 |
} |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 | 6 |
"code.google.com/p/go-uuid/uuid" |
| 7 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| ... | ... |
@@ -31,7 +31,7 @@ func (r *REST) New() runtime.Object {
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 | 33 |
// List obtains a list of BuildConfigs that match selector. |
| 34 |
-func (r *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 34 |
+func (r *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 35 | 35 |
builds, err := r.registry.ListBuildConfigs(ctx, selector) |
| 36 | 36 |
if err != nil {
|
| 37 | 37 |
return nil, err |
| ... | ... |
@@ -40,7 +40,7 @@ func (r *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runt |
| 40 | 40 |
} |
| 41 | 41 |
|
| 42 | 42 |
// Get obtains the BuildConfig specified by its id. |
| 43 |
-func (r *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 43 |
+func (r *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 44 | 44 |
buildConfig, err := r.registry.GetBuildConfig(ctx, id) |
| 45 | 45 |
if err != nil {
|
| 46 | 46 |
return nil, err |
| ... | ... |
@@ -49,19 +49,19 @@ func (r *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
// Delete asynchronously deletes the BuildConfig specified by its id. |
| 52 |
-func (r *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 52 |
+func (r *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 53 | 53 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| 54 |
- return &kubeapi.Status{Status: kubeapi.StatusSuccess}, r.registry.DeleteBuildConfig(ctx, id)
|
|
| 54 |
+ return &kapi.Status{Status: kapi.StatusSuccess}, r.registry.DeleteBuildConfig(ctx, id)
|
|
| 55 | 55 |
}), nil |
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
// Create registers a given new BuildConfig instance to r.registry. |
| 59 |
-func (r *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 59 |
+func (r *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 60 | 60 |
buildConfig, ok := obj.(*api.BuildConfig) |
| 61 | 61 |
if !ok {
|
| 62 | 62 |
return nil, fmt.Errorf("not a buildConfig: %#v", obj)
|
| 63 | 63 |
} |
| 64 |
- if !kubeapi.ValidNamespace(ctx, &buildConfig.TypeMeta) {
|
|
| 64 |
+ if !kapi.ValidNamespace(ctx, &buildConfig.TypeMeta) {
|
|
| 65 | 65 |
return nil, errors.NewConflict("buildConfig", buildConfig.Namespace, fmt.Errorf("BuildConfig.Namespace does not match the provided context"))
|
| 66 | 66 |
} |
| 67 | 67 |
|
| ... | ... |
@@ -82,7 +82,7 @@ func (r *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 82 | 82 |
} |
| 83 | 83 |
|
| 84 | 84 |
// Update replaces a given BuildConfig instance with an existing instance in r.registry. |
| 85 |
-func (r *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 85 |
+func (r *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 86 | 86 |
buildConfig, ok := obj.(*api.BuildConfig) |
| 87 | 87 |
if !ok {
|
| 88 | 88 |
return nil, fmt.Errorf("not a buildConfig: %#v", obj)
|
| ... | ... |
@@ -90,7 +90,7 @@ func (r *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 90 | 90 |
if errs := validation.ValidateBuildConfig(buildConfig); len(errs) > 0 {
|
| 91 | 91 |
return nil, errors.NewInvalid("buildConfig", buildConfig.ID, errs)
|
| 92 | 92 |
} |
| 93 |
- if !kubeapi.ValidNamespace(ctx, &buildConfig.TypeMeta) {
|
|
| 93 |
+ if !kapi.ValidNamespace(ctx, &buildConfig.TypeMeta) {
|
|
| 94 | 94 |
return nil, errors.NewConflict("buildConfig", buildConfig.Namespace, fmt.Errorf("BuildConfig.Namespace does not match the provided context"))
|
| 95 | 95 |
} |
| 96 | 96 |
|
| ... | ... |
@@ -10,10 +10,10 @@ import ( |
| 10 | 10 |
"testing" |
| 11 | 11 |
"time" |
| 12 | 12 |
|
| 13 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 13 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 14 | 14 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 15 | 15 |
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1" |
| 16 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 16 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 17 | 17 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 18 | 18 |
|
| 19 | 19 |
"github.com/openshift/origin/pkg/api/latest" |
| ... | ... |
@@ -35,7 +35,7 @@ func TestGetConfig(t *testing.T) {
|
| 35 | 35 |
expectedConfig := mockBuildConfig() |
| 36 | 36 |
mockRegistry := test.BuildConfigRegistry{BuildConfig: expectedConfig}
|
| 37 | 37 |
storage := REST{&mockRegistry}
|
| 38 |
- configObj, err := storage.Get(kubeapi.NewDefaultContext(), "foo") |
|
| 38 |
+ configObj, err := storage.Get(kapi.NewDefaultContext(), "foo") |
|
| 39 | 39 |
if err != nil {
|
| 40 | 40 |
t.Errorf("Unexpected error returned: %v", err)
|
| 41 | 41 |
} |
| ... | ... |
@@ -51,7 +51,7 @@ func TestGetConfig(t *testing.T) {
|
| 51 | 51 |
func TestGetConfigError(t *testing.T) {
|
| 52 | 52 |
mockRegistry := test.BuildConfigRegistry{Err: fmt.Errorf("get error")}
|
| 53 | 53 |
storage := REST{&mockRegistry}
|
| 54 |
- buildObj, err := storage.Get(kubeapi.NewDefaultContext(), "foo") |
|
| 54 |
+ buildObj, err := storage.Get(kapi.NewDefaultContext(), "foo") |
|
| 55 | 55 |
if err != mockRegistry.Err {
|
| 56 | 56 |
t.Errorf("Expected %#v, Got %#v", mockRegistry.Err, err)
|
| 57 | 57 |
} |
| ... | ... |
@@ -64,17 +64,17 @@ func TestDeleteBuild(t *testing.T) {
|
| 64 | 64 |
mockRegistry := test.BuildConfigRegistry{}
|
| 65 | 65 |
configId := "test-config-id" |
| 66 | 66 |
storage := REST{&mockRegistry}
|
| 67 |
- channel, err := storage.Delete(kubeapi.NewDefaultContext(), configId) |
|
| 67 |
+ channel, err := storage.Delete(kapi.NewDefaultContext(), configId) |
|
| 68 | 68 |
if err != nil {
|
| 69 | 69 |
t.Errorf("Unexpected error when deleting: %v", err)
|
| 70 | 70 |
} |
| 71 | 71 |
select {
|
| 72 | 72 |
case result := <-channel: |
| 73 |
- status, ok := result.(*kubeapi.Status) |
|
| 73 |
+ status, ok := result.(*kapi.Status) |
|
| 74 | 74 |
if !ok {
|
| 75 | 75 |
t.Errorf("Unexpected operation result: %v", result)
|
| 76 | 76 |
} |
| 77 |
- if status.Status != kubeapi.StatusSuccess {
|
|
| 77 |
+ if status.Status != kapi.StatusSuccess {
|
|
| 78 | 78 |
t.Errorf("Unexpected failure status: %v", status)
|
| 79 | 79 |
} |
| 80 | 80 |
if mockRegistry.DeletedConfigId != configId {
|
| ... | ... |
@@ -90,10 +90,10 @@ func TestDeleteBuildError(t *testing.T) {
|
| 90 | 90 |
mockRegistry := test.BuildConfigRegistry{Err: fmt.Errorf("Delete error")}
|
| 91 | 91 |
configId := "test-config-id" |
| 92 | 92 |
storage := REST{&mockRegistry}
|
| 93 |
- channel, _ := storage.Delete(kubeapi.NewDefaultContext(), configId) |
|
| 93 |
+ channel, _ := storage.Delete(kapi.NewDefaultContext(), configId) |
|
| 94 | 94 |
select {
|
| 95 | 95 |
case result := <-channel: |
| 96 |
- status, ok := result.(*kubeapi.Status) |
|
| 96 |
+ status, ok := result.(*kapi.Status) |
|
| 97 | 97 |
if !ok {
|
| 98 | 98 |
t.Errorf("Unexpected operation result: %#v", channel)
|
| 99 | 99 |
} |
| ... | ... |
@@ -110,7 +110,7 @@ func TestListConfigsError(t *testing.T) {
|
| 110 | 110 |
Err: fmt.Errorf("test error"),
|
| 111 | 111 |
} |
| 112 | 112 |
storage := REST{&mockRegistry}
|
| 113 |
- configs, err := storage.List(kubeapi.NewDefaultContext(), nil, nil) |
|
| 113 |
+ configs, err := storage.List(kapi.NewDefaultContext(), nil, nil) |
|
| 114 | 114 |
if err != mockRegistry.Err {
|
| 115 | 115 |
t.Errorf("Expected %#v, Got %#v", mockRegistry.Err, err)
|
| 116 | 116 |
} |
| ... | ... |
@@ -120,9 +120,9 @@ func TestListConfigsError(t *testing.T) {
|
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 | 122 |
func TestListEmptyConfigList(t *testing.T) {
|
| 123 |
- mockRegistry := test.BuildConfigRegistry{BuildConfigs: &api.BuildConfigList{TypeMeta: kubeapi.TypeMeta{ResourceVersion: "1"}}}
|
|
| 123 |
+ mockRegistry := test.BuildConfigRegistry{BuildConfigs: &api.BuildConfigList{TypeMeta: kapi.TypeMeta{ResourceVersion: "1"}}}
|
|
| 124 | 124 |
storage := REST{&mockRegistry}
|
| 125 |
- buildConfigs, err := storage.List(kubeapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 125 |
+ buildConfigs, err := storage.List(kapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 126 | 126 |
if err != nil {
|
| 127 | 127 |
t.Errorf("unexpected error: %v", err)
|
| 128 | 128 |
} |
| ... | ... |
@@ -140,12 +140,12 @@ func TestListConfigs(t *testing.T) {
|
| 140 | 140 |
BuildConfigs: &api.BuildConfigList{
|
| 141 | 141 |
Items: []api.BuildConfig{
|
| 142 | 142 |
{
|
| 143 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 143 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 144 | 144 |
ID: "foo", |
| 145 | 145 |
}, |
| 146 | 146 |
}, |
| 147 | 147 |
{
|
| 148 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 148 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 149 | 149 |
ID: "bar", |
| 150 | 150 |
}, |
| 151 | 151 |
}, |
| ... | ... |
@@ -153,7 +153,7 @@ func TestListConfigs(t *testing.T) {
|
| 153 | 153 |
}, |
| 154 | 154 |
} |
| 155 | 155 |
storage := REST{&mockRegistry}
|
| 156 |
- configsObj, err := storage.List(kubeapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 156 |
+ configsObj, err := storage.List(kapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 157 | 157 |
configs := configsObj.(*api.BuildConfigList) |
| 158 | 158 |
if err != nil {
|
| 159 | 159 |
t.Errorf("unexpected error: %v", err)
|
| ... | ... |
@@ -173,7 +173,7 @@ func TestBuildConfigDecode(t *testing.T) {
|
| 173 | 173 |
mockRegistry := test.BuildConfigRegistry{}
|
| 174 | 174 |
storage := REST{registry: &mockRegistry}
|
| 175 | 175 |
buildConfig := &api.BuildConfig{
|
| 176 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 176 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 177 | 177 |
ID: "foo", |
| 178 | 178 |
}, |
| 179 | 179 |
} |
| ... | ... |
@@ -235,7 +235,7 @@ func TestCreateBuildConfig(t *testing.T) {
|
| 235 | 235 |
mockRegistry := test.BuildConfigRegistry{}
|
| 236 | 236 |
storage := REST{&mockRegistry}
|
| 237 | 237 |
buildConfig := mockBuildConfig() |
| 238 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), buildConfig) |
|
| 238 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), buildConfig) |
|
| 239 | 239 |
if err != nil {
|
| 240 | 240 |
t.Fatalf("Unexpected error: %v", err)
|
| 241 | 241 |
} |
| ... | ... |
@@ -253,9 +253,9 @@ func TestCreateBuildConfig(t *testing.T) {
|
| 253 | 253 |
|
| 254 | 254 |
func mockBuildConfig() *api.BuildConfig {
|
| 255 | 255 |
return &api.BuildConfig{
|
| 256 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 256 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 257 | 257 |
ID: "dataBuild", |
| 258 |
- Namespace: kubeapi.NamespaceDefault, |
|
| 258 |
+ Namespace: kapi.NamespaceDefault, |
|
| 259 | 259 |
}, |
| 260 | 260 |
DesiredInput: api.BuildInput{
|
| 261 | 261 |
SourceURI: "http://my.build.com/the/buildConfig/Dockerfile", |
| ... | ... |
@@ -271,14 +271,14 @@ func TestUpdateBuildConfig(t *testing.T) {
|
| 271 | 271 |
mockRegistry := test.BuildConfigRegistry{}
|
| 272 | 272 |
storage := REST{&mockRegistry}
|
| 273 | 273 |
buildConfig := mockBuildConfig() |
| 274 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), buildConfig) |
|
| 274 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), buildConfig) |
|
| 275 | 275 |
if err != nil {
|
| 276 | 276 |
t.Errorf("unexpected error: %v", err)
|
| 277 | 277 |
} |
| 278 | 278 |
select {
|
| 279 | 279 |
case result := <-channel: |
| 280 | 280 |
switch obj := result.(type) {
|
| 281 |
- case *kubeapi.Status: |
|
| 281 |
+ case *kapi.Status: |
|
| 282 | 282 |
t.Errorf("Unexpected operation error: %v", obj)
|
| 283 | 283 |
|
| 284 | 284 |
case *api.BuildConfig: |
| ... | ... |
@@ -298,14 +298,14 @@ func TestUpdateBuildConfigError(t *testing.T) {
|
| 298 | 298 |
mockRegistry := test.BuildConfigRegistry{Err: fmt.Errorf("Update error")}
|
| 299 | 299 |
storage := REST{&mockRegistry}
|
| 300 | 300 |
buildConfig := mockBuildConfig() |
| 301 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), buildConfig) |
|
| 301 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), buildConfig) |
|
| 302 | 302 |
if err != nil {
|
| 303 | 303 |
t.Errorf("unexpected error: %v", err)
|
| 304 | 304 |
} |
| 305 | 305 |
select {
|
| 306 | 306 |
case result := <-channel: |
| 307 | 307 |
switch obj := result.(type) {
|
| 308 |
- case *kubeapi.Status: |
|
| 308 |
+ case *kapi.Status: |
|
| 309 | 309 |
if obj.Message != mockRegistry.Err.Error() {
|
| 310 | 310 |
t.Errorf("Unexpected error result: %v", obj)
|
| 311 | 311 |
} |
| ... | ... |
@@ -322,7 +322,7 @@ func TestBuildConfigRESTValidatesCreate(t *testing.T) {
|
| 322 | 322 |
storage := REST{&mockRegistry}
|
| 323 | 323 |
failureCases := map[string]api.BuildConfig{
|
| 324 | 324 |
"blank sourceURI": {
|
| 325 |
- TypeMeta: kubeapi.TypeMeta{ID: "abc"},
|
|
| 325 |
+ TypeMeta: kapi.TypeMeta{ID: "abc"},
|
|
| 326 | 326 |
DesiredInput: api.BuildInput{
|
| 327 | 327 |
SourceURI: "", |
| 328 | 328 |
ImageTag: "data/image", |
| ... | ... |
@@ -332,14 +332,14 @@ func TestBuildConfigRESTValidatesCreate(t *testing.T) {
|
| 332 | 332 |
}, |
| 333 | 333 |
}, |
| 334 | 334 |
"blank ImageTag": {
|
| 335 |
- TypeMeta: kubeapi.TypeMeta{ID: "abc"},
|
|
| 335 |
+ TypeMeta: kapi.TypeMeta{ID: "abc"},
|
|
| 336 | 336 |
DesiredInput: api.BuildInput{
|
| 337 | 337 |
SourceURI: "http://github.com/test/source", |
| 338 | 338 |
ImageTag: "", |
| 339 | 339 |
}, |
| 340 | 340 |
}, |
| 341 | 341 |
"blank BuilderImage": {
|
| 342 |
- TypeMeta: kubeapi.TypeMeta{ID: "abc"},
|
|
| 342 |
+ TypeMeta: kapi.TypeMeta{ID: "abc"},
|
|
| 343 | 343 |
DesiredInput: api.BuildInput{
|
| 344 | 344 |
SourceURI: "http://github.com/test/source", |
| 345 | 345 |
ImageTag: "data/image", |
| ... | ... |
@@ -350,7 +350,7 @@ func TestBuildConfigRESTValidatesCreate(t *testing.T) {
|
| 350 | 350 |
}, |
| 351 | 351 |
} |
| 352 | 352 |
for desc, failureCase := range failureCases {
|
| 353 |
- c, err := storage.Create(kubeapi.NewDefaultContext(), &failureCase) |
|
| 353 |
+ c, err := storage.Create(kapi.NewDefaultContext(), &failureCase) |
|
| 354 | 354 |
if c != nil {
|
| 355 | 355 |
t.Errorf("%s: Expected nil channel", desc)
|
| 356 | 356 |
} |
| ... | ... |
@@ -365,14 +365,14 @@ func TestBuildRESTValidatesUpdate(t *testing.T) {
|
| 365 | 365 |
storage := REST{&mockRegistry}
|
| 366 | 366 |
failureCases := map[string]api.BuildConfig{
|
| 367 | 367 |
"empty ID": {
|
| 368 |
- TypeMeta: kubeapi.TypeMeta{ID: ""},
|
|
| 368 |
+ TypeMeta: kapi.TypeMeta{ID: ""},
|
|
| 369 | 369 |
DesiredInput: api.BuildInput{
|
| 370 | 370 |
SourceURI: "http://github.com/test/source", |
| 371 | 371 |
ImageTag: "data/image", |
| 372 | 372 |
}, |
| 373 | 373 |
}, |
| 374 | 374 |
"blank sourceURI": {
|
| 375 |
- TypeMeta: kubeapi.TypeMeta{ID: "abc"},
|
|
| 375 |
+ TypeMeta: kapi.TypeMeta{ID: "abc"},
|
|
| 376 | 376 |
DesiredInput: api.BuildInput{
|
| 377 | 377 |
SourceURI: "", |
| 378 | 378 |
ImageTag: "data/image", |
| ... | ... |
@@ -382,14 +382,14 @@ func TestBuildRESTValidatesUpdate(t *testing.T) {
|
| 382 | 382 |
}, |
| 383 | 383 |
}, |
| 384 | 384 |
"blank ImageTag": {
|
| 385 |
- TypeMeta: kubeapi.TypeMeta{ID: "abc"},
|
|
| 385 |
+ TypeMeta: kapi.TypeMeta{ID: "abc"},
|
|
| 386 | 386 |
DesiredInput: api.BuildInput{
|
| 387 | 387 |
SourceURI: "http://github.com/test/source", |
| 388 | 388 |
ImageTag: "", |
| 389 | 389 |
}, |
| 390 | 390 |
}, |
| 391 | 391 |
"blank BuilderImage on STIBuildType": {
|
| 392 |
- TypeMeta: kubeapi.TypeMeta{ID: "abc"},
|
|
| 392 |
+ TypeMeta: kapi.TypeMeta{ID: "abc"},
|
|
| 393 | 393 |
DesiredInput: api.BuildInput{
|
| 394 | 394 |
SourceURI: "http://github.com/test/source", |
| 395 | 395 |
ImageTag: "data/image", |
| ... | ... |
@@ -400,7 +400,7 @@ func TestBuildRESTValidatesUpdate(t *testing.T) {
|
| 400 | 400 |
}, |
| 401 | 401 |
} |
| 402 | 402 |
for desc, failureCase := range failureCases {
|
| 403 |
- c, err := storage.Update(kubeapi.NewDefaultContext(), &failureCase) |
|
| 403 |
+ c, err := storage.Update(kapi.NewDefaultContext(), &failureCase) |
|
| 404 | 404 |
if c != nil {
|
| 405 | 405 |
t.Errorf("%s: Expected nil channel", desc)
|
| 406 | 406 |
} |
| ... | ... |
@@ -413,8 +413,8 @@ func TestBuildRESTValidatesUpdate(t *testing.T) {
|
| 413 | 413 |
func TestCreateBuildConfigConflictingNamespace(t *testing.T) {
|
| 414 | 414 |
storage := REST{}
|
| 415 | 415 |
|
| 416 |
- channel, err := storage.Create(kubeapi.WithNamespace(kubeapi.NewContext(), "legal-name"), &api.BuildConfig{
|
|
| 417 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo", Namespace: "some-value"},
|
|
| 416 |
+ channel, err := storage.Create(kapi.WithNamespace(kapi.NewContext(), "legal-name"), &api.BuildConfig{
|
|
| 417 |
+ TypeMeta: kapi.TypeMeta{ID: "foo", Namespace: "some-value"},
|
|
| 418 | 418 |
}) |
| 419 | 419 |
|
| 420 | 420 |
if channel != nil {
|
| ... | ... |
@@ -429,7 +429,7 @@ func TestUpdateBuildConfigConflictingNamespace(t *testing.T) {
|
| 429 | 429 |
storage := REST{&mockRegistry}
|
| 430 | 430 |
|
| 431 | 431 |
buildConfig := mockBuildConfig() |
| 432 |
- channel, err := storage.Update(kubeapi.WithNamespace(kubeapi.NewContext(), "legal-name"), buildConfig) |
|
| 432 |
+ channel, err := storage.Update(kapi.WithNamespace(kapi.NewContext(), "legal-name"), buildConfig) |
|
| 433 | 433 |
|
| 434 | 434 |
if channel != nil {
|
| 435 | 435 |
t.Error("Expected a nil channel, but we got a value")
|
| ... | ... |
@@ -443,7 +443,7 @@ func checkExpectedNamespaceError(t *testing.T, err error) {
|
| 443 | 443 |
if err == nil {
|
| 444 | 444 |
t.Errorf("Expected '" + expectedError + "', but we didn't get one")
|
| 445 | 445 |
} else {
|
| 446 |
- e, ok := err.(kubeclient.APIStatus) |
|
| 446 |
+ e, ok := err.(kclient.APIStatus) |
|
| 447 | 447 |
if !ok {
|
| 448 | 448 |
t.Errorf("error was not a statusError: %v", err)
|
| 449 | 449 |
} |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"net/url" |
| 6 | 6 |
|
| 7 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| ... | ... |
@@ -33,7 +33,7 @@ func NewREST(b build.Registry, c client.PodInterface, p string) apiserver.RESTSt |
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 | 35 |
// Redirector implementation |
| 36 |
-func (r *REST) ResourceLocation(ctx kubeapi.Context, id string) (string, error) {
|
|
| 36 |
+func (r *REST) ResourceLocation(ctx kapi.Context, id string) (string, error) {
|
|
| 37 | 37 |
build, err := r.BuildRegistry.GetBuild(ctx, id) |
| 38 | 38 |
if err != nil {
|
| 39 | 39 |
return "", fmt.Errorf("No such build")
|
| ... | ... |
@@ -60,7 +60,7 @@ func (r *REST) ResourceLocation(ctx kubeapi.Context, id string) (string, error) |
| 60 | 60 |
return location.String(), nil |
| 61 | 61 |
} |
| 62 | 62 |
|
| 63 |
-func (r *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 63 |
+func (r *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 64 | 64 |
return nil, fmt.Errorf("BuildLog can't be retrieved")
|
| 65 | 65 |
} |
| 66 | 66 |
|
| ... | ... |
@@ -68,18 +68,18 @@ func (r *REST) New() runtime.Object {
|
| 68 | 68 |
return nil |
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 |
-func (r *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 71 |
+func (r *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 72 | 72 |
return nil, fmt.Errorf("BuildLog can't be listed")
|
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 |
-func (r *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 75 |
+func (r *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 76 | 76 |
return nil, fmt.Errorf("BuildLog can't be deleted")
|
| 77 | 77 |
} |
| 78 | 78 |
|
| 79 |
-func (r *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 79 |
+func (r *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 80 | 80 |
return nil, fmt.Errorf("BuildLog can't be created")
|
| 81 | 81 |
} |
| 82 | 82 |
|
| 83 |
-func (r *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 83 |
+func (r *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 84 | 84 |
return nil, fmt.Errorf("BuildLog can't be updated")
|
| 85 | 85 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package buildlog |
| 3 | 3 |
import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 9 | 9 |
|
| ... | ... |
@@ -14,39 +14,39 @@ import ( |
| 14 | 14 |
type podClient struct {
|
| 15 | 15 |
} |
| 16 | 16 |
|
| 17 |
-func (p *podClient) ListPods(ctx kubeapi.Context, selector labels.Selector) (*kubeapi.PodList, error) {
|
|
| 17 |
+func (p *podClient) ListPods(ctx kapi.Context, selector labels.Selector) (*kapi.PodList, error) {
|
|
| 18 | 18 |
return nil, nil |
| 19 | 19 |
} |
| 20 | 20 |
|
| 21 |
-func (p *podClient) GetPod(ctx kubeapi.Context, id string) (*kubeapi.Pod, error) {
|
|
| 22 |
- pod := &kubeapi.Pod{
|
|
| 23 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 24 |
- DesiredState: kubeapi.PodState{
|
|
| 25 |
- Manifest: kubeapi.ContainerManifest{
|
|
| 21 |
+func (p *podClient) GetPod(ctx kapi.Context, id string) (*kapi.Pod, error) {
|
|
| 22 |
+ pod := &kapi.Pod{
|
|
| 23 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 24 |
+ DesiredState: kapi.PodState{
|
|
| 25 |
+ Manifest: kapi.ContainerManifest{
|
|
| 26 | 26 |
Version: "v1beta1", |
| 27 |
- Containers: []kubeapi.Container{
|
|
| 27 |
+ Containers: []kapi.Container{
|
|
| 28 | 28 |
{
|
| 29 | 29 |
Name: "foo-container", |
| 30 | 30 |
}, |
| 31 | 31 |
}, |
| 32 | 32 |
}, |
| 33 | 33 |
}, |
| 34 |
- CurrentState: kubeapi.PodState{
|
|
| 34 |
+ CurrentState: kapi.PodState{
|
|
| 35 | 35 |
Host: "foo-host", |
| 36 | 36 |
}, |
| 37 | 37 |
} |
| 38 | 38 |
return pod, nil |
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 |
-func (p *podClient) DeletePod(ctx kubeapi.Context, id string) error {
|
|
| 41 |
+func (p *podClient) DeletePod(ctx kapi.Context, id string) error {
|
|
| 42 | 42 |
return nil |
| 43 | 43 |
} |
| 44 | 44 |
|
| 45 |
-func (p *podClient) CreatePod(ctx kubeapi.Context, pod *kubeapi.Pod) (*kubeapi.Pod, error) {
|
|
| 45 |
+func (p *podClient) CreatePod(ctx kapi.Context, pod *kapi.Pod) (*kapi.Pod, error) {
|
|
| 46 | 46 |
return nil, nil |
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 |
-func (p *podClient) UpdatePod(ctx kubeapi.Context, pod *kubeapi.Pod) (*kubeapi.Pod, error) {
|
|
| 49 |
+func (p *podClient) UpdatePod(ctx kapi.Context, pod *kapi.Pod) (*kapi.Pod, error) {
|
|
| 50 | 50 |
return nil, nil |
| 51 | 51 |
} |
| 52 | 52 |
|
| ... | ... |
@@ -56,7 +56,7 @@ func TestRegistryResourceLocation(t *testing.T) {
|
| 56 | 56 |
api.BuildRunning: "/proxy/minion/foo-host/containerLogs/foo-pod/foo-container?follow=1", |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 |
- ctx := kubeapi.NewDefaultContext() |
|
| 59 |
+ ctx := kapi.NewDefaultContext() |
|
| 60 | 60 |
proxyPrefix := "/proxy/minion" |
| 61 | 61 |
|
| 62 | 62 |
for buildStatus, expectedLocation := range expectedLocations {
|
| ... | ... |
@@ -76,7 +76,7 @@ func TestRegistryResourceLocation(t *testing.T) {
|
| 76 | 76 |
|
| 77 | 77 |
func mockBuild(buildStatus api.BuildStatus) *api.Build {
|
| 78 | 78 |
return &api.Build{
|
| 79 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 79 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 80 | 80 |
ID: "foo-build", |
| 81 | 81 |
}, |
| 82 | 82 |
Status: buildStatus, |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package test |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 6 | 6 |
"github.com/openshift/origin/pkg/build/api" |
| 7 | 7 |
) |
| ... | ... |
@@ -13,23 +13,23 @@ type BuildConfigRegistry struct {
|
| 13 | 13 |
DeletedConfigId string |
| 14 | 14 |
} |
| 15 | 15 |
|
| 16 |
-func (r *BuildConfigRegistry) ListBuildConfigs(ctx kubeapi.Context, labels labels.Selector) (*api.BuildConfigList, error) {
|
|
| 16 |
+func (r *BuildConfigRegistry) ListBuildConfigs(ctx kapi.Context, labels labels.Selector) (*api.BuildConfigList, error) {
|
|
| 17 | 17 |
return r.BuildConfigs, r.Err |
| 18 | 18 |
} |
| 19 | 19 |
|
| 20 |
-func (r *BuildConfigRegistry) GetBuildConfig(ctx kubeapi.Context, id string) (*api.BuildConfig, error) {
|
|
| 20 |
+func (r *BuildConfigRegistry) GetBuildConfig(ctx kapi.Context, id string) (*api.BuildConfig, error) {
|
|
| 21 | 21 |
return r.BuildConfig, r.Err |
| 22 | 22 |
} |
| 23 | 23 |
|
| 24 |
-func (r *BuildConfigRegistry) CreateBuildConfig(ctx kubeapi.Context, config *api.BuildConfig) error {
|
|
| 24 |
+func (r *BuildConfigRegistry) CreateBuildConfig(ctx kapi.Context, config *api.BuildConfig) error {
|
|
| 25 | 25 |
return r.Err |
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 |
-func (r *BuildConfigRegistry) UpdateBuildConfig(ctx kubeapi.Context, config *api.BuildConfig) error {
|
|
| 28 |
+func (r *BuildConfigRegistry) UpdateBuildConfig(ctx kapi.Context, config *api.BuildConfig) error {
|
|
| 29 | 29 |
return r.Err |
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 |
-func (r *BuildConfigRegistry) DeleteBuildConfig(ctx kubeapi.Context, id string) error {
|
|
| 32 |
+func (r *BuildConfigRegistry) DeleteBuildConfig(ctx kapi.Context, id string) error {
|
|
| 33 | 33 |
r.DeletedConfigId = id |
| 34 | 34 |
return r.Err |
| 35 | 35 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package strategy |
| 3 | 3 |
import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/openshift/origin/pkg/build/api" |
| 8 | 8 |
) |
| 9 | 9 |
|
| ... | ... |
@@ -25,8 +25,8 @@ func TestDockerCreateBuildPod(t *testing.T) {
|
| 25 | 25 |
if container.Image != strategy.dockerBuilderImage {
|
| 26 | 26 |
t.Errorf("Expected %s image, got %s!", container.Image, strategy.dockerBuilderImage)
|
| 27 | 27 |
} |
| 28 |
- if container.ImagePullPolicy != kubeapi.PullIfNotPresent {
|
|
| 29 |
- t.Errorf("Expected %v, got %v", kubeapi.PullIfNotPresent, container.ImagePullPolicy)
|
|
| 28 |
+ if container.ImagePullPolicy != kapi.PullIfNotPresent {
|
|
| 29 |
+ t.Errorf("Expected %v, got %v", kapi.PullIfNotPresent, container.ImagePullPolicy)
|
|
| 30 | 30 |
} |
| 31 | 31 |
if actual.DesiredState.Manifest.RestartPolicy.Never == nil {
|
| 32 | 32 |
t.Errorf("Expected never, got %#v", actual.DesiredState.Manifest.RestartPolicy)
|
| ... | ... |
@@ -50,7 +50,7 @@ func TestDockerCreateBuildPod(t *testing.T) {
|
| 50 | 50 |
|
| 51 | 51 |
func mockDockerBuild() *api.Build {
|
| 52 | 52 |
return &api.Build{
|
| 53 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 53 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 54 | 54 |
ID: "dockerBuild", |
| 55 | 55 |
}, |
| 56 | 56 |
Input: api.BuildInput{
|
| ... | ... |
@@ -3,7 +3,7 @@ package strategy |
| 3 | 3 |
import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/openshift/origin/pkg/build/api" |
| 8 | 8 |
) |
| 9 | 9 |
|
| ... | ... |
@@ -31,8 +31,8 @@ func TestSTICreateBuildPod(t *testing.T) {
|
| 31 | 31 |
if container.Image != strategy.stiBuilderImage {
|
| 32 | 32 |
t.Errorf("Expected %s image, got %s!", container.Image, strategy.stiBuilderImage)
|
| 33 | 33 |
} |
| 34 |
- if container.ImagePullPolicy != kubeapi.PullIfNotPresent {
|
|
| 35 |
- t.Errorf("Expected %v, got %v", kubeapi.PullIfNotPresent, container.ImagePullPolicy)
|
|
| 34 |
+ if container.ImagePullPolicy != kapi.PullIfNotPresent {
|
|
| 35 |
+ t.Errorf("Expected %v, got %v", kapi.PullIfNotPresent, container.ImagePullPolicy)
|
|
| 36 | 36 |
} |
| 37 | 37 |
if actual.DesiredState.Manifest.RestartPolicy.Never == nil {
|
| 38 | 38 |
t.Errorf("Expected never, got %#v", actual.DesiredState.Manifest.RestartPolicy)
|
| ... | ... |
@@ -57,7 +57,7 @@ func TestSTICreateBuildPod(t *testing.T) {
|
| 57 | 57 |
|
| 58 | 58 |
func mockSTIBuild() *api.Build {
|
| 59 | 59 |
return &api.Build{
|
| 60 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 60 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 61 | 61 |
ID: "stiBuild", |
| 62 | 62 |
}, |
| 63 | 63 |
Input: api.BuildInput{
|
| ... | ... |
@@ -5,7 +5,7 @@ import ( |
| 5 | 5 |
"net/http" |
| 6 | 6 |
"strings" |
| 7 | 7 |
|
| 8 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 9 | 9 |
"github.com/openshift/origin/pkg/build/api" |
| 10 | 10 |
"github.com/openshift/origin/pkg/client" |
| 11 | 11 |
) |
| ... | ... |
@@ -48,7 +48,7 @@ func (c *controller) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
| 48 | 48 |
return |
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 |
- buildCfg, err := c.osClient.GetBuildConfig(kubeapi.WithNamespaceDefaultIfNone(ctx), uv.buildId) |
|
| 51 |
+ buildCfg, err := c.osClient.GetBuildConfig(kapi.WithNamespaceDefaultIfNone(ctx), uv.buildId) |
|
| 52 | 52 |
if err != nil {
|
| 53 | 53 |
badRequest(w, err.Error()) |
| 54 | 54 |
return |
| ... | ... |
@@ -77,7 +77,7 @@ func (c *controller) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
| 77 | 77 |
} |
| 78 | 78 |
} |
| 79 | 79 |
|
| 80 |
- if _, err := c.osClient.CreateBuild(kubeapi.WithNamespaceDefaultIfNone(ctx), build); err != nil {
|
|
| 80 |
+ if _, err := c.osClient.CreateBuild(kapi.WithNamespaceDefaultIfNone(ctx), build); err != nil {
|
|
| 81 | 81 |
badRequest(w, err.Error()) |
| 82 | 82 |
} |
| 83 | 83 |
} |
| ... | ... |
@@ -85,9 +85,9 @@ func (c *controller) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
| 85 | 85 |
// parseUrl retrieves the namespace from the query parameters and returns a context wrapping the namespace, |
| 86 | 86 |
// the parameters for the webhook call, and an error. |
| 87 | 87 |
// according to the docs (http://godoc.org/code.google.com/p/go.net/context) ctx is not supposed to be wrapped in another object |
| 88 |
-func parseUrl(req *http.Request) (ctx kubeapi.Context, uv urlVars, err error) {
|
|
| 88 |
+func parseUrl(req *http.Request) (ctx kapi.Context, uv urlVars, err error) {
|
|
| 89 | 89 |
url := req.URL.Path |
| 90 |
- ctx = kubeapi.NewContext() |
|
| 90 |
+ ctx = kapi.NewContext() |
|
| 91 | 91 |
|
| 92 | 92 |
parts := splitPath(url) |
| 93 | 93 |
if len(parts) < 3 {
|
| ... | ... |
@@ -105,7 +105,7 @@ func parseUrl(req *http.Request) (ctx kubeapi.Context, uv urlVars, err error) {
|
| 105 | 105 |
// for all other operations, if namespace is omitted, we will default to default namespace. |
| 106 | 106 |
namespace := req.URL.Query().Get("namespace")
|
| 107 | 107 |
if len(namespace) > 0 {
|
| 108 |
- ctx = kubeapi.WithNamespace(ctx, namespace) |
|
| 108 |
+ ctx = kapi.WithNamespace(ctx, namespace) |
|
| 109 | 109 |
} |
| 110 | 110 |
|
| 111 | 111 |
return |
| ... | ... |
@@ -11,6 +11,7 @@ import ( |
| 11 | 11 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 14 |
+ |
|
| 14 | 15 |
"github.com/openshift/origin/pkg/build/api" |
| 15 | 16 |
"github.com/openshift/origin/pkg/client" |
| 16 | 17 |
) |
| ... | ... |
@@ -11,6 +11,7 @@ import ( |
| 11 | 11 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 14 |
+ |
|
| 14 | 15 |
"github.com/openshift/origin/pkg/build/api" |
| 15 | 16 |
"github.com/openshift/origin/pkg/build/webhook" |
| 16 | 17 |
"github.com/openshift/origin/pkg/client" |
| ... | ... |
@@ -1,8 +1,8 @@ |
| 1 | 1 |
package client |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 6 | 6 |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| ... | ... |
@@ -30,83 +30,83 @@ type Interface interface {
|
| 30 | 30 |
|
| 31 | 31 |
// BuildInterface exposes methods on Build resources. |
| 32 | 32 |
type BuildInterface interface {
|
| 33 |
- ListBuilds(ctx kubeapi.Context, labels labels.Selector) (*buildapi.BuildList, error) |
|
| 34 |
- CreateBuild(ctx kubeapi.Context, build *buildapi.Build) (*buildapi.Build, error) |
|
| 35 |
- UpdateBuild(ctx kubeapi.Context, build *buildapi.Build) (*buildapi.Build, error) |
|
| 36 |
- DeleteBuild(ctx kubeapi.Context, id string) error |
|
| 37 |
- WatchBuilds(ctx kubeapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) |
|
| 33 |
+ ListBuilds(ctx kapi.Context, labels labels.Selector) (*buildapi.BuildList, error) |
|
| 34 |
+ CreateBuild(ctx kapi.Context, build *buildapi.Build) (*buildapi.Build, error) |
|
| 35 |
+ UpdateBuild(ctx kapi.Context, build *buildapi.Build) (*buildapi.Build, error) |
|
| 36 |
+ DeleteBuild(ctx kapi.Context, id string) error |
|
| 37 |
+ WatchBuilds(ctx kapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) |
|
| 38 | 38 |
} |
| 39 | 39 |
|
| 40 | 40 |
// BuildConfigInterface exposes methods on BuildConfig resources |
| 41 | 41 |
type BuildConfigInterface interface {
|
| 42 |
- ListBuildConfigs(ctx kubeapi.Context, labels labels.Selector) (*buildapi.BuildConfigList, error) |
|
| 43 |
- GetBuildConfig(ctx kubeapi.Context, id string) (*buildapi.BuildConfig, error) |
|
| 44 |
- CreateBuildConfig(ctx kubeapi.Context, config *buildapi.BuildConfig) (*buildapi.BuildConfig, error) |
|
| 45 |
- UpdateBuildConfig(ctx kubeapi.Context, config *buildapi.BuildConfig) (*buildapi.BuildConfig, error) |
|
| 46 |
- DeleteBuildConfig(ctx kubeapi.Context, id string) error |
|
| 42 |
+ ListBuildConfigs(ctx kapi.Context, labels labels.Selector) (*buildapi.BuildConfigList, error) |
|
| 43 |
+ GetBuildConfig(ctx kapi.Context, id string) (*buildapi.BuildConfig, error) |
|
| 44 |
+ CreateBuildConfig(ctx kapi.Context, config *buildapi.BuildConfig) (*buildapi.BuildConfig, error) |
|
| 45 |
+ UpdateBuildConfig(ctx kapi.Context, config *buildapi.BuildConfig) (*buildapi.BuildConfig, error) |
|
| 46 |
+ DeleteBuildConfig(ctx kapi.Context, id string) error |
|
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 | 49 |
// ImageInterface exposes methods on Image resources. |
| 50 | 50 |
type ImageInterface interface {
|
| 51 |
- ListImages(ctx kubeapi.Context, labels labels.Selector) (*imageapi.ImageList, error) |
|
| 52 |
- GetImage(ctx kubeapi.Context, id string) (*imageapi.Image, error) |
|
| 53 |
- CreateImage(ctx kubeapi.Context, image *imageapi.Image) (*imageapi.Image, error) |
|
| 51 |
+ ListImages(ctx kapi.Context, labels labels.Selector) (*imageapi.ImageList, error) |
|
| 52 |
+ GetImage(ctx kapi.Context, id string) (*imageapi.Image, error) |
|
| 53 |
+ CreateImage(ctx kapi.Context, image *imageapi.Image) (*imageapi.Image, error) |
|
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
// ImageRepositoryInterface exposes methods on ImageRepository resources. |
| 57 | 57 |
type ImageRepositoryInterface interface {
|
| 58 |
- ListImageRepositories(ctx kubeapi.Context, labels labels.Selector) (*imageapi.ImageRepositoryList, error) |
|
| 59 |
- GetImageRepository(ctx kubeapi.Context, id string) (*imageapi.ImageRepository, error) |
|
| 60 |
- WatchImageRepositories(ctx kubeapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) |
|
| 61 |
- CreateImageRepository(ctx kubeapi.Context, repo *imageapi.ImageRepository) (*imageapi.ImageRepository, error) |
|
| 62 |
- UpdateImageRepository(ctx kubeapi.Context, repo *imageapi.ImageRepository) (*imageapi.ImageRepository, error) |
|
| 58 |
+ ListImageRepositories(ctx kapi.Context, labels labels.Selector) (*imageapi.ImageRepositoryList, error) |
|
| 59 |
+ GetImageRepository(ctx kapi.Context, id string) (*imageapi.ImageRepository, error) |
|
| 60 |
+ WatchImageRepositories(ctx kapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) |
|
| 61 |
+ CreateImageRepository(ctx kapi.Context, repo *imageapi.ImageRepository) (*imageapi.ImageRepository, error) |
|
| 62 |
+ UpdateImageRepository(ctx kapi.Context, repo *imageapi.ImageRepository) (*imageapi.ImageRepository, error) |
|
| 63 | 63 |
} |
| 64 | 64 |
|
| 65 | 65 |
// ImageRepositoryMappingInterface exposes methods on ImageRepositoryMapping resources. |
| 66 | 66 |
type ImageRepositoryMappingInterface interface {
|
| 67 |
- CreateImageRepositoryMapping(ctx kubeapi.Context, mapping *imageapi.ImageRepositoryMapping) error |
|
| 67 |
+ CreateImageRepositoryMapping(ctx kapi.Context, mapping *imageapi.ImageRepositoryMapping) error |
|
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 | 70 |
// DeploymentConfigInterface contains methods for working with DeploymentConfigs |
| 71 | 71 |
type DeploymentConfigInterface interface {
|
| 72 |
- ListDeploymentConfigs(ctx kubeapi.Context, selector labels.Selector) (*deployapi.DeploymentConfigList, error) |
|
| 73 |
- WatchDeploymentConfigs(ctx kubeapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) |
|
| 74 |
- GetDeploymentConfig(ctx kubeapi.Context, id string) (*deployapi.DeploymentConfig, error) |
|
| 75 |
- CreateDeploymentConfig(ctx kubeapi.Context, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error) |
|
| 76 |
- UpdateDeploymentConfig(ctx kubeapi.Context, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error) |
|
| 77 |
- DeleteDeploymentConfig(ctx kubeapi.Context, id string) error |
|
| 78 |
- GenerateDeploymentConfig(ctx kubeapi.Context, id string) (*deployapi.DeploymentConfig, error) |
|
| 72 |
+ ListDeploymentConfigs(ctx kapi.Context, selector labels.Selector) (*deployapi.DeploymentConfigList, error) |
|
| 73 |
+ WatchDeploymentConfigs(ctx kapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) |
|
| 74 |
+ GetDeploymentConfig(ctx kapi.Context, id string) (*deployapi.DeploymentConfig, error) |
|
| 75 |
+ CreateDeploymentConfig(ctx kapi.Context, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error) |
|
| 76 |
+ UpdateDeploymentConfig(ctx kapi.Context, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error) |
|
| 77 |
+ DeleteDeploymentConfig(ctx kapi.Context, id string) error |
|
| 78 |
+ GenerateDeploymentConfig(ctx kapi.Context, id string) (*deployapi.DeploymentConfig, error) |
|
| 79 | 79 |
} |
| 80 | 80 |
|
| 81 | 81 |
// DeploymentInterface contains methods for working with Deployments |
| 82 | 82 |
type DeploymentInterface interface {
|
| 83 |
- ListDeployments(ctx kubeapi.Context, selector labels.Selector) (*deployapi.DeploymentList, error) |
|
| 84 |
- GetDeployment(ctx kubeapi.Context, id string) (*deployapi.Deployment, error) |
|
| 85 |
- CreateDeployment(ctx kubeapi.Context, deployment *deployapi.Deployment) (*deployapi.Deployment, error) |
|
| 86 |
- UpdateDeployment(ctx kubeapi.Context, deployment *deployapi.Deployment) (*deployapi.Deployment, error) |
|
| 87 |
- DeleteDeployment(ctx kubeapi.Context, id string) error |
|
| 88 |
- WatchDeployments(ctx kubeapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) |
|
| 83 |
+ ListDeployments(ctx kapi.Context, selector labels.Selector) (*deployapi.DeploymentList, error) |
|
| 84 |
+ GetDeployment(ctx kapi.Context, id string) (*deployapi.Deployment, error) |
|
| 85 |
+ CreateDeployment(ctx kapi.Context, deployment *deployapi.Deployment) (*deployapi.Deployment, error) |
|
| 86 |
+ UpdateDeployment(ctx kapi.Context, deployment *deployapi.Deployment) (*deployapi.Deployment, error) |
|
| 87 |
+ DeleteDeployment(ctx kapi.Context, id string) error |
|
| 88 |
+ WatchDeployments(ctx kapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) |
|
| 89 | 89 |
} |
| 90 | 90 |
|
| 91 | 91 |
// RouteInterface exposes methods on Route resources |
| 92 | 92 |
type RouteInterface interface {
|
| 93 |
- ListRoutes(ctx kubeapi.Context, selector labels.Selector) (*routeapi.RouteList, error) |
|
| 94 |
- GetRoute(ctx kubeapi.Context, id string) (*routeapi.Route, error) |
|
| 95 |
- CreateRoute(ctx kubeapi.Context, route *routeapi.Route) (*routeapi.Route, error) |
|
| 96 |
- UpdateRoute(ctx kubeapi.Context, route *routeapi.Route) (*routeapi.Route, error) |
|
| 97 |
- DeleteRoute(ctx kubeapi.Context, id string) error |
|
| 98 |
- WatchRoutes(ctx kubeapi.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) |
|
| 93 |
+ ListRoutes(ctx kapi.Context, selector labels.Selector) (*routeapi.RouteList, error) |
|
| 94 |
+ GetRoute(ctx kapi.Context, id string) (*routeapi.Route, error) |
|
| 95 |
+ CreateRoute(ctx kapi.Context, route *routeapi.Route) (*routeapi.Route, error) |
|
| 96 |
+ UpdateRoute(ctx kapi.Context, route *routeapi.Route) (*routeapi.Route, error) |
|
| 97 |
+ DeleteRoute(ctx kapi.Context, id string) error |
|
| 98 |
+ WatchRoutes(ctx kapi.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) |
|
| 99 | 99 |
} |
| 100 | 100 |
|
| 101 | 101 |
// Client is an OpenShift client object |
| 102 | 102 |
type Client struct {
|
| 103 |
- *kubeclient.RESTClient |
|
| 103 |
+ *kclient.RESTClient |
|
| 104 | 104 |
} |
| 105 | 105 |
|
| 106 | 106 |
// New creates an OpenShift client for the given config. This client works with builds, deployments, |
| 107 | 107 |
// templates, routes, and images. It allows operations such as list, get, update and delete on these |
| 108 | 108 |
// objects. An error is returned if the provided configuration is not valid. |
| 109 |
-func New(c *kubeclient.Config) (*Client, error) {
|
|
| 109 |
+func New(c *kclient.Config) (*Client, error) {
|
|
| 110 | 110 |
config := *c |
| 111 | 111 |
if config.Prefix == "" {
|
| 112 | 112 |
config.Prefix = "/osapi" |
| ... | ... |
@@ -116,7 +116,7 @@ func New(c *kubeclient.Config) (*Client, error) {
|
| 116 | 116 |
// TODO: implement version negotiation (highest version supported by server) |
| 117 | 117 |
config.Version = latest.Version |
| 118 | 118 |
} |
| 119 |
- client, err := kubeclient.RESTClientFor(&config) |
|
| 119 |
+ client, err := kclient.RESTClientFor(&config) |
|
| 120 | 120 |
if err != nil {
|
| 121 | 121 |
return nil, err |
| 122 | 122 |
} |
| ... | ... |
@@ -124,7 +124,7 @@ func New(c *kubeclient.Config) (*Client, error) {
|
| 124 | 124 |
} |
| 125 | 125 |
|
| 126 | 126 |
// NewOrDie creates an OpenShift client and panics if the provided API version is not recognized. |
| 127 |
-func NewOrDie(c *kubeclient.Config) *Client {
|
|
| 127 |
+func NewOrDie(c *kclient.Config) *Client {
|
|
| 128 | 128 |
client, err := New(c) |
| 129 | 129 |
if err != nil {
|
| 130 | 130 |
panic(err) |
| ... | ... |
@@ -133,35 +133,35 @@ func NewOrDie(c *kubeclient.Config) *Client {
|
| 133 | 133 |
} |
| 134 | 134 |
|
| 135 | 135 |
// CreateBuild creates new build. Returns the server's representation of the build and error if one occurs. |
| 136 |
-func (c *Client) CreateBuild(ctx kubeapi.Context, build *buildapi.Build) (result *buildapi.Build, err error) {
|
|
| 136 |
+func (c *Client) CreateBuild(ctx kapi.Context, build *buildapi.Build) (result *buildapi.Build, err error) {
|
|
| 137 | 137 |
result = &buildapi.Build{}
|
| 138 |
- err = c.Post().Namespace(kubeapi.Namespace(ctx)).Path("builds").Body(build).Do().Into(result)
|
|
| 138 |
+ err = c.Post().Namespace(kapi.Namespace(ctx)).Path("builds").Body(build).Do().Into(result)
|
|
| 139 | 139 |
return |
| 140 | 140 |
} |
| 141 | 141 |
|
| 142 | 142 |
// ListBuilds returns a list of builds that match the selector. |
| 143 |
-func (c *Client) ListBuilds(ctx kubeapi.Context, selector labels.Selector) (result *buildapi.BuildList, err error) {
|
|
| 143 |
+func (c *Client) ListBuilds(ctx kapi.Context, selector labels.Selector) (result *buildapi.BuildList, err error) {
|
|
| 144 | 144 |
result = &buildapi.BuildList{}
|
| 145 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("builds").SelectorParam("labels", selector).Do().Into(result)
|
|
| 145 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("builds").SelectorParam("labels", selector).Do().Into(result)
|
|
| 146 | 146 |
return |
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 | 149 |
// UpdateBuild updates the build on server. Returns the server's representation of the build and error if one occurs. |
| 150 |
-func (c *Client) UpdateBuild(ctx kubeapi.Context, build *buildapi.Build) (result *buildapi.Build, err error) {
|
|
| 150 |
+func (c *Client) UpdateBuild(ctx kapi.Context, build *buildapi.Build) (result *buildapi.Build, err error) {
|
|
| 151 | 151 |
result = &buildapi.Build{}
|
| 152 |
- err = c.Put().Namespace(kubeapi.Namespace(ctx)).Path("builds").Path(build.ID).Body(build).Do().Into(result)
|
|
| 152 |
+ err = c.Put().Namespace(kapi.Namespace(ctx)).Path("builds").Path(build.ID).Body(build).Do().Into(result)
|
|
| 153 | 153 |
return |
| 154 | 154 |
} |
| 155 | 155 |
|
| 156 | 156 |
// DeleteBuild deletes a build, returns error if one occurs. |
| 157 |
-func (c *Client) DeleteBuild(ctx kubeapi.Context, id string) (err error) {
|
|
| 158 |
- err = c.Delete().Namespace(kubeapi.Namespace(ctx)).Path("builds").Path(id).Do().Error()
|
|
| 157 |
+func (c *Client) DeleteBuild(ctx kapi.Context, id string) (err error) {
|
|
| 158 |
+ err = c.Delete().Namespace(kapi.Namespace(ctx)).Path("builds").Path(id).Do().Error()
|
|
| 159 | 159 |
return |
| 160 | 160 |
} |
| 161 | 161 |
|
| 162 |
-func (c *Client) WatchBuilds(ctx kubeapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 162 |
+func (c *Client) WatchBuilds(ctx kapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 163 | 163 |
return c.Get(). |
| 164 |
- Namespace(kubeapi.Namespace(ctx)). |
|
| 164 |
+ Namespace(kapi.Namespace(ctx)). |
|
| 165 | 165 |
Path("watch").
|
| 166 | 166 |
Path("builds").
|
| 167 | 167 |
Param("resourceVersion", resourceVersion).
|
| ... | ... |
@@ -171,75 +171,75 @@ func (c *Client) WatchBuilds(ctx kubeapi.Context, field, label labels.Selector, |
| 171 | 171 |
} |
| 172 | 172 |
|
| 173 | 173 |
// CreateBuildConfig creates a new buildconfig. Returns the server's representation of the buildconfig and error if one occurs. |
| 174 |
-func (c *Client) CreateBuildConfig(ctx kubeapi.Context, build *buildapi.BuildConfig) (result *buildapi.BuildConfig, err error) {
|
|
| 174 |
+func (c *Client) CreateBuildConfig(ctx kapi.Context, build *buildapi.BuildConfig) (result *buildapi.BuildConfig, err error) {
|
|
| 175 | 175 |
result = &buildapi.BuildConfig{}
|
| 176 |
- err = c.Post().Namespace(kubeapi.Namespace(ctx)).Path("buildConfigs").Body(build).Do().Into(result)
|
|
| 176 |
+ err = c.Post().Namespace(kapi.Namespace(ctx)).Path("buildConfigs").Body(build).Do().Into(result)
|
|
| 177 | 177 |
return |
| 178 | 178 |
} |
| 179 | 179 |
|
| 180 | 180 |
// ListBuildConfigs returns a list of buildconfigs that match the selector. |
| 181 |
-func (c *Client) ListBuildConfigs(ctx kubeapi.Context, selector labels.Selector) (result *buildapi.BuildConfigList, err error) {
|
|
| 181 |
+func (c *Client) ListBuildConfigs(ctx kapi.Context, selector labels.Selector) (result *buildapi.BuildConfigList, err error) {
|
|
| 182 | 182 |
result = &buildapi.BuildConfigList{}
|
| 183 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("buildConfigs").SelectorParam("labels", selector).Do().Into(result)
|
|
| 183 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("buildConfigs").SelectorParam("labels", selector).Do().Into(result)
|
|
| 184 | 184 |
return |
| 185 | 185 |
} |
| 186 | 186 |
|
| 187 | 187 |
// GetBuildConfig returns information about a particular buildconfig and error if one occurs. |
| 188 |
-func (c *Client) GetBuildConfig(ctx kubeapi.Context, id string) (result *buildapi.BuildConfig, err error) {
|
|
| 188 |
+func (c *Client) GetBuildConfig(ctx kapi.Context, id string) (result *buildapi.BuildConfig, err error) {
|
|
| 189 | 189 |
result = &buildapi.BuildConfig{}
|
| 190 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("buildConfigs").Path(id).Do().Into(result)
|
|
| 190 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("buildConfigs").Path(id).Do().Into(result)
|
|
| 191 | 191 |
return |
| 192 | 192 |
} |
| 193 | 193 |
|
| 194 | 194 |
// UpdateBuildConfig updates the buildconfig on server. Returns the server's representation of the buildconfig and error if one occurs. |
| 195 |
-func (c *Client) UpdateBuildConfig(ctx kubeapi.Context, build *buildapi.BuildConfig) (result *buildapi.BuildConfig, err error) {
|
|
| 195 |
+func (c *Client) UpdateBuildConfig(ctx kapi.Context, build *buildapi.BuildConfig) (result *buildapi.BuildConfig, err error) {
|
|
| 196 | 196 |
result = &buildapi.BuildConfig{}
|
| 197 |
- err = c.Put().Namespace(kubeapi.Namespace(ctx)).Path("buildConfigs").Path(build.ID).Body(build).Do().Into(result)
|
|
| 197 |
+ err = c.Put().Namespace(kapi.Namespace(ctx)).Path("buildConfigs").Path(build.ID).Body(build).Do().Into(result)
|
|
| 198 | 198 |
return |
| 199 | 199 |
} |
| 200 | 200 |
|
| 201 | 201 |
// DeleteBuildConfig deletes a BuildConfig, returns error if one occurs. |
| 202 |
-func (c *Client) DeleteBuildConfig(ctx kubeapi.Context, id string) error {
|
|
| 203 |
- return c.Delete().Namespace(kubeapi.Namespace(ctx)).Path("buildConfigs").Path(id).Do().Error()
|
|
| 202 |
+func (c *Client) DeleteBuildConfig(ctx kapi.Context, id string) error {
|
|
| 203 |
+ return c.Delete().Namespace(kapi.Namespace(ctx)).Path("buildConfigs").Path(id).Do().Error()
|
|
| 204 | 204 |
} |
| 205 | 205 |
|
| 206 | 206 |
// ListImages returns a list of images that match the selector. |
| 207 |
-func (c *Client) ListImages(ctx kubeapi.Context, selector labels.Selector) (result *imageapi.ImageList, err error) {
|
|
| 207 |
+func (c *Client) ListImages(ctx kapi.Context, selector labels.Selector) (result *imageapi.ImageList, err error) {
|
|
| 208 | 208 |
result = &imageapi.ImageList{}
|
| 209 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("images").SelectorParam("labels", selector).Do().Into(result)
|
|
| 209 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("images").SelectorParam("labels", selector).Do().Into(result)
|
|
| 210 | 210 |
return |
| 211 | 211 |
} |
| 212 | 212 |
|
| 213 | 213 |
// GetImage returns information about a particular image and error if one occurs. |
| 214 |
-func (c *Client) GetImage(ctx kubeapi.Context, id string) (result *imageapi.Image, err error) {
|
|
| 214 |
+func (c *Client) GetImage(ctx kapi.Context, id string) (result *imageapi.Image, err error) {
|
|
| 215 | 215 |
result = &imageapi.Image{}
|
| 216 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("images").Path(id).Do().Into(result)
|
|
| 216 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("images").Path(id).Do().Into(result)
|
|
| 217 | 217 |
return |
| 218 | 218 |
} |
| 219 | 219 |
|
| 220 | 220 |
// CreateImage creates a new image. Returns the server's representation of the image and error if one occurs. |
| 221 |
-func (c *Client) CreateImage(ctx kubeapi.Context, image *imageapi.Image) (result *imageapi.Image, err error) {
|
|
| 221 |
+func (c *Client) CreateImage(ctx kapi.Context, image *imageapi.Image) (result *imageapi.Image, err error) {
|
|
| 222 | 222 |
result = &imageapi.Image{}
|
| 223 |
- err = c.Post().Namespace(kubeapi.Namespace(ctx)).Path("images").Body(image).Do().Into(result)
|
|
| 223 |
+ err = c.Post().Namespace(kapi.Namespace(ctx)).Path("images").Body(image).Do().Into(result)
|
|
| 224 | 224 |
return |
| 225 | 225 |
} |
| 226 | 226 |
|
| 227 | 227 |
// ListImageRepositories returns a list of imagerepositories that match the selector. |
| 228 |
-func (c *Client) ListImageRepositories(ctx kubeapi.Context, selector labels.Selector) (result *imageapi.ImageRepositoryList, err error) {
|
|
| 228 |
+func (c *Client) ListImageRepositories(ctx kapi.Context, selector labels.Selector) (result *imageapi.ImageRepositoryList, err error) {
|
|
| 229 | 229 |
result = &imageapi.ImageRepositoryList{}
|
| 230 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("imageRepositories").SelectorParam("labels", selector).Do().Into(result)
|
|
| 230 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("imageRepositories").SelectorParam("labels", selector).Do().Into(result)
|
|
| 231 | 231 |
return |
| 232 | 232 |
} |
| 233 | 233 |
|
| 234 | 234 |
// GetImageRepository returns information about a particular imagerepository and error if one occurs. |
| 235 |
-func (c *Client) GetImageRepository(ctx kubeapi.Context, id string) (result *imageapi.ImageRepository, err error) {
|
|
| 235 |
+func (c *Client) GetImageRepository(ctx kapi.Context, id string) (result *imageapi.ImageRepository, err error) {
|
|
| 236 | 236 |
result = &imageapi.ImageRepository{}
|
| 237 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("imageRepositories").Path(id).Do().Into(result)
|
|
| 237 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("imageRepositories").Path(id).Do().Into(result)
|
|
| 238 | 238 |
return |
| 239 | 239 |
} |
| 240 | 240 |
|
| 241 | 241 |
// WatchImageRepositories returns a watch.Interface that watches the requested imagerepositories. |
| 242 |
-func (c *Client) WatchImageRepositories(ctx kubeapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 242 |
+func (c *Client) WatchImageRepositories(ctx kapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 243 | 243 |
return c.Get(). |
| 244 | 244 |
Path("watch").
|
| 245 | 245 |
Path("imageRepositories").
|
| ... | ... |
@@ -250,32 +250,32 @@ func (c *Client) WatchImageRepositories(ctx kubeapi.Context, field, label labels |
| 250 | 250 |
} |
| 251 | 251 |
|
| 252 | 252 |
// CreateImageRepository create a new imagerepository. Returns the server's representation of the imagerepository and error if one occurs. |
| 253 |
-func (c *Client) CreateImageRepository(ctx kubeapi.Context, repo *imageapi.ImageRepository) (result *imageapi.ImageRepository, err error) {
|
|
| 253 |
+func (c *Client) CreateImageRepository(ctx kapi.Context, repo *imageapi.ImageRepository) (result *imageapi.ImageRepository, err error) {
|
|
| 254 | 254 |
result = &imageapi.ImageRepository{}
|
| 255 |
- err = c.Post().Namespace(kubeapi.Namespace(ctx)).Path("imageRepositories").Body(repo).Do().Into(result)
|
|
| 255 |
+ err = c.Post().Namespace(kapi.Namespace(ctx)).Path("imageRepositories").Body(repo).Do().Into(result)
|
|
| 256 | 256 |
return |
| 257 | 257 |
} |
| 258 | 258 |
|
| 259 | 259 |
// UpdateImageRepository updates the imagerepository on the server. Returns the server's representation of the imagerepository and error if one occurs. |
| 260 |
-func (c *Client) UpdateImageRepository(ctx kubeapi.Context, repo *imageapi.ImageRepository) (result *imageapi.ImageRepository, err error) {
|
|
| 260 |
+func (c *Client) UpdateImageRepository(ctx kapi.Context, repo *imageapi.ImageRepository) (result *imageapi.ImageRepository, err error) {
|
|
| 261 | 261 |
result = &imageapi.ImageRepository{}
|
| 262 |
- err = c.Put().Namespace(kubeapi.Namespace(ctx)).Path("imageRepositories").Path(repo.ID).Body(repo).Do().Into(result)
|
|
| 262 |
+ err = c.Put().Namespace(kapi.Namespace(ctx)).Path("imageRepositories").Path(repo.ID).Body(repo).Do().Into(result)
|
|
| 263 | 263 |
return |
| 264 | 264 |
} |
| 265 | 265 |
|
| 266 | 266 |
// CreateImageRepositoryMapping create a new imagerepository mapping on the server. Returns error if one occurs. |
| 267 |
-func (c *Client) CreateImageRepositoryMapping(ctx kubeapi.Context, mapping *imageapi.ImageRepositoryMapping) error {
|
|
| 268 |
- return c.Post().Namespace(kubeapi.Namespace(ctx)).Path("imageRepositoryMappings").Body(mapping).Do().Error()
|
|
| 267 |
+func (c *Client) CreateImageRepositoryMapping(ctx kapi.Context, mapping *imageapi.ImageRepositoryMapping) error {
|
|
| 268 |
+ return c.Post().Namespace(kapi.Namespace(ctx)).Path("imageRepositoryMappings").Body(mapping).Do().Error()
|
|
| 269 | 269 |
} |
| 270 | 270 |
|
| 271 | 271 |
// ListDeploymentConfigs takes a selector, and returns the list of deploymentConfigs that match that selector |
| 272 |
-func (c *Client) ListDeploymentConfigs(ctx kubeapi.Context, selector labels.Selector) (result *deployapi.DeploymentConfigList, err error) {
|
|
| 272 |
+func (c *Client) ListDeploymentConfigs(ctx kapi.Context, selector labels.Selector) (result *deployapi.DeploymentConfigList, err error) {
|
|
| 273 | 273 |
result = &deployapi.DeploymentConfigList{}
|
| 274 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("deploymentConfigs").SelectorParam("labels", selector).Do().Into(result)
|
|
| 274 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("deploymentConfigs").SelectorParam("labels", selector).Do().Into(result)
|
|
| 275 | 275 |
return |
| 276 | 276 |
} |
| 277 | 277 |
|
| 278 |
-func (c *Client) WatchDeploymentConfigs(ctx kubeapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 278 |
+func (c *Client) WatchDeploymentConfigs(ctx kapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 279 | 279 |
return c.Get(). |
| 280 | 280 |
Path("watch").
|
| 281 | 281 |
Path("deploymentConfigs").
|
| ... | ... |
@@ -286,73 +286,73 @@ func (c *Client) WatchDeploymentConfigs(ctx kubeapi.Context, field, label labels |
| 286 | 286 |
} |
| 287 | 287 |
|
| 288 | 288 |
// GetDeploymentConfig returns information about a particular deploymentConfig |
| 289 |
-func (c *Client) GetDeploymentConfig(ctx kubeapi.Context, id string) (result *deployapi.DeploymentConfig, err error) {
|
|
| 289 |
+func (c *Client) GetDeploymentConfig(ctx kapi.Context, id string) (result *deployapi.DeploymentConfig, err error) {
|
|
| 290 | 290 |
result = &deployapi.DeploymentConfig{}
|
| 291 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("deploymentConfigs").Path(id).Do().Into(result)
|
|
| 291 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("deploymentConfigs").Path(id).Do().Into(result)
|
|
| 292 | 292 |
return |
| 293 | 293 |
} |
| 294 | 294 |
|
| 295 | 295 |
// CreateDeploymentConfig creates a new deploymentConfig |
| 296 |
-func (c *Client) CreateDeploymentConfig(ctx kubeapi.Context, deploymentConfig *deployapi.DeploymentConfig) (result *deployapi.DeploymentConfig, err error) {
|
|
| 296 |
+func (c *Client) CreateDeploymentConfig(ctx kapi.Context, deploymentConfig *deployapi.DeploymentConfig) (result *deployapi.DeploymentConfig, err error) {
|
|
| 297 | 297 |
result = &deployapi.DeploymentConfig{}
|
| 298 |
- err = c.Post().Namespace(kubeapi.Namespace(ctx)).Path("deploymentConfigs").Body(deploymentConfig).Do().Into(result)
|
|
| 298 |
+ err = c.Post().Namespace(kapi.Namespace(ctx)).Path("deploymentConfigs").Body(deploymentConfig).Do().Into(result)
|
|
| 299 | 299 |
return |
| 300 | 300 |
} |
| 301 | 301 |
|
| 302 | 302 |
// UpdateDeploymentConfig updates an existing deploymentConfig |
| 303 |
-func (c *Client) UpdateDeploymentConfig(ctx kubeapi.Context, deploymentConfig *deployapi.DeploymentConfig) (result *deployapi.DeploymentConfig, err error) {
|
|
| 303 |
+func (c *Client) UpdateDeploymentConfig(ctx kapi.Context, deploymentConfig *deployapi.DeploymentConfig) (result *deployapi.DeploymentConfig, err error) {
|
|
| 304 | 304 |
result = &deployapi.DeploymentConfig{}
|
| 305 |
- err = c.Put().Namespace(kubeapi.Namespace(ctx)).Path("deploymentConfigs").Path(deploymentConfig.ID).Body(deploymentConfig).Do().Into(result)
|
|
| 305 |
+ err = c.Put().Namespace(kapi.Namespace(ctx)).Path("deploymentConfigs").Path(deploymentConfig.ID).Body(deploymentConfig).Do().Into(result)
|
|
| 306 | 306 |
return |
| 307 | 307 |
} |
| 308 | 308 |
|
| 309 | 309 |
// DeleteDeploymentConfig deletes an existing deploymentConfig. |
| 310 |
-func (c *Client) DeleteDeploymentConfig(ctx kubeapi.Context, id string) error {
|
|
| 311 |
- return c.Delete().Namespace(kubeapi.Namespace(ctx)).Path("deploymentConfigs").Path(id).Do().Error()
|
|
| 310 |
+func (c *Client) DeleteDeploymentConfig(ctx kapi.Context, id string) error {
|
|
| 311 |
+ return c.Delete().Namespace(kapi.Namespace(ctx)).Path("deploymentConfigs").Path(id).Do().Error()
|
|
| 312 | 312 |
} |
| 313 | 313 |
|
| 314 | 314 |
// GenerateDeploymentConfig generates a new deploymentConfig for the given ID. |
| 315 |
-func (c *Client) GenerateDeploymentConfig(ctx kubeapi.Context, id string) (result *deployapi.DeploymentConfig, err error) {
|
|
| 315 |
+func (c *Client) GenerateDeploymentConfig(ctx kapi.Context, id string) (result *deployapi.DeploymentConfig, err error) {
|
|
| 316 | 316 |
result = &deployapi.DeploymentConfig{}
|
| 317 | 317 |
err = c.Get().Path("generateDeploymentConfigs").Path(id).Do().Into(result)
|
| 318 | 318 |
return |
| 319 | 319 |
} |
| 320 | 320 |
|
| 321 | 321 |
// ListDeployments takes a selector, and returns the list of deployments that match that selector |
| 322 |
-func (c *Client) ListDeployments(ctx kubeapi.Context, selector labels.Selector) (result *deployapi.DeploymentList, err error) {
|
|
| 322 |
+func (c *Client) ListDeployments(ctx kapi.Context, selector labels.Selector) (result *deployapi.DeploymentList, err error) {
|
|
| 323 | 323 |
result = &deployapi.DeploymentList{}
|
| 324 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("deployments").SelectorParam("labels", selector).Do().Into(result)
|
|
| 324 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("deployments").SelectorParam("labels", selector).Do().Into(result)
|
|
| 325 | 325 |
return |
| 326 | 326 |
} |
| 327 | 327 |
|
| 328 | 328 |
// GetDeployment returns information about a particular deployment |
| 329 |
-func (c *Client) GetDeployment(ctx kubeapi.Context, id string) (result *deployapi.Deployment, err error) {
|
|
| 329 |
+func (c *Client) GetDeployment(ctx kapi.Context, id string) (result *deployapi.Deployment, err error) {
|
|
| 330 | 330 |
result = &deployapi.Deployment{}
|
| 331 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("deployments").Path(id).Do().Into(result)
|
|
| 331 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("deployments").Path(id).Do().Into(result)
|
|
| 332 | 332 |
return |
| 333 | 333 |
} |
| 334 | 334 |
|
| 335 | 335 |
// CreateDeployment creates a new deployment |
| 336 |
-func (c *Client) CreateDeployment(ctx kubeapi.Context, deployment *deployapi.Deployment) (result *deployapi.Deployment, err error) {
|
|
| 336 |
+func (c *Client) CreateDeployment(ctx kapi.Context, deployment *deployapi.Deployment) (result *deployapi.Deployment, err error) {
|
|
| 337 | 337 |
result = &deployapi.Deployment{}
|
| 338 |
- err = c.Post().Namespace(kubeapi.Namespace(ctx)).Path("deployments").Body(deployment).Do().Into(result)
|
|
| 338 |
+ err = c.Post().Namespace(kapi.Namespace(ctx)).Path("deployments").Body(deployment).Do().Into(result)
|
|
| 339 | 339 |
return |
| 340 | 340 |
} |
| 341 | 341 |
|
| 342 | 342 |
// UpdateDeployment updates an existing deployment |
| 343 |
-func (c *Client) UpdateDeployment(ctx kubeapi.Context, deployment *deployapi.Deployment) (result *deployapi.Deployment, err error) {
|
|
| 343 |
+func (c *Client) UpdateDeployment(ctx kapi.Context, deployment *deployapi.Deployment) (result *deployapi.Deployment, err error) {
|
|
| 344 | 344 |
result = &deployapi.Deployment{}
|
| 345 |
- err = c.Put().Namespace(kubeapi.Namespace(ctx)).Path("deployments").Path(deployment.ID).Body(deployment).Do().Into(result)
|
|
| 345 |
+ err = c.Put().Namespace(kapi.Namespace(ctx)).Path("deployments").Path(deployment.ID).Body(deployment).Do().Into(result)
|
|
| 346 | 346 |
return |
| 347 | 347 |
} |
| 348 | 348 |
|
| 349 | 349 |
// DeleteDeployment deletes an existing replication deployment. |
| 350 |
-func (c *Client) DeleteDeployment(ctx kubeapi.Context, id string) error {
|
|
| 351 |
- return c.Delete().Namespace(kubeapi.Namespace(ctx)).Path("deployments").Path(id).Do().Error()
|
|
| 350 |
+func (c *Client) DeleteDeployment(ctx kapi.Context, id string) error {
|
|
| 351 |
+ return c.Delete().Namespace(kapi.Namespace(ctx)).Path("deployments").Path(id).Do().Error()
|
|
| 352 | 352 |
} |
| 353 | 353 |
|
| 354 | 354 |
// WatchDeployments returns a watch.Interface that watches the requested deployments. |
| 355 |
-func (c *Client) WatchDeployments(ctx kubeapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 355 |
+func (c *Client) WatchDeployments(ctx kapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 356 | 356 |
return c.Get(). |
| 357 | 357 |
Path("watch").
|
| 358 | 358 |
Path("deployments").
|
| ... | ... |
@@ -363,40 +363,40 @@ func (c *Client) WatchDeployments(ctx kubeapi.Context, field, label labels.Selec |
| 363 | 363 |
} |
| 364 | 364 |
|
| 365 | 365 |
// ListRoutes takes a selector, and returns the list of routes that match that selector |
| 366 |
-func (c *Client) ListRoutes(ctx kubeapi.Context, selector labels.Selector) (result *routeapi.RouteList, err error) {
|
|
| 366 |
+func (c *Client) ListRoutes(ctx kapi.Context, selector labels.Selector) (result *routeapi.RouteList, err error) {
|
|
| 367 | 367 |
result = &routeapi.RouteList{}
|
| 368 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("routes").SelectorParam("labels", selector).Do().Into(result)
|
|
| 368 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("routes").SelectorParam("labels", selector).Do().Into(result)
|
|
| 369 | 369 |
return |
| 370 | 370 |
} |
| 371 | 371 |
|
| 372 | 372 |
// GetRoute takes the name of the route, and returns the corresponding Route object, and an error if it occurs |
| 373 |
-func (c *Client) GetRoute(ctx kubeapi.Context, id string) (result *routeapi.Route, err error) {
|
|
| 373 |
+func (c *Client) GetRoute(ctx kapi.Context, id string) (result *routeapi.Route, err error) {
|
|
| 374 | 374 |
result = &routeapi.Route{}
|
| 375 |
- err = c.Get().Namespace(kubeapi.Namespace(ctx)).Path("routes").Path(id).Do().Into(result)
|
|
| 375 |
+ err = c.Get().Namespace(kapi.Namespace(ctx)).Path("routes").Path(id).Do().Into(result)
|
|
| 376 | 376 |
return |
| 377 | 377 |
} |
| 378 | 378 |
|
| 379 | 379 |
// DeleteRoute takes the name of the route, and returns an error if one occurs |
| 380 |
-func (c *Client) DeleteRoute(ctx kubeapi.Context, id string) error {
|
|
| 381 |
- return c.Delete().Namespace(kubeapi.Namespace(ctx)).Path("routes").Path(id).Do().Error()
|
|
| 380 |
+func (c *Client) DeleteRoute(ctx kapi.Context, id string) error {
|
|
| 381 |
+ return c.Delete().Namespace(kapi.Namespace(ctx)).Path("routes").Path(id).Do().Error()
|
|
| 382 | 382 |
} |
| 383 | 383 |
|
| 384 | 384 |
// CreateRoute takes the representation of a route. Returns the server's representation of the route, and an error, if it occurs |
| 385 |
-func (c *Client) CreateRoute(ctx kubeapi.Context, route *routeapi.Route) (result *routeapi.Route, err error) {
|
|
| 385 |
+func (c *Client) CreateRoute(ctx kapi.Context, route *routeapi.Route) (result *routeapi.Route, err error) {
|
|
| 386 | 386 |
result = &routeapi.Route{}
|
| 387 |
- err = c.Post().Namespace(kubeapi.Namespace(ctx)).Path("routes").Body(route).Do().Into(result)
|
|
| 387 |
+ err = c.Post().Namespace(kapi.Namespace(ctx)).Path("routes").Body(route).Do().Into(result)
|
|
| 388 | 388 |
return |
| 389 | 389 |
} |
| 390 | 390 |
|
| 391 | 391 |
// UpdateRoute takes the representation of a route to update. Returns the server's representation of the route, and an error, if it occurs |
| 392 |
-func (c *Client) UpdateRoute(ctx kubeapi.Context, route *routeapi.Route) (result *routeapi.Route, err error) {
|
|
| 392 |
+func (c *Client) UpdateRoute(ctx kapi.Context, route *routeapi.Route) (result *routeapi.Route, err error) {
|
|
| 393 | 393 |
result = &routeapi.Route{}
|
| 394 |
- err = c.Put().Namespace(kubeapi.Namespace(ctx)).Path("routes").Path(route.ID).Body(route).Do().Into(result)
|
|
| 394 |
+ err = c.Put().Namespace(kapi.Namespace(ctx)).Path("routes").Path(route.ID).Body(route).Do().Into(result)
|
|
| 395 | 395 |
return |
| 396 | 396 |
} |
| 397 | 397 |
|
| 398 | 398 |
// WatchRoutes returns a watch.Interface that watches the requested routes. |
| 399 |
-func (c *Client) WatchRoutes(ctx kubeapi.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 399 |
+func (c *Client) WatchRoutes(ctx kapi.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 400 | 400 |
return c.Get(). |
| 401 | 401 |
Path("watch").
|
| 402 | 402 |
Path("routes").
|
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package client |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 6 | 6 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 7 | 7 |
|
| ... | ... |
@@ -15,7 +15,7 @@ import ( |
| 15 | 15 |
type FakeAction struct {
|
| 16 | 16 |
Action string |
| 17 | 17 |
Value interface{}
|
| 18 |
- Ctx kubeapi.Context |
|
| 18 |
+ Ctx kapi.Context |
|
| 19 | 19 |
} |
| 20 | 20 |
|
| 21 | 21 |
// Fake implements Interface. Meant to be embedded into a struct to get a default |
| ... | ... |
@@ -25,187 +25,187 @@ type Fake struct {
|
| 25 | 25 |
Actions []FakeAction |
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 |
-func (c *Fake) CreateBuild(ctx kubeapi.Context, build *buildapi.Build) (*buildapi.Build, error) {
|
|
| 28 |
+func (c *Fake) CreateBuild(ctx kapi.Context, build *buildapi.Build) (*buildapi.Build, error) {
|
|
| 29 | 29 |
c.Actions = append(c.Actions, FakeAction{Action: "create-build", Ctx: ctx, Value: build})
|
| 30 | 30 |
return &buildapi.Build{}, nil
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 |
-func (c *Fake) ListBuilds(ctx kubeapi.Context, selector labels.Selector) (*buildapi.BuildList, error) {
|
|
| 33 |
+func (c *Fake) ListBuilds(ctx kapi.Context, selector labels.Selector) (*buildapi.BuildList, error) {
|
|
| 34 | 34 |
c.Actions = append(c.Actions, FakeAction{Action: "list-builds", Ctx: ctx})
|
| 35 | 35 |
return &buildapi.BuildList{}, nil
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 |
-func (c *Fake) UpdateBuild(ctx kubeapi.Context, build *buildapi.Build) (*buildapi.Build, error) {
|
|
| 38 |
+func (c *Fake) UpdateBuild(ctx kapi.Context, build *buildapi.Build) (*buildapi.Build, error) {
|
|
| 39 | 39 |
c.Actions = append(c.Actions, FakeAction{Action: "update-build", Ctx: ctx})
|
| 40 | 40 |
return &buildapi.Build{}, nil
|
| 41 | 41 |
} |
| 42 | 42 |
|
| 43 |
-func (c *Fake) DeleteBuild(ctx kubeapi.Context, id string) error {
|
|
| 43 |
+func (c *Fake) DeleteBuild(ctx kapi.Context, id string) error {
|
|
| 44 | 44 |
c.Actions = append(c.Actions, FakeAction{Action: "delete-build", Ctx: ctx, Value: id})
|
| 45 | 45 |
return nil |
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 |
-func (c *Fake) CreateBuildConfig(ctx kubeapi.Context, config *buildapi.BuildConfig) (*buildapi.BuildConfig, error) {
|
|
| 48 |
+func (c *Fake) CreateBuildConfig(ctx kapi.Context, config *buildapi.BuildConfig) (*buildapi.BuildConfig, error) {
|
|
| 49 | 49 |
c.Actions = append(c.Actions, FakeAction{Action: "create-buildconfig", Ctx: ctx})
|
| 50 | 50 |
return &buildapi.BuildConfig{}, nil
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 |
-func (c *Fake) ListBuildConfigs(ctx kubeapi.Context, selector labels.Selector) (*buildapi.BuildConfigList, error) {
|
|
| 53 |
+func (c *Fake) ListBuildConfigs(ctx kapi.Context, selector labels.Selector) (*buildapi.BuildConfigList, error) {
|
|
| 54 | 54 |
c.Actions = append(c.Actions, FakeAction{Action: "list-buildconfig", Ctx: ctx})
|
| 55 | 55 |
return &buildapi.BuildConfigList{}, nil
|
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 |
-func (c *Fake) GetBuildConfig(ctx kubeapi.Context, id string) (*buildapi.BuildConfig, error) {
|
|
| 58 |
+func (c *Fake) GetBuildConfig(ctx kapi.Context, id string) (*buildapi.BuildConfig, error) {
|
|
| 59 | 59 |
c.Actions = append(c.Actions, FakeAction{Action: "get-buildconfig", Ctx: ctx, Value: id})
|
| 60 | 60 |
return &buildapi.BuildConfig{}, nil
|
| 61 | 61 |
} |
| 62 | 62 |
|
| 63 |
-func (c *Fake) UpdateBuildConfig(ctx kubeapi.Context, config *buildapi.BuildConfig) (*buildapi.BuildConfig, error) {
|
|
| 63 |
+func (c *Fake) UpdateBuildConfig(ctx kapi.Context, config *buildapi.BuildConfig) (*buildapi.BuildConfig, error) {
|
|
| 64 | 64 |
c.Actions = append(c.Actions, FakeAction{Action: "update-buildconfig", Ctx: ctx})
|
| 65 | 65 |
return &buildapi.BuildConfig{}, nil
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 |
-func (c *Fake) DeleteBuildConfig(ctx kubeapi.Context, id string) error {
|
|
| 68 |
+func (c *Fake) DeleteBuildConfig(ctx kapi.Context, id string) error {
|
|
| 69 | 69 |
c.Actions = append(c.Actions, FakeAction{Action: "delete-buildconfig", Ctx: ctx, Value: id})
|
| 70 | 70 |
return nil |
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 |
-func (c *Fake) WatchDeploymentConfigs(ctx kubeapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 73 |
+func (c *Fake) WatchDeploymentConfigs(ctx kapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 74 | 74 |
c.Actions = append(c.Actions, FakeAction{Action: "watch-deploymentconfig"})
|
| 75 | 75 |
return nil, nil |
| 76 | 76 |
} |
| 77 | 77 |
|
| 78 |
-func (c *Fake) ListImages(ctx kubeapi.Context, selector labels.Selector) (*imageapi.ImageList, error) {
|
|
| 78 |
+func (c *Fake) ListImages(ctx kapi.Context, selector labels.Selector) (*imageapi.ImageList, error) {
|
|
| 79 | 79 |
c.Actions = append(c.Actions, FakeAction{Action: "list-images"})
|
| 80 | 80 |
return &imageapi.ImageList{}, nil
|
| 81 | 81 |
} |
| 82 | 82 |
|
| 83 |
-func (c *Fake) GetImage(ctx kubeapi.Context, id string) (*imageapi.Image, error) {
|
|
| 83 |
+func (c *Fake) GetImage(ctx kapi.Context, id string) (*imageapi.Image, error) {
|
|
| 84 | 84 |
c.Actions = append(c.Actions, FakeAction{Action: "get-image", Ctx: ctx, Value: id})
|
| 85 | 85 |
return &imageapi.Image{}, nil
|
| 86 | 86 |
} |
| 87 | 87 |
|
| 88 |
-func (c *Fake) CreateImage(ctx kubeapi.Context, image *imageapi.Image) (*imageapi.Image, error) {
|
|
| 88 |
+func (c *Fake) CreateImage(ctx kapi.Context, image *imageapi.Image) (*imageapi.Image, error) {
|
|
| 89 | 89 |
c.Actions = append(c.Actions, FakeAction{Action: "create-image", Ctx: ctx})
|
| 90 | 90 |
return &imageapi.Image{}, nil
|
| 91 | 91 |
} |
| 92 | 92 |
|
| 93 |
-func (c *Fake) ListImageRepositories(ctx kubeapi.Context, selector labels.Selector) (*imageapi.ImageRepositoryList, error) {
|
|
| 93 |
+func (c *Fake) ListImageRepositories(ctx kapi.Context, selector labels.Selector) (*imageapi.ImageRepositoryList, error) {
|
|
| 94 | 94 |
c.Actions = append(c.Actions, FakeAction{Action: "list-imagerepositries", Ctx: ctx})
|
| 95 | 95 |
return &imageapi.ImageRepositoryList{}, nil
|
| 96 | 96 |
} |
| 97 | 97 |
|
| 98 |
-func (c *Fake) GetImageRepository(ctx kubeapi.Context, id string) (*imageapi.ImageRepository, error) {
|
|
| 98 |
+func (c *Fake) GetImageRepository(ctx kapi.Context, id string) (*imageapi.ImageRepository, error) {
|
|
| 99 | 99 |
c.Actions = append(c.Actions, FakeAction{Action: "get-imagerepository", Ctx: ctx, Value: id})
|
| 100 | 100 |
return &imageapi.ImageRepository{}, nil
|
| 101 | 101 |
} |
| 102 | 102 |
|
| 103 |
-func (c *Fake) WatchImageRepositories(ctx kubeapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 103 |
+func (c *Fake) WatchImageRepositories(ctx kapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 104 | 104 |
c.Actions = append(c.Actions, FakeAction{Action: "watch-imagerepositories"})
|
| 105 | 105 |
return nil, nil |
| 106 | 106 |
} |
| 107 | 107 |
|
| 108 |
-func (c *Fake) CreateImageRepository(ctx kubeapi.Context, repo *imageapi.ImageRepository) (*imageapi.ImageRepository, error) {
|
|
| 108 |
+func (c *Fake) CreateImageRepository(ctx kapi.Context, repo *imageapi.ImageRepository) (*imageapi.ImageRepository, error) {
|
|
| 109 | 109 |
c.Actions = append(c.Actions, FakeAction{Action: "create-imagerepository", Ctx: ctx})
|
| 110 | 110 |
return &imageapi.ImageRepository{}, nil
|
| 111 | 111 |
} |
| 112 | 112 |
|
| 113 |
-func (c *Fake) UpdateImageRepository(ctx kubeapi.Context, repo *imageapi.ImageRepository) (*imageapi.ImageRepository, error) {
|
|
| 113 |
+func (c *Fake) UpdateImageRepository(ctx kapi.Context, repo *imageapi.ImageRepository) (*imageapi.ImageRepository, error) {
|
|
| 114 | 114 |
c.Actions = append(c.Actions, FakeAction{Action: "update-imagerepository", Ctx: ctx})
|
| 115 | 115 |
return &imageapi.ImageRepository{}, nil
|
| 116 | 116 |
} |
| 117 | 117 |
|
| 118 |
-func (c *Fake) CreateImageRepositoryMapping(ctx kubeapi.Context, mapping *imageapi.ImageRepositoryMapping) error {
|
|
| 118 |
+func (c *Fake) CreateImageRepositoryMapping(ctx kapi.Context, mapping *imageapi.ImageRepositoryMapping) error {
|
|
| 119 | 119 |
c.Actions = append(c.Actions, FakeAction{Action: "create-imagerepository-mapping", Ctx: ctx})
|
| 120 | 120 |
return nil |
| 121 | 121 |
} |
| 122 | 122 |
|
| 123 |
-func (c *Fake) ListDeploymentConfigs(ctx kubeapi.Context, selector labels.Selector) (*deployapi.DeploymentConfigList, error) {
|
|
| 123 |
+func (c *Fake) ListDeploymentConfigs(ctx kapi.Context, selector labels.Selector) (*deployapi.DeploymentConfigList, error) {
|
|
| 124 | 124 |
c.Actions = append(c.Actions, FakeAction{Action: "list-deploymentconfig", Ctx: ctx})
|
| 125 | 125 |
return &deployapi.DeploymentConfigList{}, nil
|
| 126 | 126 |
} |
| 127 | 127 |
|
| 128 |
-func (c *Fake) GetDeploymentConfig(ctx kubeapi.Context, id string) (*deployapi.DeploymentConfig, error) {
|
|
| 128 |
+func (c *Fake) GetDeploymentConfig(ctx kapi.Context, id string) (*deployapi.DeploymentConfig, error) {
|
|
| 129 | 129 |
c.Actions = append(c.Actions, FakeAction{Action: "get-deploymentconfig", Ctx: ctx})
|
| 130 | 130 |
return &deployapi.DeploymentConfig{}, nil
|
| 131 | 131 |
} |
| 132 | 132 |
|
| 133 |
-func (c *Fake) CreateDeploymentConfig(ctx kubeapi.Context, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error) {
|
|
| 133 |
+func (c *Fake) CreateDeploymentConfig(ctx kapi.Context, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error) {
|
|
| 134 | 134 |
c.Actions = append(c.Actions, FakeAction{Action: "create-deploymentconfig", Ctx: ctx})
|
| 135 | 135 |
return &deployapi.DeploymentConfig{}, nil
|
| 136 | 136 |
} |
| 137 | 137 |
|
| 138 |
-func (c *Fake) UpdateDeploymentConfig(ctx kubeapi.Context, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error) {
|
|
| 138 |
+func (c *Fake) UpdateDeploymentConfig(ctx kapi.Context, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error) {
|
|
| 139 | 139 |
c.Actions = append(c.Actions, FakeAction{Action: "update-deploymentconfig", Ctx: ctx})
|
| 140 | 140 |
return &deployapi.DeploymentConfig{}, nil
|
| 141 | 141 |
} |
| 142 | 142 |
|
| 143 |
-func (c *Fake) DeleteDeploymentConfig(ctx kubeapi.Context, id string) error {
|
|
| 143 |
+func (c *Fake) DeleteDeploymentConfig(ctx kapi.Context, id string) error {
|
|
| 144 | 144 |
c.Actions = append(c.Actions, FakeAction{Action: "delete-deploymentconfig", Ctx: ctx})
|
| 145 | 145 |
return nil |
| 146 | 146 |
} |
| 147 | 147 |
|
| 148 |
-func (c *Fake) GenerateDeploymentConfig(ctx kubeapi.Context, id string) (*deployapi.DeploymentConfig, error) {
|
|
| 148 |
+func (c *Fake) GenerateDeploymentConfig(ctx kapi.Context, id string) (*deployapi.DeploymentConfig, error) {
|
|
| 149 | 149 |
c.Actions = append(c.Actions, FakeAction{Action: "generate-deploymentconfig"})
|
| 150 | 150 |
return nil, nil |
| 151 | 151 |
} |
| 152 | 152 |
|
| 153 |
-func (c *Fake) ListDeployments(ctx kubeapi.Context, selector labels.Selector) (*deployapi.DeploymentList, error) {
|
|
| 153 |
+func (c *Fake) ListDeployments(ctx kapi.Context, selector labels.Selector) (*deployapi.DeploymentList, error) {
|
|
| 154 | 154 |
c.Actions = append(c.Actions, FakeAction{Action: "list-deployment"})
|
| 155 | 155 |
return &deployapi.DeploymentList{}, nil
|
| 156 | 156 |
} |
| 157 | 157 |
|
| 158 |
-func (c *Fake) GetDeployment(ctx kubeapi.Context, id string) (*deployapi.Deployment, error) {
|
|
| 158 |
+func (c *Fake) GetDeployment(ctx kapi.Context, id string) (*deployapi.Deployment, error) {
|
|
| 159 | 159 |
c.Actions = append(c.Actions, FakeAction{Action: "get-deployment", Ctx: ctx})
|
| 160 | 160 |
return &deployapi.Deployment{}, nil
|
| 161 | 161 |
} |
| 162 | 162 |
|
| 163 |
-func (c *Fake) CreateDeployment(ctx kubeapi.Context, deployment *deployapi.Deployment) (*deployapi.Deployment, error) {
|
|
| 163 |
+func (c *Fake) CreateDeployment(ctx kapi.Context, deployment *deployapi.Deployment) (*deployapi.Deployment, error) {
|
|
| 164 | 164 |
c.Actions = append(c.Actions, FakeAction{Action: "create-deployment", Ctx: ctx})
|
| 165 | 165 |
return &deployapi.Deployment{}, nil
|
| 166 | 166 |
} |
| 167 | 167 |
|
| 168 |
-func (c *Fake) UpdateDeployment(ctx kubeapi.Context, deployment *deployapi.Deployment) (*deployapi.Deployment, error) {
|
|
| 168 |
+func (c *Fake) UpdateDeployment(ctx kapi.Context, deployment *deployapi.Deployment) (*deployapi.Deployment, error) {
|
|
| 169 | 169 |
c.Actions = append(c.Actions, FakeAction{Action: "update-deployment", Value: deployment})
|
| 170 | 170 |
return &deployapi.Deployment{}, nil
|
| 171 | 171 |
} |
| 172 | 172 |
|
| 173 |
-func (c *Fake) DeleteDeployment(ctx kubeapi.Context, id string) error {
|
|
| 173 |
+func (c *Fake) DeleteDeployment(ctx kapi.Context, id string) error {
|
|
| 174 | 174 |
c.Actions = append(c.Actions, FakeAction{Action: "delete-deployment", Ctx: ctx})
|
| 175 | 175 |
return nil |
| 176 | 176 |
} |
| 177 | 177 |
|
| 178 |
-func (c *Fake) WatchDeployments(ctx kubeapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 178 |
+func (c *Fake) WatchDeployments(ctx kapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 179 | 179 |
c.Actions = append(c.Actions, FakeAction{Action: "watch-deployments"})
|
| 180 | 180 |
return nil, nil |
| 181 | 181 |
} |
| 182 | 182 |
|
| 183 |
-func (c *Fake) ListRoutes(ctx kubeapi.Context, selector labels.Selector) (*routeapi.RouteList, error) {
|
|
| 183 |
+func (c *Fake) ListRoutes(ctx kapi.Context, selector labels.Selector) (*routeapi.RouteList, error) {
|
|
| 184 | 184 |
c.Actions = append(c.Actions, FakeAction{Action: "list-routes"})
|
| 185 | 185 |
return &routeapi.RouteList{}, nil
|
| 186 | 186 |
} |
| 187 | 187 |
|
| 188 |
-func (c *Fake) GetRoute(ctx kubeapi.Context, id string) (*routeapi.Route, error) {
|
|
| 188 |
+func (c *Fake) GetRoute(ctx kapi.Context, id string) (*routeapi.Route, error) {
|
|
| 189 | 189 |
c.Actions = append(c.Actions, FakeAction{Action: "get-route", Ctx: ctx})
|
| 190 | 190 |
return &routeapi.Route{}, nil
|
| 191 | 191 |
} |
| 192 | 192 |
|
| 193 |
-func (c *Fake) CreateRoute(ctx kubeapi.Context, route *routeapi.Route) (*routeapi.Route, error) {
|
|
| 193 |
+func (c *Fake) CreateRoute(ctx kapi.Context, route *routeapi.Route) (*routeapi.Route, error) {
|
|
| 194 | 194 |
c.Actions = append(c.Actions, FakeAction{Action: "create-route", Ctx: ctx})
|
| 195 | 195 |
return &routeapi.Route{}, nil
|
| 196 | 196 |
} |
| 197 | 197 |
|
| 198 |
-func (c *Fake) UpdateRoute(ctx kubeapi.Context, route *routeapi.Route) (*routeapi.Route, error) {
|
|
| 198 |
+func (c *Fake) UpdateRoute(ctx kapi.Context, route *routeapi.Route) (*routeapi.Route, error) {
|
|
| 199 | 199 |
c.Actions = append(c.Actions, FakeAction{Action: "update-route", Ctx: ctx})
|
| 200 | 200 |
return &routeapi.Route{}, nil
|
| 201 | 201 |
} |
| 202 | 202 |
|
| 203 |
-func (c *Fake) DeleteRoute(ctx kubeapi.Context, id string) error {
|
|
| 203 |
+func (c *Fake) DeleteRoute(ctx kapi.Context, id string) error {
|
|
| 204 | 204 |
c.Actions = append(c.Actions, FakeAction{Action: "delete-route", Ctx: ctx})
|
| 205 | 205 |
return nil |
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 |
-func (c *Fake) WatchRoutes(ctx kubeapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 208 |
+func (c *Fake) WatchRoutes(ctx kapi.Context, field, label labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 209 | 209 |
c.Actions = append(c.Actions, FakeAction{Action: "watch-routes"})
|
| 210 | 210 |
return nil, nil |
| 211 | 211 |
} |
| ... | ... |
@@ -16,7 +16,7 @@ import ( |
| 16 | 16 |
|
| 17 | 17 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 18 | 18 |
klatest "github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest" |
| 19 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 19 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 20 | 20 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubecfg" |
| 21 | 21 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 22 | 22 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
| ... | ... |
@@ -41,7 +41,7 @@ import ( |
| 41 | 41 |
) |
| 42 | 42 |
|
| 43 | 43 |
type KubeConfig struct {
|
| 44 |
- ClientConfig kubeclient.Config |
|
| 44 |
+ ClientConfig kclient.Config |
|
| 45 | 45 |
ServerVersion bool |
| 46 | 46 |
PreventSkew bool |
| 47 | 47 |
Config string |
| ... | ... |
@@ -222,7 +222,7 @@ func (c *KubeConfig) Run() {
|
| 222 | 222 |
} |
| 223 | 223 |
clientConfig.Host = hosts[0] |
| 224 | 224 |
|
| 225 |
- if kubeclient.IsConfigTransportSecure(clientConfig) {
|
|
| 225 |
+ if kclient.IsConfigTransportSecure(clientConfig) {
|
|
| 226 | 226 |
auth, err := kubecfg.LoadAuthInfo(c.AuthConfig, os.Stdin) |
| 227 | 227 |
if err != nil {
|
| 228 | 228 |
glog.Fatalf("Error loading auth: %v", err)
|
| ... | ... |
@@ -243,7 +243,7 @@ func (c *KubeConfig) Run() {
|
| 243 | 243 |
} |
| 244 | 244 |
} |
| 245 | 245 |
clientConfig.Version = c.APIVersion |
| 246 |
- kubeClient, err := kubeclient.New(clientConfig) |
|
| 246 |
+ kubeClient, err := kclient.New(clientConfig) |
|
| 247 | 247 |
if err != nil {
|
| 248 | 248 |
glog.Fatalf("Unable to set up the Kubernetes API client: %v", err)
|
| 249 | 249 |
} |
| ... | ... |
@@ -453,7 +453,7 @@ func (c *KubeConfig) executeAPIRequest(method string, clients ClientMappings) bo |
| 453 | 453 |
return true |
| 454 | 454 |
} |
| 455 | 455 |
|
| 456 |
-func (c *KubeConfig) executeControllerRequest(method string, client *kubeclient.Client) bool {
|
|
| 456 |
+func (c *KubeConfig) executeControllerRequest(method string, client *kclient.Client) bool {
|
|
| 457 | 457 |
parseController := func() string {
|
| 458 | 458 |
if len(c.Args) != 2 {
|
| 459 | 459 |
glog.Fatal("usage: kubecfg [OPTIONS] stop|rm|rollingupdate|run|resize <controller>")
|
| ... | ... |
@@ -568,7 +568,7 @@ func (c *KubeConfig) executeConfigRequest(method string, clients ClientMappings) |
| 568 | 568 |
continue |
| 569 | 569 |
} |
| 570 | 570 |
|
| 571 |
- if statusErr, ok := itemResult.Error.(kubeclient.APIStatus); ok {
|
|
| 571 |
+ if statusErr, ok := itemResult.Error.(kclient.APIStatus); ok {
|
|
| 572 | 572 |
fmt.Printf("Error: %v\n", statusErr.Status().Message)
|
| 573 | 573 |
} else {
|
| 574 | 574 |
fmt.Printf("Error: %v\n", itemResult.Error)
|
| ... | ... |
@@ -7,7 +7,7 @@ import ( |
| 7 | 7 |
"time" |
| 8 | 8 |
|
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 10 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 10 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/controller" |
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/master" |
| 13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/service" |
| ... | ... |
@@ -31,7 +31,7 @@ type MasterConfig struct {
|
| 31 | 31 |
PortalNet *net.IPNet |
| 32 | 32 |
|
| 33 | 33 |
EtcdHelper tools.EtcdHelper |
| 34 |
- KubeClient *kubeclient.Client |
|
| 34 |
+ KubeClient *kclient.Client |
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
// TODO: Longer term we should read this from some config store, rather than a flag. |
| ... | ... |
@@ -46,7 +46,7 @@ func (c *MasterConfig) EnsurePortalFlags() {
|
| 46 | 46 |
// endpoints were started (these are format strings that will expect to be sent |
| 47 | 47 |
// a single string value). |
| 48 | 48 |
func (c *MasterConfig) InstallAPI(mux util.Mux) []string {
|
| 49 |
- podInfoGetter := &kubeclient.HTTPPodInfoGetter{
|
|
| 49 |
+ podInfoGetter := &kclient.HTTPPodInfoGetter{
|
|
| 50 | 50 |
Client: http.DefaultClient, |
| 51 | 51 |
Port: uint(NodePort), |
| 52 | 52 |
} |
| ... | ... |
@@ -11,7 +11,7 @@ import ( |
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 12 | 12 |
klatest "github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest" |
| 13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 14 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 14 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 15 | 15 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
| 16 | 16 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
| 17 | 17 |
etcdclient "github.com/coreos/go-etcd/etcd" |
| ... | ... |
@@ -76,7 +76,7 @@ type MasterConfig struct {
|
| 76 | 76 |
|
| 77 | 77 |
EtcdHelper tools.EtcdHelper |
| 78 | 78 |
|
| 79 |
- KubeClient *kubeclient.Client |
|
| 79 |
+ KubeClient *kclient.Client |
|
| 80 | 80 |
OSClient *osclient.Client |
| 81 | 81 |
} |
| 82 | 82 |
|
| ... | ... |
@@ -88,7 +88,7 @@ type APIInstaller interface {
|
| 88 | 88 |
|
| 89 | 89 |
// EnsureKubernetesClient creates a Kubernetes client or exits if the client cannot be created. |
| 90 | 90 |
func (c *MasterConfig) EnsureKubernetesClient() {
|
| 91 |
- kubeClient, err := kubeclient.New(&kubeclient.Config{Host: c.MasterAddr, Version: klatest.Version})
|
|
| 91 |
+ kubeClient, err := kclient.New(&kclient.Config{Host: c.MasterAddr, Version: klatest.Version})
|
|
| 92 | 92 |
if err != nil {
|
| 93 | 93 |
glog.Fatalf("Unable to configure client: %v", err)
|
| 94 | 94 |
} |
| ... | ... |
@@ -97,7 +97,7 @@ func (c *MasterConfig) EnsureKubernetesClient() {
|
| 97 | 97 |
|
| 98 | 98 |
// EnsureOpenShiftClient creates an OpenShift client or exits if the client cannot be created. |
| 99 | 99 |
func (c *MasterConfig) EnsureOpenShiftClient() {
|
| 100 |
- osClient, err := osclient.New(&kubeclient.Config{Host: c.MasterAddr, Version: latest.Version})
|
|
| 100 |
+ osClient, err := osclient.New(&kclient.Config{Host: c.MasterAddr, Version: latest.Version})
|
|
| 101 | 101 |
if err != nil {
|
| 102 | 102 |
glog.Fatalf("Unable to configure client: %v", err)
|
| 103 | 103 |
} |
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
"time" |
| 11 | 11 |
|
| 12 | 12 |
klatest "github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest" |
| 13 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 13 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 14 | 14 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet" |
| 15 | 15 |
kmaster "github.com/GoogleCloudPlatform/kubernetes/pkg/master" |
| 16 | 16 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
| ... | ... |
@@ -179,7 +179,7 @@ func NewCommandStartServer(name string) *cobra.Command {
|
| 179 | 179 |
if startKube {
|
| 180 | 180 |
osmaster.EnsureKubernetesClient() |
| 181 | 181 |
} else {
|
| 182 |
- kubeClient, err := kubeclient.New(&kubeclient.Config{Host: cfg.KubernetesAddr.URL.String(), Version: klatest.Version})
|
|
| 182 |
+ kubeClient, err := kclient.New(&kclient.Config{Host: cfg.KubernetesAddr.URL.String(), Version: klatest.Version})
|
|
| 183 | 183 |
if err != nil {
|
| 184 | 184 |
glog.Fatalf("Unable to configure Kubernetes client: %v", err)
|
| 185 | 185 |
} |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package api |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 6 | 6 |
) |
| 7 | 7 |
|
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
// TODO: Unify with Kubernetes Config |
| 10 | 10 |
// https://github.com/GoogleCloudPlatform/kubernetes/pull/1007 |
| 11 | 11 |
type Config struct {
|
| 12 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 12 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 13 | 13 |
|
| 14 | 14 |
// Required: Name identifies the Config. |
| 15 | 15 |
Name string `json:"name" yaml:"name"` |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package v1beta1 |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1" |
|
| 5 | 5 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 6 | 6 |
) |
| 7 | 7 |
|
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
// TODO: Unify with Kubernetes Config |
| 10 | 10 |
// https://github.com/GoogleCloudPlatform/kubernetes/pull/1007 |
| 11 | 11 |
type Config struct {
|
| 12 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 12 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 13 | 13 |
|
| 14 | 14 |
// Required: Name identifies the Config. |
| 15 | 15 |
Name string `json:"name" yaml:"name"` |
| ... | ... |
@@ -5,7 +5,7 @@ import ( |
| 5 | 5 |
"fmt" |
| 6 | 6 |
"reflect" |
| 7 | 7 |
|
| 8 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 10 | 10 |
|
| 11 | 11 |
clientapi "github.com/openshift/origin/pkg/cmd/client/api" |
| ... | ... |
@@ -43,7 +43,7 @@ func Apply(namespace string, data []byte, storage clientapi.ClientMappings) (res |
| 43 | 43 |
continue |
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 |
- itemBase := kubeapi.TypeMeta{}
|
|
| 46 |
+ itemBase := kapi.TypeMeta{}
|
|
| 47 | 47 |
|
| 48 | 48 |
err = json.Unmarshal(item, &itemBase) |
| 49 | 49 |
if err != nil {
|
| ... | ... |
@@ -92,15 +92,15 @@ func Apply(namespace string, data []byte, storage clientapi.ClientMappings) (res |
| 92 | 92 |
func AddConfigLabels(c *api.Config, labels labels.Set) error {
|
| 93 | 93 |
for i, _ := range c.Items {
|
| 94 | 94 |
switch t := c.Items[i].Object.(type) {
|
| 95 |
- case *kubeapi.Pod: |
|
| 95 |
+ case *kapi.Pod: |
|
| 96 | 96 |
if err := mergeMaps(&t.Labels, labels, ErrorOnDifferentDstKeyValue); err != nil {
|
| 97 | 97 |
return fmt.Errorf("Unable to add labels to Template.Items[%v] Pod.Labels: %v", i, err)
|
| 98 | 98 |
} |
| 99 |
- case *kubeapi.Service: |
|
| 99 |
+ case *kapi.Service: |
|
| 100 | 100 |
if err := mergeMaps(&t.Labels, labels, ErrorOnDifferentDstKeyValue); err != nil {
|
| 101 | 101 |
return fmt.Errorf("Unable to add labels to Template.Items[%v] Service.Labels: %v", i, err)
|
| 102 | 102 |
} |
| 103 |
- case *kubeapi.ReplicationController: |
|
| 103 |
+ case *kapi.ReplicationController: |
|
| 104 | 104 |
if err := mergeMaps(&t.Labels, labels, ErrorOnDifferentDstKeyValue); err != nil {
|
| 105 | 105 |
return fmt.Errorf("Unable to add labels to Template.Items[%v] ReplicationController.Labels: %v", i, err)
|
| 106 | 106 |
} |
| ... | ... |
@@ -8,9 +8,9 @@ import ( |
| 8 | 8 |
"reflect" |
| 9 | 9 |
"testing" |
| 10 | 10 |
|
| 11 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 11 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 12 | 12 |
klatest "github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest" |
| 13 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 13 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 14 | 14 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 15 | 15 |
|
| 16 | 16 |
clientapi "github.com/openshift/origin/pkg/cmd/client/api" |
| ... | ... |
@@ -34,7 +34,7 @@ func TestApplyInvalidConfig(t *testing.T) {
|
| 34 | 34 |
`{ "items": [ { "kind": "InvalidClientResource", "apiVersion": "v1beta1" } ] }`,
|
| 35 | 35 |
} |
| 36 | 36 |
for i, invalidConfig := range invalidConfigs {
|
| 37 |
- result, _ := Apply(kubeapi.NamespaceDefault, []byte(invalidConfig), clients) |
|
| 37 |
+ result, _ := Apply(kapi.NamespaceDefault, []byte(invalidConfig), clients) |
|
| 38 | 38 |
|
| 39 | 39 |
if result != nil {
|
| 40 | 40 |
t.Errorf("Expected error while applying invalid Config '%v'", invalidConfig[i])
|
| ... | ... |
@@ -43,15 +43,15 @@ func TestApplyInvalidConfig(t *testing.T) {
|
| 43 | 43 |
if itemResult.Error == nil {
|
| 44 | 44 |
t.Errorf("Expected error while applying invalid Config '%v'", invalidConfig[i])
|
| 45 | 45 |
} |
| 46 |
- if _, ok := itemResult.Error.(kubeclient.APIStatus); ok {
|
|
| 47 |
- t.Errorf("Unexpected conversion of %T into kubeclient.APIStatus", itemResult.Error)
|
|
| 46 |
+ if _, ok := itemResult.Error.(kclient.APIStatus); ok {
|
|
| 47 |
+ t.Errorf("Unexpected conversion of %T into kclient.APIStatus", itemResult.Error)
|
|
| 48 | 48 |
} |
| 49 | 49 |
} |
| 50 | 50 |
} |
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
type FakeResource struct {
|
| 54 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 54 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 55 | 55 |
} |
| 56 | 56 |
|
| 57 | 57 |
func (*FakeResource) IsAnAPIObject() {}
|
| ... | ... |
@@ -66,18 +66,18 @@ func TestApplySendsData(t *testing.T) {
|
| 66 | 66 |
received := make(chan bool, 1) |
| 67 | 67 |
fakeServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
| 68 | 68 |
received <- true |
| 69 |
- if r.RequestURI != "/api/v1beta1/FakeMapping?namespace="+kubeapi.NamespaceDefault {
|
|
| 69 |
+ if r.RequestURI != "/api/v1beta1/FakeMapping?namespace="+kapi.NamespaceDefault {
|
|
| 70 | 70 |
t.Errorf("Unexpected RESTClient RequestURI. Expected: %v, got: %v.", "/api/v1beta1/FakeMapping", r.RequestURI)
|
| 71 | 71 |
} |
| 72 | 72 |
})) |
| 73 | 73 |
|
| 74 | 74 |
uri, _ := url.Parse(fakeServer.URL + "/api/v1beta1") |
| 75 |
- fakeClient := kubeclient.NewRESTClient(uri, fakeCodec) |
|
| 75 |
+ fakeClient := kclient.NewRESTClient(uri, fakeCodec) |
|
| 76 | 76 |
clients := clientapi.ClientMappings{
|
| 77 | 77 |
"FakeMapping": {"FakeResource", fakeClient, fakeCodec},
|
| 78 | 78 |
} |
| 79 | 79 |
config := `{ "apiVersion": "v1beta1", "items": [ { "kind": "FakeResource", "apiVersion": "v1beta1", "id": "FakeID" } ] }`
|
| 80 |
- result, err := Apply(kubeapi.NamespaceDefault, []byte(config), clients) |
|
| 80 |
+ result, err := Apply(kapi.NamespaceDefault, []byte(config), clients) |
|
| 81 | 81 |
|
| 82 | 82 |
if err != nil || result == nil {
|
| 83 | 83 |
t.Errorf("Unexpected error while applying valid Config '%v': %v", config, err)
|
| ... | ... |
@@ -87,10 +87,10 @@ func TestApplySendsData(t *testing.T) {
|
| 87 | 87 |
continue |
| 88 | 88 |
} |
| 89 | 89 |
|
| 90 |
- if _, ok := itemResult.Error.(kubeclient.APIStatus); ok {
|
|
| 90 |
+ if _, ok := itemResult.Error.(kclient.APIStatus); ok {
|
|
| 91 | 91 |
t.Errorf("Unexpected error while applying valid Config '%v': %v", config, itemResult.Error)
|
| 92 | 92 |
} else {
|
| 93 |
- t.Errorf("Cannot convert %T into kubeclient.APIStatus", itemResult.Error)
|
|
| 93 |
+ t.Errorf("Cannot convert %T into kclient.APIStatus", itemResult.Error)
|
|
| 94 | 94 |
} |
| 95 | 95 |
} |
| 96 | 96 |
|
| ... | ... |
@@ -98,7 +98,7 @@ func TestApplySendsData(t *testing.T) {
|
| 98 | 98 |
} |
| 99 | 99 |
|
| 100 | 100 |
func TestGetClientAndPath(t *testing.T) {
|
| 101 |
- kubeClient, _ := kubeclient.New(&kubeclient.Config{Host: "127.0.0.1"})
|
|
| 101 |
+ kubeClient, _ := kclient.New(&kclient.Config{Host: "127.0.0.1"})
|
|
| 102 | 102 |
testClientMappings := clientapi.ClientMappings{
|
| 103 | 103 |
"pods": {"Pod", kubeClient.RESTClient, klatest.Codec},
|
| 104 | 104 |
"services": {"Service", kubeClient.RESTClient, klatest.Codec},
|
| ... | ... |
@@ -113,18 +113,18 @@ func TestGetClientAndPath(t *testing.T) {
|
| 113 | 113 |
} |
| 114 | 114 |
|
| 115 | 115 |
func ExampleApply() {
|
| 116 |
- kubeClient, _ := kubeclient.New(&kubeclient.Config{Host: "127.0.0.1"})
|
|
| 116 |
+ kubeClient, _ := kclient.New(&kclient.Config{Host: "127.0.0.1"})
|
|
| 117 | 117 |
testClientMappings := clientapi.ClientMappings{
|
| 118 | 118 |
"pods": {"Pod", kubeClient.RESTClient, klatest.Codec},
|
| 119 | 119 |
"services": {"Service", kubeClient.RESTClient, klatest.Codec},
|
| 120 | 120 |
} |
| 121 | 121 |
data, _ := ioutil.ReadFile("config_test.json")
|
| 122 |
- Apply(kubeapi.NamespaceDefault, data, testClientMappings) |
|
| 122 |
+ Apply(kapi.NamespaceDefault, data, testClientMappings) |
|
| 123 | 123 |
} |
| 124 | 124 |
|
| 125 | 125 |
type FakeLabelsResource struct {
|
| 126 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 127 |
- Labels map[string]string `json:"labels" yaml:"labels"` |
|
| 126 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 127 |
+ Labels map[string]string `json:"labels" yaml:"labels"` |
|
| 128 | 128 |
} |
| 129 | 129 |
|
| 130 | 130 |
func (*FakeLabelsResource) IsAnAPIObject() {}
|
| ... | ... |
@@ -137,46 +137,46 @@ func TestAddConfigLabels(t *testing.T) {
|
| 137 | 137 |
expectedLabels map[string]string |
| 138 | 138 |
}{
|
| 139 | 139 |
{ // Test empty labels
|
| 140 |
- &kubeapi.Pod{},
|
|
| 140 |
+ &kapi.Pod{},
|
|
| 141 | 141 |
map[string]string{},
|
| 142 | 142 |
true, |
| 143 | 143 |
map[string]string{},
|
| 144 | 144 |
}, |
| 145 | 145 |
{ // Test resource labels + 0 => expected labels
|
| 146 |
- &kubeapi.Pod{Labels: map[string]string{"foo": "bar"}},
|
|
| 146 |
+ &kapi.Pod{Labels: map[string]string{"foo": "bar"}},
|
|
| 147 | 147 |
map[string]string{},
|
| 148 | 148 |
true, |
| 149 | 149 |
map[string]string{"foo": "bar"},
|
| 150 | 150 |
}, |
| 151 | 151 |
{ // Test 0 + addLabels => expected labels
|
| 152 |
- &kubeapi.Pod{},
|
|
| 152 |
+ &kapi.Pod{},
|
|
| 153 | 153 |
map[string]string{"foo": "bar"},
|
| 154 | 154 |
true, |
| 155 | 155 |
map[string]string{"foo": "bar"},
|
| 156 | 156 |
}, |
| 157 | 157 |
{ // Test resource labels + addLabels => expected labels
|
| 158 |
- &kubeapi.Service{Labels: map[string]string{"baz": ""}},
|
|
| 158 |
+ &kapi.Service{Labels: map[string]string{"baz": ""}},
|
|
| 159 | 159 |
map[string]string{"foo": "bar"},
|
| 160 | 160 |
true, |
| 161 | 161 |
map[string]string{"foo": "bar", "baz": ""},
|
| 162 | 162 |
}, |
| 163 | 163 |
{ // Test conflicting keys with the same value
|
| 164 |
- &kubeapi.Service{Labels: map[string]string{"foo": "same value"}},
|
|
| 164 |
+ &kapi.Service{Labels: map[string]string{"foo": "same value"}},
|
|
| 165 | 165 |
map[string]string{"foo": "same value"},
|
| 166 | 166 |
true, |
| 167 | 167 |
map[string]string{"foo": "same value"},
|
| 168 | 168 |
}, |
| 169 | 169 |
{ // Test conflicting keys with a different value
|
| 170 |
- &kubeapi.Service{Labels: map[string]string{"foo": "first value"}},
|
|
| 170 |
+ &kapi.Service{Labels: map[string]string{"foo": "first value"}},
|
|
| 171 | 171 |
map[string]string{"foo": "second value"},
|
| 172 | 172 |
false, |
| 173 | 173 |
map[string]string{"foo": "first value"},
|
| 174 | 174 |
}, |
| 175 | 175 |
{ // Test conflicting keys with the same value in the nested ReplicationController labels
|
| 176 |
- &kubeapi.ReplicationController{
|
|
| 176 |
+ &kapi.ReplicationController{
|
|
| 177 | 177 |
Labels: map[string]string{"foo": "same value"},
|
| 178 |
- DesiredState: kubeapi.ReplicationControllerState{
|
|
| 179 |
- PodTemplate: kubeapi.PodTemplate{
|
|
| 178 |
+ DesiredState: kapi.ReplicationControllerState{
|
|
| 179 |
+ PodTemplate: kapi.PodTemplate{
|
|
| 180 | 180 |
Labels: map[string]string{"foo": "same value"},
|
| 181 | 181 |
}, |
| 182 | 182 |
}, |
| ... | ... |
@@ -186,10 +186,10 @@ func TestAddConfigLabels(t *testing.T) {
|
| 186 | 186 |
map[string]string{"foo": "same value"},
|
| 187 | 187 |
}, |
| 188 | 188 |
{ // Test conflicting keys with a different value in the nested ReplicationController labels
|
| 189 |
- &kubeapi.ReplicationController{
|
|
| 189 |
+ &kapi.ReplicationController{
|
|
| 190 | 190 |
Labels: map[string]string{"foo": "first value"},
|
| 191 |
- DesiredState: kubeapi.ReplicationControllerState{
|
|
| 192 |
- PodTemplate: kubeapi.PodTemplate{
|
|
| 191 |
+ DesiredState: kapi.ReplicationControllerState{
|
|
| 192 |
+ PodTemplate: kapi.PodTemplate{
|
|
| 193 | 193 |
Labels: map[string]string{"foo": "first value"},
|
| 194 | 194 |
}, |
| 195 | 195 |
}, |
| ... | ... |
@@ -201,8 +201,8 @@ func TestAddConfigLabels(t *testing.T) {
|
| 201 | 201 |
{ // Test merging into deployment object
|
| 202 | 202 |
&deployapi.Deployment{
|
| 203 | 203 |
Labels: map[string]string{"foo": "first value"},
|
| 204 |
- ControllerTemplate: kubeapi.ReplicationControllerState{
|
|
| 205 |
- PodTemplate: kubeapi.PodTemplate{
|
|
| 204 |
+ ControllerTemplate: kapi.ReplicationControllerState{
|
|
| 205 |
+ PodTemplate: kapi.PodTemplate{
|
|
| 206 | 206 |
Labels: map[string]string{"foo": "first value"},
|
| 207 | 207 |
}, |
| 208 | 208 |
}, |
| ... | ... |
@@ -215,8 +215,8 @@ func TestAddConfigLabels(t *testing.T) {
|
| 215 | 215 |
&deployapi.DeploymentConfig{
|
| 216 | 216 |
Labels: map[string]string{"foo": "first value"},
|
| 217 | 217 |
Template: deployapi.DeploymentTemplate{
|
| 218 |
- ControllerTemplate: kubeapi.ReplicationControllerState{
|
|
| 219 |
- PodTemplate: kubeapi.PodTemplate{
|
|
| 218 |
+ ControllerTemplate: kapi.ReplicationControllerState{
|
|
| 219 |
+ PodTemplate: kapi.PodTemplate{
|
|
| 220 | 220 |
Labels: map[string]string{"foo": "first value"},
|
| 221 | 221 |
}, |
| 222 | 222 |
}, |
| ... | ... |
@@ -3,7 +3,7 @@ package validation |
| 3 | 3 |
import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 8 | 8 |
"github.com/openshift/origin/pkg/deploy/api" |
| 9 | 9 |
) |
| ... | ... |
@@ -18,8 +18,8 @@ func manualTrigger() []api.DeploymentTriggerPolicy {
|
| 18 | 18 |
} |
| 19 | 19 |
} |
| 20 | 20 |
|
| 21 |
-func okControllerTemplate() kubeapi.ReplicationControllerState {
|
|
| 22 |
- return kubeapi.ReplicationControllerState{
|
|
| 21 |
+func okControllerTemplate() kapi.ReplicationControllerState {
|
|
| 22 |
+ return kapi.ReplicationControllerState{
|
|
| 23 | 23 |
ReplicaSelector: okSelector(), |
| 24 | 24 |
PodTemplate: okPodTemplate(), |
| 25 | 25 |
} |
| ... | ... |
@@ -29,10 +29,10 @@ func okSelector() map[string]string {
|
| 29 | 29 |
return map[string]string{"a": "b"}
|
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 |
-func okPodTemplate() kubeapi.PodTemplate {
|
|
| 33 |
- return kubeapi.PodTemplate{
|
|
| 34 |
- DesiredState: kubeapi.PodState{
|
|
| 35 |
- Manifest: kubeapi.ContainerManifest{
|
|
| 32 |
+func okPodTemplate() kapi.PodTemplate {
|
|
| 33 |
+ return kapi.PodTemplate{
|
|
| 34 |
+ DesiredState: kapi.PodState{
|
|
| 35 |
+ Manifest: kapi.ContainerManifest{
|
|
| 36 | 36 |
Version: "v1beta1", |
| 37 | 37 |
}, |
| 38 | 38 |
}, |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package deploy |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 6 | 6 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 7 | 7 |
api "github.com/openshift/origin/pkg/deploy/api" |
| ... | ... |
@@ -9,10 +9,10 @@ import ( |
| 9 | 9 |
|
| 10 | 10 |
// Registry is an interface for things that know how to store Deployments. |
| 11 | 11 |
type Registry interface {
|
| 12 |
- ListDeployments(ctx kubeapi.Context, selector labels.Selector) (*api.DeploymentList, error) |
|
| 13 |
- GetDeployment(ctx kubeapi.Context, id string) (*api.Deployment, error) |
|
| 14 |
- CreateDeployment(ctx kubeapi.Context, deployment *api.Deployment) error |
|
| 15 |
- UpdateDeployment(ctx kubeapi.Context, deployment *api.Deployment) error |
|
| 16 |
- DeleteDeployment(ctx kubeapi.Context, id string) error |
|
| 17 |
- WatchDeployments(ctx kubeapi.Context, resourceVersion string, filter func(repo *api.Deployment) bool) (watch.Interface, error) |
|
| 12 |
+ ListDeployments(ctx kapi.Context, selector labels.Selector) (*api.DeploymentList, error) |
|
| 13 |
+ GetDeployment(ctx kapi.Context, id string) (*api.Deployment, error) |
|
| 14 |
+ CreateDeployment(ctx kapi.Context, deployment *api.Deployment) error |
|
| 15 |
+ UpdateDeployment(ctx kapi.Context, deployment *api.Deployment) error |
|
| 16 |
+ DeleteDeployment(ctx kapi.Context, id string) error |
|
| 17 |
+ WatchDeployments(ctx kapi.Context, resourceVersion string, filter func(repo *api.Deployment) bool) (watch.Interface, error) |
|
| 18 | 18 |
} |
| ... | ... |
@@ -4,8 +4,8 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 | 6 |
"code.google.com/p/go-uuid/uuid" |
| 7 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 |
- kubeerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
|
| 7 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 |
+ kerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
|
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -35,7 +35,7 @@ func (s *REST) New() runtime.Object {
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
// List obtains a list of Deployments that match selector. |
| 38 |
-func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 38 |
+func (s *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 39 | 39 |
deployments, err := s.registry.ListDeployments(ctx, selector) |
| 40 | 40 |
if err != nil {
|
| 41 | 41 |
return nil, err |
| ... | ... |
@@ -45,7 +45,7 @@ func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runt |
| 45 | 45 |
} |
| 46 | 46 |
|
| 47 | 47 |
// Get obtains the Deployment specified by its id. |
| 48 |
-func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 48 |
+func (s *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 49 | 49 |
deployment, err := s.registry.GetDeployment(ctx, id) |
| 50 | 50 |
if err != nil {
|
| 51 | 51 |
return nil, err |
| ... | ... |
@@ -54,20 +54,20 @@ func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
// Delete asynchronously deletes the Deployment specified by its id. |
| 57 |
-func (s *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 57 |
+func (s *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 58 | 58 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| 59 |
- return &kubeapi.Status{Status: kubeapi.StatusSuccess}, s.registry.DeleteDeployment(ctx, id)
|
|
| 59 |
+ return &kapi.Status{Status: kapi.StatusSuccess}, s.registry.DeleteDeployment(ctx, id)
|
|
| 60 | 60 |
}), nil |
| 61 | 61 |
} |
| 62 | 62 |
|
| 63 | 63 |
// Create registers a given new Deployment instance to s.registry. |
| 64 |
-func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 64 |
+func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 65 | 65 |
deployment, ok := obj.(*deployapi.Deployment) |
| 66 | 66 |
if !ok {
|
| 67 | 67 |
return nil, fmt.Errorf("not a deployment: %#v", obj)
|
| 68 | 68 |
} |
| 69 |
- if !kubeapi.ValidNamespace(ctx, &deployment.TypeMeta) {
|
|
| 70 |
- return nil, kubeerrors.NewConflict("deployment", deployment.Namespace, fmt.Errorf("Deployment.Namespace does not match the provided context"))
|
|
| 69 |
+ if !kapi.ValidNamespace(ctx, &deployment.TypeMeta) {
|
|
| 70 |
+ return nil, kerrors.NewConflict("deployment", deployment.Namespace, fmt.Errorf("Deployment.Namespace does not match the provided context"))
|
|
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
deployment.CreationTimestamp = util.Now() |
| ... | ... |
@@ -80,7 +80,7 @@ func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 80 | 80 |
glog.Infof("Creating deployment with namespace::ID: %v::%v", deployment.Namespace, deployment.ID)
|
| 81 | 81 |
|
| 82 | 82 |
if errs := validation.ValidateDeployment(deployment); len(errs) > 0 {
|
| 83 |
- return nil, kubeerrors.NewInvalid("deployment", deployment.ID, errs)
|
|
| 83 |
+ return nil, kerrors.NewInvalid("deployment", deployment.ID, errs)
|
|
| 84 | 84 |
} |
| 85 | 85 |
|
| 86 | 86 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| ... | ... |
@@ -93,7 +93,7 @@ func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 | 95 |
// Update replaces a given Deployment instance with an existing instance in s.registry. |
| 96 |
-func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 96 |
+func (s *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 97 | 97 |
deployment, ok := obj.(*deployapi.Deployment) |
| 98 | 98 |
if !ok {
|
| 99 | 99 |
return nil, fmt.Errorf("not a deployment: %#v", obj)
|
| ... | ... |
@@ -101,8 +101,8 @@ func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 101 | 101 |
if len(deployment.ID) == 0 {
|
| 102 | 102 |
return nil, fmt.Errorf("id is unspecified: %#v", deployment)
|
| 103 | 103 |
} |
| 104 |
- if !kubeapi.ValidNamespace(ctx, &deployment.TypeMeta) {
|
|
| 105 |
- return nil, kubeerrors.NewConflict("deployment", deployment.Namespace, fmt.Errorf("Deployment.Namespace does not match the provided context"))
|
|
| 104 |
+ if !kapi.ValidNamespace(ctx, &deployment.TypeMeta) {
|
|
| 105 |
+ return nil, kerrors.NewConflict("deployment", deployment.Namespace, fmt.Errorf("Deployment.Namespace does not match the provided context"))
|
|
| 106 | 106 |
} |
| 107 | 107 |
|
| 108 | 108 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| ... | ... |
@@ -115,7 +115,7 @@ func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 115 | 115 |
} |
| 116 | 116 |
|
| 117 | 117 |
// Watch begins watching for new, changed, or deleted Deployments. |
| 118 |
-func (s *REST) Watch(ctx kubeapi.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 118 |
+func (s *REST) Watch(ctx kapi.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 119 | 119 |
return s.registry.WatchDeployments(ctx, resourceVersion, func(deployment *deployapi.Deployment) bool {
|
| 120 | 120 |
fields := labels.Set{
|
| 121 | 121 |
"ID": deployment.ID, |
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
"time" |
| 9 | 9 |
|
| 10 | 10 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 11 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 11 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 13 | 13 |
"github.com/openshift/origin/pkg/deploy/api" |
| 14 | 14 |
deploytest "github.com/openshift/origin/pkg/deploy/api/test" |
| ... | ... |
@@ -321,7 +321,7 @@ func checkExpectedNamespaceError(t *testing.T, err error) {
|
| 321 | 321 |
if err == nil {
|
| 322 | 322 |
t.Errorf("Expected '" + expectedError + "', but we didn't get one")
|
| 323 | 323 |
} else {
|
| 324 |
- e, ok := err.(kubeclient.APIStatus) |
|
| 324 |
+ e, ok := err.(kclient.APIStatus) |
|
| 325 | 325 |
if !ok {
|
| 326 | 326 |
t.Errorf("error was not a statusError: %v", err)
|
| 327 | 327 |
} |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package deployconfig |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 6 | 6 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 7 | 7 |
api "github.com/openshift/origin/pkg/deploy/api" |
| ... | ... |
@@ -9,10 +9,10 @@ import ( |
| 9 | 9 |
|
| 10 | 10 |
// Registry is an interface for things that know how to store DeploymentConfigs. |
| 11 | 11 |
type Registry interface {
|
| 12 |
- ListDeploymentConfigs(ctx kubeapi.Context, selector labels.Selector) (*api.DeploymentConfigList, error) |
|
| 13 |
- WatchDeploymentConfigs(ctx kubeapi.Context, resourceVersion string, filter func(repo *api.DeploymentConfig) bool) (watch.Interface, error) |
|
| 14 |
- GetDeploymentConfig(ctx kubeapi.Context, id string) (*api.DeploymentConfig, error) |
|
| 15 |
- CreateDeploymentConfig(ctx kubeapi.Context, deploymentConfig *api.DeploymentConfig) error |
|
| 16 |
- UpdateDeploymentConfig(ctx kubeapi.Context, deploymentConfig *api.DeploymentConfig) error |
|
| 17 |
- DeleteDeploymentConfig(ctx kubeapi.Context, id string) error |
|
| 12 |
+ ListDeploymentConfigs(ctx kapi.Context, selector labels.Selector) (*api.DeploymentConfigList, error) |
|
| 13 |
+ WatchDeploymentConfigs(ctx kapi.Context, resourceVersion string, filter func(repo *api.DeploymentConfig) bool) (watch.Interface, error) |
|
| 14 |
+ GetDeploymentConfig(ctx kapi.Context, id string) (*api.DeploymentConfig, error) |
|
| 15 |
+ CreateDeploymentConfig(ctx kapi.Context, deploymentConfig *api.DeploymentConfig) error |
|
| 16 |
+ UpdateDeploymentConfig(ctx kapi.Context, deploymentConfig *api.DeploymentConfig) error |
|
| 17 |
+ DeleteDeploymentConfig(ctx kapi.Context, id string) error |
|
| 18 | 18 |
} |
| ... | ... |
@@ -5,8 +5,8 @@ import ( |
| 5 | 5 |
|
| 6 | 6 |
"code.google.com/p/go-uuid/uuid" |
| 7 | 7 |
|
| 8 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 9 |
- kubeerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
|
| 8 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 9 |
+ kerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
|
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -36,7 +36,7 @@ func (s *REST) New() runtime.Object {
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
// List obtains a list of DeploymentConfigs that match selector. |
| 39 |
-func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 39 |
+func (s *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 40 | 40 |
deploymentConfigs, err := s.registry.ListDeploymentConfigs(ctx, selector) |
| 41 | 41 |
if err != nil {
|
| 42 | 42 |
return nil, err |
| ... | ... |
@@ -46,7 +46,7 @@ func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runt |
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 | 48 |
// Watch begins watching for new, changed, or deleted ImageRepositories. |
| 49 |
-func (s *REST) Watch(ctx kubeapi.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 49 |
+func (s *REST) Watch(ctx kapi.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 50 | 50 |
return s.registry.WatchDeploymentConfigs(ctx, resourceVersion, func(config *deployapi.DeploymentConfig) bool {
|
| 51 | 51 |
fields := labels.Set{
|
| 52 | 52 |
"ID": config.ID, |
| ... | ... |
@@ -56,7 +56,7 @@ func (s *REST) Watch(ctx kubeapi.Context, label, field labels.Selector, resource |
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
// Get obtains the DeploymentConfig specified by its id. |
| 59 |
-func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 59 |
+func (s *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 60 | 60 |
deploymentConfig, err := s.registry.GetDeploymentConfig(ctx, id) |
| 61 | 61 |
if err != nil {
|
| 62 | 62 |
return nil, err |
| ... | ... |
@@ -65,14 +65,14 @@ func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 | 67 |
// Delete asynchronously deletes the DeploymentConfig specified by its id. |
| 68 |
-func (s *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 68 |
+func (s *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 69 | 69 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| 70 |
- return &kubeapi.Status{Status: kubeapi.StatusSuccess}, s.registry.DeleteDeploymentConfig(ctx, id)
|
|
| 70 |
+ return &kapi.Status{Status: kapi.StatusSuccess}, s.registry.DeleteDeploymentConfig(ctx, id)
|
|
| 71 | 71 |
}), nil |
| 72 | 72 |
} |
| 73 | 73 |
|
| 74 | 74 |
// Create registers a given new DeploymentConfig instance to s.registry. |
| 75 |
-func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 75 |
+func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 76 | 76 |
deploymentConfig, ok := obj.(*deployapi.DeploymentConfig) |
| 77 | 77 |
if !ok {
|
| 78 | 78 |
return nil, fmt.Errorf("not a deploymentConfig: %#v", obj)
|
| ... | ... |
@@ -83,14 +83,14 @@ func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 83 | 83 |
if len(deploymentConfig.ID) == 0 {
|
| 84 | 84 |
deploymentConfig.ID = uuid.NewUUID().String() |
| 85 | 85 |
} |
| 86 |
- if !kubeapi.ValidNamespace(ctx, &deploymentConfig.TypeMeta) {
|
|
| 87 |
- return nil, kubeerrors.NewConflict("deploymentConfig", deploymentConfig.Namespace, fmt.Errorf("DeploymentConfig.Namespace does not match the provided context"))
|
|
| 86 |
+ if !kapi.ValidNamespace(ctx, &deploymentConfig.TypeMeta) {
|
|
| 87 |
+ return nil, kerrors.NewConflict("deploymentConfig", deploymentConfig.Namespace, fmt.Errorf("DeploymentConfig.Namespace does not match the provided context"))
|
|
| 88 | 88 |
} |
| 89 | 89 |
|
| 90 | 90 |
glog.Infof("Creating deploymentConfig with namespace::ID: %v::%v", deploymentConfig.Namespace, deploymentConfig.ID)
|
| 91 | 91 |
|
| 92 | 92 |
if errs := validation.ValidateDeploymentConfig(deploymentConfig); len(errs) > 0 {
|
| 93 |
- return nil, kubeerrors.NewInvalid("deploymentConfig", deploymentConfig.ID, errs)
|
|
| 93 |
+ return nil, kerrors.NewInvalid("deploymentConfig", deploymentConfig.ID, errs)
|
|
| 94 | 94 |
} |
| 95 | 95 |
|
| 96 | 96 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| ... | ... |
@@ -103,7 +103,7 @@ func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 103 | 103 |
} |
| 104 | 104 |
|
| 105 | 105 |
// Update replaces a given DeploymentConfig instance with an existing instance in s.registry. |
| 106 |
-func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 106 |
+func (s *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 107 | 107 |
deploymentConfig, ok := obj.(*deployapi.DeploymentConfig) |
| 108 | 108 |
if !ok {
|
| 109 | 109 |
return nil, fmt.Errorf("not a deploymentConfig: %#v", obj)
|
| ... | ... |
@@ -111,8 +111,8 @@ func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 111 | 111 |
if len(deploymentConfig.ID) == 0 {
|
| 112 | 112 |
return nil, fmt.Errorf("id is unspecified: %#v", deploymentConfig)
|
| 113 | 113 |
} |
| 114 |
- if !kubeapi.ValidNamespace(ctx, &deploymentConfig.TypeMeta) {
|
|
| 115 |
- return nil, kubeerrors.NewConflict("deploymentConfig", deploymentConfig.Namespace, fmt.Errorf("DeploymentConfig.Namespace does not match the provided context"))
|
|
| 114 |
+ if !kapi.ValidNamespace(ctx, &deploymentConfig.TypeMeta) {
|
|
| 115 |
+ return nil, kerrors.NewConflict("deploymentConfig", deploymentConfig.Namespace, fmt.Errorf("DeploymentConfig.Namespace does not match the provided context"))
|
|
| 116 | 116 |
} |
| 117 | 117 |
|
| 118 | 118 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
"time" |
| 9 | 9 |
|
| 10 | 10 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 11 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 11 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 13 | 13 |
"github.com/openshift/origin/pkg/deploy/api" |
| 14 | 14 |
deploytest "github.com/openshift/origin/pkg/deploy/api/test" |
| ... | ... |
@@ -323,7 +323,7 @@ func checkExpectedNamespaceError(t *testing.T, err error) {
|
| 323 | 323 |
if err == nil {
|
| 324 | 324 |
t.Errorf("Expected '" + expectedError + "', but we didn't get one")
|
| 325 | 325 |
} else {
|
| 326 |
- e, ok := err.(kubeclient.APIStatus) |
|
| 326 |
+ e, ok := err.(kclient.APIStatus) |
|
| 327 | 327 |
if !ok {
|
| 328 | 328 |
t.Errorf("error was not a statusError: %v", err)
|
| 329 | 329 |
} |
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 11 | 11 |
"github.com/golang/glog" |
| 12 | 12 |
|
| 13 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 13 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 14 | 14 |
kubeetcd "github.com/GoogleCloudPlatform/kubernetes/pkg/registry/etcd" |
| 15 | 15 |
"github.com/openshift/origin/pkg/deploy/api" |
| 16 | 16 |
) |
| ... | ... |
@@ -35,7 +35,7 @@ func New(helper tools.EtcdHelper) *Etcd {
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
// ListDeployments obtains a list of Deployments. |
| 38 |
-func (r *Etcd) ListDeployments(ctx kubeapi.Context, selector labels.Selector) (*api.DeploymentList, error) {
|
|
| 38 |
+func (r *Etcd) ListDeployments(ctx kapi.Context, selector labels.Selector) (*api.DeploymentList, error) {
|
|
| 39 | 39 |
deployments := api.DeploymentList{}
|
| 40 | 40 |
err := r.ExtractToList(makeDeploymentListKey(ctx), &deployments) |
| 41 | 41 |
if err != nil {
|
| ... | ... |
@@ -52,16 +52,16 @@ func (r *Etcd) ListDeployments(ctx kubeapi.Context, selector labels.Selector) (* |
| 52 | 52 |
return &deployments, err |
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 |
-func makeDeploymentListKey(ctx kubeapi.Context) string {
|
|
| 55 |
+func makeDeploymentListKey(ctx kapi.Context) string {
|
|
| 56 | 56 |
return kubeetcd.MakeEtcdListKey(ctx, DeploymentPath) |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 |
-func makeDeploymentKey(ctx kubeapi.Context, id string) (string, error) {
|
|
| 59 |
+func makeDeploymentKey(ctx kapi.Context, id string) (string, error) {
|
|
| 60 | 60 |
return kubeetcd.MakeEtcdItemKey(ctx, DeploymentPath, id) |
| 61 | 61 |
} |
| 62 | 62 |
|
| 63 | 63 |
// GetDeployment gets a specific Deployment specified by its ID. |
| 64 |
-func (r *Etcd) GetDeployment(ctx kubeapi.Context, id string) (*api.Deployment, error) {
|
|
| 64 |
+func (r *Etcd) GetDeployment(ctx kapi.Context, id string) (*api.Deployment, error) {
|
|
| 65 | 65 |
var deployment api.Deployment |
| 66 | 66 |
key, err := makeDeploymentKey(ctx, id) |
| 67 | 67 |
if err != nil {
|
| ... | ... |
@@ -75,7 +75,7 @@ func (r *Etcd) GetDeployment(ctx kubeapi.Context, id string) (*api.Deployment, e |
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 | 77 |
// CreateDeployment creates a new Deployment. |
| 78 |
-func (r *Etcd) CreateDeployment(ctx kubeapi.Context, deployment *api.Deployment) error {
|
|
| 78 |
+func (r *Etcd) CreateDeployment(ctx kapi.Context, deployment *api.Deployment) error {
|
|
| 79 | 79 |
key, err := makeDeploymentKey(ctx, deployment.ID) |
| 80 | 80 |
if err != nil {
|
| 81 | 81 |
return err |
| ... | ... |
@@ -85,7 +85,7 @@ func (r *Etcd) CreateDeployment(ctx kubeapi.Context, deployment *api.Deployment) |
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 | 87 |
// UpdateDeployment replaces an existing Deployment. |
| 88 |
-func (r *Etcd) UpdateDeployment(ctx kubeapi.Context, deployment *api.Deployment) error {
|
|
| 88 |
+func (r *Etcd) UpdateDeployment(ctx kapi.Context, deployment *api.Deployment) error {
|
|
| 89 | 89 |
key, err := makeDeploymentKey(ctx, deployment.ID) |
| 90 | 90 |
if err != nil {
|
| 91 | 91 |
return err |
| ... | ... |
@@ -95,7 +95,7 @@ func (r *Etcd) UpdateDeployment(ctx kubeapi.Context, deployment *api.Deployment) |
| 95 | 95 |
} |
| 96 | 96 |
|
| 97 | 97 |
// DeleteDeployment deletes a Deployment specified by its ID. |
| 98 |
-func (r *Etcd) DeleteDeployment(ctx kubeapi.Context, id string) error {
|
|
| 98 |
+func (r *Etcd) DeleteDeployment(ctx kapi.Context, id string) error {
|
|
| 99 | 99 |
key, err := makeDeploymentKey(ctx, id) |
| 100 | 100 |
if err != nil {
|
| 101 | 101 |
return err |
| ... | ... |
@@ -105,7 +105,7 @@ func (r *Etcd) DeleteDeployment(ctx kubeapi.Context, id string) error {
|
| 105 | 105 |
} |
| 106 | 106 |
|
| 107 | 107 |
// WatchDeployments begins watching for new, changed, or deleted Deployments. |
| 108 |
-func (r *Etcd) WatchDeployments(ctx kubeapi.Context, resourceVersion string, filter func(deployment *api.Deployment) bool) (watch.Interface, error) {
|
|
| 108 |
+func (r *Etcd) WatchDeployments(ctx kapi.Context, resourceVersion string, filter func(deployment *api.Deployment) bool) (watch.Interface, error) {
|
|
| 109 | 109 |
version, err := parseWatchResourceVersion(resourceVersion, "deployment") |
| 110 | 110 |
if err != nil {
|
| 111 | 111 |
return nil, err |
| ... | ... |
@@ -122,7 +122,7 @@ func (r *Etcd) WatchDeployments(ctx kubeapi.Context, resourceVersion string, fil |
| 122 | 122 |
} |
| 123 | 123 |
|
| 124 | 124 |
// ListDeploymentConfigs obtains a list of DeploymentConfigs. |
| 125 |
-func (r *Etcd) ListDeploymentConfigs(ctx kubeapi.Context, selector labels.Selector) (*api.DeploymentConfigList, error) {
|
|
| 125 |
+func (r *Etcd) ListDeploymentConfigs(ctx kapi.Context, selector labels.Selector) (*api.DeploymentConfigList, error) {
|
|
| 126 | 126 |
deploymentConfigs := api.DeploymentConfigList{}
|
| 127 | 127 |
err := r.ExtractToList(makeDeploymentConfigListKey(ctx), &deploymentConfigs) |
| 128 | 128 |
if err != nil {
|
| ... | ... |
@@ -156,7 +156,7 @@ func parseWatchResourceVersion(resourceVersion, kind string) (uint64, error) {
|
| 156 | 156 |
} |
| 157 | 157 |
|
| 158 | 158 |
// WatchDeploymentConfigs begins watching for new, changed, or deleted DeploymentConfigs. |
| 159 |
-func (r *Etcd) WatchDeploymentConfigs(ctx kubeapi.Context, resourceVersion string, filter func(repo *api.DeploymentConfig) bool) (watch.Interface, error) {
|
|
| 159 |
+func (r *Etcd) WatchDeploymentConfigs(ctx kapi.Context, resourceVersion string, filter func(repo *api.DeploymentConfig) bool) (watch.Interface, error) {
|
|
| 160 | 160 |
version, err := parseWatchResourceVersion(resourceVersion, "deploymentConfig") |
| 161 | 161 |
if err != nil {
|
| 162 | 162 |
return nil, err |
| ... | ... |
@@ -172,16 +172,16 @@ func (r *Etcd) WatchDeploymentConfigs(ctx kubeapi.Context, resourceVersion strin |
| 172 | 172 |
}) |
| 173 | 173 |
} |
| 174 | 174 |
|
| 175 |
-func makeDeploymentConfigListKey(ctx kubeapi.Context) string {
|
|
| 175 |
+func makeDeploymentConfigListKey(ctx kapi.Context) string {
|
|
| 176 | 176 |
return kubeetcd.MakeEtcdListKey(ctx, DeploymentConfigPath) |
| 177 | 177 |
} |
| 178 | 178 |
|
| 179 |
-func makeDeploymentConfigKey(ctx kubeapi.Context, id string) (string, error) {
|
|
| 179 |
+func makeDeploymentConfigKey(ctx kapi.Context, id string) (string, error) {
|
|
| 180 | 180 |
return kubeetcd.MakeEtcdItemKey(ctx, DeploymentConfigPath, id) |
| 181 | 181 |
} |
| 182 | 182 |
|
| 183 | 183 |
// GetDeploymentConfig gets a specific DeploymentConfig specified by its ID. |
| 184 |
-func (r *Etcd) GetDeploymentConfig(ctx kubeapi.Context, id string) (*api.DeploymentConfig, error) {
|
|
| 184 |
+func (r *Etcd) GetDeploymentConfig(ctx kapi.Context, id string) (*api.DeploymentConfig, error) {
|
|
| 185 | 185 |
var deploymentConfig api.DeploymentConfig |
| 186 | 186 |
key, err := makeDeploymentConfigKey(ctx, id) |
| 187 | 187 |
if err != nil {
|
| ... | ... |
@@ -196,7 +196,7 @@ func (r *Etcd) GetDeploymentConfig(ctx kubeapi.Context, id string) (*api.Deploym |
| 196 | 196 |
} |
| 197 | 197 |
|
| 198 | 198 |
// CreateDeploymentConfig creates a new DeploymentConfig. |
| 199 |
-func (r *Etcd) CreateDeploymentConfig(ctx kubeapi.Context, deploymentConfig *api.DeploymentConfig) error {
|
|
| 199 |
+func (r *Etcd) CreateDeploymentConfig(ctx kapi.Context, deploymentConfig *api.DeploymentConfig) error {
|
|
| 200 | 200 |
key, err := makeDeploymentConfigKey(ctx, deploymentConfig.ID) |
| 201 | 201 |
if err != nil {
|
| 202 | 202 |
return err |
| ... | ... |
@@ -207,7 +207,7 @@ func (r *Etcd) CreateDeploymentConfig(ctx kubeapi.Context, deploymentConfig *api |
| 207 | 207 |
} |
| 208 | 208 |
|
| 209 | 209 |
// UpdateDeploymentConfig replaces an existing DeploymentConfig. |
| 210 |
-func (r *Etcd) UpdateDeploymentConfig(ctx kubeapi.Context, deploymentConfig *api.DeploymentConfig) error {
|
|
| 210 |
+func (r *Etcd) UpdateDeploymentConfig(ctx kapi.Context, deploymentConfig *api.DeploymentConfig) error {
|
|
| 211 | 211 |
key, err := makeDeploymentConfigKey(ctx, deploymentConfig.ID) |
| 212 | 212 |
if err != nil {
|
| 213 | 213 |
return err |
| ... | ... |
@@ -218,7 +218,7 @@ func (r *Etcd) UpdateDeploymentConfig(ctx kubeapi.Context, deploymentConfig *api |
| 218 | 218 |
} |
| 219 | 219 |
|
| 220 | 220 |
// DeleteDeploymentConfig deletes a DeploymentConfig specified by its ID. |
| 221 |
-func (r *Etcd) DeleteDeploymentConfig(ctx kubeapi.Context, id string) error {
|
|
| 221 |
+func (r *Etcd) DeleteDeploymentConfig(ctx kapi.Context, id string) error {
|
|
| 222 | 222 |
key, err := makeDeploymentConfigKey(ctx, id) |
| 223 | 223 |
if err != nil {
|
| 224 | 224 |
return err |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"testing" |
| 6 | 6 |
|
| 7 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -29,10 +29,10 @@ func makeTestDeploymentKey(namespace, id string) string {
|
| 29 | 29 |
return "/deployments/" + namespace + "/" + id |
| 30 | 30 |
} |
| 31 | 31 |
func makeTestDefaultDeploymentKey(id string) string {
|
| 32 |
- return makeTestDeploymentKey(kubeapi.NamespaceDefault, id) |
|
| 32 |
+ return makeTestDeploymentKey(kapi.NamespaceDefault, id) |
|
| 33 | 33 |
} |
| 34 | 34 |
func makeTestDefaultDeploymentListKey() string {
|
| 35 |
- return makeTestDeploymentListKey(kubeapi.NamespaceDefault) |
|
| 35 |
+ return makeTestDeploymentListKey(kapi.NamespaceDefault) |
|
| 36 | 36 |
} |
| 37 | 37 |
func makeTestDeploymentConfigListKey(namespace string) string {
|
| 38 | 38 |
if len(namespace) != 0 {
|
| ... | ... |
@@ -44,10 +44,10 @@ func makeTestDeploymentConfigKey(namespace, id string) string {
|
| 44 | 44 |
return "/deploymentConfigs/" + namespace + "/" + id |
| 45 | 45 |
} |
| 46 | 46 |
func makeTestDefaultDeploymentConfigKey(id string) string {
|
| 47 |
- return makeTestDeploymentConfigKey(kubeapi.NamespaceDefault, id) |
|
| 47 |
+ return makeTestDeploymentConfigKey(kapi.NamespaceDefault, id) |
|
| 48 | 48 |
} |
| 49 | 49 |
func makeTestDefaultDeploymentConfigListKey() string {
|
| 50 |
- return makeTestDeploymentConfigListKey(kubeapi.NamespaceDefault) |
|
| 50 |
+ return makeTestDeploymentConfigListKey(kapi.NamespaceDefault) |
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
func NewTestEtcd(client tools.EtcdClient) *Etcd {
|
| ... | ... |
@@ -66,7 +66,7 @@ func TestEtcdListEmptyDeployments(t *testing.T) {
|
| 66 | 66 |
E: nil, |
| 67 | 67 |
} |
| 68 | 68 |
registry := NewTestEtcd(fakeClient) |
| 69 |
- deployments, err := registry.ListDeployments(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 69 |
+ deployments, err := registry.ListDeployments(kapi.NewDefaultContext(), labels.Everything()) |
|
| 70 | 70 |
if err != nil {
|
| 71 | 71 |
t.Errorf("unexpected error: %v", err)
|
| 72 | 72 |
} |
| ... | ... |
@@ -86,7 +86,7 @@ func TestEtcdListErrorDeployments(t *testing.T) {
|
| 86 | 86 |
E: fmt.Errorf("some error"),
|
| 87 | 87 |
} |
| 88 | 88 |
registry := NewTestEtcd(fakeClient) |
| 89 |
- deployments, err := registry.ListDeployments(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 89 |
+ deployments, err := registry.ListDeployments(kapi.NewDefaultContext(), labels.Everything()) |
|
| 90 | 90 |
if err == nil {
|
| 91 | 91 |
t.Error("unexpected nil error")
|
| 92 | 92 |
} |
| ... | ... |
@@ -104,10 +104,10 @@ func TestEtcdListEverythingDeployments(t *testing.T) {
|
| 104 | 104 |
Node: &etcd.Node{
|
| 105 | 105 |
Nodes: []*etcd.Node{
|
| 106 | 106 |
{
|
| 107 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}),
|
|
| 107 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kapi.TypeMeta{ID: "foo"}}),
|
|
| 108 | 108 |
}, |
| 109 | 109 |
{
|
| 110 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kubeapi.TypeMeta{ID: "bar"}}),
|
|
| 110 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kapi.TypeMeta{ID: "bar"}}),
|
|
| 111 | 111 |
}, |
| 112 | 112 |
}, |
| 113 | 113 |
}, |
| ... | ... |
@@ -115,7 +115,7 @@ func TestEtcdListEverythingDeployments(t *testing.T) {
|
| 115 | 115 |
E: nil, |
| 116 | 116 |
} |
| 117 | 117 |
registry := NewTestEtcd(fakeClient) |
| 118 |
- deployments, err := registry.ListDeployments(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 118 |
+ deployments, err := registry.ListDeployments(kapi.NewDefaultContext(), labels.Everything()) |
|
| 119 | 119 |
if err != nil {
|
| 120 | 120 |
t.Errorf("unexpected error: %v", err)
|
| 121 | 121 |
} |
| ... | ... |
@@ -134,13 +134,13 @@ func TestEtcdListFilteredDeployments(t *testing.T) {
|
| 134 | 134 |
Nodes: []*etcd.Node{
|
| 135 | 135 |
{
|
| 136 | 136 |
Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{
|
| 137 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 137 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 138 | 138 |
Labels: map[string]string{"env": "prod"},
|
| 139 | 139 |
}), |
| 140 | 140 |
}, |
| 141 | 141 |
{
|
| 142 | 142 |
Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{
|
| 143 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar"},
|
|
| 143 |
+ TypeMeta: kapi.TypeMeta{ID: "bar"},
|
|
| 144 | 144 |
Labels: map[string]string{"env": "dev"},
|
| 145 | 145 |
}), |
| 146 | 146 |
}, |
| ... | ... |
@@ -150,7 +150,7 @@ func TestEtcdListFilteredDeployments(t *testing.T) {
|
| 150 | 150 |
E: nil, |
| 151 | 151 |
} |
| 152 | 152 |
registry := NewTestEtcd(fakeClient) |
| 153 |
- deployments, err := registry.ListDeployments(kubeapi.NewDefaultContext(), labels.SelectorFromSet(labels.Set{"env": "dev"}))
|
|
| 153 |
+ deployments, err := registry.ListDeployments(kapi.NewDefaultContext(), labels.SelectorFromSet(labels.Set{"env": "dev"}))
|
|
| 154 | 154 |
if err != nil {
|
| 155 | 155 |
t.Errorf("unexpected error: %v", err)
|
| 156 | 156 |
} |
| ... | ... |
@@ -162,9 +162,9 @@ func TestEtcdListFilteredDeployments(t *testing.T) {
|
| 162 | 162 |
|
| 163 | 163 |
func TestEtcdGetDeployments(t *testing.T) {
|
| 164 | 164 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 165 |
- fakeClient.Set(makeTestDefaultDeploymentKey("foo"), runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 165 |
+ fakeClient.Set(makeTestDefaultDeploymentKey("foo"), runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 166 | 166 |
registry := NewTestEtcd(fakeClient) |
| 167 |
- deployment, err := registry.GetDeployment(kubeapi.NewDefaultContext(), "foo") |
|
| 167 |
+ deployment, err := registry.GetDeployment(kapi.NewDefaultContext(), "foo") |
|
| 168 | 168 |
if err != nil {
|
| 169 | 169 |
t.Errorf("unexpected error: %v", err)
|
| 170 | 170 |
} |
| ... | ... |
@@ -183,7 +183,7 @@ func TestEtcdGetNotFoundDeployments(t *testing.T) {
|
| 183 | 183 |
E: tools.EtcdErrorNotFound, |
| 184 | 184 |
} |
| 185 | 185 |
registry := NewTestEtcd(fakeClient) |
| 186 |
- deployment, err := registry.GetDeployment(kubeapi.NewDefaultContext(), "foo") |
|
| 186 |
+ deployment, err := registry.GetDeployment(kapi.NewDefaultContext(), "foo") |
|
| 187 | 187 |
if err == nil {
|
| 188 | 188 |
t.Errorf("Unexpected non-error.")
|
| 189 | 189 |
} |
| ... | ... |
@@ -202,8 +202,8 @@ func TestEtcdCreateDeployments(t *testing.T) {
|
| 202 | 202 |
E: tools.EtcdErrorNotFound, |
| 203 | 203 |
} |
| 204 | 204 |
registry := NewTestEtcd(fakeClient) |
| 205 |
- err := registry.CreateDeployment(kubeapi.NewDefaultContext(), &api.Deployment{
|
|
| 206 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 205 |
+ err := registry.CreateDeployment(kapi.NewDefaultContext(), &api.Deployment{
|
|
| 206 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 207 | 207 |
ID: "foo", |
| 208 | 208 |
}, |
| 209 | 209 |
}) |
| ... | ... |
@@ -231,14 +231,14 @@ func TestEtcdCreateAlreadyExistsDeployments(t *testing.T) {
|
| 231 | 231 |
fakeClient.Data[makeTestDefaultDeploymentKey("foo")] = tools.EtcdResponseWithError{
|
| 232 | 232 |
R: &etcd.Response{
|
| 233 | 233 |
Node: &etcd.Node{
|
| 234 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}),
|
|
| 234 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kapi.TypeMeta{ID: "foo"}}),
|
|
| 235 | 235 |
}, |
| 236 | 236 |
}, |
| 237 | 237 |
E: nil, |
| 238 | 238 |
} |
| 239 | 239 |
registry := NewTestEtcd(fakeClient) |
| 240 |
- err := registry.CreateDeployment(kubeapi.NewDefaultContext(), &api.Deployment{
|
|
| 241 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 240 |
+ err := registry.CreateDeployment(kapi.NewDefaultContext(), &api.Deployment{
|
|
| 241 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 242 | 242 |
ID: "foo", |
| 243 | 243 |
}, |
| 244 | 244 |
}) |
| ... | ... |
@@ -253,7 +253,7 @@ func TestEtcdCreateAlreadyExistsDeployments(t *testing.T) {
|
| 253 | 253 |
func TestEtcdUpdateOkDeployments(t *testing.T) {
|
| 254 | 254 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 255 | 255 |
registry := NewTestEtcd(fakeClient) |
| 256 |
- err := registry.UpdateDeployment(kubeapi.NewDefaultContext(), &api.Deployment{TypeMeta: kubeapi.TypeMeta{ID: "foo"}})
|
|
| 256 |
+ err := registry.UpdateDeployment(kapi.NewDefaultContext(), &api.Deployment{TypeMeta: kapi.TypeMeta{ID: "foo"}})
|
|
| 257 | 257 |
if err != nil {
|
| 258 | 258 |
t.Error("Unexpected error: %#v", err)
|
| 259 | 259 |
} |
| ... | ... |
@@ -263,7 +263,7 @@ func TestEtcdDeleteNotFoundDeployments(t *testing.T) {
|
| 263 | 263 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 264 | 264 |
fakeClient.Err = tools.EtcdErrorNotFound |
| 265 | 265 |
registry := NewTestEtcd(fakeClient) |
| 266 |
- err := registry.DeleteDeployment(kubeapi.NewDefaultContext(), "foo") |
|
| 266 |
+ err := registry.DeleteDeployment(kapi.NewDefaultContext(), "foo") |
|
| 267 | 267 |
if err == nil {
|
| 268 | 268 |
t.Error("Unexpected non-error")
|
| 269 | 269 |
} |
| ... | ... |
@@ -276,7 +276,7 @@ func TestEtcdDeleteErrorDeployments(t *testing.T) {
|
| 276 | 276 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 277 | 277 |
fakeClient.Err = fmt.Errorf("Some error")
|
| 278 | 278 |
registry := NewTestEtcd(fakeClient) |
| 279 |
- err := registry.DeleteDeployment(kubeapi.NewDefaultContext(), "foo") |
|
| 279 |
+ err := registry.DeleteDeployment(kapi.NewDefaultContext(), "foo") |
|
| 280 | 280 |
if err == nil {
|
| 281 | 281 |
t.Error("Unexpected non-error")
|
| 282 | 282 |
} |
| ... | ... |
@@ -287,7 +287,7 @@ func TestEtcdDeleteOkDeployments(t *testing.T) {
|
| 287 | 287 |
registry := NewTestEtcd(fakeClient) |
| 288 | 288 |
key := makeTestDefaultDeploymentListKey() + "/foo" |
| 289 | 289 |
|
| 290 |
- err := registry.DeleteDeployment(kubeapi.NewDefaultContext(), "foo") |
|
| 290 |
+ err := registry.DeleteDeployment(kapi.NewDefaultContext(), "foo") |
|
| 291 | 291 |
if err != nil {
|
| 292 | 292 |
t.Errorf("Unexpected error: %#v", err)
|
| 293 | 293 |
} |
| ... | ... |
@@ -310,7 +310,7 @@ func TestEtcdListEmptyDeploymentConfig(t *testing.T) {
|
| 310 | 310 |
E: nil, |
| 311 | 311 |
} |
| 312 | 312 |
registry := NewTestEtcd(fakeClient) |
| 313 |
- deploymentConfigs, err := registry.ListDeploymentConfigs(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 313 |
+ deploymentConfigs, err := registry.ListDeploymentConfigs(kapi.NewDefaultContext(), labels.Everything()) |
|
| 314 | 314 |
if err != nil {
|
| 315 | 315 |
t.Errorf("unexpected error: %v", err)
|
| 316 | 316 |
} |
| ... | ... |
@@ -330,7 +330,7 @@ func TestEtcdListErrorDeploymentConfig(t *testing.T) {
|
| 330 | 330 |
E: fmt.Errorf("some error"),
|
| 331 | 331 |
} |
| 332 | 332 |
registry := NewTestEtcd(fakeClient) |
| 333 |
- deploymentConfigs, err := registry.ListDeploymentConfigs(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 333 |
+ deploymentConfigs, err := registry.ListDeploymentConfigs(kapi.NewDefaultContext(), labels.Everything()) |
|
| 334 | 334 |
if err == nil {
|
| 335 | 335 |
t.Error("unexpected nil error")
|
| 336 | 336 |
} |
| ... | ... |
@@ -348,10 +348,10 @@ func TestEtcdListEverythingDeploymentConfig(t *testing.T) {
|
| 348 | 348 |
Node: &etcd.Node{
|
| 349 | 349 |
Nodes: []*etcd.Node{
|
| 350 | 350 |
{
|
| 351 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}),
|
|
| 351 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kapi.TypeMeta{ID: "foo"}}),
|
|
| 352 | 352 |
}, |
| 353 | 353 |
{
|
| 354 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kubeapi.TypeMeta{ID: "bar"}}),
|
|
| 354 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kapi.TypeMeta{ID: "bar"}}),
|
|
| 355 | 355 |
}, |
| 356 | 356 |
}, |
| 357 | 357 |
}, |
| ... | ... |
@@ -359,7 +359,7 @@ func TestEtcdListEverythingDeploymentConfig(t *testing.T) {
|
| 359 | 359 |
E: nil, |
| 360 | 360 |
} |
| 361 | 361 |
registry := NewTestEtcd(fakeClient) |
| 362 |
- deploymentConfigs, err := registry.ListDeploymentConfigs(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 362 |
+ deploymentConfigs, err := registry.ListDeploymentConfigs(kapi.NewDefaultContext(), labels.Everything()) |
|
| 363 | 363 |
if err != nil {
|
| 364 | 364 |
t.Errorf("unexpected error: %v", err)
|
| 365 | 365 |
} |
| ... | ... |
@@ -378,13 +378,13 @@ func TestEtcdListFilteredDeploymentConfig(t *testing.T) {
|
| 378 | 378 |
Nodes: []*etcd.Node{
|
| 379 | 379 |
{
|
| 380 | 380 |
Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{
|
| 381 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 381 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 382 | 382 |
Labels: map[string]string{"env": "prod"},
|
| 383 | 383 |
}), |
| 384 | 384 |
}, |
| 385 | 385 |
{
|
| 386 | 386 |
Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{
|
| 387 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar"},
|
|
| 387 |
+ TypeMeta: kapi.TypeMeta{ID: "bar"},
|
|
| 388 | 388 |
Labels: map[string]string{"env": "dev"},
|
| 389 | 389 |
}), |
| 390 | 390 |
}, |
| ... | ... |
@@ -394,7 +394,7 @@ func TestEtcdListFilteredDeploymentConfig(t *testing.T) {
|
| 394 | 394 |
E: nil, |
| 395 | 395 |
} |
| 396 | 396 |
registry := NewTestEtcd(fakeClient) |
| 397 |
- deploymentConfigs, err := registry.ListDeploymentConfigs(kubeapi.NewDefaultContext(), labels.SelectorFromSet(labels.Set{"env": "dev"}))
|
|
| 397 |
+ deploymentConfigs, err := registry.ListDeploymentConfigs(kapi.NewDefaultContext(), labels.SelectorFromSet(labels.Set{"env": "dev"}))
|
|
| 398 | 398 |
if err != nil {
|
| 399 | 399 |
t.Errorf("unexpected error: %v", err)
|
| 400 | 400 |
} |
| ... | ... |
@@ -406,9 +406,9 @@ func TestEtcdListFilteredDeploymentConfig(t *testing.T) {
|
| 406 | 406 |
|
| 407 | 407 |
func TestEtcdGetDeploymentConfig(t *testing.T) {
|
| 408 | 408 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 409 |
- fakeClient.Set(makeTestDefaultDeploymentConfigKey("foo"), runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 409 |
+ fakeClient.Set(makeTestDefaultDeploymentConfigKey("foo"), runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 410 | 410 |
registry := NewTestEtcd(fakeClient) |
| 411 |
- deployment, err := registry.GetDeploymentConfig(kubeapi.NewDefaultContext(), "foo") |
|
| 411 |
+ deployment, err := registry.GetDeploymentConfig(kapi.NewDefaultContext(), "foo") |
|
| 412 | 412 |
if err != nil {
|
| 413 | 413 |
t.Errorf("unexpected error: %v", err)
|
| 414 | 414 |
} |
| ... | ... |
@@ -427,7 +427,7 @@ func TestEtcdGetNotFoundDeploymentConfig(t *testing.T) {
|
| 427 | 427 |
E: tools.EtcdErrorNotFound, |
| 428 | 428 |
} |
| 429 | 429 |
registry := NewTestEtcd(fakeClient) |
| 430 |
- deployment, err := registry.GetDeploymentConfig(kubeapi.NewDefaultContext(), "foo") |
|
| 430 |
+ deployment, err := registry.GetDeploymentConfig(kapi.NewDefaultContext(), "foo") |
|
| 431 | 431 |
if err == nil {
|
| 432 | 432 |
t.Errorf("Unexpected non-error.")
|
| 433 | 433 |
} |
| ... | ... |
@@ -447,8 +447,8 @@ func TestEtcdCreateDeploymentConfig(t *testing.T) {
|
| 447 | 447 |
E: tools.EtcdErrorNotFound, |
| 448 | 448 |
} |
| 449 | 449 |
registry := NewTestEtcd(fakeClient) |
| 450 |
- err := registry.CreateDeploymentConfig(kubeapi.NewDefaultContext(), &api.DeploymentConfig{
|
|
| 451 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 450 |
+ err := registry.CreateDeploymentConfig(kapi.NewDefaultContext(), &api.DeploymentConfig{
|
|
| 451 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 452 | 452 |
ID: "foo", |
| 453 | 453 |
}, |
| 454 | 454 |
}) |
| ... | ... |
@@ -476,14 +476,14 @@ func TestEtcdCreateAlreadyExistsDeploymentConfig(t *testing.T) {
|
| 476 | 476 |
fakeClient.Data[makeTestDefaultDeploymentConfigKey("foo")] = tools.EtcdResponseWithError{
|
| 477 | 477 |
R: &etcd.Response{
|
| 478 | 478 |
Node: &etcd.Node{
|
| 479 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}),
|
|
| 479 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kapi.TypeMeta{ID: "foo"}}),
|
|
| 480 | 480 |
}, |
| 481 | 481 |
}, |
| 482 | 482 |
E: nil, |
| 483 | 483 |
} |
| 484 | 484 |
registry := NewTestEtcd(fakeClient) |
| 485 |
- err := registry.CreateDeploymentConfig(kubeapi.NewDefaultContext(), &api.DeploymentConfig{
|
|
| 486 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 485 |
+ err := registry.CreateDeploymentConfig(kapi.NewDefaultContext(), &api.DeploymentConfig{
|
|
| 486 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 487 | 487 |
ID: "foo", |
| 488 | 488 |
}, |
| 489 | 489 |
}) |
| ... | ... |
@@ -498,7 +498,7 @@ func TestEtcdCreateAlreadyExistsDeploymentConfig(t *testing.T) {
|
| 498 | 498 |
func TestEtcdUpdateOkDeploymentConfig(t *testing.T) {
|
| 499 | 499 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 500 | 500 |
registry := NewTestEtcd(fakeClient) |
| 501 |
- err := registry.UpdateDeploymentConfig(kubeapi.NewDefaultContext(), &api.DeploymentConfig{TypeMeta: kubeapi.TypeMeta{ID: "foo"}})
|
|
| 501 |
+ err := registry.UpdateDeploymentConfig(kapi.NewDefaultContext(), &api.DeploymentConfig{TypeMeta: kapi.TypeMeta{ID: "foo"}})
|
|
| 502 | 502 |
if err != nil {
|
| 503 | 503 |
t.Error("Unexpected error %#v", err)
|
| 504 | 504 |
} |
| ... | ... |
@@ -508,7 +508,7 @@ func TestEtcdDeleteNotFoundDeploymentConfig(t *testing.T) {
|
| 508 | 508 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 509 | 509 |
fakeClient.Err = tools.EtcdErrorNotFound |
| 510 | 510 |
registry := NewTestEtcd(fakeClient) |
| 511 |
- err := registry.DeleteDeploymentConfig(kubeapi.NewDefaultContext(), "foo") |
|
| 511 |
+ err := registry.DeleteDeploymentConfig(kapi.NewDefaultContext(), "foo") |
|
| 512 | 512 |
if err == nil {
|
| 513 | 513 |
t.Error("Unexpected non-error")
|
| 514 | 514 |
} |
| ... | ... |
@@ -521,7 +521,7 @@ func TestEtcdDeleteErrorDeploymentConfig(t *testing.T) {
|
| 521 | 521 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 522 | 522 |
fakeClient.Err = fmt.Errorf("Some error")
|
| 523 | 523 |
registry := NewTestEtcd(fakeClient) |
| 524 |
- err := registry.DeleteDeploymentConfig(kubeapi.NewDefaultContext(), "foo") |
|
| 524 |
+ err := registry.DeleteDeploymentConfig(kapi.NewDefaultContext(), "foo") |
|
| 525 | 525 |
if err == nil {
|
| 526 | 526 |
t.Error("Unexpected non-error")
|
| 527 | 527 |
} |
| ... | ... |
@@ -531,7 +531,7 @@ func TestEtcdDeleteOkDeploymentConfig(t *testing.T) {
|
| 531 | 531 |
key := makeTestDefaultDeploymentConfigKey("foo")
|
| 532 | 532 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 533 | 533 |
registry := NewTestEtcd(fakeClient) |
| 534 |
- err := registry.DeleteDeploymentConfig(kubeapi.NewDefaultContext(), "foo") |
|
| 534 |
+ err := registry.DeleteDeploymentConfig(kapi.NewDefaultContext(), "foo") |
|
| 535 | 535 |
if err != nil {
|
| 536 | 536 |
t.Errorf("Unexpected error: %#v", err)
|
| 537 | 537 |
} |
| ... | ... |
@@ -546,8 +546,8 @@ func TestEtcdCreateDeploymentConfigFailsWithoutNamespace(t *testing.T) {
|
| 546 | 546 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 547 | 547 |
fakeClient.TestIndex = true |
| 548 | 548 |
registry := NewTestEtcd(fakeClient) |
| 549 |
- err := registry.CreateDeploymentConfig(kubeapi.NewContext(), &api.DeploymentConfig{
|
|
| 550 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 549 |
+ err := registry.CreateDeploymentConfig(kapi.NewContext(), &api.DeploymentConfig{
|
|
| 550 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 551 | 551 |
ID: "foo", |
| 552 | 552 |
}, |
| 553 | 553 |
}) |
| ... | ... |
@@ -561,8 +561,8 @@ func TestEtcdCreateDeploymentFailsWithoutNamespace(t *testing.T) {
|
| 561 | 561 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 562 | 562 |
fakeClient.TestIndex = true |
| 563 | 563 |
registry := NewTestEtcd(fakeClient) |
| 564 |
- err := registry.CreateDeployment(kubeapi.NewContext(), &api.Deployment{
|
|
| 565 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 564 |
+ err := registry.CreateDeployment(kapi.NewContext(), &api.Deployment{
|
|
| 565 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 566 | 566 |
ID: "foo", |
| 567 | 567 |
}, |
| 568 | 568 |
}) |
| ... | ... |
@@ -574,14 +574,14 @@ func TestEtcdCreateDeploymentFailsWithoutNamespace(t *testing.T) {
|
| 574 | 574 |
|
| 575 | 575 |
func TestEtcdListDeploymentsInDifferentNamespaces(t *testing.T) {
|
| 576 | 576 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 577 |
- namespaceAlfa := kubeapi.WithNamespace(kubeapi.NewContext(), "alfa") |
|
| 578 |
- namespaceBravo := kubeapi.WithNamespace(kubeapi.NewContext(), "bravo") |
|
| 577 |
+ namespaceAlfa := kapi.WithNamespace(kapi.NewContext(), "alfa") |
|
| 578 |
+ namespaceBravo := kapi.WithNamespace(kapi.NewContext(), "bravo") |
|
| 579 | 579 |
fakeClient.Data["/deployments/alfa"] = tools.EtcdResponseWithError{
|
| 580 | 580 |
R: &etcd.Response{
|
| 581 | 581 |
Node: &etcd.Node{
|
| 582 | 582 |
Nodes: []*etcd.Node{
|
| 583 | 583 |
{
|
| 584 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kubeapi.TypeMeta{ID: "foo1"}}),
|
|
| 584 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kapi.TypeMeta{ID: "foo1"}}),
|
|
| 585 | 585 |
}, |
| 586 | 586 |
}, |
| 587 | 587 |
}, |
| ... | ... |
@@ -593,10 +593,10 @@ func TestEtcdListDeploymentsInDifferentNamespaces(t *testing.T) {
|
| 593 | 593 |
Node: &etcd.Node{
|
| 594 | 594 |
Nodes: []*etcd.Node{
|
| 595 | 595 |
{
|
| 596 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kubeapi.TypeMeta{ID: "foo2"}}),
|
|
| 596 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kapi.TypeMeta{ID: "foo2"}}),
|
|
| 597 | 597 |
}, |
| 598 | 598 |
{
|
| 599 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kubeapi.TypeMeta{ID: "bar2"}}),
|
|
| 599 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kapi.TypeMeta{ID: "bar2"}}),
|
|
| 600 | 600 |
}, |
| 601 | 601 |
}, |
| 602 | 602 |
}, |
| ... | ... |
@@ -624,14 +624,14 @@ func TestEtcdListDeploymentsInDifferentNamespaces(t *testing.T) {
|
| 624 | 624 |
|
| 625 | 625 |
func TestEtcdListDeploymentConfigsInDifferentNamespaces(t *testing.T) {
|
| 626 | 626 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 627 |
- namespaceAlfa := kubeapi.WithNamespace(kubeapi.NewContext(), "alfa") |
|
| 628 |
- namespaceBravo := kubeapi.WithNamespace(kubeapi.NewContext(), "bravo") |
|
| 627 |
+ namespaceAlfa := kapi.WithNamespace(kapi.NewContext(), "alfa") |
|
| 628 |
+ namespaceBravo := kapi.WithNamespace(kapi.NewContext(), "bravo") |
|
| 629 | 629 |
fakeClient.Data["/deploymentConfigs/alfa"] = tools.EtcdResponseWithError{
|
| 630 | 630 |
R: &etcd.Response{
|
| 631 | 631 |
Node: &etcd.Node{
|
| 632 | 632 |
Nodes: []*etcd.Node{
|
| 633 | 633 |
{
|
| 634 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kubeapi.TypeMeta{ID: "foo1"}}),
|
|
| 634 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kapi.TypeMeta{ID: "foo1"}}),
|
|
| 635 | 635 |
}, |
| 636 | 636 |
}, |
| 637 | 637 |
}, |
| ... | ... |
@@ -643,10 +643,10 @@ func TestEtcdListDeploymentConfigsInDifferentNamespaces(t *testing.T) {
|
| 643 | 643 |
Node: &etcd.Node{
|
| 644 | 644 |
Nodes: []*etcd.Node{
|
| 645 | 645 |
{
|
| 646 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kubeapi.TypeMeta{ID: "foo2"}}),
|
|
| 646 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kapi.TypeMeta{ID: "foo2"}}),
|
|
| 647 | 647 |
}, |
| 648 | 648 |
{
|
| 649 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kubeapi.TypeMeta{ID: "bar2"}}),
|
|
| 649 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kapi.TypeMeta{ID: "bar2"}}),
|
|
| 650 | 650 |
}, |
| 651 | 651 |
}, |
| 652 | 652 |
}, |
| ... | ... |
@@ -674,10 +674,10 @@ func TestEtcdListDeploymentConfigsInDifferentNamespaces(t *testing.T) {
|
| 674 | 674 |
|
| 675 | 675 |
func TestEtcdGetDeploymentConfigInDifferentNamespaces(t *testing.T) {
|
| 676 | 676 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 677 |
- namespaceAlfa := kubeapi.WithNamespace(kubeapi.NewContext(), "alfa") |
|
| 678 |
- namespaceBravo := kubeapi.WithNamespace(kubeapi.NewContext(), "bravo") |
|
| 679 |
- fakeClient.Set("/deploymentConfigs/alfa/foo", runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 680 |
- fakeClient.Set("/deploymentConfigs/bravo/foo", runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 677 |
+ namespaceAlfa := kapi.WithNamespace(kapi.NewContext(), "alfa") |
|
| 678 |
+ namespaceBravo := kapi.WithNamespace(kapi.NewContext(), "bravo") |
|
| 679 |
+ fakeClient.Set("/deploymentConfigs/alfa/foo", runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 680 |
+ fakeClient.Set("/deploymentConfigs/bravo/foo", runtime.EncodeOrDie(latest.Codec, &api.DeploymentConfig{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 681 | 681 |
registry := NewTestEtcd(fakeClient) |
| 682 | 682 |
|
| 683 | 683 |
alfaFoo, err := registry.GetDeploymentConfig(namespaceAlfa, "foo") |
| ... | ... |
@@ -699,10 +699,10 @@ func TestEtcdGetDeploymentConfigInDifferentNamespaces(t *testing.T) {
|
| 699 | 699 |
|
| 700 | 700 |
func TestEtcdGetDeploymentInDifferentNamespaces(t *testing.T) {
|
| 701 | 701 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 702 |
- namespaceAlfa := kubeapi.WithNamespace(kubeapi.NewContext(), "alfa") |
|
| 703 |
- namespaceBravo := kubeapi.WithNamespace(kubeapi.NewContext(), "bravo") |
|
| 704 |
- fakeClient.Set("/deployments/alfa/foo", runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 705 |
- fakeClient.Set("/deployments/bravo/foo", runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 702 |
+ namespaceAlfa := kapi.WithNamespace(kapi.NewContext(), "alfa") |
|
| 703 |
+ namespaceBravo := kapi.WithNamespace(kapi.NewContext(), "bravo") |
|
| 704 |
+ fakeClient.Set("/deployments/alfa/foo", runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 705 |
+ fakeClient.Set("/deployments/bravo/foo", runtime.EncodeOrDie(latest.Codec, &api.Deployment{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 706 | 706 |
registry := NewTestEtcd(fakeClient) |
| 707 | 707 |
|
| 708 | 708 |
alfaFoo, err := registry.GetDeployment(namespaceAlfa, "foo") |
| ... | ... |
@@ -3,7 +3,7 @@ package test |
| 3 | 3 |
import ( |
| 4 | 4 |
"sync" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 9 | 9 |
"github.com/openshift/origin/pkg/deploy/api" |
| ... | ... |
@@ -20,21 +20,21 @@ func NewDeploymentRegistry() *DeploymentRegistry {
|
| 20 | 20 |
return &DeploymentRegistry{}
|
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 |
-func (r *DeploymentRegistry) ListDeployments(ctx kubeapi.Context, selector labels.Selector) (*api.DeploymentList, error) {
|
|
| 23 |
+func (r *DeploymentRegistry) ListDeployments(ctx kapi.Context, selector labels.Selector) (*api.DeploymentList, error) {
|
|
| 24 | 24 |
r.Lock() |
| 25 | 25 |
defer r.Unlock() |
| 26 | 26 |
|
| 27 | 27 |
return r.Deployments, r.Err |
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 |
-func (r *DeploymentRegistry) GetDeployment(ctx kubeapi.Context, id string) (*api.Deployment, error) {
|
|
| 30 |
+func (r *DeploymentRegistry) GetDeployment(ctx kapi.Context, id string) (*api.Deployment, error) {
|
|
| 31 | 31 |
r.Lock() |
| 32 | 32 |
defer r.Unlock() |
| 33 | 33 |
|
| 34 | 34 |
return r.Deployment, r.Err |
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 |
-func (r *DeploymentRegistry) CreateDeployment(ctx kubeapi.Context, deployment *api.Deployment) error {
|
|
| 37 |
+func (r *DeploymentRegistry) CreateDeployment(ctx kapi.Context, deployment *api.Deployment) error {
|
|
| 38 | 38 |
r.Lock() |
| 39 | 39 |
defer r.Unlock() |
| 40 | 40 |
|
| ... | ... |
@@ -42,7 +42,7 @@ func (r *DeploymentRegistry) CreateDeployment(ctx kubeapi.Context, deployment *a |
| 42 | 42 |
return r.Err |
| 43 | 43 |
} |
| 44 | 44 |
|
| 45 |
-func (r *DeploymentRegistry) UpdateDeployment(ctx kubeapi.Context, deployment *api.Deployment) error {
|
|
| 45 |
+func (r *DeploymentRegistry) UpdateDeployment(ctx kapi.Context, deployment *api.Deployment) error {
|
|
| 46 | 46 |
r.Lock() |
| 47 | 47 |
defer r.Unlock() |
| 48 | 48 |
|
| ... | ... |
@@ -50,13 +50,13 @@ func (r *DeploymentRegistry) UpdateDeployment(ctx kubeapi.Context, deployment *a |
| 50 | 50 |
return r.Err |
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 |
-func (r *DeploymentRegistry) DeleteDeployment(ctx kubeapi.Context, id string) error {
|
|
| 53 |
+func (r *DeploymentRegistry) DeleteDeployment(ctx kapi.Context, id string) error {
|
|
| 54 | 54 |
r.Lock() |
| 55 | 55 |
defer r.Unlock() |
| 56 | 56 |
|
| 57 | 57 |
return r.Err |
| 58 | 58 |
} |
| 59 | 59 |
|
| 60 |
-func (r *DeploymentRegistry) WatchDeployments(ctx kubeapi.Context, resourceVersion string, filter func(repo *api.Deployment) bool) (watch.Interface, error) {
|
|
| 60 |
+func (r *DeploymentRegistry) WatchDeployments(ctx kapi.Context, resourceVersion string, filter func(repo *api.Deployment) bool) (watch.Interface, error) {
|
|
| 61 | 61 |
return nil, r.Err |
| 62 | 62 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package test |
| 3 | 3 |
import ( |
| 4 | 4 |
"sync" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 9 | 9 |
"github.com/openshift/origin/pkg/deploy/api" |
| ... | ... |
@@ -20,21 +20,21 @@ func NewDeploymentConfigRegistry() *DeploymentConfigRegistry {
|
| 20 | 20 |
return &DeploymentConfigRegistry{}
|
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 |
-func (r *DeploymentConfigRegistry) ListDeploymentConfigs(ctx kubeapi.Context, selector labels.Selector) (*api.DeploymentConfigList, error) {
|
|
| 23 |
+func (r *DeploymentConfigRegistry) ListDeploymentConfigs(ctx kapi.Context, selector labels.Selector) (*api.DeploymentConfigList, error) {
|
|
| 24 | 24 |
r.Lock() |
| 25 | 25 |
defer r.Unlock() |
| 26 | 26 |
|
| 27 | 27 |
return r.DeploymentConfigs, r.Err |
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 |
-func (r *DeploymentConfigRegistry) GetDeploymentConfig(ctx kubeapi.Context, id string) (*api.DeploymentConfig, error) {
|
|
| 30 |
+func (r *DeploymentConfigRegistry) GetDeploymentConfig(ctx kapi.Context, id string) (*api.DeploymentConfig, error) {
|
|
| 31 | 31 |
r.Lock() |
| 32 | 32 |
defer r.Unlock() |
| 33 | 33 |
|
| 34 | 34 |
return r.DeploymentConfig, r.Err |
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 |
-func (r *DeploymentConfigRegistry) CreateDeploymentConfig(ctx kubeapi.Context, image *api.DeploymentConfig) error {
|
|
| 37 |
+func (r *DeploymentConfigRegistry) CreateDeploymentConfig(ctx kapi.Context, image *api.DeploymentConfig) error {
|
|
| 38 | 38 |
r.Lock() |
| 39 | 39 |
defer r.Unlock() |
| 40 | 40 |
|
| ... | ... |
@@ -42,7 +42,7 @@ func (r *DeploymentConfigRegistry) CreateDeploymentConfig(ctx kubeapi.Context, i |
| 42 | 42 |
return r.Err |
| 43 | 43 |
} |
| 44 | 44 |
|
| 45 |
-func (r *DeploymentConfigRegistry) UpdateDeploymentConfig(ctx kubeapi.Context, image *api.DeploymentConfig) error {
|
|
| 45 |
+func (r *DeploymentConfigRegistry) UpdateDeploymentConfig(ctx kapi.Context, image *api.DeploymentConfig) error {
|
|
| 46 | 46 |
r.Lock() |
| 47 | 47 |
defer r.Unlock() |
| 48 | 48 |
|
| ... | ... |
@@ -50,13 +50,13 @@ func (r *DeploymentConfigRegistry) UpdateDeploymentConfig(ctx kubeapi.Context, i |
| 50 | 50 |
return r.Err |
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 |
-func (r *DeploymentConfigRegistry) DeleteDeploymentConfig(ctx kubeapi.Context, id string) error {
|
|
| 53 |
+func (r *DeploymentConfigRegistry) DeleteDeploymentConfig(ctx kapi.Context, id string) error {
|
|
| 54 | 54 |
r.Lock() |
| 55 | 55 |
defer r.Unlock() |
| 56 | 56 |
|
| 57 | 57 |
return r.Err |
| 58 | 58 |
} |
| 59 | 59 |
|
| 60 |
-func (r *DeploymentConfigRegistry) WatchDeploymentConfigs(ctx kubeapi.Context, resourceVersion string, filter func(repo *api.DeploymentConfig) bool) (watch.Interface, error) {
|
|
| 60 |
+func (r *DeploymentConfigRegistry) WatchDeploymentConfigs(ctx kapi.Context, resourceVersion string, filter func(repo *api.DeploymentConfig) bool) (watch.Interface, error) {
|
|
| 61 | 61 |
return nil, r.Err |
| 62 | 62 |
} |
| ... | ... |
@@ -1,19 +1,19 @@ |
| 1 | 1 |
package api |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
"github.com/fsouza/go-dockerclient" |
| 6 | 6 |
) |
| 7 | 7 |
|
| 8 | 8 |
// ImageList is a list of Image objects. |
| 9 | 9 |
type ImageList struct {
|
| 10 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 10 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 11 | 11 |
Items []Image `json:"items,omitempty" yaml:"items,omitempty"` |
| 12 | 12 |
} |
| 13 | 13 |
|
| 14 | 14 |
// Image is an immutable representation of a Docker image and metadata at a point in time. |
| 15 | 15 |
type Image struct {
|
| 16 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 16 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 17 | 17 |
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` |
| 18 | 18 |
DockerImageReference string `json:"dockerImageReference,omitempty" yaml:"dockerImageReference,omitempty"` |
| 19 | 19 |
Metadata docker.Image `json:"metadata,omitempty" yaml:"metadata,omitempty"` |
| ... | ... |
@@ -21,7 +21,7 @@ type Image struct {
|
| 21 | 21 |
|
| 22 | 22 |
// ImageRepositoryList is a list of ImageRepository objects. |
| 23 | 23 |
type ImageRepositoryList struct {
|
| 24 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 24 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 25 | 25 |
Items []ImageRepository `json:"items,omitempty" yaml:"items,omitempty"` |
| 26 | 26 |
} |
| 27 | 27 |
|
| ... | ... |
@@ -29,7 +29,7 @@ type ImageRepositoryList struct {
|
| 29 | 29 |
// when images are tagged in a repository, and an optional reference to a Docker image |
| 30 | 30 |
// repository on a registry. |
| 31 | 31 |
type ImageRepository struct {
|
| 32 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 32 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 33 | 33 |
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` |
| 34 | 34 |
DockerImageRepository string `json:"dockerImageRepository,omitempty" yaml:"dockerImageRepository,omitempty"` |
| 35 | 35 |
Tags map[string]string `json:"tags,omitempty" yaml:"tags,omitempty"` |
| ... | ... |
@@ -40,7 +40,7 @@ type ImageRepository struct {
|
| 40 | 40 |
// ImageRepositoryMapping represents a mapping from a single tag to a Docker image as |
| 41 | 41 |
// well as the reference to the Docker image repository the image came from. |
| 42 | 42 |
type ImageRepositoryMapping struct {
|
| 43 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 43 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 44 | 44 |
DockerImageRepository string `json:"dockerImageRepository" yaml:"dockerImageRepository"` |
| 45 | 45 |
Image Image `json:"image" yaml:"image"` |
| 46 | 46 |
Tag string `json:"tag" yaml:"tag"` |
| ... | ... |
@@ -1,19 +1,19 @@ |
| 1 | 1 |
package v1beta1 |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1" |
|
| 5 | 5 |
"github.com/fsouza/go-dockerclient" |
| 6 | 6 |
) |
| 7 | 7 |
|
| 8 | 8 |
// ImageList is a list of Image objects. |
| 9 | 9 |
type ImageList struct {
|
| 10 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 10 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 11 | 11 |
Items []Image `json:"items,omitempty" yaml:"items,omitempty"` |
| 12 | 12 |
} |
| 13 | 13 |
|
| 14 | 14 |
// Image is an immutable representation of a Docker image and metadata at a point in time. |
| 15 | 15 |
type Image struct {
|
| 16 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 16 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 17 | 17 |
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` |
| 18 | 18 |
DockerImageReference string `json:"dockerImageReference,omitempty" yaml:"dockerImageReference,omitempty"` |
| 19 | 19 |
Metadata docker.Image `json:"metadata,omitempty" yaml:"metadata,omitempty"` |
| ... | ... |
@@ -21,7 +21,7 @@ type Image struct {
|
| 21 | 21 |
|
| 22 | 22 |
// ImageRepositoryList is a list of ImageRepository objects. |
| 23 | 23 |
type ImageRepositoryList struct {
|
| 24 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 24 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 25 | 25 |
Items []ImageRepository `json:"items,omitempty" yaml:"items,omitempty"` |
| 26 | 26 |
} |
| 27 | 27 |
|
| ... | ... |
@@ -29,7 +29,7 @@ type ImageRepositoryList struct {
|
| 29 | 29 |
// when images are tagged in a repository, and an optional reference to a Docker image |
| 30 | 30 |
// repository on a registry. |
| 31 | 31 |
type ImageRepository struct {
|
| 32 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 32 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 33 | 33 |
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` |
| 34 | 34 |
DockerImageRepository string `json:"dockerImageRepository,omitempty" yaml:"dockerImageRepository,omitempty"` |
| 35 | 35 |
Tags map[string]string `json:"tags,omitempty" yaml:"tags,omitempty"` |
| ... | ... |
@@ -40,7 +40,7 @@ type ImageRepository struct {
|
| 40 | 40 |
// ImageRepositoryMapping represents a mapping from a single tag to a Docker image as |
| 41 | 41 |
// well as the reference to the Docker image repository the image came from. |
| 42 | 42 |
type ImageRepositoryMapping struct {
|
| 43 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 43 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 44 | 44 |
DockerImageRepository string `json:"dockerImageRepository" yaml:"dockerImageRepository"` |
| 45 | 45 |
Image Image `json:"image" yaml:"image"` |
| 46 | 46 |
Tag string `json:"tag" yaml:"tag"` |
| ... | ... |
@@ -3,14 +3,14 @@ package validation |
| 3 | 3 |
import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 8 | 8 |
"github.com/openshift/origin/pkg/image/api" |
| 9 | 9 |
) |
| 10 | 10 |
|
| 11 | 11 |
func TestValidateImageOK(t *testing.T) {
|
| 12 | 12 |
errs := ValidateImage(&api.Image{
|
| 13 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 13 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 14 | 14 |
DockerImageReference: "openshift/ruby-19-centos", |
| 15 | 15 |
}) |
| 16 | 16 |
if len(errs) > 0 {
|
| ... | ... |
@@ -25,7 +25,7 @@ func TestValidateImageMissingFields(t *testing.T) {
|
| 25 | 25 |
F string |
| 26 | 26 |
}{
|
| 27 | 27 |
"missing ID": {api.Image{DockerImageReference: "ref"}, errors.ValidationErrorTypeRequired, "ID"},
|
| 28 |
- "missing DockerImageReference": {api.Image{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}, errors.ValidationErrorTypeRequired, "DockerImageReference"},
|
|
| 28 |
+ "missing DockerImageReference": {api.Image{TypeMeta: kapi.TypeMeta{ID: "foo"}}, errors.ValidationErrorTypeRequired, "DockerImageReference"},
|
|
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 | 31 |
for k, v := range errorCases {
|
| ... | ... |
@@ -55,7 +55,7 @@ func TestValidateImageRepositoryMappingNotOK(t *testing.T) {
|
| 55 | 55 |
api.ImageRepositoryMapping{
|
| 56 | 56 |
Tag: "latest", |
| 57 | 57 |
Image: api.Image{
|
| 58 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 58 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 59 | 59 |
ID: "foo", |
| 60 | 60 |
}, |
| 61 | 61 |
DockerImageReference: "openshift/ruby-19-centos", |
| ... | ... |
@@ -68,7 +68,7 @@ func TestValidateImageRepositoryMappingNotOK(t *testing.T) {
|
| 68 | 68 |
api.ImageRepositoryMapping{
|
| 69 | 69 |
DockerImageRepository: "openshift/ruby-19-centos", |
| 70 | 70 |
Image: api.Image{
|
| 71 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 71 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 72 | 72 |
ID: "foo", |
| 73 | 73 |
}, |
| 74 | 74 |
DockerImageReference: "openshift/ruby-19-centos", |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"errors" |
| 5 | 5 |
"strconv" |
| 6 | 6 |
|
| 7 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 | 8 |
etcderr "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors/etcd" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 10 | 10 |
kubeetcd "github.com/GoogleCloudPlatform/kubernetes/pkg/registry/etcd" |
| ... | ... |
@@ -36,7 +36,7 @@ func New(helper tools.EtcdHelper) *Etcd {
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
// ListImages retrieves a list of images that match selector. |
| 39 |
-func (r *Etcd) ListImages(ctx kubeapi.Context, selector labels.Selector) (*api.ImageList, error) {
|
|
| 39 |
+func (r *Etcd) ListImages(ctx kapi.Context, selector labels.Selector) (*api.ImageList, error) {
|
|
| 40 | 40 |
list := api.ImageList{}
|
| 41 | 41 |
err := r.ExtractToList(makeImageListKey(ctx), &list) |
| 42 | 42 |
if err != nil {
|
| ... | ... |
@@ -52,16 +52,16 @@ func (r *Etcd) ListImages(ctx kubeapi.Context, selector labels.Selector) (*api.I |
| 52 | 52 |
return &list, nil |
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 |
-func makeImageListKey(ctx kubeapi.Context) string {
|
|
| 55 |
+func makeImageListKey(ctx kapi.Context) string {
|
|
| 56 | 56 |
return kubeetcd.MakeEtcdListKey(ctx, ImagePath) |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 |
-func makeImageKey(ctx kubeapi.Context, id string) (string, error) {
|
|
| 59 |
+func makeImageKey(ctx kapi.Context, id string) (string, error) {
|
|
| 60 | 60 |
return kubeetcd.MakeEtcdItemKey(ctx, ImagePath, id) |
| 61 | 61 |
} |
| 62 | 62 |
|
| 63 | 63 |
// GetImage retrieves a specific image |
| 64 |
-func (r *Etcd) GetImage(ctx kubeapi.Context, id string) (*api.Image, error) {
|
|
| 64 |
+func (r *Etcd) GetImage(ctx kapi.Context, id string) (*api.Image, error) {
|
|
| 65 | 65 |
var image api.Image |
| 66 | 66 |
key, err := makeImageKey(ctx, id) |
| 67 | 67 |
if err != nil {
|
| ... | ... |
@@ -75,7 +75,7 @@ func (r *Etcd) GetImage(ctx kubeapi.Context, id string) (*api.Image, error) {
|
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 | 77 |
// CreateImage creates a new image |
| 78 |
-func (r *Etcd) CreateImage(ctx kubeapi.Context, image *api.Image) error {
|
|
| 78 |
+func (r *Etcd) CreateImage(ctx kapi.Context, image *api.Image) error {
|
|
| 79 | 79 |
key, err := makeImageKey(ctx, image.ID) |
| 80 | 80 |
if err != nil {
|
| 81 | 81 |
return err |
| ... | ... |
@@ -86,12 +86,12 @@ func (r *Etcd) CreateImage(ctx kubeapi.Context, image *api.Image) error {
|
| 86 | 86 |
} |
| 87 | 87 |
|
| 88 | 88 |
// UpdateImage updates an existing image |
| 89 |
-func (r *Etcd) UpdateImage(ctx kubeapi.Context, image *api.Image) error {
|
|
| 89 |
+func (r *Etcd) UpdateImage(ctx kapi.Context, image *api.Image) error {
|
|
| 90 | 90 |
return errors.New("not supported")
|
| 91 | 91 |
} |
| 92 | 92 |
|
| 93 | 93 |
// DeleteImage deletes an existing image |
| 94 |
-func (r *Etcd) DeleteImage(ctx kubeapi.Context, id string) error {
|
|
| 94 |
+func (r *Etcd) DeleteImage(ctx kapi.Context, id string) error {
|
|
| 95 | 95 |
key, err := makeImageKey(ctx, id) |
| 96 | 96 |
if err != nil {
|
| 97 | 97 |
return err |
| ... | ... |
@@ -102,7 +102,7 @@ func (r *Etcd) DeleteImage(ctx kubeapi.Context, id string) error {
|
| 102 | 102 |
} |
| 103 | 103 |
|
| 104 | 104 |
// ListImageRepositories retrieves a list of ImageRepositories that match selector. |
| 105 |
-func (r *Etcd) ListImageRepositories(ctx kubeapi.Context, selector labels.Selector) (*api.ImageRepositoryList, error) {
|
|
| 105 |
+func (r *Etcd) ListImageRepositories(ctx kapi.Context, selector labels.Selector) (*api.ImageRepositoryList, error) {
|
|
| 106 | 106 |
list := api.ImageRepositoryList{}
|
| 107 | 107 |
err := r.ExtractToList(makeImageRepositoryListKey(ctx), &list) |
| 108 | 108 |
if err != nil {
|
| ... | ... |
@@ -118,16 +118,16 @@ func (r *Etcd) ListImageRepositories(ctx kubeapi.Context, selector labels.Select |
| 118 | 118 |
return &list, nil |
| 119 | 119 |
} |
| 120 | 120 |
|
| 121 |
-func makeImageRepositoryListKey(ctx kubeapi.Context) string {
|
|
| 121 |
+func makeImageRepositoryListKey(ctx kapi.Context) string {
|
|
| 122 | 122 |
return kubeetcd.MakeEtcdListKey(ctx, ImageRepositoriesPath) |
| 123 | 123 |
} |
| 124 | 124 |
|
| 125 |
-func makeImageRepositoryKey(ctx kubeapi.Context, id string) (string, error) {
|
|
| 125 |
+func makeImageRepositoryKey(ctx kapi.Context, id string) (string, error) {
|
|
| 126 | 126 |
return kubeetcd.MakeEtcdItemKey(ctx, ImageRepositoriesPath, id) |
| 127 | 127 |
} |
| 128 | 128 |
|
| 129 | 129 |
// GetImageRepository retrieves an ImageRepository by id. |
| 130 |
-func (r *Etcd) GetImageRepository(ctx kubeapi.Context, id string) (*api.ImageRepository, error) {
|
|
| 130 |
+func (r *Etcd) GetImageRepository(ctx kapi.Context, id string) (*api.ImageRepository, error) {
|
|
| 131 | 131 |
var repo api.ImageRepository |
| 132 | 132 |
key, err := makeImageRepositoryKey(ctx, id) |
| 133 | 133 |
if err != nil {
|
| ... | ... |
@@ -156,7 +156,7 @@ func parseWatchResourceVersion(resourceVersion, kind string) (uint64, error) {
|
| 156 | 156 |
} |
| 157 | 157 |
|
| 158 | 158 |
// WatchImageRepositories begins watching for new, changed, or deleted ImageRepositories. |
| 159 |
-func (r *Etcd) WatchImageRepositories(ctx kubeapi.Context, resourceVersion string, filter func(repo *api.ImageRepository) bool) (watch.Interface, error) {
|
|
| 159 |
+func (r *Etcd) WatchImageRepositories(ctx kapi.Context, resourceVersion string, filter func(repo *api.ImageRepository) bool) (watch.Interface, error) {
|
|
| 160 | 160 |
version, err := parseWatchResourceVersion(resourceVersion, "imageRepository") |
| 161 | 161 |
if err != nil {
|
| 162 | 162 |
return nil, err |
| ... | ... |
@@ -173,7 +173,7 @@ func (r *Etcd) WatchImageRepositories(ctx kubeapi.Context, resourceVersion strin |
| 173 | 173 |
} |
| 174 | 174 |
|
| 175 | 175 |
// CreateImageRepository registers the given ImageRepository. |
| 176 |
-func (r *Etcd) CreateImageRepository(ctx kubeapi.Context, repo *api.ImageRepository) error {
|
|
| 176 |
+func (r *Etcd) CreateImageRepository(ctx kapi.Context, repo *api.ImageRepository) error {
|
|
| 177 | 177 |
key, err := makeImageRepositoryKey(ctx, repo.ID) |
| 178 | 178 |
if err != nil {
|
| 179 | 179 |
return err |
| ... | ... |
@@ -183,7 +183,7 @@ func (r *Etcd) CreateImageRepository(ctx kubeapi.Context, repo *api.ImageReposit |
| 183 | 183 |
} |
| 184 | 184 |
|
| 185 | 185 |
// UpdateImageRepository replaces an existing ImageRepository in the registry with the given ImageRepository. |
| 186 |
-func (r *Etcd) UpdateImageRepository(ctx kubeapi.Context, repo *api.ImageRepository) error {
|
|
| 186 |
+func (r *Etcd) UpdateImageRepository(ctx kapi.Context, repo *api.ImageRepository) error {
|
|
| 187 | 187 |
key, err := makeImageRepositoryKey(ctx, repo.ID) |
| 188 | 188 |
if err != nil {
|
| 189 | 189 |
return err |
| ... | ... |
@@ -193,7 +193,7 @@ func (r *Etcd) UpdateImageRepository(ctx kubeapi.Context, repo *api.ImageReposit |
| 193 | 193 |
} |
| 194 | 194 |
|
| 195 | 195 |
// DeleteImageRepository deletes an ImageRepository by id. |
| 196 |
-func (r *Etcd) DeleteImageRepository(ctx kubeapi.Context, id string) error {
|
|
| 196 |
+func (r *Etcd) DeleteImageRepository(ctx kapi.Context, id string) error {
|
|
| 197 | 197 |
key, err := makeImageRepositoryKey(ctx, id) |
| 198 | 198 |
if err != nil {
|
| 199 | 199 |
return err |
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
"strconv" |
| 7 | 7 |
"testing" |
| 8 | 8 |
|
| 9 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 9 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -33,10 +33,10 @@ func makeTestImageKey(namespace, id string) string {
|
| 33 | 33 |
return "/images/" + namespace + "/" + id |
| 34 | 34 |
} |
| 35 | 35 |
func makeTestDefaultImageKey(id string) string {
|
| 36 |
- return makeTestImageKey(kubeapi.NamespaceDefault, id) |
|
| 36 |
+ return makeTestImageKey(kapi.NamespaceDefault, id) |
|
| 37 | 37 |
} |
| 38 | 38 |
func makeTestDefaultImageListKey() string {
|
| 39 |
- return makeTestImageListKey(kubeapi.NamespaceDefault) |
|
| 39 |
+ return makeTestImageListKey(kapi.NamespaceDefault) |
|
| 40 | 40 |
} |
| 41 | 41 |
func makeTestImageRepositoriesListKey(namespace string) string {
|
| 42 | 42 |
if len(namespace) != 0 {
|
| ... | ... |
@@ -48,10 +48,10 @@ func makeTestImageRepositoriesKey(namespace, id string) string {
|
| 48 | 48 |
return "/imageRepositories/" + namespace + "/" + id |
| 49 | 49 |
} |
| 50 | 50 |
func makeTestDefaultImageRepositoriesKey(id string) string {
|
| 51 |
- return makeTestImageRepositoriesKey(kubeapi.NamespaceDefault, id) |
|
| 51 |
+ return makeTestImageRepositoriesKey(kapi.NamespaceDefault, id) |
|
| 52 | 52 |
} |
| 53 | 53 |
func makeTestDefaultImageRepositoriesListKey() string {
|
| 54 |
- return makeTestImageRepositoriesListKey(kubeapi.NamespaceDefault) |
|
| 54 |
+ return makeTestImageRepositoriesListKey(kapi.NamespaceDefault) |
|
| 55 | 55 |
} |
| 56 | 56 |
|
| 57 | 57 |
func NewTestEtcd(client tools.EtcdClient) *Etcd {
|
| ... | ... |
@@ -70,7 +70,7 @@ func TestEtcdListImagesEmpty(t *testing.T) {
|
| 70 | 70 |
E: nil, |
| 71 | 71 |
} |
| 72 | 72 |
registry := NewTestEtcd(fakeClient) |
| 73 |
- images, err := registry.ListImages(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 73 |
+ images, err := registry.ListImages(kapi.NewDefaultContext(), labels.Everything()) |
|
| 74 | 74 |
if err != nil {
|
| 75 | 75 |
t.Errorf("unexpected error: %v", err)
|
| 76 | 76 |
} |
| ... | ... |
@@ -90,7 +90,7 @@ func TestEtcdListImagesError(t *testing.T) {
|
| 90 | 90 |
E: fmt.Errorf("some error"),
|
| 91 | 91 |
} |
| 92 | 92 |
registry := NewTestEtcd(fakeClient) |
| 93 |
- images, err := registry.ListImages(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 93 |
+ images, err := registry.ListImages(kapi.NewDefaultContext(), labels.Everything()) |
|
| 94 | 94 |
if err == nil {
|
| 95 | 95 |
t.Error("unexpected nil error")
|
| 96 | 96 |
} |
| ... | ... |
@@ -108,10 +108,10 @@ func TestEtcdListImagesEverything(t *testing.T) {
|
| 108 | 108 |
Node: &etcd.Node{
|
| 109 | 109 |
Nodes: []*etcd.Node{
|
| 110 | 110 |
{
|
| 111 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}),
|
|
| 111 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kapi.TypeMeta{ID: "foo"}}),
|
|
| 112 | 112 |
}, |
| 113 | 113 |
{
|
| 114 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kubeapi.TypeMeta{ID: "bar"}}),
|
|
| 114 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kapi.TypeMeta{ID: "bar"}}),
|
|
| 115 | 115 |
}, |
| 116 | 116 |
}, |
| 117 | 117 |
}, |
| ... | ... |
@@ -119,7 +119,7 @@ func TestEtcdListImagesEverything(t *testing.T) {
|
| 119 | 119 |
E: nil, |
| 120 | 120 |
} |
| 121 | 121 |
registry := NewTestEtcd(fakeClient) |
| 122 |
- images, err := registry.ListImages(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 122 |
+ images, err := registry.ListImages(kapi.NewDefaultContext(), labels.Everything()) |
|
| 123 | 123 |
if err != nil {
|
| 124 | 124 |
t.Errorf("unexpected error: %v", err)
|
| 125 | 125 |
} |
| ... | ... |
@@ -138,13 +138,13 @@ func TestEtcdListImagesFiltered(t *testing.T) {
|
| 138 | 138 |
Nodes: []*etcd.Node{
|
| 139 | 139 |
{
|
| 140 | 140 |
Value: runtime.EncodeOrDie(latest.Codec, &api.Image{
|
| 141 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 141 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 142 | 142 |
Labels: map[string]string{"env": "prod"},
|
| 143 | 143 |
}), |
| 144 | 144 |
}, |
| 145 | 145 |
{
|
| 146 | 146 |
Value: runtime.EncodeOrDie(latest.Codec, &api.Image{
|
| 147 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar"},
|
|
| 147 |
+ TypeMeta: kapi.TypeMeta{ID: "bar"},
|
|
| 148 | 148 |
Labels: map[string]string{"env": "dev"},
|
| 149 | 149 |
}), |
| 150 | 150 |
}, |
| ... | ... |
@@ -154,7 +154,7 @@ func TestEtcdListImagesFiltered(t *testing.T) {
|
| 154 | 154 |
E: nil, |
| 155 | 155 |
} |
| 156 | 156 |
registry := NewTestEtcd(fakeClient) |
| 157 |
- images, err := registry.ListImages(kubeapi.NewDefaultContext(), labels.SelectorFromSet(labels.Set{"env": "dev"}))
|
|
| 157 |
+ images, err := registry.ListImages(kapi.NewDefaultContext(), labels.SelectorFromSet(labels.Set{"env": "dev"}))
|
|
| 158 | 158 |
if err != nil {
|
| 159 | 159 |
t.Errorf("unexpected error: %v", err)
|
| 160 | 160 |
} |
| ... | ... |
@@ -166,9 +166,9 @@ func TestEtcdListImagesFiltered(t *testing.T) {
|
| 166 | 166 |
|
| 167 | 167 |
func TestEtcdGetImage(t *testing.T) {
|
| 168 | 168 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 169 |
- fakeClient.Set(makeTestDefaultImageKey("foo"), runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 169 |
+ fakeClient.Set(makeTestDefaultImageKey("foo"), runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 170 | 170 |
registry := NewTestEtcd(fakeClient) |
| 171 |
- image, err := registry.GetImage(kubeapi.NewDefaultContext(), "foo") |
|
| 171 |
+ image, err := registry.GetImage(kapi.NewDefaultContext(), "foo") |
|
| 172 | 172 |
if err != nil {
|
| 173 | 173 |
t.Errorf("unexpected error: %v", err)
|
| 174 | 174 |
} |
| ... | ... |
@@ -187,7 +187,7 @@ func TestEtcdGetImageNotFound(t *testing.T) {
|
| 187 | 187 |
E: tools.EtcdErrorNotFound, |
| 188 | 188 |
} |
| 189 | 189 |
registry := NewTestEtcd(fakeClient) |
| 190 |
- image, err := registry.GetImage(kubeapi.NewDefaultContext(), "foo") |
|
| 190 |
+ image, err := registry.GetImage(kapi.NewDefaultContext(), "foo") |
|
| 191 | 191 |
if err == nil {
|
| 192 | 192 |
t.Errorf("Unexpected non-error.")
|
| 193 | 193 |
} |
| ... | ... |
@@ -206,8 +206,8 @@ func TestEtcdCreateImage(t *testing.T) {
|
| 206 | 206 |
E: tools.EtcdErrorNotFound, |
| 207 | 207 |
} |
| 208 | 208 |
registry := NewTestEtcd(fakeClient) |
| 209 |
- err := registry.CreateImage(kubeapi.NewDefaultContext(), &api.Image{
|
|
| 210 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 209 |
+ err := registry.CreateImage(kapi.NewDefaultContext(), &api.Image{
|
|
| 210 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 211 | 211 |
ID: "foo", |
| 212 | 212 |
}, |
| 213 | 213 |
DockerImageReference: "openshift/ruby-19-centos", |
| ... | ... |
@@ -247,14 +247,14 @@ func TestEtcdCreateImageAlreadyExists(t *testing.T) {
|
| 247 | 247 |
fakeClient.Data[makeTestDefaultImageKey("foo")] = tools.EtcdResponseWithError{
|
| 248 | 248 |
R: &etcd.Response{
|
| 249 | 249 |
Node: &etcd.Node{
|
| 250 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}),
|
|
| 250 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kapi.TypeMeta{ID: "foo"}}),
|
|
| 251 | 251 |
}, |
| 252 | 252 |
}, |
| 253 | 253 |
E: nil, |
| 254 | 254 |
} |
| 255 | 255 |
registry := NewTestEtcd(fakeClient) |
| 256 |
- err := registry.CreateImage(kubeapi.NewDefaultContext(), &api.Image{
|
|
| 257 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 256 |
+ err := registry.CreateImage(kapi.NewDefaultContext(), &api.Image{
|
|
| 257 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 258 | 258 |
ID: "foo", |
| 259 | 259 |
}, |
| 260 | 260 |
}) |
| ... | ... |
@@ -269,7 +269,7 @@ func TestEtcdCreateImageAlreadyExists(t *testing.T) {
|
| 269 | 269 |
func TestEtcdUpdateImage(t *testing.T) {
|
| 270 | 270 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 271 | 271 |
registry := NewTestEtcd(fakeClient) |
| 272 |
- err := registry.UpdateImage(kubeapi.NewDefaultContext(), &api.Image{})
|
|
| 272 |
+ err := registry.UpdateImage(kapi.NewDefaultContext(), &api.Image{})
|
|
| 273 | 273 |
if err == nil {
|
| 274 | 274 |
t.Error("Unexpected non-error")
|
| 275 | 275 |
} |
| ... | ... |
@@ -279,7 +279,7 @@ func TestEtcdDeleteImageNotFound(t *testing.T) {
|
| 279 | 279 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 280 | 280 |
fakeClient.Err = tools.EtcdErrorNotFound |
| 281 | 281 |
registry := NewTestEtcd(fakeClient) |
| 282 |
- err := registry.DeleteImage(kubeapi.NewDefaultContext(), "foo") |
|
| 282 |
+ err := registry.DeleteImage(kapi.NewDefaultContext(), "foo") |
|
| 283 | 283 |
if err == nil {
|
| 284 | 284 |
t.Error("Unexpected non-error")
|
| 285 | 285 |
} |
| ... | ... |
@@ -292,7 +292,7 @@ func TestEtcdDeleteImageError(t *testing.T) {
|
| 292 | 292 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 293 | 293 |
fakeClient.Err = fmt.Errorf("Some error")
|
| 294 | 294 |
registry := NewTestEtcd(fakeClient) |
| 295 |
- err := registry.DeleteImage(kubeapi.NewDefaultContext(), "foo") |
|
| 295 |
+ err := registry.DeleteImage(kapi.NewDefaultContext(), "foo") |
|
| 296 | 296 |
if err == nil {
|
| 297 | 297 |
t.Error("Unexpected non-error")
|
| 298 | 298 |
} |
| ... | ... |
@@ -302,7 +302,7 @@ func TestEtcdDeleteImageOK(t *testing.T) {
|
| 302 | 302 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 303 | 303 |
registry := NewTestEtcd(fakeClient) |
| 304 | 304 |
key := makeTestDefaultImageListKey() + "/foo" |
| 305 |
- err := registry.DeleteImage(kubeapi.NewDefaultContext(), "foo") |
|
| 305 |
+ err := registry.DeleteImage(kapi.NewDefaultContext(), "foo") |
|
| 306 | 306 |
if err != nil {
|
| 307 | 307 |
t.Errorf("Unexpected error: %#v", err)
|
| 308 | 308 |
} |
| ... | ... |
@@ -325,7 +325,7 @@ func TestEtcdListImagesRepositoriesEmpty(t *testing.T) {
|
| 325 | 325 |
E: nil, |
| 326 | 326 |
} |
| 327 | 327 |
registry := NewTestEtcd(fakeClient) |
| 328 |
- repos, err := registry.ListImageRepositories(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 328 |
+ repos, err := registry.ListImageRepositories(kapi.NewDefaultContext(), labels.Everything()) |
|
| 329 | 329 |
if err != nil {
|
| 330 | 330 |
t.Errorf("unexpected error: %v", err)
|
| 331 | 331 |
} |
| ... | ... |
@@ -345,7 +345,7 @@ func TestEtcdListImageRepositoriesError(t *testing.T) {
|
| 345 | 345 |
E: fmt.Errorf("some error"),
|
| 346 | 346 |
} |
| 347 | 347 |
registry := NewTestEtcd(fakeClient) |
| 348 |
- repos, err := registry.ListImageRepositories(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 348 |
+ repos, err := registry.ListImageRepositories(kapi.NewDefaultContext(), labels.Everything()) |
|
| 349 | 349 |
if err == nil {
|
| 350 | 350 |
t.Error("unexpected nil error")
|
| 351 | 351 |
} |
| ... | ... |
@@ -363,10 +363,10 @@ func TestEtcdListImageRepositoriesEverything(t *testing.T) {
|
| 363 | 363 |
Node: &etcd.Node{
|
| 364 | 364 |
Nodes: []*etcd.Node{
|
| 365 | 365 |
{
|
| 366 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}),
|
|
| 366 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kapi.TypeMeta{ID: "foo"}}),
|
|
| 367 | 367 |
}, |
| 368 | 368 |
{
|
| 369 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kubeapi.TypeMeta{ID: "bar"}}),
|
|
| 369 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kapi.TypeMeta{ID: "bar"}}),
|
|
| 370 | 370 |
}, |
| 371 | 371 |
}, |
| 372 | 372 |
}, |
| ... | ... |
@@ -374,7 +374,7 @@ func TestEtcdListImageRepositoriesEverything(t *testing.T) {
|
| 374 | 374 |
E: nil, |
| 375 | 375 |
} |
| 376 | 376 |
registry := NewTestEtcd(fakeClient) |
| 377 |
- repos, err := registry.ListImageRepositories(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 377 |
+ repos, err := registry.ListImageRepositories(kapi.NewDefaultContext(), labels.Everything()) |
|
| 378 | 378 |
if err != nil {
|
| 379 | 379 |
t.Errorf("unexpected error: %v", err)
|
| 380 | 380 |
} |
| ... | ... |
@@ -393,13 +393,13 @@ func TestEtcdListImageRepositoriesFiltered(t *testing.T) {
|
| 393 | 393 |
Nodes: []*etcd.Node{
|
| 394 | 394 |
{
|
| 395 | 395 |
Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{
|
| 396 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 396 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 397 | 397 |
Labels: map[string]string{"env": "prod"},
|
| 398 | 398 |
}), |
| 399 | 399 |
}, |
| 400 | 400 |
{
|
| 401 | 401 |
Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{
|
| 402 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar"},
|
|
| 402 |
+ TypeMeta: kapi.TypeMeta{ID: "bar"},
|
|
| 403 | 403 |
Labels: map[string]string{"env": "dev"},
|
| 404 | 404 |
}), |
| 405 | 405 |
}, |
| ... | ... |
@@ -409,7 +409,7 @@ func TestEtcdListImageRepositoriesFiltered(t *testing.T) {
|
| 409 | 409 |
E: nil, |
| 410 | 410 |
} |
| 411 | 411 |
registry := NewTestEtcd(fakeClient) |
| 412 |
- repos, err := registry.ListImageRepositories(kubeapi.NewDefaultContext(), labels.SelectorFromSet(labels.Set{"env": "dev"}))
|
|
| 412 |
+ repos, err := registry.ListImageRepositories(kapi.NewDefaultContext(), labels.SelectorFromSet(labels.Set{"env": "dev"}))
|
|
| 413 | 413 |
if err != nil {
|
| 414 | 414 |
t.Errorf("unexpected error: %v", err)
|
| 415 | 415 |
} |
| ... | ... |
@@ -421,9 +421,9 @@ func TestEtcdListImageRepositoriesFiltered(t *testing.T) {
|
| 421 | 421 |
|
| 422 | 422 |
func TestEtcdGetImageRepository(t *testing.T) {
|
| 423 | 423 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 424 |
- fakeClient.Set(makeTestDefaultImageRepositoriesKey("foo"), runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 424 |
+ fakeClient.Set(makeTestDefaultImageRepositoriesKey("foo"), runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 425 | 425 |
registry := NewTestEtcd(fakeClient) |
| 426 |
- repo, err := registry.GetImageRepository(kubeapi.NewDefaultContext(), "foo") |
|
| 426 |
+ repo, err := registry.GetImageRepository(kapi.NewDefaultContext(), "foo") |
|
| 427 | 427 |
if err != nil {
|
| 428 | 428 |
t.Errorf("unexpected error: %v", err)
|
| 429 | 429 |
} |
| ... | ... |
@@ -442,7 +442,7 @@ func TestEtcdGetImageRepositoryNotFound(t *testing.T) {
|
| 442 | 442 |
E: tools.EtcdErrorNotFound, |
| 443 | 443 |
} |
| 444 | 444 |
registry := NewTestEtcd(fakeClient) |
| 445 |
- repo, err := registry.GetImageRepository(kubeapi.NewDefaultContext(), "foo") |
|
| 445 |
+ repo, err := registry.GetImageRepository(kapi.NewDefaultContext(), "foo") |
|
| 446 | 446 |
if err == nil {
|
| 447 | 447 |
t.Errorf("Unexpected non-error.")
|
| 448 | 448 |
} |
| ... | ... |
@@ -461,8 +461,8 @@ func TestEtcdCreateImageRepository(t *testing.T) {
|
| 461 | 461 |
E: tools.EtcdErrorNotFound, |
| 462 | 462 |
} |
| 463 | 463 |
registry := NewTestEtcd(fakeClient) |
| 464 |
- err := registry.CreateImageRepository(kubeapi.NewDefaultContext(), &api.ImageRepository{
|
|
| 465 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 464 |
+ err := registry.CreateImageRepository(kapi.NewDefaultContext(), &api.ImageRepository{
|
|
| 465 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 466 | 466 |
ID: "foo", |
| 467 | 467 |
}, |
| 468 | 468 |
Labels: map[string]string{"a": "b"},
|
| ... | ... |
@@ -505,14 +505,14 @@ func TestEtcdCreateImageRepositoryAlreadyExists(t *testing.T) {
|
| 505 | 505 |
fakeClient.Data[makeTestDefaultImageRepositoriesKey("foo")] = tools.EtcdResponseWithError{
|
| 506 | 506 |
R: &etcd.Response{
|
| 507 | 507 |
Node: &etcd.Node{
|
| 508 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}),
|
|
| 508 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kapi.TypeMeta{ID: "foo"}}),
|
|
| 509 | 509 |
}, |
| 510 | 510 |
}, |
| 511 | 511 |
E: nil, |
| 512 | 512 |
} |
| 513 | 513 |
registry := NewTestEtcd(fakeClient) |
| 514 |
- err := registry.CreateImageRepository(kubeapi.NewDefaultContext(), &api.ImageRepository{
|
|
| 515 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 514 |
+ err := registry.CreateImageRepository(kapi.NewDefaultContext(), &api.ImageRepository{
|
|
| 515 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 516 | 516 |
ID: "foo", |
| 517 | 517 |
}, |
| 518 | 518 |
}) |
| ... | ... |
@@ -528,17 +528,17 @@ func TestEtcdUpdateImageRepository(t *testing.T) {
|
| 528 | 528 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 529 | 529 |
fakeClient.TestIndex = true |
| 530 | 530 |
|
| 531 |
- resp, _ := fakeClient.Set(makeTestDefaultImageRepositoriesKey("foo"), runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 531 |
+ resp, _ := fakeClient.Set(makeTestDefaultImageRepositoriesKey("foo"), runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 532 | 532 |
registry := NewTestEtcd(fakeClient) |
| 533 |
- err := registry.UpdateImageRepository(kubeapi.NewDefaultContext(), &api.ImageRepository{
|
|
| 534 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo", ResourceVersion: strconv.FormatUint(resp.Node.ModifiedIndex, 10)},
|
|
| 533 |
+ err := registry.UpdateImageRepository(kapi.NewDefaultContext(), &api.ImageRepository{
|
|
| 534 |
+ TypeMeta: kapi.TypeMeta{ID: "foo", ResourceVersion: strconv.FormatUint(resp.Node.ModifiedIndex, 10)},
|
|
| 535 | 535 |
DockerImageRepository: "some/repo", |
| 536 | 536 |
}) |
| 537 | 537 |
if err != nil {
|
| 538 | 538 |
t.Errorf("unexpected error: %v", err)
|
| 539 | 539 |
} |
| 540 | 540 |
|
| 541 |
- repo, err := registry.GetImageRepository(kubeapi.NewDefaultContext(), "foo") |
|
| 541 |
+ repo, err := registry.GetImageRepository(kapi.NewDefaultContext(), "foo") |
|
| 542 | 542 |
if repo.DockerImageRepository != "some/repo" {
|
| 543 | 543 |
t.Errorf("Unexpected repo: %#v", repo)
|
| 544 | 544 |
} |
| ... | ... |
@@ -548,7 +548,7 @@ func TestEtcdDeleteImageRepositoryNotFound(t *testing.T) {
|
| 548 | 548 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 549 | 549 |
fakeClient.Err = tools.EtcdErrorNotFound |
| 550 | 550 |
registry := NewTestEtcd(fakeClient) |
| 551 |
- err := registry.DeleteImageRepository(kubeapi.NewDefaultContext(), "foo") |
|
| 551 |
+ err := registry.DeleteImageRepository(kapi.NewDefaultContext(), "foo") |
|
| 552 | 552 |
if err == nil {
|
| 553 | 553 |
t.Error("Unexpected non-error")
|
| 554 | 554 |
} |
| ... | ... |
@@ -561,7 +561,7 @@ func TestEtcdDeleteImageRepositoryError(t *testing.T) {
|
| 561 | 561 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 562 | 562 |
fakeClient.Err = fmt.Errorf("Some error")
|
| 563 | 563 |
registry := NewTestEtcd(fakeClient) |
| 564 |
- err := registry.DeleteImageRepository(kubeapi.NewDefaultContext(), "foo") |
|
| 564 |
+ err := registry.DeleteImageRepository(kapi.NewDefaultContext(), "foo") |
|
| 565 | 565 |
if err == nil {
|
| 566 | 566 |
t.Error("Unexpected non-error")
|
| 567 | 567 |
} |
| ... | ... |
@@ -571,7 +571,7 @@ func TestEtcdDeleteImageRepositoryOK(t *testing.T) {
|
| 571 | 571 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 572 | 572 |
registry := NewTestEtcd(fakeClient) |
| 573 | 573 |
key := makeTestDefaultImageRepositoriesListKey() + "/foo" |
| 574 |
- err := registry.DeleteImageRepository(kubeapi.NewDefaultContext(), "foo") |
|
| 574 |
+ err := registry.DeleteImageRepository(kapi.NewDefaultContext(), "foo") |
|
| 575 | 575 |
if err != nil {
|
| 576 | 576 |
t.Errorf("Unexpected error: %#v", err)
|
| 577 | 577 |
} |
| ... | ... |
@@ -587,7 +587,7 @@ func TestEtcdWatchImageRepositories(t *testing.T) {
|
| 587 | 587 |
registry := NewTestEtcd(fakeClient) |
| 588 | 588 |
filterFields := labels.SelectorFromSet(labels.Set{"ID": "foo"})
|
| 589 | 589 |
|
| 590 |
- watching, err := registry.WatchImageRepositories(kubeapi.NewDefaultContext(), "1", func(repo *api.ImageRepository) bool {
|
|
| 590 |
+ watching, err := registry.WatchImageRepositories(kapi.NewDefaultContext(), "1", func(repo *api.ImageRepository) bool {
|
|
| 591 | 591 |
fields := labels.Set{
|
| 592 | 592 |
"ID": repo.ID, |
| 593 | 593 |
} |
| ... | ... |
@@ -598,7 +598,7 @@ func TestEtcdWatchImageRepositories(t *testing.T) {
|
| 598 | 598 |
} |
| 599 | 599 |
fakeClient.WaitForWatchCompletion() |
| 600 | 600 |
|
| 601 |
- repo := &api.ImageRepository{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}
|
|
| 601 |
+ repo := &api.ImageRepository{TypeMeta: kapi.TypeMeta{ID: "foo"}}
|
|
| 602 | 602 |
repoBytes, _ := latest.Codec.Encode(repo) |
| 603 | 603 |
fakeClient.WatchResponse <- &etcd.Response{
|
| 604 | 604 |
Action: "set", |
| ... | ... |
@@ -634,8 +634,8 @@ func TestEtcdCreateImageFailsWithoutNamespace(t *testing.T) {
|
| 634 | 634 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 635 | 635 |
fakeClient.TestIndex = true |
| 636 | 636 |
registry := NewTestEtcd(fakeClient) |
| 637 |
- err := registry.CreateImage(kubeapi.NewContext(), &api.Image{
|
|
| 638 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 637 |
+ err := registry.CreateImage(kapi.NewContext(), &api.Image{
|
|
| 638 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 639 | 639 |
ID: "foo", |
| 640 | 640 |
}, |
| 641 | 641 |
}) |
| ... | ... |
@@ -647,14 +647,14 @@ func TestEtcdCreateImageFailsWithoutNamespace(t *testing.T) {
|
| 647 | 647 |
|
| 648 | 648 |
func TestEtcdListImagesInDifferentNamespaces(t *testing.T) {
|
| 649 | 649 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 650 |
- namespaceAlfa := kubeapi.WithNamespace(kubeapi.NewContext(), "alfa") |
|
| 651 |
- namespaceBravo := kubeapi.WithNamespace(kubeapi.NewContext(), "bravo") |
|
| 650 |
+ namespaceAlfa := kapi.WithNamespace(kapi.NewContext(), "alfa") |
|
| 651 |
+ namespaceBravo := kapi.WithNamespace(kapi.NewContext(), "bravo") |
|
| 652 | 652 |
fakeClient.Data["/images/alfa"] = tools.EtcdResponseWithError{
|
| 653 | 653 |
R: &etcd.Response{
|
| 654 | 654 |
Node: &etcd.Node{
|
| 655 | 655 |
Nodes: []*etcd.Node{
|
| 656 | 656 |
{
|
| 657 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kubeapi.TypeMeta{ID: "foo1"}}),
|
|
| 657 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kapi.TypeMeta{ID: "foo1"}}),
|
|
| 658 | 658 |
}, |
| 659 | 659 |
}, |
| 660 | 660 |
}, |
| ... | ... |
@@ -666,10 +666,10 @@ func TestEtcdListImagesInDifferentNamespaces(t *testing.T) {
|
| 666 | 666 |
Node: &etcd.Node{
|
| 667 | 667 |
Nodes: []*etcd.Node{
|
| 668 | 668 |
{
|
| 669 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kubeapi.TypeMeta{ID: "foo2"}}),
|
|
| 669 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kapi.TypeMeta{ID: "foo2"}}),
|
|
| 670 | 670 |
}, |
| 671 | 671 |
{
|
| 672 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kubeapi.TypeMeta{ID: "bar2"}}),
|
|
| 672 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kapi.TypeMeta{ID: "bar2"}}),
|
|
| 673 | 673 |
}, |
| 674 | 674 |
}, |
| 675 | 675 |
}, |
| ... | ... |
@@ -697,10 +697,10 @@ func TestEtcdListImagesInDifferentNamespaces(t *testing.T) {
|
| 697 | 697 |
|
| 698 | 698 |
func TestEtcdGetImageInDifferentNamespaces(t *testing.T) {
|
| 699 | 699 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 700 |
- namespaceAlfa := kubeapi.WithNamespace(kubeapi.NewContext(), "alfa") |
|
| 701 |
- namespaceBravo := kubeapi.WithNamespace(kubeapi.NewContext(), "bravo") |
|
| 702 |
- fakeClient.Set("/images/alfa/foo", runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 703 |
- fakeClient.Set("/images/bravo/foo", runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 700 |
+ namespaceAlfa := kapi.WithNamespace(kapi.NewContext(), "alfa") |
|
| 701 |
+ namespaceBravo := kapi.WithNamespace(kapi.NewContext(), "bravo") |
|
| 702 |
+ fakeClient.Set("/images/alfa/foo", runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 703 |
+ fakeClient.Set("/images/bravo/foo", runtime.EncodeOrDie(latest.Codec, &api.Image{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 704 | 704 |
registry := NewTestEtcd(fakeClient) |
| 705 | 705 |
|
| 706 | 706 |
alfaFoo, err := registry.GetImage(namespaceAlfa, "foo") |
| ... | ... |
@@ -724,8 +724,8 @@ func TestEtcdCreateImageRepositoryFailsWithoutNamespace(t *testing.T) {
|
| 724 | 724 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 725 | 725 |
fakeClient.TestIndex = true |
| 726 | 726 |
registry := NewTestEtcd(fakeClient) |
| 727 |
- err := registry.CreateImageRepository(kubeapi.NewContext(), &api.ImageRepository{
|
|
| 728 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 727 |
+ err := registry.CreateImageRepository(kapi.NewContext(), &api.ImageRepository{
|
|
| 728 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 729 | 729 |
ID: "foo", |
| 730 | 730 |
}, |
| 731 | 731 |
}) |
| ... | ... |
@@ -737,14 +737,14 @@ func TestEtcdCreateImageRepositoryFailsWithoutNamespace(t *testing.T) {
|
| 737 | 737 |
|
| 738 | 738 |
func TestEtcdListImageRepositoriesInDifferentNamespaces(t *testing.T) {
|
| 739 | 739 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 740 |
- namespaceAlfa := kubeapi.WithNamespace(kubeapi.NewContext(), "alfa") |
|
| 741 |
- namespaceBravo := kubeapi.WithNamespace(kubeapi.NewContext(), "bravo") |
|
| 740 |
+ namespaceAlfa := kapi.WithNamespace(kapi.NewContext(), "alfa") |
|
| 741 |
+ namespaceBravo := kapi.WithNamespace(kapi.NewContext(), "bravo") |
|
| 742 | 742 |
fakeClient.Data["/imageRepositories/alfa"] = tools.EtcdResponseWithError{
|
| 743 | 743 |
R: &etcd.Response{
|
| 744 | 744 |
Node: &etcd.Node{
|
| 745 | 745 |
Nodes: []*etcd.Node{
|
| 746 | 746 |
{
|
| 747 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kubeapi.TypeMeta{ID: "foo1"}}),
|
|
| 747 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kapi.TypeMeta{ID: "foo1"}}),
|
|
| 748 | 748 |
}, |
| 749 | 749 |
}, |
| 750 | 750 |
}, |
| ... | ... |
@@ -756,10 +756,10 @@ func TestEtcdListImageRepositoriesInDifferentNamespaces(t *testing.T) {
|
| 756 | 756 |
Node: &etcd.Node{
|
| 757 | 757 |
Nodes: []*etcd.Node{
|
| 758 | 758 |
{
|
| 759 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kubeapi.TypeMeta{ID: "foo2"}}),
|
|
| 759 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kapi.TypeMeta{ID: "foo2"}}),
|
|
| 760 | 760 |
}, |
| 761 | 761 |
{
|
| 762 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kubeapi.TypeMeta{ID: "bar2"}}),
|
|
| 762 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kapi.TypeMeta{ID: "bar2"}}),
|
|
| 763 | 763 |
}, |
| 764 | 764 |
}, |
| 765 | 765 |
}, |
| ... | ... |
@@ -787,10 +787,10 @@ func TestEtcdListImageRepositoriesInDifferentNamespaces(t *testing.T) {
|
| 787 | 787 |
|
| 788 | 788 |
func TestEtcdGetImageRepositoryInDifferentNamespaces(t *testing.T) {
|
| 789 | 789 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 790 |
- namespaceAlfa := kubeapi.WithNamespace(kubeapi.NewContext(), "alfa") |
|
| 791 |
- namespaceBravo := kubeapi.WithNamespace(kubeapi.NewContext(), "bravo") |
|
| 792 |
- fakeClient.Set("/imageRepositories/alfa/foo", runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 793 |
- fakeClient.Set("/imageRepositories/bravo/foo", runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 790 |
+ namespaceAlfa := kapi.WithNamespace(kapi.NewContext(), "alfa") |
|
| 791 |
+ namespaceBravo := kapi.WithNamespace(kapi.NewContext(), "bravo") |
|
| 792 |
+ fakeClient.Set("/imageRepositories/alfa/foo", runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 793 |
+ fakeClient.Set("/imageRepositories/bravo/foo", runtime.EncodeOrDie(latest.Codec, &api.ImageRepository{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 794 | 794 |
registry := NewTestEtcd(fakeClient) |
| 795 | 795 |
|
| 796 | 796 |
alfaFoo, err := registry.GetImageRepository(namespaceAlfa, "foo") |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package image |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 6 | 6 |
"github.com/openshift/origin/pkg/image/api" |
| 7 | 7 |
) |
| ... | ... |
@@ -9,13 +9,13 @@ import ( |
| 9 | 9 |
// Registry is an interface for things that know how to store Image objects. |
| 10 | 10 |
type Registry interface {
|
| 11 | 11 |
// ListImages obtains a list of images that match a selector. |
| 12 |
- ListImages(ctx kubeapi.Context, selector labels.Selector) (*api.ImageList, error) |
|
| 12 |
+ ListImages(ctx kapi.Context, selector labels.Selector) (*api.ImageList, error) |
|
| 13 | 13 |
// GetImage retrieves a specific image. |
| 14 |
- GetImage(ctx kubeapi.Context, id string) (*api.Image, error) |
|
| 14 |
+ GetImage(ctx kapi.Context, id string) (*api.Image, error) |
|
| 15 | 15 |
// CreateImage creates a new image. |
| 16 |
- CreateImage(ctx kubeapi.Context, image *api.Image) error |
|
| 16 |
+ CreateImage(ctx kapi.Context, image *api.Image) error |
|
| 17 | 17 |
// UpdateImage updates an image. |
| 18 |
- UpdateImage(ctx kubeapi.Context, image *api.Image) error |
|
| 18 |
+ UpdateImage(ctx kapi.Context, image *api.Image) error |
|
| 19 | 19 |
// DeleteImage deletes an image. |
| 20 |
- DeleteImage(ctx kubeapi.Context, id string) error |
|
| 20 |
+ DeleteImage(ctx kapi.Context, id string) error |
|
| 21 | 21 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package image |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| ... | ... |
@@ -30,7 +30,7 @@ func (s *REST) New() runtime.Object {
|
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 | 32 |
// List retrieves a list of Images that match selector. |
| 33 |
-func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 33 |
+func (s *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 34 | 34 |
images, err := s.registry.ListImages(ctx, selector) |
| 35 | 35 |
if err != nil {
|
| 36 | 36 |
return nil, err |
| ... | ... |
@@ -40,7 +40,7 @@ func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runt |
| 40 | 40 |
} |
| 41 | 41 |
|
| 42 | 42 |
// Get retrieves an Image by id. |
| 43 |
-func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 43 |
+func (s *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 44 | 44 |
image, err := s.registry.GetImage(ctx, id) |
| 45 | 45 |
if err != nil {
|
| 46 | 46 |
return nil, err |
| ... | ... |
@@ -49,12 +49,12 @@ func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
// Create registers the given Image. |
| 52 |
-func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 52 |
+func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 53 | 53 |
image, ok := obj.(*api.Image) |
| 54 | 54 |
if !ok {
|
| 55 | 55 |
return nil, fmt.Errorf("not an image: %#v", obj)
|
| 56 | 56 |
} |
| 57 |
- if !kubeapi.ValidNamespace(ctx, &image.TypeMeta) {
|
|
| 57 |
+ if !kapi.ValidNamespace(ctx, &image.TypeMeta) {
|
|
| 58 | 58 |
return nil, errors.NewConflict("image", image.Namespace, fmt.Errorf("Image.Namespace does not match the provided context"))
|
| 59 | 59 |
} |
| 60 | 60 |
|
| ... | ... |
@@ -73,13 +73,13 @@ func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 | 75 |
// Update is not supported for Images, as they are immutable. |
| 76 |
-func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 76 |
+func (s *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 77 | 77 |
return nil, fmt.Errorf("Images may not be changed.")
|
| 78 | 78 |
} |
| 79 | 79 |
|
| 80 | 80 |
// Delete asynchronously deletes an Image specified by its id. |
| 81 |
-func (s *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 81 |
+func (s *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 82 | 82 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| 83 |
- return &kubeapi.Status{Status: kubeapi.StatusSuccess}, s.registry.DeleteImage(ctx, id)
|
|
| 83 |
+ return &kapi.Status{Status: kapi.StatusSuccess}, s.registry.DeleteImage(ctx, id)
|
|
| 84 | 84 |
}), nil |
| 85 | 85 |
} |
| ... | ... |
@@ -7,9 +7,9 @@ import ( |
| 7 | 7 |
"testing" |
| 8 | 8 |
"time" |
| 9 | 9 |
|
| 10 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 10 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 12 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 12 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 14 | 14 |
"github.com/openshift/origin/pkg/image/api" |
| 15 | 15 |
"github.com/openshift/origin/pkg/image/registry/test" |
| ... | ... |
@@ -23,7 +23,7 @@ func TestListImagesError(t *testing.T) {
|
| 23 | 23 |
registry: mockRegistry, |
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 |
- images, err := storage.List(kubeapi.NewDefaultContext(), nil, nil) |
|
| 26 |
+ images, err := storage.List(kapi.NewDefaultContext(), nil, nil) |
|
| 27 | 27 |
if err != mockRegistry.Err {
|
| 28 | 28 |
t.Errorf("Expected %#v, Got %#v", mockRegistry.Err, err)
|
| 29 | 29 |
} |
| ... | ... |
@@ -43,7 +43,7 @@ func TestListImagesEmptyList(t *testing.T) {
|
| 43 | 43 |
registry: mockRegistry, |
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 |
- images, err := storage.List(kubeapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 46 |
+ images, err := storage.List(kapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 47 | 47 |
if err != nil {
|
| 48 | 48 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 49 | 49 |
} |
| ... | ... |
@@ -58,12 +58,12 @@ func TestListImagesPopulatedList(t *testing.T) {
|
| 58 | 58 |
mockRegistry.Images = &api.ImageList{
|
| 59 | 59 |
Items: []api.Image{
|
| 60 | 60 |
{
|
| 61 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 61 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 62 | 62 |
ID: "foo", |
| 63 | 63 |
}, |
| 64 | 64 |
}, |
| 65 | 65 |
{
|
| 66 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 66 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 67 | 67 |
ID: "bar", |
| 68 | 68 |
}, |
| 69 | 69 |
}, |
| ... | ... |
@@ -74,7 +74,7 @@ func TestListImagesPopulatedList(t *testing.T) {
|
| 74 | 74 |
registry: mockRegistry, |
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 |
- list, err := storage.List(kubeapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 77 |
+ list, err := storage.List(kapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 78 | 78 |
if err != nil {
|
| 79 | 79 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 80 | 80 |
} |
| ... | ... |
@@ -89,7 +89,7 @@ func TestListImagesPopulatedList(t *testing.T) {
|
| 89 | 89 |
func TestCreateImageBadObject(t *testing.T) {
|
| 90 | 90 |
storage := REST{}
|
| 91 | 91 |
|
| 92 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), &api.ImageList{})
|
|
| 92 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), &api.ImageList{})
|
|
| 93 | 93 |
if channel != nil {
|
| 94 | 94 |
t.Errorf("Expected nil, got %v", channel)
|
| 95 | 95 |
} |
| ... | ... |
@@ -101,7 +101,7 @@ func TestCreateImageBadObject(t *testing.T) {
|
| 101 | 101 |
func TestCreateImageMissingID(t *testing.T) {
|
| 102 | 102 |
storage := REST{}
|
| 103 | 103 |
|
| 104 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), &api.Image{})
|
|
| 104 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), &api.Image{})
|
|
| 105 | 105 |
if channel != nil {
|
| 106 | 106 |
t.Errorf("Expected nil channel, got %v", channel)
|
| 107 | 107 |
} |
| ... | ... |
@@ -115,8 +115,8 @@ func TestCreateRegistrySaveError(t *testing.T) {
|
| 115 | 115 |
mockRegistry.Err = fmt.Errorf("test error")
|
| 116 | 116 |
storage := REST{registry: mockRegistry}
|
| 117 | 117 |
|
| 118 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), &api.Image{
|
|
| 119 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 118 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), &api.Image{
|
|
| 119 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 120 | 120 |
DockerImageReference: "openshift/ruby-19-centos", |
| 121 | 121 |
}) |
| 122 | 122 |
if channel == nil {
|
| ... | ... |
@@ -128,11 +128,11 @@ func TestCreateRegistrySaveError(t *testing.T) {
|
| 128 | 128 |
|
| 129 | 129 |
select {
|
| 130 | 130 |
case result := <-channel: |
| 131 |
- status, ok := result.(*kubeapi.Status) |
|
| 131 |
+ status, ok := result.(*kapi.Status) |
|
| 132 | 132 |
if !ok {
|
| 133 | 133 |
t.Errorf("Expected status type, got: %#v", result)
|
| 134 | 134 |
} |
| 135 |
- if status.Status != kubeapi.StatusFailure || status.Message != "test error" {
|
|
| 135 |
+ if status.Status != kapi.StatusFailure || status.Message != "test error" {
|
|
| 136 | 136 |
t.Errorf("Expected failure status, got %#v", status)
|
| 137 | 137 |
} |
| 138 | 138 |
case <-time.After(50 * time.Millisecond): |
| ... | ... |
@@ -144,8 +144,8 @@ func TestCreateImageOK(t *testing.T) {
|
| 144 | 144 |
mockRegistry := test.NewImageRegistry() |
| 145 | 145 |
storage := REST{registry: mockRegistry}
|
| 146 | 146 |
|
| 147 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), &api.Image{
|
|
| 148 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 147 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), &api.Image{
|
|
| 148 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 149 | 149 |
DockerImageReference: "openshift/ruby-19-centos", |
| 150 | 150 |
}) |
| 151 | 151 |
if channel == nil {
|
| ... | ... |
@@ -174,7 +174,7 @@ func TestGetImageError(t *testing.T) {
|
| 174 | 174 |
mockRegistry.Err = fmt.Errorf("bad")
|
| 175 | 175 |
storage := REST{registry: mockRegistry}
|
| 176 | 176 |
|
| 177 |
- image, err := storage.Get(kubeapi.NewDefaultContext(), "foo") |
|
| 177 |
+ image, err := storage.Get(kapi.NewDefaultContext(), "foo") |
|
| 178 | 178 |
if image != nil {
|
| 179 | 179 |
t.Errorf("Unexpected non-nil image: %#v", image)
|
| 180 | 180 |
} |
| ... | ... |
@@ -186,12 +186,12 @@ func TestGetImageError(t *testing.T) {
|
| 186 | 186 |
func TestGetImageOK(t *testing.T) {
|
| 187 | 187 |
mockRegistry := test.NewImageRegistry() |
| 188 | 188 |
mockRegistry.Image = &api.Image{
|
| 189 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 189 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 190 | 190 |
DockerImageReference: "openshift/ruby-19-centos", |
| 191 | 191 |
} |
| 192 | 192 |
storage := REST{registry: mockRegistry}
|
| 193 | 193 |
|
| 194 |
- image, err := storage.Get(kubeapi.NewDefaultContext(), "foo") |
|
| 194 |
+ image, err := storage.Get(kapi.NewDefaultContext(), "foo") |
|
| 195 | 195 |
if image == nil {
|
| 196 | 196 |
t.Error("Unexpected nil image")
|
| 197 | 197 |
} |
| ... | ... |
@@ -205,7 +205,7 @@ func TestGetImageOK(t *testing.T) {
|
| 205 | 205 |
|
| 206 | 206 |
func TestUpdateImage(t *testing.T) {
|
| 207 | 207 |
storage := REST{}
|
| 208 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), &api.Image{})
|
|
| 208 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), &api.Image{})
|
|
| 209 | 209 |
if channel != nil {
|
| 210 | 210 |
t.Errorf("Unexpected non-nil channel: %#v", channel)
|
| 211 | 211 |
} |
| ... | ... |
@@ -220,7 +220,7 @@ func TestUpdateImage(t *testing.T) {
|
| 220 | 220 |
func TestDeleteImage(t *testing.T) {
|
| 221 | 221 |
mockRegistry := test.NewImageRegistry() |
| 222 | 222 |
storage := REST{registry: mockRegistry}
|
| 223 |
- channel, err := storage.Delete(kubeapi.NewDefaultContext(), "foo") |
|
| 223 |
+ channel, err := storage.Delete(kapi.NewDefaultContext(), "foo") |
|
| 224 | 224 |
if channel == nil {
|
| 225 | 225 |
t.Error("Unexpected nil channel")
|
| 226 | 226 |
} |
| ... | ... |
@@ -230,11 +230,11 @@ func TestDeleteImage(t *testing.T) {
|
| 230 | 230 |
|
| 231 | 231 |
select {
|
| 232 | 232 |
case result := <-channel: |
| 233 |
- status, ok := result.(*kubeapi.Status) |
|
| 233 |
+ status, ok := result.(*kapi.Status) |
|
| 234 | 234 |
if !ok {
|
| 235 | 235 |
t.Errorf("Expected status type, got: %#v", result)
|
| 236 | 236 |
} |
| 237 |
- if status.Status != kubeapi.StatusSuccess {
|
|
| 237 |
+ if status.Status != kapi.StatusSuccess {
|
|
| 238 | 238 |
t.Errorf("Expected status=success, got: %#v", status)
|
| 239 | 239 |
} |
| 240 | 240 |
case <-time.After(50 * time.Millisecond): |
| ... | ... |
@@ -245,8 +245,8 @@ func TestDeleteImage(t *testing.T) {
|
| 245 | 245 |
func TestCreateImageConflictingNamespace(t *testing.T) {
|
| 246 | 246 |
storage := REST{}
|
| 247 | 247 |
|
| 248 |
- channel, err := storage.Create(kubeapi.WithNamespace(kubeapi.NewContext(), "legal-name"), &api.Image{
|
|
| 249 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo", Namespace: "some-value"},
|
|
| 248 |
+ channel, err := storage.Create(kapi.WithNamespace(kapi.NewContext(), "legal-name"), &api.Image{
|
|
| 249 |
+ TypeMeta: kapi.TypeMeta{ID: "foo", Namespace: "some-value"},
|
|
| 250 | 250 |
DockerImageReference: "openshift/ruby-19-centos", |
| 251 | 251 |
}) |
| 252 | 252 |
|
| ... | ... |
@@ -262,7 +262,7 @@ func checkExpectedNamespaceError(t *testing.T, err error) {
|
| 262 | 262 |
if err == nil {
|
| 263 | 263 |
t.Errorf("Expected '" + expectedError + "', but we didn't get one")
|
| 264 | 264 |
} else {
|
| 265 |
- e, ok := err.(kubeclient.APIStatus) |
|
| 265 |
+ e, ok := err.(kclient.APIStatus) |
|
| 266 | 266 |
if !ok {
|
| 267 | 267 |
t.Errorf("error was not a statusError: %v", err)
|
| 268 | 268 |
} |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package imagerepository |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
|
| 6 | 6 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| ... | ... |
@@ -11,15 +11,15 @@ import ( |
| 11 | 11 |
// Registry is an interface for things that know how to store ImageRepository objects. |
| 12 | 12 |
type Registry interface {
|
| 13 | 13 |
// ListImageRepositories obtains a list of image repositories that match a selector. |
| 14 |
- ListImageRepositories(ctx kubeapi.Context, selector labels.Selector) (*api.ImageRepositoryList, error) |
|
| 14 |
+ ListImageRepositories(ctx kapi.Context, selector labels.Selector) (*api.ImageRepositoryList, error) |
|
| 15 | 15 |
// GetImageRepository retrieves a specific image repository. |
| 16 |
- GetImageRepository(ctx kubeapi.Context, id string) (*api.ImageRepository, error) |
|
| 16 |
+ GetImageRepository(ctx kapi.Context, id string) (*api.ImageRepository, error) |
|
| 17 | 17 |
// WatchImageRepositories watches for new/changed/deleted image repositories. |
| 18 |
- WatchImageRepositories(ctx kubeapi.Context, resourceVersion string, filter func(repo *api.ImageRepository) bool) (watch.Interface, error) |
|
| 18 |
+ WatchImageRepositories(ctx kapi.Context, resourceVersion string, filter func(repo *api.ImageRepository) bool) (watch.Interface, error) |
|
| 19 | 19 |
// CreateImageRepository creates a new image repository. |
| 20 |
- CreateImageRepository(ctx kubeapi.Context, repo *api.ImageRepository) error |
|
| 20 |
+ CreateImageRepository(ctx kapi.Context, repo *api.ImageRepository) error |
|
| 21 | 21 |
// UpdateImageRepository updates an image repository. |
| 22 |
- UpdateImageRepository(ctx kubeapi.Context, repo *api.ImageRepository) error |
|
| 22 |
+ UpdateImageRepository(ctx kapi.Context, repo *api.ImageRepository) error |
|
| 23 | 23 |
// DeleteImageRepository deletes an image repository. |
| 24 |
- DeleteImageRepository(ctx kubeapi.Context, id string) error |
|
| 24 |
+ DeleteImageRepository(ctx kapi.Context, id string) error |
|
| 25 | 25 |
} |
| ... | ... |
@@ -5,7 +5,7 @@ import ( |
| 5 | 5 |
|
| 6 | 6 |
"code.google.com/p/go-uuid/uuid" |
| 7 | 7 |
|
| 8 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| ... | ... |
@@ -32,7 +32,7 @@ func (s *REST) New() runtime.Object {
|
| 32 | 32 |
} |
| 33 | 33 |
|
| 34 | 34 |
// List retrieves a list of ImageRepositories that match selector. |
| 35 |
-func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 35 |
+func (s *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 36 | 36 |
imageRepositories, err := s.registry.ListImageRepositories(ctx, selector) |
| 37 | 37 |
if err != nil {
|
| 38 | 38 |
return nil, err |
| ... | ... |
@@ -41,7 +41,7 @@ func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runt |
| 41 | 41 |
} |
| 42 | 42 |
|
| 43 | 43 |
// Get retrieves an ImageRepository by id. |
| 44 |
-func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 44 |
+func (s *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 45 | 45 |
repo, err := s.registry.GetImageRepository(ctx, id) |
| 46 | 46 |
if err != nil {
|
| 47 | 47 |
return nil, err |
| ... | ... |
@@ -50,7 +50,7 @@ func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 | 52 |
// Watch begins watching for new, changed, or deleted ImageRepositories. |
| 53 |
-func (s *REST) Watch(ctx kubeapi.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 53 |
+func (s *REST) Watch(ctx kapi.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
|
|
| 54 | 54 |
return s.registry.WatchImageRepositories(ctx, resourceVersion, func(repo *api.ImageRepository) bool {
|
| 55 | 55 |
fields := labels.Set{
|
| 56 | 56 |
"ID": repo.ID, |
| ... | ... |
@@ -61,12 +61,12 @@ func (s *REST) Watch(ctx kubeapi.Context, label, field labels.Selector, resource |
| 61 | 61 |
} |
| 62 | 62 |
|
| 63 | 63 |
// Create registers the given ImageRepository. |
| 64 |
-func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 64 |
+func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 65 | 65 |
repo, ok := obj.(*api.ImageRepository) |
| 66 | 66 |
if !ok {
|
| 67 | 67 |
return nil, fmt.Errorf("not an image repository: %#v", obj)
|
| 68 | 68 |
} |
| 69 |
- if !kubeapi.ValidNamespace(ctx, &repo.TypeMeta) {
|
|
| 69 |
+ if !kapi.ValidNamespace(ctx, &repo.TypeMeta) {
|
|
| 70 | 70 |
return nil, errors.NewConflict("imageRepository", repo.Namespace, fmt.Errorf("ImageRepository.Namespace does not match the provided context"))
|
| 71 | 71 |
} |
| 72 | 72 |
|
| ... | ... |
@@ -89,7 +89,7 @@ func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 89 | 89 |
} |
| 90 | 90 |
|
| 91 | 91 |
// Update replaces an existing ImageRepository in the registry with the given ImageRepository. |
| 92 |
-func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 92 |
+func (s *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 93 | 93 |
repo, ok := obj.(*api.ImageRepository) |
| 94 | 94 |
if !ok {
|
| 95 | 95 |
return nil, fmt.Errorf("not an image repository: %#v", obj)
|
| ... | ... |
@@ -97,7 +97,7 @@ func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 97 | 97 |
if len(repo.ID) == 0 {
|
| 98 | 98 |
return nil, fmt.Errorf("id is unspecified: %#v", repo)
|
| 99 | 99 |
} |
| 100 |
- if !kubeapi.ValidNamespace(ctx, &repo.TypeMeta) {
|
|
| 100 |
+ if !kapi.ValidNamespace(ctx, &repo.TypeMeta) {
|
|
| 101 | 101 |
return nil, errors.NewConflict("imageRepository", repo.Namespace, fmt.Errorf("ImageRepository.Namespace does not match the provided context"))
|
| 102 | 102 |
} |
| 103 | 103 |
|
| ... | ... |
@@ -111,8 +111,8 @@ func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 111 | 111 |
} |
| 112 | 112 |
|
| 113 | 113 |
// Delete asynchronously deletes an ImageRepository specified by its id. |
| 114 |
-func (s *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 114 |
+func (s *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 115 | 115 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| 116 |
- return &kubeapi.Status{Status: kubeapi.StatusSuccess}, s.registry.DeleteImageRepository(ctx, id)
|
|
| 116 |
+ return &kapi.Status{Status: kapi.StatusSuccess}, s.registry.DeleteImageRepository(ctx, id)
|
|
| 117 | 117 |
}), nil |
| 118 | 118 |
} |
| ... | ... |
@@ -7,8 +7,8 @@ import ( |
| 7 | 7 |
"strings" |
| 8 | 8 |
"testing" |
| 9 | 9 |
|
| 10 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 11 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 10 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 11 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 13 | 13 |
"github.com/openshift/origin/pkg/image/api" |
| 14 | 14 |
"github.com/openshift/origin/pkg/image/registry/test" |
| ... | ... |
@@ -19,7 +19,7 @@ func TestGetImageRepositoryError(t *testing.T) {
|
| 19 | 19 |
mockRepositoryRegistry.Err = fmt.Errorf("test error")
|
| 20 | 20 |
storage := REST{registry: mockRepositoryRegistry}
|
| 21 | 21 |
|
| 22 |
- image, err := storage.Get(kubeapi.NewDefaultContext(), "image1") |
|
| 22 |
+ image, err := storage.Get(kapi.NewDefaultContext(), "image1") |
|
| 23 | 23 |
if image != nil {
|
| 24 | 24 |
t.Errorf("Unexpected non-nil image: %#v", image)
|
| 25 | 25 |
} |
| ... | ... |
@@ -31,12 +31,12 @@ func TestGetImageRepositoryError(t *testing.T) {
|
| 31 | 31 |
func TestGetImageRepositoryOK(t *testing.T) {
|
| 32 | 32 |
mockRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 33 | 33 |
mockRepositoryRegistry.ImageRepository = &api.ImageRepository{
|
| 34 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 34 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 35 | 35 |
DockerImageRepository: "openshift/ruby-19-centos", |
| 36 | 36 |
} |
| 37 | 37 |
storage := REST{registry: mockRepositoryRegistry}
|
| 38 | 38 |
|
| 39 |
- repo, err := storage.Get(kubeapi.NewDefaultContext(), "foo") |
|
| 39 |
+ repo, err := storage.Get(kapi.NewDefaultContext(), "foo") |
|
| 40 | 40 |
if repo == nil {
|
| 41 | 41 |
t.Errorf("Unexpected nil repo: %#v", repo)
|
| 42 | 42 |
} |
| ... | ... |
@@ -56,7 +56,7 @@ func TestListImageRepositoriesError(t *testing.T) {
|
| 56 | 56 |
registry: mockRepositoryRegistry, |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 |
- imageRepositories, err := storage.List(kubeapi.NewDefaultContext(), nil, nil) |
|
| 59 |
+ imageRepositories, err := storage.List(kapi.NewDefaultContext(), nil, nil) |
|
| 60 | 60 |
if err != mockRepositoryRegistry.Err {
|
| 61 | 61 |
t.Errorf("Expected %#v, Got %#v", mockRepositoryRegistry.Err, err)
|
| 62 | 62 |
} |
| ... | ... |
@@ -76,7 +76,7 @@ func TestListImageRepositoriesEmptyList(t *testing.T) {
|
| 76 | 76 |
registry: mockRepositoryRegistry, |
| 77 | 77 |
} |
| 78 | 78 |
|
| 79 |
- imageRepositories, err := storage.List(kubeapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 79 |
+ imageRepositories, err := storage.List(kapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 80 | 80 |
if err != nil {
|
| 81 | 81 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 82 | 82 |
} |
| ... | ... |
@@ -91,12 +91,12 @@ func TestListImageRepositoriesPopulatedList(t *testing.T) {
|
| 91 | 91 |
mockRepositoryRegistry.ImageRepositories = &api.ImageRepositoryList{
|
| 92 | 92 |
Items: []api.ImageRepository{
|
| 93 | 93 |
{
|
| 94 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 94 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 95 | 95 |
ID: "foo", |
| 96 | 96 |
}, |
| 97 | 97 |
}, |
| 98 | 98 |
{
|
| 99 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 99 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 100 | 100 |
ID: "bar", |
| 101 | 101 |
}, |
| 102 | 102 |
}, |
| ... | ... |
@@ -107,7 +107,7 @@ func TestListImageRepositoriesPopulatedList(t *testing.T) {
|
| 107 | 107 |
registry: mockRepositoryRegistry, |
| 108 | 108 |
} |
| 109 | 109 |
|
| 110 |
- list, err := storage.List(kubeapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 110 |
+ list, err := storage.List(kapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 111 | 111 |
if err != nil {
|
| 112 | 112 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 113 | 113 |
} |
| ... | ... |
@@ -122,7 +122,7 @@ func TestListImageRepositoriesPopulatedList(t *testing.T) {
|
| 122 | 122 |
func TestCreateImageRepositoryBadObject(t *testing.T) {
|
| 123 | 123 |
storage := REST{}
|
| 124 | 124 |
|
| 125 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), &api.ImageList{})
|
|
| 125 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), &api.ImageList{})
|
|
| 126 | 126 |
if channel != nil {
|
| 127 | 127 |
t.Errorf("Expected nil, got %v", channel)
|
| 128 | 128 |
} |
| ... | ... |
@@ -135,7 +135,7 @@ func TestCreateImageRepositoryOK(t *testing.T) {
|
| 135 | 135 |
mockRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 136 | 136 |
storage := REST{registry: mockRepositoryRegistry}
|
| 137 | 137 |
|
| 138 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), &api.ImageRepository{})
|
|
| 138 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), &api.ImageRepository{})
|
|
| 139 | 139 |
if err != nil {
|
| 140 | 140 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 141 | 141 |
} |
| ... | ... |
@@ -158,16 +158,16 @@ func TestCreateRegistryErrorSaving(t *testing.T) {
|
| 158 | 158 |
mockRepositoryRegistry.Err = fmt.Errorf("foo")
|
| 159 | 159 |
storage := REST{registry: mockRepositoryRegistry}
|
| 160 | 160 |
|
| 161 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), &api.ImageRepository{})
|
|
| 161 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), &api.ImageRepository{})
|
|
| 162 | 162 |
if err != nil {
|
| 163 | 163 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 164 | 164 |
} |
| 165 | 165 |
result := <-channel |
| 166 |
- status, ok := result.(*kubeapi.Status) |
|
| 166 |
+ status, ok := result.(*kapi.Status) |
|
| 167 | 167 |
if !ok {
|
| 168 | 168 |
t.Errorf("Expected status, got %#v", result)
|
| 169 | 169 |
} |
| 170 |
- if status.Status != kubeapi.StatusFailure || status.Message != "foo" {
|
|
| 170 |
+ if status.Status != kapi.StatusFailure || status.Message != "foo" {
|
|
| 171 | 171 |
t.Errorf("Expected status=failure, message=foo, got %#v", status)
|
| 172 | 172 |
} |
| 173 | 173 |
} |
| ... | ... |
@@ -175,7 +175,7 @@ func TestCreateRegistryErrorSaving(t *testing.T) {
|
| 175 | 175 |
func TestUpdateImageRepositoryBadObject(t *testing.T) {
|
| 176 | 176 |
storage := REST{}
|
| 177 | 177 |
|
| 178 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), &api.ImageList{})
|
|
| 178 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), &api.ImageList{})
|
|
| 179 | 179 |
if channel != nil {
|
| 180 | 180 |
t.Errorf("Expected nil, got %v", channel)
|
| 181 | 181 |
} |
| ... | ... |
@@ -187,7 +187,7 @@ func TestUpdateImageRepositoryBadObject(t *testing.T) {
|
| 187 | 187 |
func TestUpdateImageRepositoryMissingID(t *testing.T) {
|
| 188 | 188 |
storage := REST{}
|
| 189 | 189 |
|
| 190 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), &api.ImageRepository{})
|
|
| 190 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), &api.ImageRepository{})
|
|
| 191 | 191 |
if channel != nil {
|
| 192 | 192 |
t.Errorf("Expected nil, got %v", channel)
|
| 193 | 193 |
} |
| ... | ... |
@@ -201,18 +201,18 @@ func TestUpdateRegistryErrorSaving(t *testing.T) {
|
| 201 | 201 |
mockRepositoryRegistry.Err = fmt.Errorf("foo")
|
| 202 | 202 |
storage := REST{registry: mockRepositoryRegistry}
|
| 203 | 203 |
|
| 204 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), &api.ImageRepository{
|
|
| 205 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar"},
|
|
| 204 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), &api.ImageRepository{
|
|
| 205 |
+ TypeMeta: kapi.TypeMeta{ID: "bar"},
|
|
| 206 | 206 |
}) |
| 207 | 207 |
if err != nil {
|
| 208 | 208 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 209 | 209 |
} |
| 210 | 210 |
result := <-channel |
| 211 |
- status, ok := result.(*kubeapi.Status) |
|
| 211 |
+ status, ok := result.(*kapi.Status) |
|
| 212 | 212 |
if !ok {
|
| 213 | 213 |
t.Errorf("Expected status, got %#v", result)
|
| 214 | 214 |
} |
| 215 |
- if status.Status != kubeapi.StatusFailure || status.Message != "foo" {
|
|
| 215 |
+ if status.Status != kapi.StatusFailure || status.Message != "foo" {
|
|
| 216 | 216 |
t.Errorf("Expected status=failure, message=foo, got %#v", status)
|
| 217 | 217 |
} |
| 218 | 218 |
} |
| ... | ... |
@@ -221,8 +221,8 @@ func TestUpdateImageRepositoryOK(t *testing.T) {
|
| 221 | 221 |
mockRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 222 | 222 |
storage := REST{registry: mockRepositoryRegistry}
|
| 223 | 223 |
|
| 224 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), &api.ImageRepository{
|
|
| 225 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar"},
|
|
| 224 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), &api.ImageRepository{
|
|
| 225 |
+ TypeMeta: kapi.TypeMeta{ID: "bar"},
|
|
| 226 | 226 |
}) |
| 227 | 227 |
if err != nil {
|
| 228 | 228 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| ... | ... |
@@ -241,16 +241,16 @@ func TestDeleteImageRepository(t *testing.T) {
|
| 241 | 241 |
mockRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 242 | 242 |
storage := REST{registry: mockRepositoryRegistry}
|
| 243 | 243 |
|
| 244 |
- channel, err := storage.Delete(kubeapi.NewDefaultContext(), "foo") |
|
| 244 |
+ channel, err := storage.Delete(kapi.NewDefaultContext(), "foo") |
|
| 245 | 245 |
if err != nil {
|
| 246 | 246 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 247 | 247 |
} |
| 248 | 248 |
result := <-channel |
| 249 |
- status, ok := result.(*kubeapi.Status) |
|
| 249 |
+ status, ok := result.(*kapi.Status) |
|
| 250 | 250 |
if !ok {
|
| 251 | 251 |
t.Errorf("Expected status, got %#v", result)
|
| 252 | 252 |
} |
| 253 |
- if status.Status != kubeapi.StatusSuccess {
|
|
| 253 |
+ if status.Status != kapi.StatusSuccess {
|
|
| 254 | 254 |
t.Errorf("Expected status=success, got %#v", status)
|
| 255 | 255 |
} |
| 256 | 256 |
} |
| ... | ... |
@@ -258,8 +258,8 @@ func TestDeleteImageRepository(t *testing.T) {
|
| 258 | 258 |
func TestCreateImageRepositoryConflictingNamespace(t *testing.T) {
|
| 259 | 259 |
storage := REST{}
|
| 260 | 260 |
|
| 261 |
- channel, err := storage.Create(kubeapi.WithNamespace(kubeapi.NewContext(), "legal-name"), &api.ImageRepository{
|
|
| 262 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar", Namespace: "some-value"},
|
|
| 261 |
+ channel, err := storage.Create(kapi.WithNamespace(kapi.NewContext(), "legal-name"), &api.ImageRepository{
|
|
| 262 |
+ TypeMeta: kapi.TypeMeta{ID: "bar", Namespace: "some-value"},
|
|
| 263 | 263 |
}) |
| 264 | 264 |
|
| 265 | 265 |
if channel != nil {
|
| ... | ... |
@@ -273,8 +273,8 @@ func TestUpdateImageRepositoryConflictingNamespace(t *testing.T) {
|
| 273 | 273 |
mockRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 274 | 274 |
storage := REST{registry: mockRepositoryRegistry}
|
| 275 | 275 |
|
| 276 |
- channel, err := storage.Update(kubeapi.WithNamespace(kubeapi.NewContext(), "legal-name"), &api.ImageRepository{
|
|
| 277 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar", Namespace: "some-value"},
|
|
| 276 |
+ channel, err := storage.Update(kapi.WithNamespace(kapi.NewContext(), "legal-name"), &api.ImageRepository{
|
|
| 277 |
+ TypeMeta: kapi.TypeMeta{ID: "bar", Namespace: "some-value"},
|
|
| 278 | 278 |
}) |
| 279 | 279 |
|
| 280 | 280 |
if channel != nil {
|
| ... | ... |
@@ -289,7 +289,7 @@ func checkExpectedNamespaceError(t *testing.T, err error) {
|
| 289 | 289 |
if err == nil {
|
| 290 | 290 |
t.Errorf("Expected '" + expectedError + "', but we didn't get one")
|
| 291 | 291 |
} else {
|
| 292 |
- e, ok := err.(kubeclient.APIStatus) |
|
| 292 |
+ e, ok := err.(kclient.APIStatus) |
|
| 293 | 293 |
if !ok {
|
| 294 | 294 |
t.Errorf("error was not a statusError: %v", err)
|
| 295 | 295 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package imagerepositorymapping |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| ... | ... |
@@ -34,22 +34,22 @@ func (s *REST) New() runtime.Object {
|
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 | 36 |
// List is not supported. |
| 37 |
-func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 37 |
+func (s *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 38 | 38 |
return nil, errors.NewNotFound("imageRepositoryMapping", "list")
|
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 | 41 |
// Get is not supported. |
| 42 |
-func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 42 |
+func (s *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 43 | 43 |
return nil, errors.NewNotFound("imageRepositoryMapping", id)
|
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
// Create registers a new image (if it doesn't exist) and updates the specified ImageRepository's tags. |
| 47 |
-func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 47 |
+func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 48 | 48 |
mapping, ok := obj.(*api.ImageRepositoryMapping) |
| 49 | 49 |
if !ok {
|
| 50 | 50 |
return nil, fmt.Errorf("not an image repository mapping: %#v", obj)
|
| 51 | 51 |
} |
| 52 |
- if !kubeapi.ValidNamespace(ctx, &mapping.TypeMeta) {
|
|
| 52 |
+ if !kapi.ValidNamespace(ctx, &mapping.TypeMeta) {
|
|
| 53 | 53 |
return nil, errors.NewConflict("imageRepositoryMapping", mapping.Namespace, fmt.Errorf("ImageRepositoryMapping.Namespace does not match the provided context"))
|
| 54 | 54 |
} |
| 55 | 55 |
|
| ... | ... |
@@ -92,12 +92,12 @@ func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 92 | 92 |
return nil, err |
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 |
- return &kubeapi.Status{Status: kubeapi.StatusSuccess}, nil
|
|
| 95 |
+ return &kapi.Status{Status: kapi.StatusSuccess}, nil
|
|
| 96 | 96 |
}), nil |
| 97 | 97 |
} |
| 98 | 98 |
|
| 99 | 99 |
// findImageRepository retrieves an ImageRepository whose DockerImageRepository matches dockerRepo. |
| 100 |
-func (s *REST) findImageRepository(ctx kubeapi.Context, dockerRepo string) (*api.ImageRepository, error) {
|
|
| 100 |
+func (s *REST) findImageRepository(ctx kapi.Context, dockerRepo string) (*api.ImageRepository, error) {
|
|
| 101 | 101 |
//TODO make this more efficient |
| 102 | 102 |
// you should not do this, but we have a bug right now that prevents us from trusting the ctx passed in |
| 103 | 103 |
allNamespaces := kapi.NewContext() |
| ... | ... |
@@ -118,11 +118,11 @@ func (s *REST) findImageRepository(ctx kubeapi.Context, dockerRepo string) (*api |
| 118 | 118 |
} |
| 119 | 119 |
|
| 120 | 120 |
// Update is not supported. |
| 121 |
-func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 121 |
+func (s *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 122 | 122 |
return nil, fmt.Errorf("ImageRepositoryMappings may not be changed.")
|
| 123 | 123 |
} |
| 124 | 124 |
|
| 125 | 125 |
// Delete is not supported. |
| 126 |
-func (s *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 126 |
+func (s *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 127 | 127 |
return nil, errors.NewNotFound("imageRepositoryMapping", id)
|
| 128 | 128 |
} |
| ... | ... |
@@ -7,9 +7,9 @@ import ( |
| 7 | 7 |
"strings" |
| 8 | 8 |
"testing" |
| 9 | 9 |
|
| 10 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 10 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 12 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 12 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 14 | 14 |
"github.com/fsouza/go-dockerclient" |
| 15 | 15 |
|
| ... | ... |
@@ -22,7 +22,7 @@ func TestGetImageRepositoryMapping(t *testing.T) {
|
| 22 | 22 |
imageRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 23 | 23 |
storage := &REST{imageRegistry, imageRepositoryRegistry}
|
| 24 | 24 |
|
| 25 |
- obj, err := storage.Get(kubeapi.NewDefaultContext(), "foo") |
|
| 25 |
+ obj, err := storage.Get(kapi.NewDefaultContext(), "foo") |
|
| 26 | 26 |
if obj != nil {
|
| 27 | 27 |
t.Errorf("Unexpected non-nil object %#v", obj)
|
| 28 | 28 |
} |
| ... | ... |
@@ -39,7 +39,7 @@ func TestListImageRepositoryMappings(t *testing.T) {
|
| 39 | 39 |
imageRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 40 | 40 |
storage := &REST{imageRegistry, imageRepositoryRegistry}
|
| 41 | 41 |
|
| 42 |
- list, err := storage.List(kubeapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 42 |
+ list, err := storage.List(kapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 43 | 43 |
if list != nil {
|
| 44 | 44 |
t.Errorf("Unexpected non-nil list %#v", list)
|
| 45 | 45 |
} |
| ... | ... |
@@ -56,7 +56,7 @@ func TestDeleteImageRepositoryMapping(t *testing.T) {
|
| 56 | 56 |
imageRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 57 | 57 |
storage := &REST{imageRegistry, imageRepositoryRegistry}
|
| 58 | 58 |
|
| 59 |
- channel, err := storage.Delete(kubeapi.NewDefaultContext(), "repo1") |
|
| 59 |
+ channel, err := storage.Delete(kapi.NewDefaultContext(), "repo1") |
|
| 60 | 60 |
if channel != nil {
|
| 61 | 61 |
t.Errorf("Unexpected non-nil channel %#v", channel)
|
| 62 | 62 |
} |
| ... | ... |
@@ -73,7 +73,7 @@ func TestUpdateImageRepositoryMapping(t *testing.T) {
|
| 73 | 73 |
imageRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 74 | 74 |
storage := &REST{imageRegistry, imageRepositoryRegistry}
|
| 75 | 75 |
|
| 76 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), &api.ImageList{})
|
|
| 76 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), &api.ImageList{})
|
|
| 77 | 77 |
if channel != nil {
|
| 78 | 78 |
t.Errorf("Unexpected non-nil channel %#v", channel)
|
| 79 | 79 |
} |
| ... | ... |
@@ -90,7 +90,7 @@ func TestCreateImageRepositoryMappingBadObject(t *testing.T) {
|
| 90 | 90 |
imageRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 91 | 91 |
storage := &REST{imageRegistry, imageRepositoryRegistry}
|
| 92 | 92 |
|
| 93 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), &api.ImageList{})
|
|
| 93 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), &api.ImageList{})
|
|
| 94 | 94 |
if channel != nil {
|
| 95 | 95 |
t.Errorf("Unexpected non-nil channel %#v", channel)
|
| 96 | 96 |
} |
| ... | ... |
@@ -111,7 +111,7 @@ func TestCreateImageRepositoryMappingFindError(t *testing.T) {
|
| 111 | 111 |
mapping := api.ImageRepositoryMapping{
|
| 112 | 112 |
DockerImageRepository: "localhost:5000/someproject/somerepo", |
| 113 | 113 |
Image: api.Image{
|
| 114 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 114 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 115 | 115 |
ID: "imageID1", |
| 116 | 116 |
}, |
| 117 | 117 |
DockerImageReference: "localhost:5000/someproject/somerepo:imageID1", |
| ... | ... |
@@ -119,7 +119,7 @@ func TestCreateImageRepositoryMappingFindError(t *testing.T) {
|
| 119 | 119 |
Tag: "latest", |
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), &mapping) |
|
| 122 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), &mapping) |
|
| 123 | 123 |
if channel != nil {
|
| 124 | 124 |
t.Errorf("Unexpected non-nil channel %#v", channel)
|
| 125 | 125 |
} |
| ... | ... |
@@ -137,7 +137,7 @@ func TestCreateImageRepositoryMappingNotFound(t *testing.T) {
|
| 137 | 137 |
imageRepositoryRegistry.ImageRepositories = &api.ImageRepositoryList{
|
| 138 | 138 |
Items: []api.ImageRepository{
|
| 139 | 139 |
{
|
| 140 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 140 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 141 | 141 |
ID: "repo1", |
| 142 | 142 |
}, |
| 143 | 143 |
DockerImageRepository: "localhost:5000/test/repo", |
| ... | ... |
@@ -149,7 +149,7 @@ func TestCreateImageRepositoryMappingNotFound(t *testing.T) {
|
| 149 | 149 |
mapping := api.ImageRepositoryMapping{
|
| 150 | 150 |
DockerImageRepository: "localhost:5000/someproject/somerepo", |
| 151 | 151 |
Image: api.Image{
|
| 152 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 152 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 153 | 153 |
ID: "imageID1", |
| 154 | 154 |
}, |
| 155 | 155 |
DockerImageReference: "localhost:5000/someproject/somerepo:imageID1", |
| ... | ... |
@@ -157,7 +157,7 @@ func TestCreateImageRepositoryMappingNotFound(t *testing.T) {
|
| 157 | 157 |
Tag: "latest", |
| 158 | 158 |
} |
| 159 | 159 |
|
| 160 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), &mapping) |
|
| 160 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), &mapping) |
|
| 161 | 161 |
if channel != nil {
|
| 162 | 162 |
t.Errorf("Unexpected non-nil channel %#v", channel)
|
| 163 | 163 |
} |
| ... | ... |
@@ -175,7 +175,7 @@ func TestCreateImageRepositoryMapping(t *testing.T) {
|
| 175 | 175 |
imageRepositoryRegistry.ImageRepositories = &api.ImageRepositoryList{
|
| 176 | 176 |
Items: []api.ImageRepository{
|
| 177 | 177 |
{
|
| 178 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 178 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 179 | 179 |
ID: "repo1", |
| 180 | 180 |
}, |
| 181 | 181 |
DockerImageRepository: "localhost:5000/someproject/somerepo", |
| ... | ... |
@@ -187,7 +187,7 @@ func TestCreateImageRepositoryMapping(t *testing.T) {
|
| 187 | 187 |
mapping := api.ImageRepositoryMapping{
|
| 188 | 188 |
DockerImageRepository: "localhost:5000/someproject/somerepo", |
| 189 | 189 |
Image: api.Image{
|
| 190 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 190 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 191 | 191 |
ID: "imageID1", |
| 192 | 192 |
}, |
| 193 | 193 |
DockerImageReference: "localhost:5000/someproject/somerepo:imageID1", |
| ... | ... |
@@ -204,7 +204,7 @@ func TestCreateImageRepositoryMapping(t *testing.T) {
|
| 204 | 204 |
}, |
| 205 | 205 |
Tag: "latest", |
| 206 | 206 |
} |
| 207 |
- ch, err := storage.Create(kubeapi.NewDefaultContext(), &mapping) |
|
| 207 |
+ ch, err := storage.Create(kapi.NewDefaultContext(), &mapping) |
|
| 208 | 208 |
if err != nil {
|
| 209 | 209 |
t.Errorf("Unexpected error creating mapping: %#v", err)
|
| 210 | 210 |
} |
| ... | ... |
@@ -212,7 +212,7 @@ func TestCreateImageRepositoryMapping(t *testing.T) {
|
| 212 | 212 |
out := <-ch |
| 213 | 213 |
t.Logf("out = '%#v'", out)
|
| 214 | 214 |
|
| 215 |
- image, err := imageRegistry.GetImage(kubeapi.NewDefaultContext(), "imageID1") |
|
| 215 |
+ image, err := imageRegistry.GetImage(kapi.NewDefaultContext(), "imageID1") |
|
| 216 | 216 |
if err != nil {
|
| 217 | 217 |
t.Errorf("Unexpected error retrieving image: %#v", err)
|
| 218 | 218 |
} |
| ... | ... |
@@ -223,7 +223,7 @@ func TestCreateImageRepositoryMapping(t *testing.T) {
|
| 223 | 223 |
t.Errorf("Expected %#v, got %#v", mapping.Image, image)
|
| 224 | 224 |
} |
| 225 | 225 |
|
| 226 |
- repo, err := imageRepositoryRegistry.GetImageRepository(kubeapi.NewDefaultContext(), "repo1") |
|
| 226 |
+ repo, err := imageRepositoryRegistry.GetImageRepository(kapi.NewDefaultContext(), "repo1") |
|
| 227 | 227 |
if err != nil {
|
| 228 | 228 |
t.Errorf("Unexpected non-nil err: %#v", err)
|
| 229 | 229 |
} |
| ... | ... |
@@ -238,7 +238,7 @@ func TestCreateImageRepositoryConflictingNamespace(t *testing.T) {
|
| 238 | 238 |
imageRepositoryRegistry.ImageRepositories = &api.ImageRepositoryList{
|
| 239 | 239 |
Items: []api.ImageRepository{
|
| 240 | 240 |
{
|
| 241 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 241 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 242 | 242 |
ID: "repo1", |
| 243 | 243 |
}, |
| 244 | 244 |
DockerImageRepository: "localhost:5000/someproject/somerepo", |
| ... | ... |
@@ -248,12 +248,12 @@ func TestCreateImageRepositoryConflictingNamespace(t *testing.T) {
|
| 248 | 248 |
storage := &REST{imageRegistry, imageRepositoryRegistry}
|
| 249 | 249 |
|
| 250 | 250 |
mapping := api.ImageRepositoryMapping{
|
| 251 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 251 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 252 | 252 |
Namespace: "some-value", |
| 253 | 253 |
}, |
| 254 | 254 |
DockerImageRepository: "localhost:5000/someproject/somerepo", |
| 255 | 255 |
Image: api.Image{
|
| 256 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 256 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 257 | 257 |
ID: "imageID1", |
| 258 | 258 |
}, |
| 259 | 259 |
DockerImageReference: "localhost:5000/someproject/somerepo:imageID1", |
| ... | ... |
@@ -271,7 +271,7 @@ func TestCreateImageRepositoryConflictingNamespace(t *testing.T) {
|
| 271 | 271 |
Tag: "latest", |
| 272 | 272 |
} |
| 273 | 273 |
|
| 274 |
- ch, err := storage.Create(kubeapi.WithNamespace(kubeapi.NewContext(), "legal-name"), &mapping) |
|
| 274 |
+ ch, err := storage.Create(kapi.WithNamespace(kapi.NewContext(), "legal-name"), &mapping) |
|
| 275 | 275 |
if ch != nil {
|
| 276 | 276 |
t.Error("Expected a nil channel, but we got a value")
|
| 277 | 277 |
} |
| ... | ... |
@@ -283,7 +283,7 @@ func checkExpectedNamespaceError(t *testing.T, err error) {
|
| 283 | 283 |
if err == nil {
|
| 284 | 284 |
t.Errorf("Expected '" + expectedError + "', but we didn't get one")
|
| 285 | 285 |
} else {
|
| 286 |
- e, ok := err.(kubeclient.APIStatus) |
|
| 286 |
+ e, ok := err.(kclient.APIStatus) |
|
| 287 | 287 |
if !ok {
|
| 288 | 288 |
t.Errorf("error was not a statusError: %v", err)
|
| 289 | 289 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package test |
| 3 | 3 |
import ( |
| 4 | 4 |
"sync" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 8 | 8 |
"github.com/openshift/origin/pkg/image/api" |
| 9 | 9 |
) |
| ... | ... |
@@ -19,21 +19,21 @@ func NewImageRegistry() *ImageRegistry {
|
| 19 | 19 |
return &ImageRegistry{}
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
-func (r *ImageRegistry) ListImages(ctx kubeapi.Context, selector labels.Selector) (*api.ImageList, error) {
|
|
| 22 |
+func (r *ImageRegistry) ListImages(ctx kapi.Context, selector labels.Selector) (*api.ImageList, error) {
|
|
| 23 | 23 |
r.Lock() |
| 24 | 24 |
defer r.Unlock() |
| 25 | 25 |
|
| 26 | 26 |
return r.Images, r.Err |
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 |
-func (r *ImageRegistry) GetImage(ctx kubeapi.Context, id string) (*api.Image, error) {
|
|
| 29 |
+func (r *ImageRegistry) GetImage(ctx kapi.Context, id string) (*api.Image, error) {
|
|
| 30 | 30 |
r.Lock() |
| 31 | 31 |
defer r.Unlock() |
| 32 | 32 |
|
| 33 | 33 |
return r.Image, r.Err |
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 |
-func (r *ImageRegistry) CreateImage(ctx kubeapi.Context, image *api.Image) error {
|
|
| 36 |
+func (r *ImageRegistry) CreateImage(ctx kapi.Context, image *api.Image) error {
|
|
| 37 | 37 |
r.Lock() |
| 38 | 38 |
defer r.Unlock() |
| 39 | 39 |
|
| ... | ... |
@@ -41,7 +41,7 @@ func (r *ImageRegistry) CreateImage(ctx kubeapi.Context, image *api.Image) error |
| 41 | 41 |
return r.Err |
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 |
-func (r *ImageRegistry) UpdateImage(ctx kubeapi.Context, image *api.Image) error {
|
|
| 44 |
+func (r *ImageRegistry) UpdateImage(ctx kapi.Context, image *api.Image) error {
|
|
| 45 | 45 |
r.Lock() |
| 46 | 46 |
defer r.Unlock() |
| 47 | 47 |
|
| ... | ... |
@@ -49,7 +49,7 @@ func (r *ImageRegistry) UpdateImage(ctx kubeapi.Context, image *api.Image) error |
| 49 | 49 |
return r.Err |
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 |
-func (r *ImageRegistry) DeleteImage(ctx kubeapi.Context, id string) error {
|
|
| 52 |
+func (r *ImageRegistry) DeleteImage(ctx kapi.Context, id string) error {
|
|
| 53 | 53 |
r.Lock() |
| 54 | 54 |
defer r.Unlock() |
| 55 | 55 |
|
| ... | ... |
@@ -3,7 +3,7 @@ package test |
| 3 | 3 |
import ( |
| 4 | 4 |
"sync" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
|
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| ... | ... |
@@ -21,25 +21,25 @@ func NewImageRepositoryRegistry() *ImageRepositoryRegistry {
|
| 21 | 21 |
return &ImageRepositoryRegistry{}
|
| 22 | 22 |
} |
| 23 | 23 |
|
| 24 |
-func (r *ImageRepositoryRegistry) ListImageRepositories(ctx kubeapi.Context, selector labels.Selector) (*api.ImageRepositoryList, error) {
|
|
| 24 |
+func (r *ImageRepositoryRegistry) ListImageRepositories(ctx kapi.Context, selector labels.Selector) (*api.ImageRepositoryList, error) {
|
|
| 25 | 25 |
r.Lock() |
| 26 | 26 |
defer r.Unlock() |
| 27 | 27 |
|
| 28 | 28 |
return r.ImageRepositories, r.Err |
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 |
-func (r *ImageRepositoryRegistry) GetImageRepository(ctx kubeapi.Context, id string) (*api.ImageRepository, error) {
|
|
| 31 |
+func (r *ImageRepositoryRegistry) GetImageRepository(ctx kapi.Context, id string) (*api.ImageRepository, error) {
|
|
| 32 | 32 |
r.Lock() |
| 33 | 33 |
defer r.Unlock() |
| 34 | 34 |
|
| 35 | 35 |
return r.ImageRepository, r.Err |
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 |
-func (r *ImageRepositoryRegistry) WatchImageRepositories(ctx kubeapi.Context, resourceVersion string, filter func(repo *api.ImageRepository) bool) (watch.Interface, error) {
|
|
| 38 |
+func (r *ImageRepositoryRegistry) WatchImageRepositories(ctx kapi.Context, resourceVersion string, filter func(repo *api.ImageRepository) bool) (watch.Interface, error) {
|
|
| 39 | 39 |
return nil, r.Err |
| 40 | 40 |
} |
| 41 | 41 |
|
| 42 |
-func (r *ImageRepositoryRegistry) CreateImageRepository(ctx kubeapi.Context, repo *api.ImageRepository) error {
|
|
| 42 |
+func (r *ImageRepositoryRegistry) CreateImageRepository(ctx kapi.Context, repo *api.ImageRepository) error {
|
|
| 43 | 43 |
r.Lock() |
| 44 | 44 |
defer r.Unlock() |
| 45 | 45 |
|
| ... | ... |
@@ -47,7 +47,7 @@ func (r *ImageRepositoryRegistry) CreateImageRepository(ctx kubeapi.Context, rep |
| 47 | 47 |
return r.Err |
| 48 | 48 |
} |
| 49 | 49 |
|
| 50 |
-func (r *ImageRepositoryRegistry) UpdateImageRepository(ctx kubeapi.Context, repo *api.ImageRepository) error {
|
|
| 50 |
+func (r *ImageRepositoryRegistry) UpdateImageRepository(ctx kapi.Context, repo *api.ImageRepository) error {
|
|
| 51 | 51 |
r.Lock() |
| 52 | 52 |
defer r.Unlock() |
| 53 | 53 |
|
| ... | ... |
@@ -55,7 +55,7 @@ func (r *ImageRepositoryRegistry) UpdateImageRepository(ctx kubeapi.Context, rep |
| 55 | 55 |
return r.Err |
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 |
-func (r *ImageRepositoryRegistry) DeleteImageRepository(ctx kubeapi.Context, id string) error {
|
|
| 58 |
+func (r *ImageRepositoryRegistry) DeleteImageRepository(ctx kapi.Context, id string) error {
|
|
| 59 | 59 |
r.Lock() |
| 60 | 60 |
defer r.Unlock() |
| 61 | 61 |
|
| ... | ... |
@@ -3,7 +3,7 @@ package accesstoken |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -28,7 +28,7 @@ func (s *REST) New() runtime.Object {
|
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 | 30 |
// Get retrieves an AccessToken by id. |
| 31 |
-func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 31 |
+func (s *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 32 | 32 |
token, err := s.registry.GetAccessToken(id) |
| 33 | 33 |
if err != nil {
|
| 34 | 34 |
return nil, err |
| ... | ... |
@@ -37,7 +37,7 @@ func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
// List retrieves a list of AccessTokens that match selector. |
| 40 |
-func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 40 |
+func (s *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 41 | 41 |
tokens, err := s.registry.ListAccessTokens(selector) |
| 42 | 42 |
if err != nil {
|
| 43 | 43 |
return nil, err |
| ... | ... |
@@ -47,7 +47,7 @@ func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runt |
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 | 49 |
// Create registers the given AccessToken. |
| 50 |
-func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 50 |
+func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 51 | 51 |
token, ok := obj.(*api.AccessToken) |
| 52 | 52 |
if !ok {
|
| 53 | 53 |
return nil, fmt.Errorf("not an token: %#v", obj)
|
| ... | ... |
@@ -68,13 +68,13 @@ func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 | 70 |
// Update is not supported for AccessTokens, as they are immutable. |
| 71 |
-func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 71 |
+func (s *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 72 | 72 |
return nil, fmt.Errorf("AccessTokens may not be changed.")
|
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 | 75 |
// Delete asynchronously deletes an AccessToken specified by its id. |
| 76 |
-func (s *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 76 |
+func (s *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 77 | 77 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| 78 |
- return &kubeapi.Status{Status: kubeapi.StatusSuccess}, s.registry.DeleteAccessToken(id)
|
|
| 78 |
+ return &kapi.Status{Status: kapi.StatusSuccess}, s.registry.DeleteAccessToken(id)
|
|
| 79 | 79 |
}), nil |
| 80 | 80 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package authorizetoken |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -29,7 +29,7 @@ func (s *REST) New() runtime.Object {
|
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 | 31 |
// Get retrieves an AuthorizeToken by id. |
| 32 |
-func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 32 |
+func (s *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 33 | 33 |
token, err := s.registry.GetAuthorizeToken(id) |
| 34 | 34 |
if err != nil {
|
| 35 | 35 |
return nil, err |
| ... | ... |
@@ -38,7 +38,7 @@ func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
| 38 | 38 |
} |
| 39 | 39 |
|
| 40 | 40 |
// List retrieves a list of AuthorizeTokens that match selector. |
| 41 |
-func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 41 |
+func (s *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 42 | 42 |
tokens, err := s.registry.ListAuthorizeTokens(selector) |
| 43 | 43 |
if err != nil {
|
| 44 | 44 |
return nil, err |
| ... | ... |
@@ -48,7 +48,7 @@ func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runt |
| 48 | 48 |
} |
| 49 | 49 |
|
| 50 | 50 |
// Create registers the given AuthorizeToken. |
| 51 |
-func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 51 |
+func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 52 | 52 |
token, ok := obj.(*api.AuthorizeToken) |
| 53 | 53 |
if !ok {
|
| 54 | 54 |
return nil, fmt.Errorf("not an token: %#v", obj)
|
| ... | ... |
@@ -69,13 +69,13 @@ func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 | 71 |
// Update is not supported for AuthorizeTokens, as they are immutable. |
| 72 |
-func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 72 |
+func (s *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 73 | 73 |
return nil, fmt.Errorf("AuthorizeTokens may not be changed.")
|
| 74 | 74 |
} |
| 75 | 75 |
|
| 76 | 76 |
// Delete asynchronously deletes an AuthorizeToken specified by its id. |
| 77 |
-func (s *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 77 |
+func (s *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 78 | 78 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| 79 |
- return &kubeapi.Status{Status: kubeapi.StatusSuccess}, s.registry.DeleteAuthorizeToken(id)
|
|
| 79 |
+ return &kapi.Status{Status: kapi.StatusSuccess}, s.registry.DeleteAuthorizeToken(id)
|
|
| 80 | 80 |
}), nil |
| 81 | 81 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package client |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -29,7 +29,7 @@ func (s *REST) New() runtime.Object {
|
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 | 31 |
// Get retrieves an Client by id. |
| 32 |
-func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 32 |
+func (s *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 33 | 33 |
client, err := s.registry.GetClient(id) |
| 34 | 34 |
if err != nil {
|
| 35 | 35 |
return nil, err |
| ... | ... |
@@ -38,7 +38,7 @@ func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
| 38 | 38 |
} |
| 39 | 39 |
|
| 40 | 40 |
// List retrieves a list of Clients that match selector. |
| 41 |
-func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 41 |
+func (s *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 42 | 42 |
clients, err := s.registry.ListClients(selector) |
| 43 | 43 |
if err != nil {
|
| 44 | 44 |
return nil, err |
| ... | ... |
@@ -48,7 +48,7 @@ func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runt |
| 48 | 48 |
} |
| 49 | 49 |
|
| 50 | 50 |
// Create registers the given Client. |
| 51 |
-func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 51 |
+func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 52 | 52 |
client, ok := obj.(*api.Client) |
| 53 | 53 |
if !ok {
|
| 54 | 54 |
return nil, fmt.Errorf("not an client: %#v", obj)
|
| ... | ... |
@@ -69,13 +69,13 @@ func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 | 71 |
// Update is not supported for Clients, as they are immutable. |
| 72 |
-func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 72 |
+func (s *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 73 | 73 |
return nil, fmt.Errorf("Clients may not be changed.")
|
| 74 | 74 |
} |
| 75 | 75 |
|
| 76 | 76 |
// Delete asynchronously deletes an Client specified by its id. |
| 77 |
-func (s *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 77 |
+func (s *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 78 | 78 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| 79 |
- return &kubeapi.Status{Status: kubeapi.StatusSuccess}, s.registry.DeleteClient(id)
|
|
| 79 |
+ return &kapi.Status{Status: kapi.StatusSuccess}, s.registry.DeleteClient(id)
|
|
| 80 | 80 |
}), nil |
| 81 | 81 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package clientauthorization |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -28,7 +28,7 @@ func (s *REST) New() runtime.Object {
|
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 | 30 |
// Get retrieves an ClientAuthorization by id. |
| 31 |
-func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 31 |
+func (s *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 32 | 32 |
authorization, err := s.registry.GetClientAuthorization(id) |
| 33 | 33 |
if err != nil {
|
| 34 | 34 |
return nil, err |
| ... | ... |
@@ -37,12 +37,12 @@ func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
// List retrieves a list of ClientAuthorizations that match selector. |
| 40 |
-func (s *REST) List(ctx kubeapi.Context, label, fields labels.Selector) (runtime.Object, error) {
|
|
| 40 |
+func (s *REST) List(ctx kapi.Context, label, fields labels.Selector) (runtime.Object, error) {
|
|
| 41 | 41 |
return s.registry.ListClientAuthorizations(label, labels.Everything()) |
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 | 44 |
// Create registers the given ClientAuthorization. |
| 45 |
-func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 45 |
+func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 46 | 46 |
authorization, ok := obj.(*api.ClientAuthorization) |
| 47 | 47 |
if !ok {
|
| 48 | 48 |
return nil, fmt.Errorf("not an authorization: %#v", obj)
|
| ... | ... |
@@ -68,13 +68,13 @@ func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 | 70 |
// Update modifies an existing client authorization |
| 71 |
-func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 71 |
+func (s *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 72 | 72 |
return s.Create(ctx, obj) |
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 | 75 |
// Delete asynchronously deletes an ClientAuthorization specified by its id. |
| 76 |
-func (s *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 76 |
+func (s *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 77 | 77 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| 78 |
- return &kubeapi.Status{Status: kubeapi.StatusSuccess}, s.registry.DeleteClientAuthorization(id)
|
|
| 78 |
+ return &kapi.Status{Status: kapi.StatusSuccess}, s.registry.DeleteClientAuthorization(id)
|
|
| 79 | 79 |
}), nil |
| 80 | 80 |
} |
| ... | ... |
@@ -1,18 +1,18 @@ |
| 1 | 1 |
package api |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
) |
| 6 | 6 |
|
| 7 | 7 |
// ProjectList is a list of Project objects. |
| 8 | 8 |
type ProjectList struct {
|
| 9 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 9 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 10 | 10 |
Items []Project `json:"items,omitempty" yaml:"items,omitempty"` |
| 11 | 11 |
} |
| 12 | 12 |
|
| 13 | 13 |
// Project is a logical top-level container for a set of origin resources |
| 14 | 14 |
type Project struct {
|
| 15 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 15 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 16 | 16 |
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` |
| 17 | 17 |
DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` |
| 18 | 18 |
Description string `json:"description,omitempty" yaml:"description,omitempty"` |
| ... | ... |
@@ -1,18 +1,18 @@ |
| 1 | 1 |
package v1beta1 |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
) |
| 6 | 6 |
|
| 7 | 7 |
// ProjectList is a list of Project objects. |
| 8 | 8 |
type ProjectList struct {
|
| 9 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 9 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 10 | 10 |
Items []Project `json:"items,omitempty" yaml:"items,omitempty"` |
| 11 | 11 |
} |
| 12 | 12 |
|
| 13 | 13 |
// Project is a logical top-level container for a set of origin resources |
| 14 | 14 |
type Project struct {
|
| 15 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 15 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 16 | 16 |
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` |
| 17 | 17 |
DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` |
| 18 | 18 |
Description string `json:"description,omitempty" yaml:"description,omitempty"` |
| ... | ... |
@@ -3,7 +3,7 @@ package validation |
| 3 | 3 |
import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/openshift/origin/pkg/project/api" |
| 8 | 8 |
) |
| 9 | 9 |
|
| ... | ... |
@@ -16,7 +16,7 @@ func TestValidateProject(t *testing.T) {
|
| 16 | 16 |
{
|
| 17 | 17 |
name: "missing id", |
| 18 | 18 |
project: api.Project{
|
| 19 |
- TypeMeta: kubeapi.TypeMeta{Namespace: kubeapi.NamespaceDefault},
|
|
| 19 |
+ TypeMeta: kapi.TypeMeta{Namespace: kapi.NamespaceDefault},
|
|
| 20 | 20 |
DisplayName: "hi", |
| 21 | 21 |
Description: "This is a description", |
| 22 | 22 |
}, |
| ... | ... |
@@ -26,7 +26,7 @@ func TestValidateProject(t *testing.T) {
|
| 26 | 26 |
{
|
| 27 | 27 |
name: "invalid id", |
| 28 | 28 |
project: api.Project{
|
| 29 |
- TypeMeta: kubeapi.TypeMeta{ID: "141-.124.$", Namespace: kubeapi.NamespaceDefault},
|
|
| 29 |
+ TypeMeta: kapi.TypeMeta{ID: "141-.124.$", Namespace: kapi.NamespaceDefault},
|
|
| 30 | 30 |
DisplayName: "hi", |
| 31 | 31 |
Description: "This is a description", |
| 32 | 32 |
}, |
| ... | ... |
@@ -36,7 +36,7 @@ func TestValidateProject(t *testing.T) {
|
| 36 | 36 |
{
|
| 37 | 37 |
name: "missing namespace", |
| 38 | 38 |
project: api.Project{
|
| 39 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo", Namespace: ""},
|
|
| 39 |
+ TypeMeta: kapi.TypeMeta{ID: "foo", Namespace: ""},
|
|
| 40 | 40 |
DisplayName: "hi", |
| 41 | 41 |
Description: "This is a description", |
| 42 | 42 |
}, |
| ... | ... |
@@ -46,7 +46,7 @@ func TestValidateProject(t *testing.T) {
|
| 46 | 46 |
{
|
| 47 | 47 |
name: "invalid namespace", |
| 48 | 48 |
project: api.Project{
|
| 49 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo", Namespace: "141-.124.$"},
|
|
| 49 |
+ TypeMeta: kapi.TypeMeta{ID: "foo", Namespace: "141-.124.$"},
|
|
| 50 | 50 |
DisplayName: "hi", |
| 51 | 51 |
Description: "This is a description", |
| 52 | 52 |
}, |
| ... | ... |
@@ -56,7 +56,7 @@ func TestValidateProject(t *testing.T) {
|
| 56 | 56 |
{
|
| 57 | 57 |
name: "invalid description", |
| 58 | 58 |
project: api.Project{
|
| 59 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo", Namespace: "foo"},
|
|
| 59 |
+ TypeMeta: kapi.TypeMeta{ID: "foo", Namespace: "foo"},
|
|
| 60 | 60 |
DisplayName: "hi", |
| 61 | 61 |
Description: "This is a \n description", |
| 62 | 62 |
}, |
| ... | ... |
@@ -66,7 +66,7 @@ func TestValidateProject(t *testing.T) {
|
| 66 | 66 |
{
|
| 67 | 67 |
name: "invalid display name", |
| 68 | 68 |
project: api.Project{
|
| 69 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo", Namespace: "foo"},
|
|
| 69 |
+ TypeMeta: kapi.TypeMeta{ID: "foo", Namespace: "foo"},
|
|
| 70 | 70 |
DisplayName: "h\t\ni", |
| 71 | 71 |
Description: "This is a description", |
| 72 | 72 |
}, |
| ... | ... |
@@ -83,7 +83,7 @@ func TestValidateProject(t *testing.T) {
|
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 | 85 |
project := api.Project{
|
| 86 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo", Namespace: kubeapi.NamespaceDefault},
|
|
| 86 |
+ TypeMeta: kapi.TypeMeta{ID: "foo", Namespace: kapi.NamespaceDefault},
|
|
| 87 | 87 |
DisplayName: "hi", |
| 88 | 88 |
Description: "This is a description", |
| 89 | 89 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package etcd |
| 3 | 3 |
import ( |
| 4 | 4 |
"errors" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
etcderr "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors/etcd" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
| ... | ... |
@@ -29,17 +29,17 @@ func New(helper tools.EtcdHelper) *Etcd {
|
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 | 31 |
// makeProjectListKey constructs etcd paths to project directories |
| 32 |
-func makeProjectListKey(ctx kubeapi.Context) string {
|
|
| 32 |
+func makeProjectListKey(ctx kapi.Context) string {
|
|
| 33 | 33 |
return ProjectPath |
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 | 36 |
// makeProjectKey constructs etcd paths to project items |
| 37 |
-func makeProjectKey(ctx kubeapi.Context, id string) string {
|
|
| 37 |
+func makeProjectKey(ctx kapi.Context, id string) string {
|
|
| 38 | 38 |
return makeProjectListKey(ctx) + "/" + id |
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 | 41 |
// ListProjects retrieves a list of projects that match selector. |
| 42 |
-func (r *Etcd) ListProjects(ctx kubeapi.Context, selector labels.Selector) (*api.ProjectList, error) {
|
|
| 42 |
+func (r *Etcd) ListProjects(ctx kapi.Context, selector labels.Selector) (*api.ProjectList, error) {
|
|
| 43 | 43 |
list := api.ProjectList{}
|
| 44 | 44 |
err := r.ExtractToList(makeProjectListKey(ctx), &list) |
| 45 | 45 |
if err != nil {
|
| ... | ... |
@@ -56,7 +56,7 @@ func (r *Etcd) ListProjects(ctx kubeapi.Context, selector labels.Selector) (*api |
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
// GetProject retrieves a specific project |
| 59 |
-func (r *Etcd) GetProject(ctx kubeapi.Context, id string) (*api.Project, error) {
|
|
| 59 |
+func (r *Etcd) GetProject(ctx kapi.Context, id string) (*api.Project, error) {
|
|
| 60 | 60 |
var project api.Project |
| 61 | 61 |
if err := r.ExtractObj(makeProjectKey(ctx, id), &project, false); err != nil {
|
| 62 | 62 |
return nil, etcderr.InterpretGetError(err, "project", id) |
| ... | ... |
@@ -65,18 +65,18 @@ func (r *Etcd) GetProject(ctx kubeapi.Context, id string) (*api.Project, error) |
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 | 67 |
// CreateProject creates a new project |
| 68 |
-func (r *Etcd) CreateProject(ctx kubeapi.Context, project *api.Project) error {
|
|
| 68 |
+func (r *Etcd) CreateProject(ctx kapi.Context, project *api.Project) error {
|
|
| 69 | 69 |
err := r.CreateObj(makeProjectKey(ctx, project.ID), project, 0) |
| 70 | 70 |
return etcderr.InterpretCreateError(err, "project", project.ID) |
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
// UpdateProject updates an existing project |
| 74 |
-func (r *Etcd) UpdateProject(ctx kubeapi.Context, project *api.Project) error {
|
|
| 74 |
+func (r *Etcd) UpdateProject(ctx kapi.Context, project *api.Project) error {
|
|
| 75 | 75 |
return errors.New("not supported")
|
| 76 | 76 |
} |
| 77 | 77 |
|
| 78 | 78 |
// DeleteProject deletes an existing project |
| 79 |
-func (r *Etcd) DeleteProject(ctx kubeapi.Context, id string) error {
|
|
| 79 |
+func (r *Etcd) DeleteProject(ctx kapi.Context, id string) error {
|
|
| 80 | 80 |
err := r.Delete(makeProjectKey(ctx, id), false) |
| 81 | 81 |
return etcderr.InterpretDeleteError(err, "project", id) |
| 82 | 82 |
} |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"testing" |
| 6 | 6 |
|
| 7 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -20,7 +20,7 @@ func NewTestEtcd(client tools.EtcdClient) *Etcd {
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 | 22 |
func TestEtcdListProjectsEmpty(t *testing.T) {
|
| 23 |
- ctx := kubeapi.NewContext() |
|
| 23 |
+ ctx := kapi.NewContext() |
|
| 24 | 24 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 25 | 25 |
key := makeProjectListKey(ctx) |
| 26 | 26 |
fakeClient.Data[key] = tools.EtcdResponseWithError{
|
| ... | ... |
@@ -43,7 +43,7 @@ func TestEtcdListProjectsEmpty(t *testing.T) {
|
| 43 | 43 |
} |
| 44 | 44 |
|
| 45 | 45 |
func TestEtcdListProjectsError(t *testing.T) {
|
| 46 |
- ctx := kubeapi.NewContext() |
|
| 46 |
+ ctx := kapi.NewContext() |
|
| 47 | 47 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 48 | 48 |
key := makeProjectListKey(ctx) |
| 49 | 49 |
fakeClient.Data[key] = tools.EtcdResponseWithError{
|
| ... | ... |
@@ -64,7 +64,7 @@ func TestEtcdListProjectsError(t *testing.T) {
|
| 64 | 64 |
} |
| 65 | 65 |
|
| 66 | 66 |
func TestEtcdListProjectsEverything(t *testing.T) {
|
| 67 |
- ctx := kubeapi.NewContext() |
|
| 67 |
+ ctx := kapi.NewContext() |
|
| 68 | 68 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 69 | 69 |
key := makeProjectListKey(ctx) |
| 70 | 70 |
fakeClient.Data[key] = tools.EtcdResponseWithError{
|
| ... | ... |
@@ -72,10 +72,10 @@ func TestEtcdListProjectsEverything(t *testing.T) {
|
| 72 | 72 |
Node: &etcd.Node{
|
| 73 | 73 |
Nodes: []*etcd.Node{
|
| 74 | 74 |
{
|
| 75 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Project{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}),
|
|
| 75 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Project{TypeMeta: kapi.TypeMeta{ID: "foo"}}),
|
|
| 76 | 76 |
}, |
| 77 | 77 |
{
|
| 78 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Project{TypeMeta: kubeapi.TypeMeta{ID: "bar"}}),
|
|
| 78 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Project{TypeMeta: kapi.TypeMeta{ID: "bar"}}),
|
|
| 79 | 79 |
}, |
| 80 | 80 |
}, |
| 81 | 81 |
}, |
| ... | ... |
@@ -94,7 +94,7 @@ func TestEtcdListProjectsEverything(t *testing.T) {
|
| 94 | 94 |
} |
| 95 | 95 |
|
| 96 | 96 |
func TestEtcdListProjectsFiltered(t *testing.T) {
|
| 97 |
- ctx := kubeapi.NewContext() |
|
| 97 |
+ ctx := kapi.NewContext() |
|
| 98 | 98 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 99 | 99 |
key := makeProjectListKey(ctx) |
| 100 | 100 |
fakeClient.Data[key] = tools.EtcdResponseWithError{
|
| ... | ... |
@@ -103,13 +103,13 @@ func TestEtcdListProjectsFiltered(t *testing.T) {
|
| 103 | 103 |
Nodes: []*etcd.Node{
|
| 104 | 104 |
{
|
| 105 | 105 |
Value: runtime.EncodeOrDie(latest.Codec, &api.Project{
|
| 106 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 106 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 107 | 107 |
Labels: map[string]string{"env": "prod"},
|
| 108 | 108 |
}), |
| 109 | 109 |
}, |
| 110 | 110 |
{
|
| 111 | 111 |
Value: runtime.EncodeOrDie(latest.Codec, &api.Project{
|
| 112 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar"},
|
|
| 112 |
+ TypeMeta: kapi.TypeMeta{ID: "bar"},
|
|
| 113 | 113 |
Labels: map[string]string{"env": "dev"},
|
| 114 | 114 |
}), |
| 115 | 115 |
}, |
| ... | ... |
@@ -130,9 +130,9 @@ func TestEtcdListProjectsFiltered(t *testing.T) {
|
| 130 | 130 |
} |
| 131 | 131 |
|
| 132 | 132 |
func TestEtcdGetProject(t *testing.T) {
|
| 133 |
- ctx := kubeapi.NewContext() |
|
| 133 |
+ ctx := kapi.NewContext() |
|
| 134 | 134 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 135 |
- fakeClient.Set(makeProjectKey(ctx, "foo"), runtime.EncodeOrDie(latest.Codec, &api.Project{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 135 |
+ fakeClient.Set(makeProjectKey(ctx, "foo"), runtime.EncodeOrDie(latest.Codec, &api.Project{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 136 | 136 |
registry := NewTestEtcd(fakeClient) |
| 137 | 137 |
project, err := registry.GetProject(ctx, "foo") |
| 138 | 138 |
if err != nil {
|
| ... | ... |
@@ -145,7 +145,7 @@ func TestEtcdGetProject(t *testing.T) {
|
| 145 | 145 |
} |
| 146 | 146 |
|
| 147 | 147 |
func TestEtcdGetProjectNotFound(t *testing.T) {
|
| 148 |
- ctx := kubeapi.NewContext() |
|
| 148 |
+ ctx := kapi.NewContext() |
|
| 149 | 149 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 150 | 150 |
fakeClient.Data[makeProjectKey(ctx, "foo")] = tools.EtcdResponseWithError{
|
| 151 | 151 |
R: &etcd.Response{
|
| ... | ... |
@@ -164,7 +164,7 @@ func TestEtcdGetProjectNotFound(t *testing.T) {
|
| 164 | 164 |
} |
| 165 | 165 |
|
| 166 | 166 |
func TestEtcdCreateProject(t *testing.T) {
|
| 167 |
- ctx := kubeapi.NewContext() |
|
| 167 |
+ ctx := kapi.NewContext() |
|
| 168 | 168 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 169 | 169 |
fakeClient.TestIndex = true |
| 170 | 170 |
fakeClient.Data[makeProjectKey(ctx, "foo")] = tools.EtcdResponseWithError{
|
| ... | ... |
@@ -175,7 +175,7 @@ func TestEtcdCreateProject(t *testing.T) {
|
| 175 | 175 |
} |
| 176 | 176 |
registry := NewTestEtcd(fakeClient) |
| 177 | 177 |
err := registry.CreateProject(ctx, &api.Project{
|
| 178 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 178 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 179 | 179 |
ID: "foo", |
| 180 | 180 |
}, |
| 181 | 181 |
}) |
| ... | ... |
@@ -199,19 +199,19 @@ func TestEtcdCreateProject(t *testing.T) {
|
| 199 | 199 |
} |
| 200 | 200 |
|
| 201 | 201 |
func TestEtcdCreateProjectAlreadyExists(t *testing.T) {
|
| 202 |
- ctx := kubeapi.NewContext() |
|
| 202 |
+ ctx := kapi.NewContext() |
|
| 203 | 203 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 204 | 204 |
fakeClient.Data[makeProjectKey(ctx, "foo")] = tools.EtcdResponseWithError{
|
| 205 | 205 |
R: &etcd.Response{
|
| 206 | 206 |
Node: &etcd.Node{
|
| 207 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Project{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}),
|
|
| 207 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Project{TypeMeta: kapi.TypeMeta{ID: "foo"}}),
|
|
| 208 | 208 |
}, |
| 209 | 209 |
}, |
| 210 | 210 |
E: nil, |
| 211 | 211 |
} |
| 212 | 212 |
registry := NewTestEtcd(fakeClient) |
| 213 | 213 |
err := registry.CreateProject(ctx, &api.Project{
|
| 214 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 214 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 215 | 215 |
ID: "foo", |
| 216 | 216 |
}, |
| 217 | 217 |
}) |
| ... | ... |
@@ -224,7 +224,7 @@ func TestEtcdCreateProjectAlreadyExists(t *testing.T) {
|
| 224 | 224 |
} |
| 225 | 225 |
|
| 226 | 226 |
func TestEtcdUpdateProject(t *testing.T) {
|
| 227 |
- ctx := kubeapi.NewContext() |
|
| 227 |
+ ctx := kapi.NewContext() |
|
| 228 | 228 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 229 | 229 |
registry := NewTestEtcd(fakeClient) |
| 230 | 230 |
err := registry.UpdateProject(ctx, &api.Project{})
|
| ... | ... |
@@ -234,7 +234,7 @@ func TestEtcdUpdateProject(t *testing.T) {
|
| 234 | 234 |
} |
| 235 | 235 |
|
| 236 | 236 |
func TestEtcdDeleteProjectNotFound(t *testing.T) {
|
| 237 |
- ctx := kubeapi.NewContext() |
|
| 237 |
+ ctx := kapi.NewContext() |
|
| 238 | 238 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 239 | 239 |
fakeClient.Err = tools.EtcdErrorNotFound |
| 240 | 240 |
registry := NewTestEtcd(fakeClient) |
| ... | ... |
@@ -248,7 +248,7 @@ func TestEtcdDeleteProjectNotFound(t *testing.T) {
|
| 248 | 248 |
} |
| 249 | 249 |
|
| 250 | 250 |
func TestEtcdDeleteProjectError(t *testing.T) {
|
| 251 |
- ctx := kubeapi.NewContext() |
|
| 251 |
+ ctx := kapi.NewContext() |
|
| 252 | 252 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 253 | 253 |
fakeClient.Err = fmt.Errorf("Some error")
|
| 254 | 254 |
registry := NewTestEtcd(fakeClient) |
| ... | ... |
@@ -259,7 +259,7 @@ func TestEtcdDeleteProjectError(t *testing.T) {
|
| 259 | 259 |
} |
| 260 | 260 |
|
| 261 | 261 |
func TestEtcdDeleteProjectOK(t *testing.T) {
|
| 262 |
- ctx := kubeapi.NewContext() |
|
| 262 |
+ ctx := kapi.NewContext() |
|
| 263 | 263 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 264 | 264 |
registry := NewTestEtcd(fakeClient) |
| 265 | 265 |
key := makeProjectKey(ctx, "foo") |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package project |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
|
| 6 | 6 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 7 | 7 |
"github.com/openshift/origin/pkg/project/api" |
| ... | ... |
@@ -10,13 +10,13 @@ import ( |
| 10 | 10 |
// Registry is an interface for things that know how to store Project objects. |
| 11 | 11 |
type Registry interface {
|
| 12 | 12 |
// ListProjects obtains a list of Projects that match a selector. |
| 13 |
- ListProjects(ctx kubeapi.Context, selector labels.Selector) (*api.ProjectList, error) |
|
| 13 |
+ ListProjects(ctx kapi.Context, selector labels.Selector) (*api.ProjectList, error) |
|
| 14 | 14 |
// GetProject retrieves a specific Project. |
| 15 |
- GetProject(ctx kubeapi.Context, id string) (*api.Project, error) |
|
| 15 |
+ GetProject(ctx kapi.Context, id string) (*api.Project, error) |
|
| 16 | 16 |
// CreateProject creates a new Project. |
| 17 |
- CreateProject(ctx kubeapi.Context, Project *api.Project) error |
|
| 17 |
+ CreateProject(ctx kapi.Context, Project *api.Project) error |
|
| 18 | 18 |
// UpdateProject updates an Project. |
| 19 |
- UpdateProject(ctx kubeapi.Context, Project *api.Project) error |
|
| 19 |
+ UpdateProject(ctx kapi.Context, Project *api.Project) error |
|
| 20 | 20 |
// DeleteProject deletes an Project. |
| 21 |
- DeleteProject(ctx kubeapi.Context, id string) error |
|
| 21 |
+ DeleteProject(ctx kapi.Context, id string) error |
|
| 22 | 22 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package project |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| ... | ... |
@@ -30,7 +30,7 @@ func (s *REST) New() runtime.Object {
|
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 | 32 |
// List retrieves a list of Projects that match selector. |
| 33 |
-func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 33 |
+func (s *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 34 | 34 |
projects, err := s.registry.ListProjects(ctx, selector) |
| 35 | 35 |
if err != nil {
|
| 36 | 36 |
return nil, err |
| ... | ... |
@@ -40,7 +40,7 @@ func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runt |
| 40 | 40 |
} |
| 41 | 41 |
|
| 42 | 42 |
// Get retrieves an Project by id. |
| 43 |
-func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 43 |
+func (s *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 44 | 44 |
project, err := s.registry.GetProject(ctx, id) |
| 45 | 45 |
if err != nil {
|
| 46 | 46 |
return nil, err |
| ... | ... |
@@ -49,7 +49,7 @@ func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
// Create registers the given Project. |
| 52 |
-func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 52 |
+func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 53 | 53 |
project, ok := obj.(*api.Project) |
| 54 | 54 |
if !ok {
|
| 55 | 55 |
return nil, fmt.Errorf("not a project: %#v", obj)
|
| ... | ... |
@@ -77,14 +77,14 @@ func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 77 | 77 |
} |
| 78 | 78 |
|
| 79 | 79 |
// Update is not supported for Projects, as they are immutable. |
| 80 |
-func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 80 |
+func (s *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 81 | 81 |
// TODO handle update of display name, labels, etc. |
| 82 | 82 |
return nil, fmt.Errorf("Projects may not be changed.")
|
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 | 85 |
// Delete asynchronously deletes a Project specified by its id. |
| 86 |
-func (s *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 86 |
+func (s *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 87 | 87 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| 88 |
- return &kubeapi.Status{Status: kubeapi.StatusSuccess}, s.registry.DeleteProject(ctx, id)
|
|
| 88 |
+ return &kapi.Status{Status: kapi.StatusSuccess}, s.registry.DeleteProject(ctx, id)
|
|
| 89 | 89 |
}), nil |
| 90 | 90 |
} |
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
"testing" |
| 7 | 7 |
"time" |
| 8 | 8 |
|
| 9 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 9 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 12 | 12 |
"github.com/openshift/origin/pkg/project/api" |
| ... | ... |
@@ -56,12 +56,12 @@ func TestListProjectsPopulatedList(t *testing.T) {
|
| 56 | 56 |
mockRegistry.Projects = &api.ProjectList{
|
| 57 | 57 |
Items: []api.Project{
|
| 58 | 58 |
{
|
| 59 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 59 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 60 | 60 |
ID: "foo", |
| 61 | 61 |
}, |
| 62 | 62 |
}, |
| 63 | 63 |
{
|
| 64 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 64 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 65 | 65 |
ID: "bar", |
| 66 | 66 |
}, |
| 67 | 67 |
}, |
| ... | ... |
@@ -114,7 +114,7 @@ func TestCreateRegistrySaveError(t *testing.T) {
|
| 114 | 114 |
storage := REST{registry: mockRegistry}
|
| 115 | 115 |
|
| 116 | 116 |
channel, err := storage.Create(nil, &api.Project{
|
| 117 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 117 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 118 | 118 |
}) |
| 119 | 119 |
if channel == nil {
|
| 120 | 120 |
t.Errorf("Expected nil channel, got %v", channel)
|
| ... | ... |
@@ -125,11 +125,11 @@ func TestCreateRegistrySaveError(t *testing.T) {
|
| 125 | 125 |
|
| 126 | 126 |
select {
|
| 127 | 127 |
case result := <-channel: |
| 128 |
- status, ok := result.(*kubeapi.Status) |
|
| 128 |
+ status, ok := result.(*kapi.Status) |
|
| 129 | 129 |
if !ok {
|
| 130 | 130 |
t.Errorf("Expected status type, got: %#v", result)
|
| 131 | 131 |
} |
| 132 |
- if status.Status != kubeapi.StatusFailure || status.Message != "foo" {
|
|
| 132 |
+ if status.Status != kapi.StatusFailure || status.Message != "foo" {
|
|
| 133 | 133 |
t.Errorf("Expected failure status, got %#V", status)
|
| 134 | 134 |
} |
| 135 | 135 |
case <-time.After(50 * time.Millisecond): |
| ... | ... |
@@ -143,7 +143,7 @@ func TestCreateProjectOK(t *testing.T) {
|
| 143 | 143 |
storage := REST{registry: mockRegistry}
|
| 144 | 144 |
|
| 145 | 145 |
channel, err := storage.Create(nil, &api.Project{
|
| 146 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 146 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 147 | 147 |
}) |
| 148 | 148 |
if channel == nil {
|
| 149 | 149 |
t.Errorf("Expected nil channel, got %v", channel)
|
| ... | ... |
@@ -184,7 +184,7 @@ func TestGetProjectError(t *testing.T) {
|
| 184 | 184 |
func TestGetProjectOK(t *testing.T) {
|
| 185 | 185 |
mockRegistry := test.NewProjectRegistry() |
| 186 | 186 |
mockRegistry.Project = &api.Project{
|
| 187 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 187 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 188 | 188 |
} |
| 189 | 189 |
storage := REST{registry: mockRegistry}
|
| 190 | 190 |
|
| ... | ... |
@@ -227,11 +227,11 @@ func TestDeleteProject(t *testing.T) {
|
| 227 | 227 |
|
| 228 | 228 |
select {
|
| 229 | 229 |
case result := <-channel: |
| 230 |
- status, ok := result.(*kubeapi.Status) |
|
| 230 |
+ status, ok := result.(*kapi.Status) |
|
| 231 | 231 |
if !ok {
|
| 232 | 232 |
t.Errorf("Expected status type, got: %#v", result)
|
| 233 | 233 |
} |
| 234 |
- if status.Status != kubeapi.StatusSuccess {
|
|
| 234 |
+ if status.Status != kapi.StatusSuccess {
|
|
| 235 | 235 |
t.Errorf("Expected status=success, got: %#v", status)
|
| 236 | 236 |
} |
| 237 | 237 |
case <-time.After(50 * time.Millisecond): |
| ... | ... |
@@ -3,7 +3,7 @@ package test |
| 3 | 3 |
import ( |
| 4 | 4 |
"sync" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 8 | 8 |
"github.com/openshift/origin/pkg/project/api" |
| 9 | 9 |
) |
| ... | ... |
@@ -19,21 +19,21 @@ func NewProjectRegistry() *ProjectRegistry {
|
| 19 | 19 |
return &ProjectRegistry{}
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
-func (r *ProjectRegistry) ListProjects(ctx kubeapi.Context, selector labels.Selector) (*api.ProjectList, error) {
|
|
| 22 |
+func (r *ProjectRegistry) ListProjects(ctx kapi.Context, selector labels.Selector) (*api.ProjectList, error) {
|
|
| 23 | 23 |
r.Lock() |
| 24 | 24 |
defer r.Unlock() |
| 25 | 25 |
|
| 26 | 26 |
return r.Projects, r.Err |
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 |
-func (r *ProjectRegistry) GetProject(ctx kubeapi.Context, id string) (*api.Project, error) {
|
|
| 29 |
+func (r *ProjectRegistry) GetProject(ctx kapi.Context, id string) (*api.Project, error) {
|
|
| 30 | 30 |
r.Lock() |
| 31 | 31 |
defer r.Unlock() |
| 32 | 32 |
|
| 33 | 33 |
return r.Project, r.Err |
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 |
-func (r *ProjectRegistry) CreateProject(ctx kubeapi.Context, project *api.Project) error {
|
|
| 36 |
+func (r *ProjectRegistry) CreateProject(ctx kapi.Context, project *api.Project) error {
|
|
| 37 | 37 |
r.Lock() |
| 38 | 38 |
defer r.Unlock() |
| 39 | 39 |
|
| ... | ... |
@@ -41,7 +41,7 @@ func (r *ProjectRegistry) CreateProject(ctx kubeapi.Context, project *api.Projec |
| 41 | 41 |
return r.Err |
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 |
-func (r *ProjectRegistry) UpdateProject(ctx kubeapi.Context, project *api.Project) error {
|
|
| 44 |
+func (r *ProjectRegistry) UpdateProject(ctx kapi.Context, project *api.Project) error {
|
|
| 45 | 45 |
r.Lock() |
| 46 | 46 |
defer r.Unlock() |
| 47 | 47 |
|
| ... | ... |
@@ -49,7 +49,7 @@ func (r *ProjectRegistry) UpdateProject(ctx kubeapi.Context, project *api.Projec |
| 49 | 49 |
return r.Err |
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 |
-func (r *ProjectRegistry) DeleteProject(ctx kubeapi.Context, id string) error {
|
|
| 52 |
+func (r *ProjectRegistry) DeleteProject(ctx kapi.Context, id string) error {
|
|
| 53 | 53 |
r.Lock() |
| 54 | 54 |
defer r.Unlock() |
| 55 | 55 |
|
| ... | ... |
@@ -1,12 +1,12 @@ |
| 1 | 1 |
package api |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
) |
| 6 | 6 |
|
| 7 | 7 |
// Route encapsulates the inputs needed to connect a DNS/alias to a service proxy. |
| 8 | 8 |
type Route struct {
|
| 9 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 9 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 10 | 10 |
|
| 11 | 11 |
// Required: Alias/DNS that points to the service |
| 12 | 12 |
// Can be host or host:port |
| ... | ... |
@@ -22,6 +22,6 @@ type Route struct {
|
| 22 | 22 |
|
| 23 | 23 |
// RouteList is a collection of Routes. |
| 24 | 24 |
type RouteList struct {
|
| 25 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 25 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 26 | 26 |
Items []Route `json:"items,omitempty" yaml:"items,omitempty"` |
| 27 | 27 |
} |
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 10 | 10 |
|
| 11 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 11 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 12 | 12 |
kubeetcd "github.com/GoogleCloudPlatform/kubernetes/pkg/registry/etcd" |
| 13 | 13 |
"github.com/openshift/origin/pkg/route/api" |
| 14 | 14 |
) |
| ... | ... |
@@ -30,16 +30,16 @@ func New(helper tools.EtcdHelper) *Etcd {
|
| 30 | 30 |
} |
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 |
-func makeRouteListKey(ctx kubeapi.Context) string {
|
|
| 33 |
+func makeRouteListKey(ctx kapi.Context) string {
|
|
| 34 | 34 |
return kubeetcd.MakeEtcdListKey(ctx, RoutePath) |
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 |
-func makeRouteKey(ctx kubeapi.Context, id string) (string, error) {
|
|
| 37 |
+func makeRouteKey(ctx kapi.Context, id string) (string, error) {
|
|
| 38 | 38 |
return kubeetcd.MakeEtcdItemKey(ctx, RoutePath, id) |
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 | 41 |
// ListRoutes obtains a list of Routes. |
| 42 |
-func (registry *Etcd) ListRoutes(ctx kubeapi.Context, selector labels.Selector) (*api.RouteList, error) {
|
|
| 42 |
+func (registry *Etcd) ListRoutes(ctx kapi.Context, selector labels.Selector) (*api.RouteList, error) {
|
|
| 43 | 43 |
allRoutes := api.RouteList{}
|
| 44 | 44 |
err := registry.ExtractToList(makeRouteListKey(ctx), &allRoutes) |
| 45 | 45 |
if err != nil {
|
| ... | ... |
@@ -57,7 +57,7 @@ func (registry *Etcd) ListRoutes(ctx kubeapi.Context, selector labels.Selector) |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 | 59 |
// GetRoute gets a specific Route specified by its ID. |
| 60 |
-func (registry *Etcd) GetRoute(ctx kubeapi.Context, routeID string) (*api.Route, error) {
|
|
| 60 |
+func (registry *Etcd) GetRoute(ctx kapi.Context, routeID string) (*api.Route, error) {
|
|
| 61 | 61 |
route := api.Route{}
|
| 62 | 62 |
key, err := makeRouteKey(ctx, routeID) |
| 63 | 63 |
if err != nil {
|
| ... | ... |
@@ -71,7 +71,7 @@ func (registry *Etcd) GetRoute(ctx kubeapi.Context, routeID string) (*api.Route, |
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
// CreateRoute creates a new Route. |
| 74 |
-func (registry *Etcd) CreateRoute(ctx kubeapi.Context, route *api.Route) error {
|
|
| 74 |
+func (registry *Etcd) CreateRoute(ctx kapi.Context, route *api.Route) error {
|
|
| 75 | 75 |
key, err := makeRouteKey(ctx, route.ID) |
| 76 | 76 |
if err != nil {
|
| 77 | 77 |
return err |
| ... | ... |
@@ -81,7 +81,7 @@ func (registry *Etcd) CreateRoute(ctx kubeapi.Context, route *api.Route) error {
|
| 81 | 81 |
} |
| 82 | 82 |
|
| 83 | 83 |
// UpdateRoute replaces an existing Route. |
| 84 |
-func (registry *Etcd) UpdateRoute(ctx kubeapi.Context, route *api.Route) error {
|
|
| 84 |
+func (registry *Etcd) UpdateRoute(ctx kapi.Context, route *api.Route) error {
|
|
| 85 | 85 |
key, err := makeRouteKey(ctx, route.ID) |
| 86 | 86 |
if err != nil {
|
| 87 | 87 |
return err |
| ... | ... |
@@ -91,7 +91,7 @@ func (registry *Etcd) UpdateRoute(ctx kubeapi.Context, route *api.Route) error {
|
| 91 | 91 |
} |
| 92 | 92 |
|
| 93 | 93 |
// DeleteRoute deletes a Route specified by its ID. |
| 94 |
-func (registry *Etcd) DeleteRoute(ctx kubeapi.Context, routeID string) error {
|
|
| 94 |
+func (registry *Etcd) DeleteRoute(ctx kapi.Context, routeID string) error {
|
|
| 95 | 95 |
key, err := makeRouteKey(ctx, routeID) |
| 96 | 96 |
if err != nil {
|
| 97 | 97 |
return err |
| ... | ... |
@@ -101,7 +101,7 @@ func (registry *Etcd) DeleteRoute(ctx kubeapi.Context, routeID string) error {
|
| 101 | 101 |
} |
| 102 | 102 |
|
| 103 | 103 |
// WatchRoutes begins watching for new, changed, or deleted route configurations. |
| 104 |
-func (registry *Etcd) WatchRoutes(ctx kubeapi.Context, label, field labels.Selector, resourceVersion uint64) (watch.Interface, error) {
|
|
| 104 |
+func (registry *Etcd) WatchRoutes(ctx kapi.Context, label, field labels.Selector, resourceVersion uint64) (watch.Interface, error) {
|
|
| 105 | 105 |
if !label.Empty() {
|
| 106 | 106 |
return nil, fmt.Errorf("label selectors are not supported on routes yet")
|
| 107 | 107 |
} |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"testing" |
| 6 | 6 |
|
| 7 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -30,10 +30,10 @@ func makeTestRouteKey(namespace, id string) string {
|
| 30 | 30 |
return "/routes/" + namespace + "/" + id |
| 31 | 31 |
} |
| 32 | 32 |
func makeTestDefaultRouteKey(id string) string {
|
| 33 |
- return makeTestRouteKey(kubeapi.NamespaceDefault, id) |
|
| 33 |
+ return makeTestRouteKey(kapi.NamespaceDefault, id) |
|
| 34 | 34 |
} |
| 35 | 35 |
func makeTestDefaultRouteListKey() string {
|
| 36 |
- return makeTestRouteListKey(kubeapi.NamespaceDefault) |
|
| 36 |
+ return makeTestRouteListKey(kapi.NamespaceDefault) |
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
func NewTestEtcd(client tools.EtcdClient) *Etcd {
|
| ... | ... |
@@ -52,7 +52,7 @@ func TestEtcdListEmptyRoutes(t *testing.T) {
|
| 52 | 52 |
E: nil, |
| 53 | 53 |
} |
| 54 | 54 |
registry := NewTestEtcd(fakeClient) |
| 55 |
- routes, err := registry.ListRoutes(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 55 |
+ routes, err := registry.ListRoutes(kapi.NewDefaultContext(), labels.Everything()) |
|
| 56 | 56 |
if err != nil {
|
| 57 | 57 |
t.Errorf("unexpected error: %v", err)
|
| 58 | 58 |
} |
| ... | ... |
@@ -72,7 +72,7 @@ func TestEtcdListErrorRoutes(t *testing.T) {
|
| 72 | 72 |
E: fmt.Errorf("some error"),
|
| 73 | 73 |
} |
| 74 | 74 |
registry := NewTestEtcd(fakeClient) |
| 75 |
- routes, err := registry.ListRoutes(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 75 |
+ routes, err := registry.ListRoutes(kapi.NewDefaultContext(), labels.Everything()) |
|
| 76 | 76 |
if err == nil {
|
| 77 | 77 |
t.Error("unexpected nil error")
|
| 78 | 78 |
} |
| ... | ... |
@@ -90,10 +90,10 @@ func TestEtcdListEverythingRoutes(t *testing.T) {
|
| 90 | 90 |
Node: &etcd.Node{
|
| 91 | 91 |
Nodes: []*etcd.Node{
|
| 92 | 92 |
{
|
| 93 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}),
|
|
| 93 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kapi.TypeMeta{ID: "foo"}}),
|
|
| 94 | 94 |
}, |
| 95 | 95 |
{
|
| 96 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kubeapi.TypeMeta{ID: "bar"}}),
|
|
| 96 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kapi.TypeMeta{ID: "bar"}}),
|
|
| 97 | 97 |
}, |
| 98 | 98 |
}, |
| 99 | 99 |
}, |
| ... | ... |
@@ -101,7 +101,7 @@ func TestEtcdListEverythingRoutes(t *testing.T) {
|
| 101 | 101 |
E: nil, |
| 102 | 102 |
} |
| 103 | 103 |
registry := NewTestEtcd(fakeClient) |
| 104 |
- routes, err := registry.ListRoutes(kubeapi.NewDefaultContext(), labels.Everything()) |
|
| 104 |
+ routes, err := registry.ListRoutes(kapi.NewDefaultContext(), labels.Everything()) |
|
| 105 | 105 |
if err != nil {
|
| 106 | 106 |
t.Errorf("unexpected error: %v", err)
|
| 107 | 107 |
} |
| ... | ... |
@@ -120,13 +120,13 @@ func TestEtcdListFilteredRoutes(t *testing.T) {
|
| 120 | 120 |
Nodes: []*etcd.Node{
|
| 121 | 121 |
{
|
| 122 | 122 |
Value: runtime.EncodeOrDie(latest.Codec, &api.Route{
|
| 123 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 123 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 124 | 124 |
Labels: map[string]string{"env": "prod"},
|
| 125 | 125 |
}), |
| 126 | 126 |
}, |
| 127 | 127 |
{
|
| 128 | 128 |
Value: runtime.EncodeOrDie(latest.Codec, &api.Route{
|
| 129 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar"},
|
|
| 129 |
+ TypeMeta: kapi.TypeMeta{ID: "bar"},
|
|
| 130 | 130 |
Labels: map[string]string{"env": "dev"},
|
| 131 | 131 |
}), |
| 132 | 132 |
}, |
| ... | ... |
@@ -136,7 +136,7 @@ func TestEtcdListFilteredRoutes(t *testing.T) {
|
| 136 | 136 |
E: nil, |
| 137 | 137 |
} |
| 138 | 138 |
registry := NewTestEtcd(fakeClient) |
| 139 |
- routes, err := registry.ListRoutes(kubeapi.NewDefaultContext(), labels.SelectorFromSet(labels.Set{"env": "dev"}))
|
|
| 139 |
+ routes, err := registry.ListRoutes(kapi.NewDefaultContext(), labels.SelectorFromSet(labels.Set{"env": "dev"}))
|
|
| 140 | 140 |
if err != nil {
|
| 141 | 141 |
t.Errorf("unexpected error: %v", err)
|
| 142 | 142 |
} |
| ... | ... |
@@ -148,9 +148,9 @@ func TestEtcdListFilteredRoutes(t *testing.T) {
|
| 148 | 148 |
|
| 149 | 149 |
func TestEtcdGetRoutes(t *testing.T) {
|
| 150 | 150 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 151 |
- fakeClient.Set(makeTestDefaultRouteKey("foo"), runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 151 |
+ fakeClient.Set(makeTestDefaultRouteKey("foo"), runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 152 | 152 |
registry := NewTestEtcd(fakeClient) |
| 153 |
- route, err := registry.GetRoute(kubeapi.NewDefaultContext(), "foo") |
|
| 153 |
+ route, err := registry.GetRoute(kapi.NewDefaultContext(), "foo") |
|
| 154 | 154 |
if err != nil {
|
| 155 | 155 |
t.Errorf("unexpected error: %v", err)
|
| 156 | 156 |
} |
| ... | ... |
@@ -169,7 +169,7 @@ func TestEtcdGetNotFoundRoutes(t *testing.T) {
|
| 169 | 169 |
E: tools.EtcdErrorNotFound, |
| 170 | 170 |
} |
| 171 | 171 |
registry := NewTestEtcd(fakeClient) |
| 172 |
- route, err := registry.GetRoute(kubeapi.NewDefaultContext(), "foo") |
|
| 172 |
+ route, err := registry.GetRoute(kapi.NewDefaultContext(), "foo") |
|
| 173 | 173 |
if err == nil {
|
| 174 | 174 |
t.Errorf("Unexpected non-error.")
|
| 175 | 175 |
} |
| ... | ... |
@@ -188,8 +188,8 @@ func TestEtcdCreateRoutes(t *testing.T) {
|
| 188 | 188 |
E: tools.EtcdErrorNotFound, |
| 189 | 189 |
} |
| 190 | 190 |
registry := NewTestEtcd(fakeClient) |
| 191 |
- err := registry.CreateRoute(kubeapi.NewDefaultContext(), &api.Route{
|
|
| 192 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 191 |
+ err := registry.CreateRoute(kapi.NewDefaultContext(), &api.Route{
|
|
| 192 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 193 | 193 |
ID: "foo", |
| 194 | 194 |
}, |
| 195 | 195 |
}) |
| ... | ... |
@@ -217,14 +217,14 @@ func TestEtcdCreateAlreadyExistsRoutes(t *testing.T) {
|
| 217 | 217 |
fakeClient.Data[makeTestDefaultRouteKey("foo")] = tools.EtcdResponseWithError{
|
| 218 | 218 |
R: &etcd.Response{
|
| 219 | 219 |
Node: &etcd.Node{
|
| 220 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}),
|
|
| 220 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kapi.TypeMeta{ID: "foo"}}),
|
|
| 221 | 221 |
}, |
| 222 | 222 |
}, |
| 223 | 223 |
E: nil, |
| 224 | 224 |
} |
| 225 | 225 |
registry := NewTestEtcd(fakeClient) |
| 226 |
- err := registry.CreateRoute(kubeapi.NewDefaultContext(), &api.Route{
|
|
| 227 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 226 |
+ err := registry.CreateRoute(kapi.NewDefaultContext(), &api.Route{
|
|
| 227 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 228 | 228 |
ID: "foo", |
| 229 | 229 |
}, |
| 230 | 230 |
}) |
| ... | ... |
@@ -239,8 +239,8 @@ func TestEtcdCreateAlreadyExistsRoutes(t *testing.T) {
|
| 239 | 239 |
func TestEtcdUpdateOkRoutes(t *testing.T) {
|
| 240 | 240 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 241 | 241 |
registry := NewTestEtcd(fakeClient) |
| 242 |
- err := registry.UpdateRoute(kubeapi.NewDefaultContext(), &api.Route{
|
|
| 243 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 242 |
+ err := registry.UpdateRoute(kapi.NewDefaultContext(), &api.Route{
|
|
| 243 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 244 | 244 |
ID: "foo", |
| 245 | 245 |
}, |
| 246 | 246 |
}) |
| ... | ... |
@@ -253,7 +253,7 @@ func TestEtcdDeleteNotFoundRoutes(t *testing.T) {
|
| 253 | 253 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 254 | 254 |
fakeClient.Err = tools.EtcdErrorNotFound |
| 255 | 255 |
registry := NewTestEtcd(fakeClient) |
| 256 |
- err := registry.DeleteRoute(kubeapi.NewDefaultContext(), "foo") |
|
| 256 |
+ err := registry.DeleteRoute(kapi.NewDefaultContext(), "foo") |
|
| 257 | 257 |
if err == nil {
|
| 258 | 258 |
t.Error("Unexpected non-error")
|
| 259 | 259 |
} |
| ... | ... |
@@ -266,7 +266,7 @@ func TestEtcdDeleteErrorRoutes(t *testing.T) {
|
| 266 | 266 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 267 | 267 |
fakeClient.Err = fmt.Errorf("Some error")
|
| 268 | 268 |
registry := NewTestEtcd(fakeClient) |
| 269 |
- err := registry.DeleteRoute(kubeapi.NewDefaultContext(), "foo") |
|
| 269 |
+ err := registry.DeleteRoute(kapi.NewDefaultContext(), "foo") |
|
| 270 | 270 |
if err == nil {
|
| 271 | 271 |
t.Error("Unexpected non-error")
|
| 272 | 272 |
} |
| ... | ... |
@@ -276,7 +276,7 @@ func TestEtcdDeleteOkRoutes(t *testing.T) {
|
| 276 | 276 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 277 | 277 |
registry := NewTestEtcd(fakeClient) |
| 278 | 278 |
key := makeTestDefaultRouteListKey() + "/foo" |
| 279 |
- err := registry.DeleteRoute(kubeapi.NewDefaultContext(), "foo") |
|
| 279 |
+ err := registry.DeleteRoute(kapi.NewDefaultContext(), "foo") |
|
| 280 | 280 |
if err != nil {
|
| 281 | 281 |
t.Errorf("Unexpected error: %#v", err)
|
| 282 | 282 |
} |
| ... | ... |
@@ -291,8 +291,8 @@ func TestEtcdCreateRouteFailsWithoutNamespace(t *testing.T) {
|
| 291 | 291 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 292 | 292 |
fakeClient.TestIndex = true |
| 293 | 293 |
registry := NewTestEtcd(fakeClient) |
| 294 |
- err := registry.CreateRoute(kubeapi.NewContext(), &api.Route{
|
|
| 295 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 294 |
+ err := registry.CreateRoute(kapi.NewContext(), &api.Route{
|
|
| 295 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 296 | 296 |
ID: "foo", |
| 297 | 297 |
}, |
| 298 | 298 |
}) |
| ... | ... |
@@ -304,14 +304,14 @@ func TestEtcdCreateRouteFailsWithoutNamespace(t *testing.T) {
|
| 304 | 304 |
|
| 305 | 305 |
func TestEtcdListRoutesInDifferentNamespaces(t *testing.T) {
|
| 306 | 306 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 307 |
- namespaceAlfa := kubeapi.WithNamespace(kubeapi.NewContext(), "alfa") |
|
| 308 |
- namespaceBravo := kubeapi.WithNamespace(kubeapi.NewContext(), "bravo") |
|
| 307 |
+ namespaceAlfa := kapi.WithNamespace(kapi.NewContext(), "alfa") |
|
| 308 |
+ namespaceBravo := kapi.WithNamespace(kapi.NewContext(), "bravo") |
|
| 309 | 309 |
fakeClient.Data["/routes/alfa"] = tools.EtcdResponseWithError{
|
| 310 | 310 |
R: &etcd.Response{
|
| 311 | 311 |
Node: &etcd.Node{
|
| 312 | 312 |
Nodes: []*etcd.Node{
|
| 313 | 313 |
{
|
| 314 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kubeapi.TypeMeta{ID: "foo1"}}),
|
|
| 314 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kapi.TypeMeta{ID: "foo1"}}),
|
|
| 315 | 315 |
}, |
| 316 | 316 |
}, |
| 317 | 317 |
}, |
| ... | ... |
@@ -323,10 +323,10 @@ func TestEtcdListRoutesInDifferentNamespaces(t *testing.T) {
|
| 323 | 323 |
Node: &etcd.Node{
|
| 324 | 324 |
Nodes: []*etcd.Node{
|
| 325 | 325 |
{
|
| 326 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kubeapi.TypeMeta{ID: "foo2"}}),
|
|
| 326 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kapi.TypeMeta{ID: "foo2"}}),
|
|
| 327 | 327 |
}, |
| 328 | 328 |
{
|
| 329 |
- Value: runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kubeapi.TypeMeta{ID: "bar2"}}),
|
|
| 329 |
+ Value: runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kapi.TypeMeta{ID: "bar2"}}),
|
|
| 330 | 330 |
}, |
| 331 | 331 |
}, |
| 332 | 332 |
}, |
| ... | ... |
@@ -354,10 +354,10 @@ func TestEtcdListRoutesInDifferentNamespaces(t *testing.T) {
|
| 354 | 354 |
|
| 355 | 355 |
func TestEtcdGetRouteInDifferentNamespaces(t *testing.T) {
|
| 356 | 356 |
fakeClient := tools.NewFakeEtcdClient(t) |
| 357 |
- namespaceAlfa := kubeapi.WithNamespace(kubeapi.NewContext(), "alfa") |
|
| 358 |
- namespaceBravo := kubeapi.WithNamespace(kubeapi.NewContext(), "bravo") |
|
| 359 |
- fakeClient.Set("/routes/alfa/foo", runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 360 |
- fakeClient.Set("/routes/bravo/foo", runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kubeapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 357 |
+ namespaceAlfa := kapi.WithNamespace(kapi.NewContext(), "alfa") |
|
| 358 |
+ namespaceBravo := kapi.WithNamespace(kapi.NewContext(), "bravo") |
|
| 359 |
+ fakeClient.Set("/routes/alfa/foo", runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 360 |
+ fakeClient.Set("/routes/bravo/foo", runtime.EncodeOrDie(latest.Codec, &api.Route{TypeMeta: kapi.TypeMeta{ID: "foo"}}), 0)
|
|
| 361 | 361 |
registry := NewTestEtcd(fakeClient) |
| 362 | 362 |
|
| 363 | 363 |
alfaFoo, err := registry.GetRoute(namespaceAlfa, "foo") |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package route |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 6 | 6 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 7 | 7 |
|
| ... | ... |
@@ -11,15 +11,15 @@ import ( |
| 11 | 11 |
// Registry is an interface for things that know how to store Routes. |
| 12 | 12 |
type Registry interface {
|
| 13 | 13 |
// ListRoutes obtains list of routes that match a selector. |
| 14 |
- ListRoutes(ctx kubeapi.Context, selector labels.Selector) (*api.RouteList, error) |
|
| 14 |
+ ListRoutes(ctx kapi.Context, selector labels.Selector) (*api.RouteList, error) |
|
| 15 | 15 |
// GetRoute retrieves a specific route. |
| 16 |
- GetRoute(ctx kubeapi.Context, routeID string) (*api.Route, error) |
|
| 16 |
+ GetRoute(ctx kapi.Context, routeID string) (*api.Route, error) |
|
| 17 | 17 |
// CreateRoute creates a new route. |
| 18 |
- CreateRoute(ctx kubeapi.Context, route *api.Route) error |
|
| 18 |
+ CreateRoute(ctx kapi.Context, route *api.Route) error |
|
| 19 | 19 |
// UpdateRoute updates a route. |
| 20 |
- UpdateRoute(ctx kubeapi.Context, route *api.Route) error |
|
| 20 |
+ UpdateRoute(ctx kapi.Context, route *api.Route) error |
|
| 21 | 21 |
// DeleteRoute deletes a route. |
| 22 |
- DeleteRoute(ctx kubeapi.Context, routeID string) error |
|
| 22 |
+ DeleteRoute(ctx kapi.Context, routeID string) error |
|
| 23 | 23 |
// WatchRoutes watches for new/modified/deleted routes. |
| 24 |
- WatchRoutes(ctx kubeapi.Context, labels, fields labels.Selector, resourceVersion uint64) (watch.Interface, error) |
|
| 24 |
+ WatchRoutes(ctx kapi.Context, labels, fields labels.Selector, resourceVersion uint64) (watch.Interface, error) |
|
| 25 | 25 |
} |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 | 6 |
"code.google.com/p/go-uuid/uuid" |
| 7 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| ... | ... |
@@ -32,7 +32,7 @@ func (rs *REST) New() runtime.Object {
|
| 32 | 32 |
} |
| 33 | 33 |
|
| 34 | 34 |
// List obtains a list of Routes that match selector. |
| 35 |
-func (rs *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 35 |
+func (rs *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 36 | 36 |
list, err := rs.registry.ListRoutes(ctx, selector) |
| 37 | 37 |
if err != nil {
|
| 38 | 38 |
return nil, err |
| ... | ... |
@@ -41,7 +41,7 @@ func (rs *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (run |
| 41 | 41 |
} |
| 42 | 42 |
|
| 43 | 43 |
// Get obtains the route specified by its id. |
| 44 |
-func (rs *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 44 |
+func (rs *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 45 | 45 |
route, err := rs.registry.GetRoute(ctx, id) |
| 46 | 46 |
if err != nil {
|
| 47 | 47 |
return nil, err |
| ... | ... |
@@ -50,23 +50,23 @@ func (rs *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 | 52 |
// Delete asynchronously deletes the Route specified by its id. |
| 53 |
-func (rs *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 53 |
+func (rs *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 54 | 54 |
_, err := rs.registry.GetRoute(ctx, id) |
| 55 | 55 |
if err != nil {
|
| 56 | 56 |
return nil, err |
| 57 | 57 |
} |
| 58 | 58 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| 59 |
- return &kubeapi.Status{Status: kubeapi.StatusSuccess}, rs.registry.DeleteRoute(ctx, id)
|
|
| 59 |
+ return &kapi.Status{Status: kapi.StatusSuccess}, rs.registry.DeleteRoute(ctx, id)
|
|
| 60 | 60 |
}), nil |
| 61 | 61 |
} |
| 62 | 62 |
|
| 63 | 63 |
// Create registers a given new Route instance to rs.registry. |
| 64 |
-func (rs *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 64 |
+func (rs *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 65 | 65 |
route, ok := obj.(*api.Route) |
| 66 | 66 |
if !ok {
|
| 67 | 67 |
return nil, fmt.Errorf("not a route: %#v", obj)
|
| 68 | 68 |
} |
| 69 |
- if !kubeapi.ValidNamespace(ctx, &route.TypeMeta) {
|
|
| 69 |
+ if !kapi.ValidNamespace(ctx, &route.TypeMeta) {
|
|
| 70 | 70 |
return nil, errors.NewConflict("route", route.Namespace, fmt.Errorf("Route.Namespace does not match the provided context"))
|
| 71 | 71 |
} |
| 72 | 72 |
|
| ... | ... |
@@ -89,7 +89,7 @@ func (rs *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime. |
| 89 | 89 |
} |
| 90 | 90 |
|
| 91 | 91 |
// Update replaces a given Route instance with an existing instance in rs.registry. |
| 92 |
-func (rs *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 92 |
+func (rs *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 93 | 93 |
route, ok := obj.(*api.Route) |
| 94 | 94 |
if !ok {
|
| 95 | 95 |
return nil, fmt.Errorf("not a route: %#v", obj)
|
| ... | ... |
@@ -97,7 +97,7 @@ func (rs *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime. |
| 97 | 97 |
if len(route.ID) == 0 {
|
| 98 | 98 |
return nil, fmt.Errorf("id is unspecified: %#v", route)
|
| 99 | 99 |
} |
| 100 |
- if !kubeapi.ValidNamespace(ctx, &route.TypeMeta) {
|
|
| 100 |
+ if !kapi.ValidNamespace(ctx, &route.TypeMeta) {
|
|
| 101 | 101 |
return nil, errors.NewConflict("route", route.Namespace, fmt.Errorf("Route.Namespace does not match the provided context"))
|
| 102 | 102 |
} |
| 103 | 103 |
|
| ... | ... |
@@ -115,6 +115,6 @@ func (rs *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime. |
| 115 | 115 |
|
| 116 | 116 |
// Watch returns Routes events via a watch.Interface. |
| 117 | 117 |
// It implements apiserver.ResourceWatcher. |
| 118 |
-func (rs *REST) Watch(ctx kubeapi.Context, label, field labels.Selector, resourceVersion uint64) (watch.Interface, error) {
|
|
| 118 |
+func (rs *REST) Watch(ctx kapi.Context, label, field labels.Selector, resourceVersion uint64) (watch.Interface, error) {
|
|
| 119 | 119 |
return rs.registry.WatchRoutes(ctx, label, field, resourceVersion) |
| 120 | 120 |
} |
| ... | ... |
@@ -6,8 +6,8 @@ import ( |
| 6 | 6 |
"testing" |
| 7 | 7 |
"time" |
| 8 | 8 |
|
| 9 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 10 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 9 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 10 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 12 | 12 |
"github.com/openshift/origin/pkg/route/api" |
| 13 | 13 |
"github.com/openshift/origin/pkg/route/registry/test" |
| ... | ... |
@@ -23,7 +23,7 @@ func TestListRoutesEmptyList(t *testing.T) {
|
| 23 | 23 |
registry: mockRegistry, |
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 |
- routes, err := storage.List(kubeapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 26 |
+ routes, err := storage.List(kapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 27 | 27 |
if err != nil {
|
| 28 | 28 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 29 | 29 |
} |
| ... | ... |
@@ -38,12 +38,12 @@ func TestListRoutesPopulatedList(t *testing.T) {
|
| 38 | 38 |
mockRegistry.Routes = &api.RouteList{
|
| 39 | 39 |
Items: []api.Route{
|
| 40 | 40 |
{
|
| 41 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 41 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 42 | 42 |
ID: "foo", |
| 43 | 43 |
}, |
| 44 | 44 |
}, |
| 45 | 45 |
{
|
| 46 |
- TypeMeta: kubeapi.TypeMeta{
|
|
| 46 |
+ TypeMeta: kapi.TypeMeta{
|
|
| 47 | 47 |
ID: "bar", |
| 48 | 48 |
}, |
| 49 | 49 |
}, |
| ... | ... |
@@ -54,7 +54,7 @@ func TestListRoutesPopulatedList(t *testing.T) {
|
| 54 | 54 |
registry: mockRegistry, |
| 55 | 55 |
} |
| 56 | 56 |
|
| 57 |
- list, err := storage.List(kubeapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 57 |
+ list, err := storage.List(kapi.NewDefaultContext(), labels.Everything(), labels.Everything()) |
|
| 58 | 58 |
if err != nil {
|
| 59 | 59 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 60 | 60 |
} |
| ... | ... |
@@ -69,7 +69,7 @@ func TestListRoutesPopulatedList(t *testing.T) {
|
| 69 | 69 |
func TestCreateRouteBadObject(t *testing.T) {
|
| 70 | 70 |
storage := REST{}
|
| 71 | 71 |
|
| 72 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), &api.RouteList{})
|
|
| 72 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), &api.RouteList{})
|
|
| 73 | 73 |
if channel != nil {
|
| 74 | 74 |
t.Errorf("Expected nil, got %v", channel)
|
| 75 | 75 |
} |
| ... | ... |
@@ -82,8 +82,8 @@ func TestCreateRouteOK(t *testing.T) {
|
| 82 | 82 |
mockRegistry := test.NewRouteRegistry() |
| 83 | 83 |
storage := REST{registry: mockRegistry}
|
| 84 | 84 |
|
| 85 |
- channel, err := storage.Create(kubeapi.NewDefaultContext(), &api.Route{
|
|
| 86 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 85 |
+ channel, err := storage.Create(kapi.NewDefaultContext(), &api.Route{
|
|
| 86 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 87 | 87 |
Host: "www.frontend.com", |
| 88 | 88 |
ServiceName: "myrubyservice", |
| 89 | 89 |
}) |
| ... | ... |
@@ -113,7 +113,7 @@ func TestGetRouteError(t *testing.T) {
|
| 113 | 113 |
mockRegistry := test.NewRouteRegistry() |
| 114 | 114 |
storage := REST{registry: mockRegistry}
|
| 115 | 115 |
|
| 116 |
- route, err := storage.Get(kubeapi.NewDefaultContext(), "foo") |
|
| 116 |
+ route, err := storage.Get(kapi.NewDefaultContext(), "foo") |
|
| 117 | 117 |
if route != nil {
|
| 118 | 118 |
t.Errorf("Unexpected non-nil route: %#v", route)
|
| 119 | 119 |
} |
| ... | ... |
@@ -128,13 +128,13 @@ func TestGetRouteOK(t *testing.T) {
|
| 128 | 128 |
mockRegistry.Routes = &api.RouteList{
|
| 129 | 129 |
Items: []api.Route{
|
| 130 | 130 |
{
|
| 131 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 131 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 132 | 132 |
}, |
| 133 | 133 |
}, |
| 134 | 134 |
} |
| 135 | 135 |
storage := REST{registry: mockRegistry}
|
| 136 | 136 |
|
| 137 |
- route, err := storage.Get(kubeapi.NewDefaultContext(), "foo") |
|
| 137 |
+ route, err := storage.Get(kapi.NewDefaultContext(), "foo") |
|
| 138 | 138 |
if route == nil {
|
| 139 | 139 |
t.Error("Unexpected nil route")
|
| 140 | 140 |
} |
| ... | ... |
@@ -149,7 +149,7 @@ func TestGetRouteOK(t *testing.T) {
|
| 149 | 149 |
func TestUpdateRouteBadObject(t *testing.T) {
|
| 150 | 150 |
storage := REST{}
|
| 151 | 151 |
|
| 152 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), &api.RouteList{})
|
|
| 152 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), &api.RouteList{})
|
|
| 153 | 153 |
if channel != nil {
|
| 154 | 154 |
t.Errorf("Expected nil, got %v", channel)
|
| 155 | 155 |
} |
| ... | ... |
@@ -161,7 +161,7 @@ func TestUpdateRouteBadObject(t *testing.T) {
|
| 161 | 161 |
func TestUpdateRouteMissingID(t *testing.T) {
|
| 162 | 162 |
storage := REST{}
|
| 163 | 163 |
|
| 164 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), &api.Route{})
|
|
| 164 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), &api.Route{})
|
|
| 165 | 165 |
if channel != nil {
|
| 166 | 166 |
t.Errorf("Expected nil, got %v", channel)
|
| 167 | 167 |
} |
| ... | ... |
@@ -174,8 +174,8 @@ func TestUpdateRegistryErrorSaving(t *testing.T) {
|
| 174 | 174 |
mockRepositoryRegistry := test.NewRouteRegistry() |
| 175 | 175 |
storage := REST{registry: mockRepositoryRegistry}
|
| 176 | 176 |
|
| 177 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), &api.Route{
|
|
| 178 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 177 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), &api.Route{
|
|
| 178 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 179 | 179 |
Host: "www.frontend.com", |
| 180 | 180 |
ServiceName: "rubyservice", |
| 181 | 181 |
}) |
| ... | ... |
@@ -183,11 +183,11 @@ func TestUpdateRegistryErrorSaving(t *testing.T) {
|
| 183 | 183 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 184 | 184 |
} |
| 185 | 185 |
result := <-channel |
| 186 |
- status, ok := result.(*kubeapi.Status) |
|
| 186 |
+ status, ok := result.(*kapi.Status) |
|
| 187 | 187 |
if !ok {
|
| 188 | 188 |
t.Errorf("Expected status, got %#v", result)
|
| 189 | 189 |
} |
| 190 |
- if status.Status != kubeapi.StatusFailure || status.Message != "Route foo not found" {
|
|
| 190 |
+ if status.Status != kapi.StatusFailure || status.Message != "Route foo not found" {
|
|
| 191 | 191 |
t.Errorf("Expected status=failure, message=Route foo not found, got %#v", status)
|
| 192 | 192 |
} |
| 193 | 193 |
} |
| ... | ... |
@@ -197,7 +197,7 @@ func TestUpdateRouteOK(t *testing.T) {
|
| 197 | 197 |
mockRepositoryRegistry.Routes = &api.RouteList{
|
| 198 | 198 |
Items: []api.Route{
|
| 199 | 199 |
{
|
| 200 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar"},
|
|
| 200 |
+ TypeMeta: kapi.TypeMeta{ID: "bar"},
|
|
| 201 | 201 |
Host: "www.frontend.com", |
| 202 | 202 |
ServiceName: "rubyservice", |
| 203 | 203 |
}, |
| ... | ... |
@@ -206,8 +206,8 @@ func TestUpdateRouteOK(t *testing.T) {
|
| 206 | 206 |
|
| 207 | 207 |
storage := REST{registry: mockRepositoryRegistry}
|
| 208 | 208 |
|
| 209 |
- channel, err := storage.Update(kubeapi.NewDefaultContext(), &api.Route{
|
|
| 210 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar"},
|
|
| 209 |
+ channel, err := storage.Update(kapi.NewDefaultContext(), &api.Route{
|
|
| 210 |
+ TypeMeta: kapi.TypeMeta{ID: "bar"},
|
|
| 211 | 211 |
Host: "www.newfrontend.com", |
| 212 | 212 |
ServiceName: "newrubyservice", |
| 213 | 213 |
}) |
| ... | ... |
@@ -238,7 +238,7 @@ func TestUpdateRouteOK(t *testing.T) {
|
| 238 | 238 |
func TestDeleteRouteError(t *testing.T) {
|
| 239 | 239 |
mockRegistry := test.NewRouteRegistry() |
| 240 | 240 |
storage := REST{registry: mockRegistry}
|
| 241 |
- _, err := storage.Delete(kubeapi.NewDefaultContext(), "foo") |
|
| 241 |
+ _, err := storage.Delete(kapi.NewDefaultContext(), "foo") |
|
| 242 | 242 |
if err == nil {
|
| 243 | 243 |
t.Errorf("Unexpected nil error: %#v", err)
|
| 244 | 244 |
} |
| ... | ... |
@@ -252,12 +252,12 @@ func TestDeleteRouteOk(t *testing.T) {
|
| 252 | 252 |
mockRegistry.Routes = &api.RouteList{
|
| 253 | 253 |
Items: []api.Route{
|
| 254 | 254 |
{
|
| 255 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo"},
|
|
| 255 |
+ TypeMeta: kapi.TypeMeta{ID: "foo"},
|
|
| 256 | 256 |
}, |
| 257 | 257 |
}, |
| 258 | 258 |
} |
| 259 | 259 |
storage := REST{registry: mockRegistry}
|
| 260 |
- channel, err := storage.Delete(kubeapi.NewDefaultContext(), "foo") |
|
| 260 |
+ channel, err := storage.Delete(kapi.NewDefaultContext(), "foo") |
|
| 261 | 261 |
if channel == nil {
|
| 262 | 262 |
t.Error("Unexpected nil channel")
|
| 263 | 263 |
} |
| ... | ... |
@@ -267,11 +267,11 @@ func TestDeleteRouteOk(t *testing.T) {
|
| 267 | 267 |
|
| 268 | 268 |
select {
|
| 269 | 269 |
case result := <-channel: |
| 270 |
- status, ok := result.(*kubeapi.Status) |
|
| 270 |
+ status, ok := result.(*kapi.Status) |
|
| 271 | 271 |
if !ok {
|
| 272 | 272 |
t.Errorf("Expected status type, got: %#v", result)
|
| 273 | 273 |
} |
| 274 |
- if status.Status != kubeapi.StatusSuccess {
|
|
| 274 |
+ if status.Status != kapi.StatusSuccess {
|
|
| 275 | 275 |
t.Errorf("Expected status=success, got: %#v", status)
|
| 276 | 276 |
} |
| 277 | 277 |
case <-time.After(50 * time.Millisecond): |
| ... | ... |
@@ -283,8 +283,8 @@ func TestDeleteRouteOk(t *testing.T) {
|
| 283 | 283 |
func TestCreateRouteConflictingNamespace(t *testing.T) {
|
| 284 | 284 |
storage := REST{}
|
| 285 | 285 |
|
| 286 |
- channel, err := storage.Create(kubeapi.WithNamespace(kubeapi.NewContext(), "legal-name"), &api.Route{
|
|
| 287 |
- TypeMeta: kubeapi.TypeMeta{ID: "foo", Namespace: "some-value"},
|
|
| 286 |
+ channel, err := storage.Create(kapi.WithNamespace(kapi.NewContext(), "legal-name"), &api.Route{
|
|
| 287 |
+ TypeMeta: kapi.TypeMeta{ID: "foo", Namespace: "some-value"},
|
|
| 288 | 288 |
}) |
| 289 | 289 |
|
| 290 | 290 |
if channel != nil {
|
| ... | ... |
@@ -298,8 +298,8 @@ func TestUpdateRouteConflictingNamespace(t *testing.T) {
|
| 298 | 298 |
mockRepositoryRegistry := test.NewRouteRegistry() |
| 299 | 299 |
storage := REST{registry: mockRepositoryRegistry}
|
| 300 | 300 |
|
| 301 |
- channel, err := storage.Update(kubeapi.WithNamespace(kubeapi.NewContext(), "legal-name"), &api.Route{
|
|
| 302 |
- TypeMeta: kubeapi.TypeMeta{ID: "bar", Namespace: "some-value"},
|
|
| 301 |
+ channel, err := storage.Update(kapi.WithNamespace(kapi.NewContext(), "legal-name"), &api.Route{
|
|
| 302 |
+ TypeMeta: kapi.TypeMeta{ID: "bar", Namespace: "some-value"},
|
|
| 303 | 303 |
Host: "www.newfrontend.com", |
| 304 | 304 |
ServiceName: "newrubyservice", |
| 305 | 305 |
}) |
| ... | ... |
@@ -316,7 +316,7 @@ func checkExpectedNamespaceError(t *testing.T, err error) {
|
| 316 | 316 |
if err == nil {
|
| 317 | 317 |
t.Errorf("Expected '" + expectedError + "', but we didn't get one")
|
| 318 | 318 |
} else {
|
| 319 |
- e, ok := err.(kubeclient.APIStatus) |
|
| 319 |
+ e, ok := err.(kclient.APIStatus) |
|
| 320 | 320 |
if !ok {
|
| 321 | 321 |
t.Errorf("error was not a statusError: %v", err)
|
| 322 | 322 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package test |
| 3 | 3 |
import ( |
| 4 | 4 |
"errors" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 9 | 9 |
routeapi "github.com/openshift/origin/pkg/route/api" |
| ... | ... |
@@ -17,11 +17,11 @@ func NewRouteRegistry() *RouteRegistry {
|
| 17 | 17 |
return &RouteRegistry{}
|
| 18 | 18 |
} |
| 19 | 19 |
|
| 20 |
-func (r *RouteRegistry) ListRoutes(ctx kubeapi.Context, labels labels.Selector) (*routeapi.RouteList, error) {
|
|
| 20 |
+func (r *RouteRegistry) ListRoutes(ctx kapi.Context, labels labels.Selector) (*routeapi.RouteList, error) {
|
|
| 21 | 21 |
return r.Routes, nil |
| 22 | 22 |
} |
| 23 | 23 |
|
| 24 |
-func (r *RouteRegistry) GetRoute(ctx kubeapi.Context, id string) (*routeapi.Route, error) {
|
|
| 24 |
+func (r *RouteRegistry) GetRoute(ctx kapi.Context, id string) (*routeapi.Route, error) {
|
|
| 25 | 25 |
if r.Routes != nil {
|
| 26 | 26 |
for _, route := range r.Routes.Items {
|
| 27 | 27 |
if route.ID == id {
|
| ... | ... |
@@ -32,7 +32,7 @@ func (r *RouteRegistry) GetRoute(ctx kubeapi.Context, id string) (*routeapi.Rout |
| 32 | 32 |
return nil, errors.New("Route " + id + " not found")
|
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 |
-func (r *RouteRegistry) CreateRoute(ctx kubeapi.Context, route *routeapi.Route) error {
|
|
| 35 |
+func (r *RouteRegistry) CreateRoute(ctx kapi.Context, route *routeapi.Route) error {
|
|
| 36 | 36 |
if r.Routes == nil {
|
| 37 | 37 |
r.Routes = &routeapi.RouteList{}
|
| 38 | 38 |
} |
| ... | ... |
@@ -45,7 +45,7 @@ func (r *RouteRegistry) CreateRoute(ctx kubeapi.Context, route *routeapi.Route) |
| 45 | 45 |
return nil |
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 |
-func (r *RouteRegistry) UpdateRoute(ctx kubeapi.Context, route *routeapi.Route) error {
|
|
| 48 |
+func (r *RouteRegistry) UpdateRoute(ctx kapi.Context, route *routeapi.Route) error {
|
|
| 49 | 49 |
if r.Routes == nil {
|
| 50 | 50 |
r.Routes = &routeapi.RouteList{}
|
| 51 | 51 |
} |
| ... | ... |
@@ -67,7 +67,7 @@ func (r *RouteRegistry) UpdateRoute(ctx kubeapi.Context, route *routeapi.Route) |
| 67 | 67 |
return nil |
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 |
-func (r *RouteRegistry) DeleteRoute(ctx kubeapi.Context, id string) error {
|
|
| 70 |
+func (r *RouteRegistry) DeleteRoute(ctx kapi.Context, id string) error {
|
|
| 71 | 71 |
if r.Routes == nil {
|
| 72 | 72 |
r.Routes = &routeapi.RouteList{}
|
| 73 | 73 |
} |
| ... | ... |
@@ -81,6 +81,6 @@ func (r *RouteRegistry) DeleteRoute(ctx kubeapi.Context, id string) error {
|
| 81 | 81 |
return nil |
| 82 | 82 |
} |
| 83 | 83 |
|
| 84 |
-func (r *RouteRegistry) WatchRoutes(ctx kubeapi.Context, labels, fields labels.Selector, resourceVersion uint64) (watch.Interface, error) {
|
|
| 84 |
+func (r *RouteRegistry) WatchRoutes(ctx kapi.Context, labels, fields labels.Selector, resourceVersion uint64) (watch.Interface, error) {
|
|
| 85 | 85 |
return nil, nil |
| 86 | 86 |
} |
| ... | ... |
@@ -7,7 +7,7 @@ import ( |
| 7 | 7 |
|
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 9 | 9 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 10 |
- kubeclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 10 |
+ kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
|
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
| 13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| ... | ... |
@@ -22,13 +22,13 @@ import ( |
| 22 | 22 |
// in the system with actual running pods. |
| 23 | 23 |
type LBManager struct {
|
| 24 | 24 |
routes router.Router |
| 25 |
- endpointWatcher kubeclient.EndpointsInterface |
|
| 25 |
+ endpointWatcher kclient.EndpointsInterface |
|
| 26 | 26 |
routeWatcher osclient.Interface |
| 27 | 27 |
lock sync.Mutex |
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 | 30 |
// NewLBManager creates a new LBManager. |
| 31 |
-func NewLBManager(routes router.Router, endpointWatcher kubeclient.EndpointsInterface, routeWatcher osclient.Interface) *LBManager {
|
|
| 31 |
+func NewLBManager(routes router.Router, endpointWatcher kclient.EndpointsInterface, routeWatcher osclient.Interface) *LBManager {
|
|
| 32 | 32 |
lm := &LBManager{
|
| 33 | 33 |
routes: routes, |
| 34 | 34 |
endpointWatcher: endpointWatcher, |
| ... | ... |
@@ -1,13 +1,13 @@ |
| 1 | 1 |
package api |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 6 | 6 |
) |
| 7 | 7 |
|
| 8 | 8 |
// Template contains the inputs needed to produce a Config. |
| 9 | 9 |
type Template struct {
|
| 10 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 10 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 11 | 11 |
|
| 12 | 12 |
// Required: Name identifies the Template. |
| 13 | 13 |
Name string `json:"name" yaml:"name"` |
| ... | ... |
@@ -1,13 +1,13 @@ |
| 1 | 1 |
package v1beta1 |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1" |
|
| 5 | 5 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 6 | 6 |
) |
| 7 | 7 |
|
| 8 | 8 |
// Template contains the inputs needed to produce a Config. |
| 9 | 9 |
type Template struct {
|
| 10 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 10 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 11 | 11 |
|
| 12 | 12 |
// Required: Name identifies the Template. |
| 13 | 13 |
Name string `json:"name" yaml:"name"` |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"regexp" |
| 5 | 5 |
"strings" |
| 6 | 6 |
|
| 7 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/validation" |
| 10 | 10 |
|
| ... | ... |
@@ -35,11 +35,11 @@ func ValidateTemplate(template *api.Template) (errs errors.ErrorList) {
|
| 35 | 35 |
for i, item := range template.Items {
|
| 36 | 36 |
err := errors.ErrorList{}
|
| 37 | 37 |
switch obj := item.Object.(type) {
|
| 38 |
- case *kubeapi.ReplicationController: |
|
| 38 |
+ case *kapi.ReplicationController: |
|
| 39 | 39 |
err = validation.ValidateReplicationController(obj) |
| 40 |
- case *kubeapi.Pod: |
|
| 40 |
+ case *kapi.Pod: |
|
| 41 | 41 |
err = validation.ValidatePod(obj) |
| 42 |
- case *kubeapi.Service: |
|
| 42 |
+ case *kapi.Service: |
|
| 43 | 43 |
err = validation.ValidateService(obj) |
| 44 | 44 |
case *routeapi.Route: |
| 45 | 45 |
err = routevalidation.ValidateRoute(obj) |
| ... | ... |
@@ -3,7 +3,7 @@ package validation |
| 3 | 3 |
import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 8 | 8 |
|
| 9 | 9 |
"github.com/openshift/origin/pkg/template/api" |
| ... | ... |
@@ -47,27 +47,27 @@ func TestValidateTemplate(t *testing.T) {
|
| 47 | 47 |
}, |
| 48 | 48 |
{ // Template with ID, should pass
|
| 49 | 49 |
&api.Template{
|
| 50 |
- TypeMeta: kubeapi.TypeMeta{ID: "templateId"},
|
|
| 50 |
+ TypeMeta: kapi.TypeMeta{ID: "templateId"},
|
|
| 51 | 51 |
}, |
| 52 | 52 |
true, |
| 53 | 53 |
}, |
| 54 | 54 |
{ // Template with invalid Parameter, should fail on Parameter name
|
| 55 | 55 |
&api.Template{
|
| 56 |
- TypeMeta: kubeapi.TypeMeta{ID: "templateId"},
|
|
| 56 |
+ TypeMeta: kapi.TypeMeta{ID: "templateId"},
|
|
| 57 | 57 |
Parameters: []api.Parameter{{Name: "", Value: "1"}},
|
| 58 | 58 |
}, |
| 59 | 59 |
false, |
| 60 | 60 |
}, |
| 61 | 61 |
{ // Template with valid Parameter, should pass
|
| 62 | 62 |
&api.Template{
|
| 63 |
- TypeMeta: kubeapi.TypeMeta{ID: "templateId"},
|
|
| 63 |
+ TypeMeta: kapi.TypeMeta{ID: "templateId"},
|
|
| 64 | 64 |
Parameters: []api.Parameter{{Name: "VALID_NAME", Value: "1"}},
|
| 65 | 65 |
}, |
| 66 | 66 |
true, |
| 67 | 67 |
}, |
| 68 | 68 |
{ // Template with Item of unknown Kind, should pass
|
| 69 | 69 |
&api.Template{
|
| 70 |
- TypeMeta: kubeapi.TypeMeta{ID: "templateId"},
|
|
| 70 |
+ TypeMeta: kapi.TypeMeta{ID: "templateId"},
|
|
| 71 | 71 |
Parameters: []api.Parameter{{Name: "VALID_NAME", Value: "1"}},
|
| 72 | 72 |
Items: []runtime.EmbeddedObject{{}},
|
| 73 | 73 |
}, |
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
"math/rand" |
| 7 | 7 |
"time" |
| 8 | 8 |
|
| 9 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 9 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -29,15 +29,15 @@ func (s *Storage) New() runtime.Object {
|
| 29 | 29 |
return &api.Template{}
|
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 |
-func (s *Storage) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 32 |
+func (s *Storage) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 33 | 33 |
return nil, errors.New("template.Storage.List() is not implemented.")
|
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 |
-func (s *Storage) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 36 |
+func (s *Storage) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 37 | 37 |
return nil, errors.New("template.Storage.Get() is not implemented.")
|
| 38 | 38 |
} |
| 39 | 39 |
|
| 40 |
-func (s *Storage) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 40 |
+func (s *Storage) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 41 | 41 |
template, ok := obj.(*api.Template) |
| 42 | 42 |
if !ok {
|
| 43 | 43 |
return nil, errors.New("Not a template config.")
|
| ... | ... |
@@ -61,11 +61,11 @@ func (s *Storage) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtim |
| 61 | 61 |
}), nil |
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 |
-func (s *Storage) Update(ctx kubeapi.Context, template runtime.Object) (<-chan runtime.Object, error) {
|
|
| 64 |
+func (s *Storage) Update(ctx kapi.Context, template runtime.Object) (<-chan runtime.Object, error) {
|
|
| 65 | 65 |
return nil, errors.New("template.Storage.Update() is not implemented.")
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 |
-func (s *Storage) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 68 |
+func (s *Storage) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 69 | 69 |
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
| 70 | 70 |
return nil, errors.New("template.Storage.Delete() is not implemented.")
|
| 71 | 71 |
}), nil |
| ... | ... |
@@ -4,12 +4,12 @@ import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
"time" |
| 6 | 6 |
|
| 7 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 | 8 |
) |
| 9 | 9 |
|
| 10 | 10 |
func TestNewStorageInvalidType(t *testing.T) {
|
| 11 | 11 |
storage := NewStorage() |
| 12 |
- _, err := storage.Create(nil, &kubeapi.Pod{})
|
|
| 12 |
+ _, err := storage.Create(nil, &kapi.Pod{})
|
|
| 13 | 13 |
if err == nil {
|
| 14 | 14 |
t.Errorf("Expected type error.")
|
| 15 | 15 |
} |
| ... | ... |
@@ -36,8 +36,8 @@ func TestStorageNotImplementedFunctions(t *testing.T) {
|
| 36 | 36 |
} |
| 37 | 37 |
select {
|
| 38 | 38 |
case result := <-channel: |
| 39 |
- status, ok := result.(*kubeapi.Status) |
|
| 40 |
- if !ok || status.Status != kubeapi.StatusFailure {
|
|
| 39 |
+ status, ok := result.(*kapi.Status) |
|
| 40 |
+ if !ok || status.Status != kapi.StatusFailure {
|
|
| 41 | 41 |
t.Errorf("Expected not implemented error.")
|
| 42 | 42 |
} |
| 43 | 43 |
case <-time.After(time.Millisecond * 100): |
| ... | ... |
@@ -5,7 +5,7 @@ import ( |
| 5 | 5 |
"regexp" |
| 6 | 6 |
"strings" |
| 7 | 7 |
|
| 8 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 8 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
| 11 | 11 |
"github.com/golang/glog" |
| ... | ... |
@@ -90,10 +90,10 @@ func (p *TemplateProcessor) SubstituteParameters(t *api.Template) error {
|
| 90 | 90 |
|
| 91 | 91 |
for i, item := range t.Items {
|
| 92 | 92 |
switch obj := item.Object.(type) {
|
| 93 |
- case *kubeapi.ReplicationController: |
|
| 93 |
+ case *kapi.ReplicationController: |
|
| 94 | 94 |
p.substituteParametersInManifest(&obj.DesiredState.PodTemplate.DesiredState.Manifest, paramMap) |
| 95 | 95 |
t.Items[i] = runtime.EmbeddedObject{Object: obj}
|
| 96 |
- case *kubeapi.Pod: |
|
| 96 |
+ case *kapi.Pod: |
|
| 97 | 97 |
p.substituteParametersInManifest(&obj.DesiredState.Manifest, paramMap) |
| 98 | 98 |
t.Items[i] = runtime.EmbeddedObject{Object: obj}
|
| 99 | 99 |
case *deployapi.Deployment: |
| ... | ... |
@@ -113,7 +113,7 @@ func (p *TemplateProcessor) SubstituteParameters(t *api.Template) error {
|
| 113 | 113 |
// substituteParametersInManifest is a helper function that iterates |
| 114 | 114 |
// over the given manifest and substitutes all Parameter expression |
| 115 | 115 |
// occurances with their corresponding values. |
| 116 |
-func (p *TemplateProcessor) substituteParametersInManifest(manifest *kubeapi.ContainerManifest, paramMap map[string]string) {
|
|
| 116 |
+func (p *TemplateProcessor) substituteParametersInManifest(manifest *kapi.ContainerManifest, paramMap map[string]string) {
|
|
| 117 | 117 |
for i, _ := range manifest.Containers {
|
| 118 | 118 |
for e, _ := range manifest.Containers[i].Env {
|
| 119 | 119 |
envValue := &manifest.Containers[i].Env[e].Value |
| ... | ... |
@@ -1,14 +1,14 @@ |
| 1 | 1 |
package api |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
) |
| 6 | 6 |
|
| 7 | 7 |
// Auth system gets identity name and provider |
| 8 | 8 |
// POST to UserIdentityMapping, get back error or a filled out UserIdentityMapping object |
| 9 | 9 |
|
| 10 | 10 |
type User struct {
|
| 11 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 11 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 12 | 12 |
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` |
| 13 | 13 |
|
| 14 | 14 |
// Name is a human readable string uniquely representing this user at any time. |
| ... | ... |
@@ -18,12 +18,12 @@ type User struct {
|
| 18 | 18 |
} |
| 19 | 19 |
|
| 20 | 20 |
type UserList struct {
|
| 21 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 21 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 22 | 22 |
Items []User `json:"items,omitempty" yaml:"items,omitempty"` |
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 | 25 |
type Identity struct {
|
| 26 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 26 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 27 | 27 |
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` |
| 28 | 28 |
|
| 29 | 29 |
// Name is the unique identifier of a user within a given provider |
| ... | ... |
@@ -36,7 +36,7 @@ type Identity struct {
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
type UserIdentityMapping struct {
|
| 39 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 39 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 40 | 40 |
|
| 41 | 41 |
Identity Identity `json:"identity,omitempty" yaml:"identity,omitempty"` |
| 42 | 42 |
User User `json:"user,omitempty" yaml:"user,omitempty"` |
| ... | ... |
@@ -1,14 +1,14 @@ |
| 1 | 1 |
package v1beta1 |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 4 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 5 | 5 |
) |
| 6 | 6 |
|
| 7 | 7 |
// Auth system gets identity name and provider |
| 8 | 8 |
// POST to UserIdentityMapping, get back error or a filled out UserIdentityMapping object |
| 9 | 9 |
|
| 10 | 10 |
type User struct {
|
| 11 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 11 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 12 | 12 |
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` |
| 13 | 13 |
|
| 14 | 14 |
// Name is a human readable string uniquely representing this user at any time. |
| ... | ... |
@@ -18,12 +18,12 @@ type User struct {
|
| 18 | 18 |
} |
| 19 | 19 |
|
| 20 | 20 |
type UserList struct {
|
| 21 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 21 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 22 | 22 |
Items []User `json:"items,omitempty" yaml:"items,omitempty"` |
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 | 25 |
type Identity struct {
|
| 26 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 26 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 27 | 27 |
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` |
| 28 | 28 |
|
| 29 | 29 |
// Name is the unique identifier of a user within a given provider |
| ... | ... |
@@ -36,7 +36,7 @@ type Identity struct {
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
type UserIdentityMapping struct {
|
| 39 |
- kubeapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 39 |
+ kapi.TypeMeta `json:",inline" yaml:",inline"` |
|
| 40 | 40 |
|
| 41 | 41 |
Identity Identity `json:"identity,omitempty" yaml:"identity,omitempty"` |
| 42 | 42 |
User User `json:"user,omitempty" yaml:"user,omitempty"` |
| ... | ... |
@@ -3,7 +3,7 @@ package user |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -27,26 +27,26 @@ func (s *REST) New() runtime.Object {
|
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 | 29 |
// Get retrieves an UserIdentityMapping by id. |
| 30 |
-func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 30 |
+func (s *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 31 | 31 |
return s.registry.GetUser(id) |
| 32 | 32 |
} |
| 33 | 33 |
|
| 34 | 34 |
// List retrieves a list of UserIdentityMappings that match selector. |
| 35 |
-func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 35 |
+func (s *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 36 | 36 |
return nil, fmt.Errorf("not implemented")
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
// Create registers the given UserIdentityMapping. |
| 40 |
-func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 40 |
+func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 41 | 41 |
return nil, fmt.Errorf("not implemented")
|
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 | 44 |
// Update is not supported for UserIdentityMappings, as they are immutable. |
| 45 |
-func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 45 |
+func (s *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 46 | 46 |
return nil, fmt.Errorf("not implemented")
|
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 | 49 |
// Delete asynchronously deletes an UserIdentityMapping specified by its id. |
| 50 |
-func (s *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 50 |
+func (s *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 51 | 51 |
return nil, fmt.Errorf("not implemented")
|
| 52 | 52 |
} |
| ... | ... |
@@ -3,7 +3,7 @@ package useridentitymapping |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 |
- kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 6 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| ... | ... |
@@ -27,22 +27,22 @@ func (s *REST) New() runtime.Object {
|
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 | 29 |
// Get retrieves an UserIdentityMapping by id. |
| 30 |
-func (s *REST) Get(ctx kubeapi.Context, id string) (runtime.Object, error) {
|
|
| 30 |
+func (s *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
|
| 31 | 31 |
return nil, fmt.Errorf("not implemented")
|
| 32 | 32 |
} |
| 33 | 33 |
|
| 34 | 34 |
// List retrieves a list of UserIdentityMappings that match selector. |
| 35 |
-func (s *REST) List(ctx kubeapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 35 |
+func (s *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 36 | 36 |
return nil, fmt.Errorf("not implemented")
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
// Create is not supported for UserIdentityMappings |
| 40 |
-func (s *REST) Create(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 40 |
+func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 41 | 41 |
return nil, fmt.Errorf("not implemented")
|
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 | 44 |
// Update will create or update a UserIdentityMapping |
| 45 |
-func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 45 |
+func (s *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error) {
|
|
| 46 | 46 |
mapping, ok := obj.(*api.UserIdentityMapping) |
| 47 | 47 |
if !ok {
|
| 48 | 48 |
return nil, fmt.Errorf("not a user identity mapping: %#v", obj)
|
| ... | ... |
@@ -57,6 +57,6 @@ func (s *REST) Update(ctx kubeapi.Context, obj runtime.Object) (<-chan runtime.O |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 | 59 |
// Delete asynchronously deletes an UserIdentityMapping specified by its id. |
| 60 |
-func (s *REST) Delete(ctx kubeapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 60 |
+func (s *REST) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error) {
|
|
| 61 | 61 |
return nil, fmt.Errorf("not implemented")
|
| 62 | 62 |
} |
| ... | ... |
@@ -51,10 +51,10 @@ func TestBuildConfigClient(t *testing.T) {
|
| 51 | 51 |
apiserver.InstallSupport(osMux) |
| 52 | 52 |
s := httptest.NewServer(osMux) |
| 53 | 53 |
|
| 54 |
- kubeclient := client.NewOrDie(&client.Config{Host: s.URL, Version: klatest.Version})
|
|
| 54 |
+ kclient := client.NewOrDie(&client.Config{Host: s.URL, Version: klatest.Version})
|
|
| 55 | 55 |
osClient := osclient.NewOrDie(&client.Config{Host: s.URL, Version: latest.Version})
|
| 56 | 56 |
|
| 57 |
- info, err := kubeclient.ServerVersion() |
|
| 57 |
+ info, err := kclient.ServerVersion() |
|
| 58 | 58 |
if err != nil {
|
| 59 | 59 |
t.Fatalf("unexpected error: %v", err)
|
| 60 | 60 |
} |
| ... | ... |
@@ -51,10 +51,10 @@ func TestBuildClient(t *testing.T) {
|
| 51 | 51 |
apiserver.InstallSupport(osMux) |
| 52 | 52 |
s := httptest.NewServer(osMux) |
| 53 | 53 |
|
| 54 |
- kubeclient := client.NewOrDie(&client.Config{Host: s.URL, Version: klatest.Version})
|
|
| 54 |
+ kclient := client.NewOrDie(&client.Config{Host: s.URL, Version: klatest.Version})
|
|
| 55 | 55 |
osClient := osclient.NewOrDie(&client.Config{Host: s.URL, Version: latest.Version})
|
| 56 | 56 |
|
| 57 |
- info, err := kubeclient.ServerVersion() |
|
| 57 |
+ info, err := kclient.ServerVersion() |
|
| 58 | 58 |
if err != nil {
|
| 59 | 59 |
t.Fatalf("unexpected error: %v", err)
|
| 60 | 60 |
} |
| ... | ... |
@@ -130,7 +130,7 @@ func setup(t *testing.T) (*osclient.Client, string) {
|
| 130 | 130 |
apiserver.InstallSupport(osMux) |
| 131 | 131 |
s := httptest.NewServer(osMux) |
| 132 | 132 |
|
| 133 |
- kubeclient := client.NewOrDie(&client.Config{Host: s.URL, Version: klatest.Version})
|
|
| 133 |
+ kclient := client.NewOrDie(&client.Config{Host: s.URL, Version: klatest.Version})
|
|
| 134 | 134 |
osClient := osclient.NewOrDie(&client.Config{Host: s.URL, Version: latest.Version})
|
| 135 | 135 |
|
| 136 | 136 |
whPrefix := osPrefix + "/buildConfigHooks/" |
| ... | ... |
@@ -139,7 +139,7 @@ func setup(t *testing.T) (*osclient.Client, string) {
|
| 139 | 139 |
"github": github.New(), |
| 140 | 140 |
}))) |
| 141 | 141 |
|
| 142 |
- info, err := kubeclient.ServerVersion() |
|
| 142 |
+ info, err := kclient.ServerVersion() |
|
| 143 | 143 |
if err != nil {
|
| 144 | 144 |
t.Fatalf("Unexpected error: %v", err)
|
| 145 | 145 |
} |