Includes changes from Jhon Honce, Mark Turansky, and David Eads
| ... | ... |
@@ -32,7 +32,7 @@ func (p *alwaysCreateUserIdentityToUserMapper) UserFor(identityInfo authapi.User |
| 32 | 32 |
|
| 33 | 33 |
ret := &authapi.DefaultUserInfo{
|
| 34 | 34 |
Name: authoritativeMapping.User.Name, |
| 35 |
- UID: authoritativeMapping.User.UID, |
|
| 35 |
+ UID: string(authoritativeMapping.User.UID), |
|
| 36 | 36 |
Extra: authoritativeMapping.Identity.Extra, |
| 37 | 37 |
} |
| 38 | 38 |
return ret, err |
| ... | ... |
@@ -10,6 +10,7 @@ func init() {
|
| 10 | 10 |
&BuildList{},
|
| 11 | 11 |
&BuildConfig{},
|
| 12 | 12 |
&BuildConfigList{},
|
| 13 |
+ &BuildLog{},
|
|
| 13 | 14 |
) |
| 14 | 15 |
} |
| 15 | 16 |
|
| ... | ... |
@@ -17,3 +18,4 @@ func (*Build) IsAnAPIObject() {}
|
| 17 | 17 |
func (*BuildList) IsAnAPIObject() {}
|
| 18 | 18 |
func (*BuildConfig) IsAnAPIObject() {}
|
| 19 | 19 |
func (*BuildConfigList) IsAnAPIObject() {}
|
| 20 |
+func (*BuildLog) IsAnAPIObject() {}
|
| ... | ... |
@@ -332,3 +332,9 @@ type GitInfo struct {
|
| 332 | 332 |
GitBuildSource `json:",inline"` |
| 333 | 333 |
GitSourceRevision `json:",inline"` |
| 334 | 334 |
} |
| 335 |
+ |
|
| 336 |
+// BuildLog is the (unused) resource associated with the build log redirector |
|
| 337 |
+type BuildLog struct {
|
|
| 338 |
+ kapi.TypeMeta `json:",inline"` |
|
| 339 |
+ kapi.ListMeta `json:"metadata,omitempty"` |
|
| 340 |
+} |
| ... | ... |
@@ -10,11 +10,12 @@ func init() {
|
| 10 | 10 |
&BuildList{},
|
| 11 | 11 |
&BuildConfig{},
|
| 12 | 12 |
&BuildConfigList{},
|
| 13 |
+ &BuildLog{},
|
|
| 13 | 14 |
) |
| 14 |
- api.Scheme.AddKnownTypeWithName("v1beta1", "BuildLog", &Build{})
|
|
| 15 | 15 |
} |
| 16 | 16 |
|
| 17 | 17 |
func (*Build) IsAnAPIObject() {}
|
| 18 | 18 |
func (*BuildList) IsAnAPIObject() {}
|
| 19 | 19 |
func (*BuildConfig) IsAnAPIObject() {}
|
| 20 | 20 |
func (*BuildConfigList) IsAnAPIObject() {}
|
| 21 |
+func (*BuildLog) IsAnAPIObject() {}
|
| ... | ... |
@@ -57,8 +57,8 @@ const ( |
| 57 | 57 |
// BuildStatusRunning indicates that a pod has been created and a build is running. |
| 58 | 58 |
BuildStatusRunning BuildStatus = "Running" |
| 59 | 59 |
|
| 60 |
- BuildStatusComplete BuildStatus = "Complete" |
|
| 61 | 60 |
// BuildStatusComplete indicates that a build has been successful. |
| 61 |
+ BuildStatusComplete BuildStatus = "Complete" |
|
| 62 | 62 |
|
| 63 | 63 |
// BuildStatusFailed indicates that a build has executed and failed. |
| 64 | 64 |
BuildStatusFailed BuildStatus = "Failed" |
| ... | ... |
@@ -340,3 +340,9 @@ type GitInfo struct {
|
| 340 | 340 |
GitBuildSource `json:",inline"` |
| 341 | 341 |
GitSourceRevision `json:",inline"` |
| 342 | 342 |
} |
| 343 |
+ |
|
| 344 |
+// BuildLog is the (unused) resource associated with the build log redirector |
|
| 345 |
+type BuildLog struct {
|
|
| 346 |
+ kapi.TypeMeta `json:",inline"` |
|
| 347 |
+ kapi.ListMeta `json:"metadata,omitempty"` |
|
| 348 |
+} |
| ... | ... |
@@ -17,8 +17,8 @@ const dockerSocketPath = "/var/run/docker.sock" |
| 17 | 17 |
func setupDockerSocket(podSpec *kapi.Pod) {
|
| 18 | 18 |
dockerSocketVolume := kapi.Volume{
|
| 19 | 19 |
Name: "docker-socket", |
| 20 |
- Source: &kapi.VolumeSource{
|
|
| 21 |
- HostDir: &kapi.HostDir{
|
|
| 20 |
+ Source: kapi.VolumeSource{
|
|
| 21 |
+ HostPath: &kapi.HostPath{
|
|
| 22 | 22 |
Path: dockerSocketPath, |
| 23 | 23 |
}, |
| 24 | 24 |
}, |
| ... | ... |
@@ -44,8 +44,8 @@ func setupDockerConfig(podSpec *kapi.Pod) {
|
| 44 | 44 |
} |
| 45 | 45 |
dockerConfigVolume := kapi.Volume{
|
| 46 | 46 |
Name: "docker-cfg", |
| 47 |
- Source: &kapi.VolumeSource{
|
|
| 48 |
- HostDir: &kapi.HostDir{
|
|
| 47 |
+ Source: kapi.VolumeSource{
|
|
| 48 |
+ HostPath: &kapi.HostPath{
|
|
| 49 | 49 |
Path: dockerConfig, |
| 50 | 50 |
}, |
| 51 | 51 |
}, |
| ... | ... |
@@ -24,16 +24,19 @@ func TestSetupDockerSocketHostSocket(t *testing.T) {
|
| 24 | 24 |
if e, a := "docker-socket", volume.Name; e != a {
|
| 25 | 25 |
t.Errorf("Expected %s, got %s", e, a)
|
| 26 | 26 |
} |
| 27 |
- if volume.Source == nil {
|
|
| 27 |
+ if volume.Name == "" {
|
|
| 28 |
+ t.Fatalf("Unexpected empty volume source name")
|
|
| 29 |
+ } |
|
| 30 |
+ if isVolumeSourceEmpty(volume.Source) {
|
|
| 28 | 31 |
t.Fatalf("Unexpected nil volume source")
|
| 29 | 32 |
} |
| 30 |
- if volume.Source.HostDir == nil {
|
|
| 33 |
+ if volume.Source.HostPath == nil {
|
|
| 31 | 34 |
t.Fatalf("Unexpected nil host directory")
|
| 32 | 35 |
} |
| 33 | 36 |
if volume.Source.EmptyDir != nil {
|
| 34 | 37 |
t.Errorf("Unexpected non-nil empty directory: %#v", volume.Source.EmptyDir)
|
| 35 | 38 |
} |
| 36 |
- if e, a := "/var/run/docker.sock", volume.Source.HostDir.Path; e != a {
|
|
| 39 |
+ if e, a := "/var/run/docker.sock", volume.Source.HostPath.Path; e != a {
|
|
| 37 | 40 |
t.Errorf("Expected %s, got %s", e, a)
|
| 38 | 41 |
} |
| 39 | 42 |
|
| ... | ... |
@@ -52,6 +55,18 @@ func TestSetupDockerSocketHostSocket(t *testing.T) {
|
| 52 | 52 |
} |
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 |
+func isVolumeSourceEmpty(volumeSource kapi.VolumeSource) bool {
|
|
| 56 |
+ |
|
| 57 |
+ if volumeSource.EmptyDir == nil && |
|
| 58 |
+ volumeSource.HostPath == nil && |
|
| 59 |
+ volumeSource.GCEPersistentDisk == nil && |
|
| 60 |
+ volumeSource.GitRepo == nil {
|
|
| 61 |
+ return true |
|
| 62 |
+ } |
|
| 63 |
+ |
|
| 64 |
+ return false |
|
| 65 |
+} |
|
| 66 |
+ |
|
| 55 | 67 |
func TestSetupBuildEnvFails(t *testing.T) {
|
| 56 | 68 |
build := mockCustomBuild() |
| 57 | 69 |
containerEnv := []kapi.EnvVar{
|
| ... | ... |
@@ -7,7 +7,6 @@ import ( |
| 7 | 7 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" |
| 9 | 9 |
kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
| 10 |
- "github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
|
| 11 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 12 | 11 |
|
| 13 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| ... | ... |
@@ -35,7 +34,7 @@ func (r RealPodControl) getPod(namespace, name string) (*kapi.Pod, error) {
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
// NewREST creates a new REST for BuildLog |
| 38 |
-// Takes build registry and pod client to get neccessary attibutes to assamble |
|
| 38 |
+// Takes build registry and pod client to get necessary attributes to assemble |
|
| 39 | 39 |
// URL to which the request shall be redirected in order to get build logs. |
| 40 | 40 |
func NewREST(b build.Registry, pn kclient.PodsNamespacer) apiserver.RESTStorage {
|
| 41 | 41 |
return &REST{
|
| ... | ... |
@@ -99,25 +98,5 @@ func (r *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {
|
| 99 | 99 |
} |
| 100 | 100 |
|
| 101 | 101 |
func (r *REST) New() runtime.Object {
|
| 102 |
- return nil |
|
| 103 |
-} |
|
| 104 |
- |
|
| 105 |
-func (*REST) NewList() runtime.Object {
|
|
| 106 |
- return nil |
|
| 107 |
-} |
|
| 108 |
- |
|
| 109 |
-func (r *REST) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error) {
|
|
| 110 |
- return nil, fmt.Errorf("BuildLog can't be listed")
|
|
| 111 |
-} |
|
| 112 |
- |
|
| 113 |
-func (r *REST) Delete(ctx kapi.Context, id string) (<-chan apiserver.RESTResult, error) {
|
|
| 114 |
- return nil, fmt.Errorf("BuildLog can't be deleted")
|
|
| 115 |
-} |
|
| 116 |
- |
|
| 117 |
-func (r *REST) Create(ctx kapi.Context, obj runtime.Object) (<-chan apiserver.RESTResult, error) {
|
|
| 118 |
- return nil, fmt.Errorf("BuildLog can't be created")
|
|
| 119 |
-} |
|
| 120 |
- |
|
| 121 |
-func (r *REST) Update(ctx kapi.Context, obj runtime.Object) (<-chan apiserver.RESTResult, error) {
|
|
| 122 |
- return nil, fmt.Errorf("BuildLog can't be updated")
|
|
| 102 |
+ return &api.BuildLog{}
|
|
| 123 | 103 |
} |
| ... | ... |
@@ -98,7 +98,9 @@ func defaultClientConfig(flags *pflag.FlagSet) clientcmd.ClientConfig {
|
| 98 | 98 |
flags.StringVar(&loadingRules.CommandLinePath, "kubeconfig", "", "Path to the kubeconfig file to use for CLI requests.") |
| 99 | 99 |
|
| 100 | 100 |
overrides := &clientcmd.ConfigOverrides{}
|
| 101 |
- clientcmd.BindOverrideFlags(overrides, flags, clientcmd.RecommendedConfigOverrideFlags(""))
|
|
| 101 |
+ overrideFlags := clientcmd.RecommendedConfigOverrideFlags("")
|
|
| 102 |
+ overrideFlags.ContextOverrideFlags.NamespaceShort = "n" |
|
| 103 |
+ clientcmd.BindOverrideFlags(overrides, flags, overrideFlags) |
|
| 102 | 104 |
clientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, overrides) |
| 103 | 105 |
|
| 104 | 106 |
return clientConfig |
| ... | ... |
@@ -23,7 +23,8 @@ $ kubectl build-logs 566bed879d2d |
| 23 | 23 |
usageError(cmd, "<build> is a required argument") |
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 |
- namespace := getOriginNamespace(cmd) |
|
| 26 |
+ namespace, err := f.DefaultNamespace(cmd) |
|
| 27 |
+ checkErr(err) |
|
| 27 | 28 |
|
| 28 | 29 |
mapper, _ := f.Object(cmd) |
| 29 | 30 |
mapping, err := mapper.RESTMapping("BuildLog", kubecmd.GetFlagString(cmd, "api-version"))
|
| ... | ... |
@@ -3,9 +3,6 @@ package cmd |
| 3 | 3 |
import ( |
| 4 | 4 |
"os" |
| 5 | 5 |
|
| 6 |
- kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 7 |
- "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl" |
|
| 8 |
- kubecmd "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd" |
|
| 9 | 6 |
"github.com/golang/glog" |
| 10 | 7 |
"github.com/spf13/cobra" |
| 11 | 8 |
) |
| ... | ... |
@@ -21,20 +18,3 @@ func checkErr(err error) {
|
| 21 | 21 |
glog.FatalDepth(1, err) |
| 22 | 22 |
} |
| 23 | 23 |
} |
| 24 |
- |
|
| 25 |
-func getOriginNamespace(cmd *cobra.Command) string {
|
|
| 26 |
- result := kapi.NamespaceDefault |
|
| 27 |
- if ns := kubecmd.GetFlagString(cmd, "namespace"); len(ns) > 0 {
|
|
| 28 |
- result = ns |
|
| 29 |
- glog.V(2).Infof("Using namespace from -ns flag")
|
|
| 30 |
- } else {
|
|
| 31 |
- nsPath := kubecmd.GetFlagString(cmd, "ns-path") |
|
| 32 |
- nsInfo, err := kubectl.LoadNamespaceInfo(nsPath) |
|
| 33 |
- if err != nil {
|
|
| 34 |
- glog.Fatalf("Error loading current namespace: %v", err)
|
|
| 35 |
- } |
|
| 36 |
- result = nsInfo.Namespace |
|
| 37 |
- } |
|
| 38 |
- glog.V(2).Infof("Using namespace %s", result)
|
|
| 39 |
- return result |
|
| 40 |
-} |
| ... | ... |
@@ -57,10 +57,13 @@ Examples: |
| 57 | 57 |
schema, err := f.Validator(cmd) |
| 58 | 58 |
checkErr(err) |
| 59 | 59 |
|
| 60 |
- namespace := getOriginNamespace(cmd) |
|
| 60 |
+ cfg, err := f.ClientConfig(cmd) |
|
| 61 |
+ checkErr(err) |
|
| 62 |
+ namespace, err := f.DefaultNamespace(cmd) |
|
| 63 |
+ checkErr(err) |
|
| 61 | 64 |
mapper, typer := f.Object(cmd) |
| 62 | 65 |
|
| 63 |
- mapping, _, _, data := kubecmd.ResourceFromFile(cmd, filename, typer, mapper, schema) |
|
| 66 |
+ mapping, _, _, data := kubecmd.ResourceFromFile(filename, typer, mapper, schema, cfg.Version) |
|
| 64 | 67 |
obj, err := mapping.Codec.Decode(data) |
| 65 | 68 |
checkErr(err) |
| 66 | 69 |
|
| ... | ... |
@@ -67,7 +67,8 @@ func NewCmdRollback(parentName string, name string, f *Factory, out io.Writer) * |
| 67 | 67 |
osClient, _, err := f.Clients(cmd) |
| 68 | 68 |
checkErr(err) |
| 69 | 69 |
|
| 70 |
- namespace := getOriginNamespace(cmd) |
|
| 70 |
+ namespace, err := f.DefaultNamespace(cmd) |
|
| 71 |
+ checkErr(err) |
|
| 71 | 72 |
|
| 72 | 73 |
// Generate the rollback config |
| 73 | 74 |
newConfig, err := osClient.DeploymentConfigs(namespace).Rollback(rollback) |
| ... | ... |
@@ -7,6 +7,7 @@ import ( |
| 7 | 7 |
"reflect" |
| 8 | 8 |
"time" |
| 9 | 9 |
|
| 10 |
+ kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
|
| 10 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet" |
| 11 | 12 |
kconfig "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/config" |
| 12 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/proxy" |
| ... | ... |
@@ -14,6 +15,7 @@ import ( |
| 14 | 14 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
| 15 | 15 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/exec" |
| 16 | 16 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/iptables" |
| 17 |
+ |
|
| 17 | 18 |
"github.com/coreos/go-etcd/etcd" |
| 18 | 19 |
"github.com/fsouza/go-dockerclient" |
| 19 | 20 |
"github.com/golang/glog" |
| ... | ... |
@@ -21,6 +23,7 @@ import ( |
| 21 | 21 |
|
| 22 | 22 |
dockerutil "github.com/openshift/origin/pkg/cmd/util/docker" |
| 23 | 23 |
|
| 24 |
+ "github.com/openshift/origin/pkg/kubelet/app" |
|
| 24 | 25 |
"github.com/openshift/origin/pkg/service" |
| 25 | 26 |
) |
| 26 | 27 |
|
| ... | ... |
@@ -103,7 +106,9 @@ func (c *NodeConfig) RunKubelet() {
|
| 103 | 103 |
5, |
| 104 | 104 |
cfg.IsSourceSeen, |
| 105 | 105 |
"", |
| 106 |
- net.IP(util.IP{}))
|
|
| 106 |
+ net.IP(util.IP{}),
|
|
| 107 |
+ kapi.NamespaceDefault, |
|
| 108 |
+ app.ProbeVolumePlugins()) |
|
| 107 | 109 |
if err != nil {
|
| 108 | 110 |
glog.Fatalf("Couldn't run kubelet: %s", err)
|
| 109 | 111 |
} |
| ... | ... |
@@ -12,7 +12,7 @@ import ( |
| 12 | 12 |
|
| 13 | 13 |
etcdclient "github.com/coreos/go-etcd/etcd" |
| 14 | 14 |
"github.com/elazarl/go-bindata-assetfs" |
| 15 |
- "github.com/emicklei/go-restful" |
|
| 15 |
+ restful "github.com/emicklei/go-restful" |
|
| 16 | 16 |
"github.com/golang/glog" |
| 17 | 17 |
|
| 18 | 18 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| ... | ... |
@@ -285,7 +285,9 @@ func (c *MasterConfig) InstallAPI(container *restful.Container) []string {
|
| 285 | 285 |
|
| 286 | 286 |
admissionControl := admit.NewAlwaysAdmit() |
| 287 | 287 |
|
| 288 |
- apiserver.NewAPIGroupVersion(storage, v1beta1.Codec, OpenShiftAPIPrefixV1Beta1, latest.SelfLinker, admissionControl).InstallREST(container, OpenShiftAPIPrefix, "v1beta1") |
|
| 288 |
+ if err := apiserver.NewAPIGroupVersion(storage, v1beta1.Codec, OpenShiftAPIPrefixV1Beta1, latest.SelfLinker, admissionControl).InstallREST(container, container.ServeMux, OpenShiftAPIPrefix, "v1beta1"); err != nil {
|
|
| 289 |
+ glog.Fatalf("Unable to initialize API: %v", err)
|
|
| 290 |
+ } |
|
| 289 | 291 |
|
| 290 | 292 |
var root *restful.WebService |
| 291 | 293 |
for _, svc := range container.RegisteredWebServices() {
|
| 292 | 294 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,43 @@ |
| 0 |
+/* |
|
| 1 |
+Copyright 2014 Google Inc. All rights reserved. |
|
| 2 |
+ |
|
| 3 |
+Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 4 |
+you may not use this file except in compliance with the License. |
|
| 5 |
+You may obtain a copy of the License at |
|
| 6 |
+ |
|
| 7 |
+ http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 |
+ |
|
| 9 |
+Unless required by applicable law or agreed to in writing, software |
|
| 10 |
+distributed under the License is distributed on an "AS IS" BASIS, |
|
| 11 |
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 12 |
+See the License for the specific language governing permissions and |
|
| 13 |
+limitations under the License. |
|
| 14 |
+*/ |
|
| 15 |
+ |
|
| 16 |
+package app |
|
| 17 |
+ |
|
| 18 |
+// This file exists to force the desired plugin implementations to be linked. |
|
| 19 |
+import ( |
|
| 20 |
+ // Credential providers |
|
| 21 |
+ _ "github.com/GoogleCloudPlatform/kubernetes/pkg/credentialprovider/gcp" |
|
| 22 |
+ // Volume plugins |
|
| 23 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" |
|
| 24 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/empty_dir" |
|
| 25 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/gce_pd" |
|
| 26 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/git_repo" |
|
| 27 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/host_path" |
|
| 28 |
+) |
|
| 29 |
+ |
|
| 30 |
+func ProbeVolumePlugins() []volume.Plugin {
|
|
| 31 |
+ allPlugins := []volume.Plugin{}
|
|
| 32 |
+ |
|
| 33 |
+ // The list of plugins to probe is decided by the kubelet binary, not |
|
| 34 |
+ // by dynamic linking or other "magic". Plugins will be analyzed and |
|
| 35 |
+ // initialized later. |
|
| 36 |
+ allPlugins = append(allPlugins, empty_dir.ProbeVolumePlugins()...) |
|
| 37 |
+ allPlugins = append(allPlugins, gce_pd.ProbeVolumePlugins()...) |
|
| 38 |
+ allPlugins = append(allPlugins, git_repo.ProbeVolumePlugins()...) |
|
| 39 |
+ allPlugins = append(allPlugins, host_path.ProbeVolumePlugins()...) |
|
| 40 |
+ |
|
| 41 |
+ return allPlugins |
|
| 42 |
+} |
| ... | ... |
@@ -7,6 +7,7 @@ import ( |
| 7 | 7 |
"code.google.com/p/go-uuid/uuid" |
| 8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
| 10 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/types" |
|
| 10 | 11 |
|
| 11 | 12 |
"github.com/openshift/origin/pkg/user" |
| 12 | 13 |
"github.com/openshift/origin/pkg/user/api" |
| ... | ... |
@@ -62,14 +63,14 @@ func (r *Etcd) CreateOrUpdateUserIdentityMapping(mapping *api.UserIdentityMappin |
| 62 | 62 |
// did not previously exist |
| 63 | 63 |
if existing.Identity.Name == "" {
|
| 64 | 64 |
uid := uuid.New() |
| 65 |
- existing.User.UID = uid |
|
| 65 |
+ existing.User.UID = types.UID(uid) |
|
| 66 | 66 |
existing.User.Name = name |
| 67 | 67 |
if err := r.initializer.InitializeUser(&mapping.Identity, &existing.User); err != nil {
|
| 68 | 68 |
return in, err |
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 | 71 |
// set these again to prevent bad initialization from messing up data |
| 72 |
- existing.User.UID = uid |
|
| 72 |
+ existing.User.UID = types.UID(uid) |
|
| 73 | 73 |
existing.User.Name = name |
| 74 | 74 |
existing.Identity = mapping.Identity |
| 75 | 75 |
|
| ... | ... |
@@ -35,6 +35,7 @@ func init() {
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
func TestListBuilds(t *testing.T) {
|
| 38 |
+ |
|
| 38 | 39 |
deleteAllEtcdKeys() |
| 39 | 40 |
openshift := NewTestBuildOpenshift(t) |
| 40 | 41 |
defer openshift.Close() |
| ... | ... |
@@ -49,6 +50,7 @@ func TestListBuilds(t *testing.T) {
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
func TestCreateBuild(t *testing.T) {
|
| 52 |
+ |
|
| 52 | 53 |
deleteAllEtcdKeys() |
| 53 | 54 |
openshift := NewTestBuildOpenshift(t) |
| 54 | 55 |
defer openshift.Close() |
| ... | ... |
@@ -192,7 +194,7 @@ func NewTestBuildOpenshift(t *testing.T) *testBuildOpenshift {
|
| 192 | 192 |
} |
| 193 | 193 |
|
| 194 | 194 |
osPrefix := "/osapi/v1beta1" |
| 195 |
- apiserver.NewAPIGroupVersion(storage, latest.Codec, osPrefix, interfaces.MetadataAccessor, admit.NewAlwaysAdmit()).InstallREST(handlerContainer, "/osapi", "v1beta1") |
|
| 195 |
+ apiserver.NewAPIGroupVersion(storage, latest.Codec, osPrefix, interfaces.MetadataAccessor, admit.NewAlwaysAdmit()).InstallREST(handlerContainer, osMux, "/osapi", "v1beta1") |
|
| 196 | 196 |
|
| 197 | 197 |
openshift.whPrefix = osPrefix + "/buildConfigHooks/" |
| 198 | 198 |
osMux.Handle(openshift.whPrefix, http.StripPrefix(openshift.whPrefix, |
| ... | ... |
@@ -324,6 +324,7 @@ func NewTestOpenshift(t *testing.T) *testOpenshift {
|
| 324 | 324 |
etcdHelper, _ := master.NewEtcdHelper(etcdClient, klatest.Version) |
| 325 | 325 |
|
| 326 | 326 |
osMux := http.NewServeMux() |
| 327 |
+ muxHelper := &apiserver.MuxHelper{osMux, []string{}}
|
|
| 327 | 328 |
openshift.Server = httptest.NewServer(osMux) |
| 328 | 329 |
|
| 329 | 330 |
kubeClient := client.NewOrDie(&client.Config{Host: openshift.Server.URL, Version: klatest.Version})
|
| ... | ... |
@@ -376,7 +377,7 @@ func NewTestOpenshift(t *testing.T) *testOpenshift {
|
| 376 | 376 |
} |
| 377 | 377 |
|
| 378 | 378 |
osPrefix := "/osapi/v1beta1" |
| 379 |
- apiserver.NewAPIGroupVersion(storage, v1beta1.Codec, osPrefix, interfaces.MetadataAccessor, admit.NewAlwaysAdmit()).InstallREST(handlerContainer, "/osapi", "v1beta1") |
|
| 379 |
+ apiserver.NewAPIGroupVersion(storage, v1beta1.Codec, osPrefix, interfaces.MetadataAccessor, admit.NewAlwaysAdmit()).InstallREST(handlerContainer, muxHelper, "/osapi", "v1beta1") |
|
| 380 | 380 |
|
| 381 | 381 |
dccFactory := deploycontrollerfactory.DeploymentConfigControllerFactory{
|
| 382 | 382 |
Client: osClient, |
| ... | ... |
@@ -409,6 +410,7 @@ func NewTestOpenshift(t *testing.T) *testOpenshift {
|
| 409 | 409 |
} |
| 410 | 410 |
|
| 411 | 411 |
biccFactory.Create().Run() |
| 412 |
+ |
|
| 412 | 413 |
return openshift |
| 413 | 414 |
} |
| 414 | 415 |
|
| ... | ... |
@@ -232,7 +232,7 @@ func NewTestImageOpenShift(t *testing.T) *testImageOpenshift {
|
| 232 | 232 |
EtcdHelper: etcdHelper, |
| 233 | 233 |
HealthCheckMinions: false, |
| 234 | 234 |
KubeletClient: kubeletClient, |
| 235 |
- APIPrefix: "/api/v1beta1", |
|
| 235 |
+ APIPrefix: "/api", |
|
| 236 | 236 |
RestfulContainer: handlerContainer, |
| 237 | 237 |
}) |
| 238 | 238 |
|
| ... | ... |
@@ -248,7 +248,7 @@ func NewTestImageOpenShift(t *testing.T) *testImageOpenshift {
|
| 248 | 248 |
} |
| 249 | 249 |
|
| 250 | 250 |
osPrefix := "/osapi/v1beta1" |
| 251 |
- apiserver.NewAPIGroupVersion(storage, latest.Codec, osPrefix, interfaces.MetadataAccessor, admit.NewAlwaysAdmit()).InstallREST(handlerContainer, "/osapi", "v1beta1") |
|
| 251 |
+ apiserver.NewAPIGroupVersion(storage, latest.Codec, osPrefix, interfaces.MetadataAccessor, admit.NewAlwaysAdmit()).InstallREST(handlerContainer, osMux, "/osapi", "v1beta1") |
|
| 252 | 252 |
|
| 253 | 253 |
return openshift |
| 254 | 254 |
} |
| ... | ... |
@@ -199,7 +199,7 @@ func TestUserLookup(t *testing.T) {
|
| 199 | 199 |
if !ok {
|
| 200 | 200 |
t.Fatalf("should have been authenticated")
|
| 201 | 201 |
} |
| 202 |
- if user.Name != info.GetName() || user.UID != info.GetUID() {
|
|
| 202 |
+ if user.Name != info.GetName() || string(user.UID) != info.GetUID() {
|
|
| 203 | 203 |
t.Errorf("unexpected user info", info)
|
| 204 | 204 |
} |
| 205 | 205 |
} |
| ... | ... |
@@ -59,7 +59,7 @@ func TestTemplateTransformationFromConfig(t *testing.T) {
|
| 59 | 59 |
interfaces, _ := latest.InterfacesFor(latest.Version) |
| 60 | 60 |
osPrefix := "/osapi/v1beta1" |
| 61 | 61 |
handlerContainer := master.NewHandlerContainer(osMux) |
| 62 |
- apiserver.NewAPIGroupVersion(storage, latest.Codec, osPrefix, interfaces.MetadataAccessor, admit.NewAlwaysAdmit()).InstallREST(handlerContainer, "/osapi", "v1beta1") |
|
| 62 |
+ apiserver.NewAPIGroupVersion(storage, latest.Codec, osPrefix, interfaces.MetadataAccessor, admit.NewAlwaysAdmit()).InstallREST(handlerContainer, osMux, "/osapi", "v1beta1") |
|
| 63 | 63 |
|
| 64 | 64 |
walkJSONFiles("fixtures", func(name, path string, _ []byte) {
|
| 65 | 65 |
config := &config.Config{}
|