... | ... |
@@ -8,7 +8,7 @@ import ( |
8 | 8 |
"testing" |
9 | 9 |
|
10 | 10 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
11 |
- "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet" |
|
11 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities" |
|
12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
13 | 13 |
"github.com/golang/glog" |
14 | 14 |
|
... | ... |
@@ -58,7 +58,7 @@ func walkJSONFiles(inDir string, fn func(name, path string, data []byte)) error |
58 | 58 |
func TestExampleObjectSchemas(t *testing.T) { |
59 | 59 |
// Allow privileged containers |
60 | 60 |
// TODO: make this configurable and not the default https://github.com/openshift/origin/issues/662 |
61 |
- kubelet.SetupCapabilities(true, nil) |
|
61 |
+ capabilities.Setup(true, nil) |
|
62 | 62 |
cases := map[string]map[string]runtime.Object{ |
63 | 63 |
"../examples/hello-openshift": { |
64 | 64 |
"hello-pod": &kapi.Pod{}, |
... | ... |
@@ -40,7 +40,7 @@ func ValidateObject(obj runtime.Object) (errors []error) { |
40 | 40 |
case *kapi.Namespace: |
41 | 41 |
errors = validation.ValidateNamespace(t) |
42 | 42 |
case *kapi.Node: |
43 |
- errors = validation.ValidateMinion(t) |
|
43 |
+ errors = validation.ValidateNode(t) |
|
44 | 44 |
|
45 | 45 |
case *imageapi.Image: |
46 | 46 |
t.Namespace = "" |
... | ... |
@@ -297,7 +297,7 @@ func (c ControllerClient) CreatePod(namespace string, pod *kapi.Pod) (*kapi.Pod, |
297 | 297 |
|
298 | 298 |
// DeletePod destroys a pod using the Kubernetes client. |
299 | 299 |
func (c ControllerClient) DeletePod(namespace string, pod *kapi.Pod) error { |
300 |
- return c.KubeClient.Pods(namespace).Delete(pod.Name) |
|
300 |
+ return c.KubeClient.Pods(namespace).Delete(pod.Name, nil) |
|
301 | 301 |
} |
302 | 302 |
|
303 | 303 |
// GetImageStream retrieves an image repository by namespace and name |
... | ... |
@@ -143,8 +143,8 @@ func (r *REST) waitForBuild(ctx kapi.Context, build *api.Build) error { |
143 | 143 |
} |
144 | 144 |
|
145 | 145 |
// NewGetOptions returns a new options object for build logs |
146 |
-func (r *REST) NewGetOptions() runtime.Object { |
|
147 |
- return &api.BuildLogOptions{} |
|
146 |
+func (r *REST) NewGetOptions() (runtime.Object, bool, string) { |
|
147 |
+ return &api.BuildLogOptions{}, false, "" |
|
148 | 148 |
} |
149 | 149 |
|
150 | 150 |
// New creates an empty BuildLog resource |
... | ... |
@@ -11,6 +11,7 @@ import ( |
11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
14 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
14 | 15 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
15 | 16 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
16 | 17 |
|
... | ... |
@@ -21,7 +22,7 @@ import ( |
21 | 21 |
) |
22 | 22 |
|
23 | 23 |
func NewTestEtcd(client tools.EtcdClient) *Etcd { |
24 |
- return New(tools.NewEtcdHelper(client, latest.Codec)) |
|
24 |
+ return New(tools.NewEtcdHelper(client, latest.Codec, etcdtest.PathPrefix())) |
|
25 | 25 |
} |
26 | 26 |
|
27 | 27 |
// This copy and paste is not pure ignorance. This is that we can be sure that the key is getting made as we |
... | ... |
@@ -126,7 +126,7 @@ func RunEdit(fullName string, f *clientcmd.Factory, out io.Writer, cmd *cobra.Co |
126 | 126 |
defaultVersion := cmdutil.OutputVersion(cmd, clientConfig.Version) |
127 | 127 |
results := editResults{} |
128 | 128 |
for { |
129 |
- obj, err := resource.AsVersionedObject(infos, defaultVersion) |
|
129 |
+ obj, err := resource.AsVersionedObject(infos, false, defaultVersion) |
|
130 | 130 |
if err != nil { |
131 | 131 |
return preservedFile(err, results.file, cmd.Out()) |
132 | 132 |
} |
... | ... |
@@ -144,7 +144,10 @@ func RunNewApplication(f *clientcmd.Factory, out io.Writer, c *cobra.Command, ar |
144 | 144 |
|
145 | 145 |
label := cmdutil.GetFlagString(c, "labels") |
146 | 146 |
if len(label) != 0 { |
147 |
- lbl := ctl.ParseLabels(label) |
|
147 |
+ lbl, err := ctl.ParseLabels(label) |
|
148 |
+ if err != nil { |
|
149 |
+ return err |
|
150 |
+ } |
|
148 | 151 |
for _, object := range result.List.Items { |
149 | 152 |
err = util.AddObjectLabels(object, lbl) |
150 | 153 |
if err != nil { |
... | ... |
@@ -177,7 +177,10 @@ func RunProcess(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, args [] |
177 | 177 |
|
178 | 178 |
label := kcmdutil.GetFlagString(cmd, "labels") |
179 | 179 |
if len(label) != 0 { |
180 |
- lbl := ctl.ParseLabels(label) |
|
180 |
+ lbl, err := ctl.ParseLabels(label) |
|
181 |
+ if err != nil { |
|
182 |
+ return err |
|
183 |
+ } |
|
181 | 184 |
for key, value := range lbl { |
182 | 185 |
templateObj.ObjectLabels[key] = value |
183 | 186 |
} |
... | ... |
@@ -12,6 +12,7 @@ import ( |
12 | 12 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
13 | 13 |
kerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
14 | 14 |
kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
15 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/fields" |
|
15 | 16 |
kctl "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl" |
16 | 17 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
17 | 18 |
|
... | ... |
@@ -84,7 +85,7 @@ func NewDeploymentConfigDescriber(client client.Interface, kclient kclient.Inter |
84 | 84 |
return kclient.ReplicationControllers(namespace).Get(name) |
85 | 85 |
}, |
86 | 86 |
listPodsFunc: func(namespace string, selector labels.Selector) (*kapi.PodList, error) { |
87 |
- return kclient.Pods(namespace).List(selector) |
|
87 |
+ return kclient.Pods(namespace).List(selector, fields.Everything()) |
|
88 | 88 |
}, |
89 | 89 |
listEventsFunc: func(deploymentConfig *deployapi.DeploymentConfig) (*kapi.EventList, error) { |
90 | 90 |
return kclient.Events(deploymentConfig.Namespace).Search(deploymentConfig) |
... | ... |
@@ -266,7 +267,7 @@ func NewLatestDeploymentDescriber(client client.Interface, kclient kclient.Inter |
266 | 266 |
return kclient.ReplicationControllers(namespace).Get(name) |
267 | 267 |
}, |
268 | 268 |
listPodsFunc: func(namespace string, selector labels.Selector) (*kapi.PodList, error) { |
269 |
- return kclient.Pods(namespace).List(selector) |
|
269 |
+ return kclient.Pods(namespace).List(selector, fields.Everything()) |
|
270 | 270 |
}, |
271 | 271 |
listEventsFunc: func(deploymentConfig *deployapi.DeploymentConfig) (*kapi.EventList, error) { |
272 | 272 |
return kclient.Events(deploymentConfig.Namespace).Search(deploymentConfig) |
... | ... |
@@ -101,7 +101,7 @@ func (o OverwriteBootstrapPolicyOptions) OverwriteBootstrapPolicy() error { |
101 | 101 |
if err != nil { |
102 | 102 |
return err |
103 | 103 |
} |
104 |
- etcdHelper, err := newEtcdHelper(etcdClient, masterConfig.EtcdStorageConfig.OpenShiftStorageVersion) |
|
104 |
+ etcdHelper, err := newEtcdHelper(etcdClient, masterConfig.EtcdStorageConfig.OpenShiftStorageVersion, "openshift") |
|
105 | 105 |
if err != nil { |
106 | 106 |
return err |
107 | 107 |
} |
... | ... |
@@ -182,10 +182,10 @@ func OverwriteBootstrapPolicy(etcdHelper tools.EtcdHelper, masterNamespace, poli |
182 | 182 |
} |
183 | 183 |
|
184 | 184 |
// newEtcdHelper returns an EtcdHelper for the provided storage version. |
185 |
-func newEtcdHelper(client *etcdclient.Client, version string) (oshelper tools.EtcdHelper, err error) { |
|
185 |
+func newEtcdHelper(client *etcdclient.Client, version, prefix string) (oshelper tools.EtcdHelper, err error) { |
|
186 | 186 |
interfaces, err := latest.InterfacesFor(version) |
187 | 187 |
if err != nil { |
188 | 188 |
return tools.EtcdHelper{}, err |
189 | 189 |
} |
190 |
- return tools.NewEtcdHelper(client, interfaces.Codec), nil |
|
190 |
+ return tools.NewEtcdHelper(client, interfaces.Codec, prefix), nil |
|
191 | 191 |
} |
... | ... |
@@ -82,22 +82,22 @@ func (c *MasterConfig) InstallAPI(container *restful.Container) []string { |
82 | 82 |
} |
83 | 83 |
|
84 | 84 |
func (c *MasterConfig) RunNamespaceController() { |
85 |
- namespaceController := namespace.NewNamespaceManager(c.KubeClient) |
|
86 |
- namespaceController.Run(1 * time.Minute) |
|
85 |
+ namespaceController := namespace.NewNamespaceManager(c.KubeClient, 5*time.Minute) |
|
86 |
+ namespaceController.Run() |
|
87 | 87 |
glog.Infof("Started Kubernetes Namespace Manager") |
88 | 88 |
} |
89 | 89 |
|
90 | 90 |
// RunReplicationController starts the Kubernetes replication controller sync loop |
91 | 91 |
func (c *MasterConfig) RunReplicationController() { |
92 | 92 |
controllerManager := controller.NewReplicationManager(c.KubeClient) |
93 |
- controllerManager.Run(10 * time.Second) |
|
93 |
+ go controllerManager.Run(5, util.NeverStop) |
|
94 | 94 |
glog.Infof("Started Kubernetes Replication Manager") |
95 | 95 |
} |
96 | 96 |
|
97 | 97 |
// RunEndpointController starts the Kubernetes replication controller sync loop |
98 | 98 |
func (c *MasterConfig) RunEndpointController() { |
99 | 99 |
endpoints := service.NewEndpointController(c.KubeClient) |
100 |
- go util.Forever(func() { endpoints.SyncServiceEndpoints() }, time.Second*10) |
|
100 |
+ go endpoints.Run(5, util.NeverStop) |
|
101 | 101 |
|
102 | 102 |
glog.Infof("Started Kubernetes Endpoint Controller") |
103 | 103 |
} |
... | ... |
@@ -130,14 +130,9 @@ func (c *MasterConfig) RunMinionController() { |
130 | 130 |
}, |
131 | 131 |
} |
132 | 132 |
|
133 |
- kubeletClient, err := kclient.NewKubeletClient(c.KubeletClientConfig) |
|
134 |
- if err != nil { |
|
135 |
- glog.Fatalf("Failure to create kubelet client: %v", err) |
|
136 |
- } |
|
137 |
- |
|
138 | 133 |
minionController := minioncontroller.NewNodeController( |
139 | 134 |
nil, "", c.NodeHosts, nodeResources, |
140 |
- c.KubeClient, kubeletClient, |
|
135 |
+ c.KubeClient, |
|
141 | 136 |
10, // registerRetryCount |
142 | 137 |
5*time.Minute, // podEvictionTimeout |
143 | 138 |
|
... | ... |
@@ -146,6 +141,7 @@ func (c *MasterConfig) RunMinionController() { |
146 | 146 |
40*time.Second, // monitor grace |
147 | 147 |
1*time.Minute, // startup grace |
148 | 148 |
10*time.Second, // monitor period |
149 |
+ "openshift", |
|
149 | 150 |
) |
150 | 151 |
minionController.Run(10*time.Second, true) |
151 | 152 |
|
... | ... |
@@ -48,7 +48,7 @@ func BuildKubernetesMasterConfig(options configapi.MasterConfig, requestContextM |
48 | 48 |
if err != nil { |
49 | 49 |
return nil, err |
50 | 50 |
} |
51 |
- ketcdHelper, err := master.NewEtcdHelper(etcdClient, options.EtcdStorageConfig.KubernetesStorageVersion) |
|
51 |
+ ketcdHelper, err := master.NewEtcdHelper(etcdClient, options.EtcdStorageConfig.KubernetesStorageVersion, "kubernetes.io") |
|
52 | 52 |
if err != nil { |
53 | 53 |
return nil, fmt.Errorf("Error setting up Kubernetes server storage: %v", err) |
54 | 54 |
} |
... | ... |
@@ -12,16 +12,19 @@ import ( |
12 | 12 |
"time" |
13 | 13 |
|
14 | 14 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
15 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities" |
|
15 | 16 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record" |
16 | 17 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet" |
17 | 18 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/cadvisor" |
18 | 19 |
kconfig "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/config" |
20 |
+ kubecontainer "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/container" |
|
19 | 21 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools" |
20 | 22 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/proxy" |
21 | 23 |
pconfig "github.com/GoogleCloudPlatform/kubernetes/pkg/proxy/config" |
22 | 24 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
23 | 25 |
kexec "github.com/GoogleCloudPlatform/kubernetes/pkg/util/exec" |
24 | 26 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/iptables" |
27 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util/mount" |
|
25 | 28 |
dockerclient "github.com/fsouza/go-dockerclient" |
26 | 29 |
"github.com/golang/glog" |
27 | 30 |
|
... | ... |
@@ -92,7 +95,7 @@ func (c *NodeConfig) HandleDockerError(message string) { |
92 | 92 |
glog.Fatalf("ERROR: %s", message) |
93 | 93 |
} |
94 | 94 |
glog.Errorf("WARNING: %s", message) |
95 |
- c.DockerClient = &dockertools.FakeDockerClient{VersionInfo: dockerclient.Env{"apiversion=1.15"}} |
|
95 |
+ c.DockerClient = &dockertools.FakeDockerClient{VersionInfo: dockerclient.Env{"ApiVersion=1.18"}} |
|
96 | 96 |
} |
97 | 97 |
|
98 | 98 |
// EnsureVolumeDir attempts to convert the provided volume directory argument to |
... | ... |
@@ -155,7 +158,7 @@ func (c *NodeConfig) RunKubelet() { |
155 | 155 |
// initialize Kubelet |
156 | 156 |
// Allow privileged containers |
157 | 157 |
// TODO: make this configurable and not the default https://github.com/openshift/origin/issues/662 |
158 |
- kubelet.SetupCapabilities(true, hostNetworkCapabilities) |
|
158 |
+ capabilities.Setup(true, hostNetworkCapabilities) |
|
159 | 159 |
recorder := record.NewBroadcaster().NewRecorder(kapi.EventSource{Component: "kubelet", Host: c.NodeHost}) |
160 | 160 |
|
161 | 161 |
cfg := kconfig.NewPodConfig(kconfig.PodConfigNotificationSnapshotAndUpdates, recorder) |
... | ... |
@@ -206,6 +209,11 @@ func (c *NodeConfig) RunKubelet() { |
206 | 206 |
imageGCPolicy, |
207 | 207 |
nil, |
208 | 208 |
15*time.Second, |
209 |
+ "/kubelet", |
|
210 |
+ kubecontainer.RealOS{}, |
|
211 |
+ "", |
|
212 |
+ "docker", |
|
213 |
+ mount.New(), |
|
209 | 214 |
) |
210 | 215 |
if err != nil { |
211 | 216 |
glog.Fatalf("Couldn't run kubelet: %s", err) |
... | ... |
@@ -38,7 +38,7 @@ func BuildAuthConfig(options configapi.MasterConfig) (*AuthConfig, error) { |
38 | 38 |
if err != nil { |
39 | 39 |
return nil, err |
40 | 40 |
} |
41 |
- etcdHelper, err := NewEtcdHelper(client, options.EtcdStorageConfig.OpenShiftStorageVersion) |
|
41 |
+ etcdHelper, err := NewEtcdHelper(client, options.EtcdStorageConfig.OpenShiftStorageVersion, "openshift") |
|
42 | 42 |
if err != nil { |
43 | 43 |
return nil, fmt.Errorf("Error setting up server storage: %v", err) |
44 | 44 |
} |
... | ... |
@@ -97,7 +97,7 @@ func BuildMasterConfig(options configapi.MasterConfig) (*MasterConfig, error) { |
97 | 97 |
if err != nil { |
98 | 98 |
return nil, err |
99 | 99 |
} |
100 |
- etcdHelper, err := NewEtcdHelper(client, options.EtcdStorageConfig.OpenShiftStorageVersion) |
|
100 |
+ etcdHelper, err := NewEtcdHelper(client, options.EtcdStorageConfig.OpenShiftStorageVersion, "openshift") |
|
101 | 101 |
if err != nil { |
102 | 102 |
return nil, fmt.Errorf("Error setting up server storage: %v", err) |
103 | 103 |
} |
... | ... |
@@ -314,10 +314,10 @@ func (c *MasterConfig) OriginNamespaceControllerClients() (*osclient.Client, *kc |
314 | 314 |
} |
315 | 315 |
|
316 | 316 |
// NewEtcdHelper returns an EtcdHelper for the provided storage version. |
317 |
-func NewEtcdHelper(client *etcdclient.Client, version string) (oshelper tools.EtcdHelper, err error) { |
|
317 |
+func NewEtcdHelper(client *etcdclient.Client, version, prefix string) (oshelper tools.EtcdHelper, err error) { |
|
318 | 318 |
interfaces, err := latest.InterfacesFor(version) |
319 | 319 |
if err != nil { |
320 | 320 |
return tools.EtcdHelper{}, err |
321 | 321 |
} |
322 |
- return tools.NewEtcdHelper(client, interfaces.Codec), nil |
|
322 |
+ return tools.NewEtcdHelper(client, interfaces.Codec, prefix), nil |
|
323 | 323 |
} |
... | ... |
@@ -62,7 +62,7 @@ func (factory *DeploymentControllerFactory) Create() controller.RunnableControll |
62 | 62 |
return factory.KubeClient.Pods(namespace).Create(pod) |
63 | 63 |
}, |
64 | 64 |
deletePodFunc: func(namespace, name string) error { |
65 |
- return factory.KubeClient.Pods(namespace).Delete(name) |
|
65 |
+ return factory.KubeClient.Pods(namespace).Delete(name, nil) |
|
66 | 66 |
}, |
67 | 67 |
}, |
68 | 68 |
makeContainer: func(strategy *deployapi.DeploymentStrategy) (*kapi.Container, error) { |
... | ... |
@@ -13,6 +13,7 @@ import ( |
13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
14 | 14 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
15 | 15 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
16 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
16 | 17 |
|
17 | 18 |
"github.com/openshift/origin/pkg/api/latest" |
18 | 19 |
"github.com/openshift/origin/pkg/deploy/api" |
... | ... |
@@ -54,7 +55,7 @@ func makeTestDefaultDeploymentConfigListKey() string { |
54 | 54 |
} |
55 | 55 |
|
56 | 56 |
func NewTestEtcd(client tools.EtcdClient) *Etcd { |
57 |
- return New(tools.NewEtcdHelper(client, latest.Codec)) |
|
57 |
+ return New(tools.NewEtcdHelper(client, latest.Codec, etcdtest.PathPrefix())) |
|
58 | 58 |
} |
59 | 59 |
|
60 | 60 |
func TestEtcdListEmptyDeployments(t *testing.T) { |
... | ... |
@@ -14,6 +14,7 @@ import ( |
14 | 14 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
15 | 15 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
16 | 16 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
17 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
17 | 18 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
18 | 19 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
19 | 20 |
"github.com/coreos/go-etcd/etcd" |
... | ... |
@@ -60,7 +61,7 @@ func makeTestDefaultImageRepositoriesListKey() string { |
60 | 60 |
func newHelper(t *testing.T) (*tools.FakeEtcdClient, tools.EtcdHelper) { |
61 | 61 |
fakeEtcdClient := tools.NewFakeEtcdClient(t) |
62 | 62 |
fakeEtcdClient.TestIndex = true |
63 |
- helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec) |
|
63 |
+ helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) |
|
64 | 64 |
return fakeEtcdClient, helper |
65 | 65 |
} |
66 | 66 |
|
... | ... |
@@ -12,6 +12,7 @@ import ( |
12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
14 | 14 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
15 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
15 | 16 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
16 | 17 |
"github.com/coreos/go-etcd/etcd" |
17 | 18 |
|
... | ... |
@@ -54,7 +55,7 @@ func (u *fakeUser) GetGroups() []string { |
54 | 54 |
func newTestHelpers(t *testing.T) (*tools.FakeEtcdClient, tools.EtcdHelper, *REST, *StatusREST) { |
55 | 55 |
fakeEtcdClient := tools.NewFakeEtcdClient(t) |
56 | 56 |
fakeEtcdClient.TestIndex = true |
57 |
- helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec) |
|
57 |
+ helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) |
|
58 | 58 |
imageStreamStorage, imageStreamStatusStorage := imagestreametcd.NewREST(helper, testDefaultRegistry, &fakeSubjectAccessReviewRegistry{}) |
59 | 59 |
imageStreamRegistry := imagestream.NewRegistry(imageStreamStorage, imageStreamStatusStorage) |
60 | 60 |
storage, statusStorage := NewREST(imageStreamRegistry) |
... | ... |
@@ -10,6 +10,7 @@ import ( |
10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
13 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
13 | 14 |
"github.com/coreos/go-etcd/etcd" |
14 | 15 |
|
15 | 16 |
"github.com/openshift/origin/pkg/api/latest" |
... | ... |
@@ -37,7 +38,7 @@ func (f *fakeSubjectAccessReviewRegistry) CreateSubjectAccessReview(ctx kapi.Con |
37 | 37 |
func setup(t *testing.T) (*tools.FakeEtcdClient, tools.EtcdHelper, *REST) { |
38 | 38 |
fakeEtcdClient := tools.NewFakeEtcdClient(t) |
39 | 39 |
fakeEtcdClient.TestIndex = true |
40 |
- helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec) |
|
40 |
+ helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) |
|
41 | 41 |
imageStorage := imageetcd.NewREST(helper) |
42 | 42 |
imageRegistry := image.NewRegistry(imageStorage) |
43 | 43 |
imageStreamStorage, imageStreamStatus := imagestreametcd.NewREST(helper, testDefaultRegistry, &fakeSubjectAccessReviewRegistry{}) |
... | ... |
@@ -9,6 +9,7 @@ import ( |
9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/auth/user" |
10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
12 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
12 | 13 |
"github.com/coreos/go-etcd/etcd" |
13 | 14 |
|
14 | 15 |
"github.com/openshift/origin/pkg/api/latest" |
... | ... |
@@ -53,7 +54,7 @@ func (u *fakeUser) GetGroups() []string { |
53 | 53 |
func setup(t *testing.T) (*tools.FakeEtcdClient, tools.EtcdHelper, *REST) { |
54 | 54 |
fakeEtcdClient := tools.NewFakeEtcdClient(t) |
55 | 55 |
fakeEtcdClient.TestIndex = true |
56 |
- helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec) |
|
56 |
+ helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) |
|
57 | 57 |
imageStorage := imageetcd.NewREST(helper) |
58 | 58 |
imageRegistry := image.NewRegistry(imageStorage) |
59 | 59 |
imageStreamStorage, imageStreamStatus := imagestreametcd.NewREST(helper, testDefaultRegistry, &fakeSubjectAccessReviewRegistry{}) |
... | ... |
@@ -12,6 +12,7 @@ import ( |
12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
14 | 14 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
15 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
15 | 16 |
"github.com/coreos/go-etcd/etcd" |
16 | 17 |
"github.com/openshift/origin/pkg/api/latest" |
17 | 18 |
authorizationapi "github.com/openshift/origin/pkg/authorization/api" |
... | ... |
@@ -43,7 +44,7 @@ func (f *fakeSubjectAccessReviewRegistry) CreateSubjectAccessReview(ctx kapi.Con |
43 | 43 |
func newHelper(t *testing.T) (*tools.FakeEtcdClient, tools.EtcdHelper) { |
44 | 44 |
fakeEtcdClient := tools.NewFakeEtcdClient(t) |
45 | 45 |
fakeEtcdClient.TestIndex = true |
46 |
- helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec) |
|
46 |
+ helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) |
|
47 | 47 |
return fakeEtcdClient, helper |
48 | 48 |
} |
49 | 49 |
|
... | ... |
@@ -4,6 +4,7 @@ import ( |
4 | 4 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
5 | 5 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
6 | 6 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
7 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
7 | 8 |
"github.com/coreos/go-etcd/etcd" |
8 | 9 |
"github.com/openshift/origin/pkg/api/latest" |
9 | 10 |
authorizationapi "github.com/openshift/origin/pkg/authorization/api" |
... | ... |
@@ -30,7 +31,7 @@ func (f *fakeSubjectAccessReviewRegistry) CreateSubjectAccessReview(ctx kapi.Con |
30 | 30 |
func setup(t *testing.T) (*tools.FakeEtcdClient, tools.EtcdHelper, *REST) { |
31 | 31 |
fakeEtcdClient := tools.NewFakeEtcdClient(t) |
32 | 32 |
fakeEtcdClient.TestIndex = true |
33 |
- helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec) |
|
33 |
+ helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) |
|
34 | 34 |
imageStorage := imageetcd.NewREST(helper) |
35 | 35 |
imageRegistry := image.NewRegistry(imageStorage) |
36 | 36 |
imageStreamStorage, imageStreamStatus := imagestreametcd.NewREST(helper, testDefaultRegistry, &fakeSubjectAccessReviewRegistry{}) |
... | ... |
@@ -10,6 +10,7 @@ import ( |
10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
13 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
13 | 14 |
"github.com/coreos/go-etcd/etcd" |
14 | 15 |
|
15 | 16 |
"github.com/openshift/origin/pkg/api/latest" |
... | ... |
@@ -36,7 +37,7 @@ func (f *fakeSubjectAccessReviewRegistry) CreateSubjectAccessReview(ctx kapi.Con |
36 | 36 |
func setup(t *testing.T) (*tools.FakeEtcdClient, tools.EtcdHelper, *REST) { |
37 | 37 |
fakeEtcdClient := tools.NewFakeEtcdClient(t) |
38 | 38 |
fakeEtcdClient.TestIndex = true |
39 |
- helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec) |
|
39 |
+ helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) |
|
40 | 40 |
imageStorage := imageetcd.NewREST(helper) |
41 | 41 |
imageRegistry := image.NewRegistry(imageStorage) |
42 | 42 |
imageStreamStorage, imageStreamStatus := imagestreametcd.NewREST(helper, testDefaultRegistry, &fakeSubjectAccessReviewRegistry{}) |
... | ... |
@@ -9,6 +9,7 @@ import ( |
9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/auth/user" |
10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
12 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
12 | 13 |
"github.com/coreos/go-etcd/etcd" |
13 | 14 |
|
14 | 15 |
"github.com/openshift/origin/pkg/api/latest" |
... | ... |
@@ -52,7 +53,7 @@ func (u *fakeUser) GetGroups() []string { |
52 | 52 |
func setup(t *testing.T) (*tools.FakeEtcdClient, tools.EtcdHelper, *REST) { |
53 | 53 |
fakeEtcdClient := tools.NewFakeEtcdClient(t) |
54 | 54 |
fakeEtcdClient.TestIndex = true |
55 |
- helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec) |
|
55 |
+ helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) |
|
56 | 56 |
imageStorage := imageetcd.NewREST(helper) |
57 | 57 |
imageRegistry := image.NewRegistry(imageStorage) |
58 | 58 |
imageStreamStorage, imageStreamStatus := imagestreametcd.NewREST(helper, testDefaultRegistry, &fakeSubjectAccessReviewRegistry{}) |
... | ... |
@@ -42,7 +42,7 @@ func TestAdmissionExists(t *testing.T) { |
42 | 42 |
}, |
43 | 43 |
Status: buildapi.BuildStatusNew, |
44 | 44 |
} |
45 |
- err := handler.Admit(admission.NewAttributesRecord(build, "bogus-ns", "builds", "CREATE")) |
|
45 |
+ err := handler.Admit(admission.NewAttributesRecord(build, "Build", "bogus-ns", "builds", "CREATE")) |
|
46 | 46 |
if err == nil { |
47 | 47 |
t.Errorf("Expected an error because namespace does not exist") |
48 | 48 |
} |
... | ... |
@@ -86,7 +86,7 @@ func TestAdmissionLifecycle(t *testing.T) { |
86 | 86 |
}, |
87 | 87 |
Status: buildapi.BuildStatusNew, |
88 | 88 |
} |
89 |
- err := handler.Admit(admission.NewAttributesRecord(build, namespaceObj.Namespace, "builds", "CREATE")) |
|
89 |
+ err := handler.Admit(admission.NewAttributesRecord(build, "Build", namespaceObj.Namespace, "builds", "CREATE")) |
|
90 | 90 |
if err != nil { |
91 | 91 |
t.Errorf("Unexpected error returned from admission handler: %v", err) |
92 | 92 |
} |
... | ... |
@@ -96,19 +96,19 @@ func TestAdmissionLifecycle(t *testing.T) { |
96 | 96 |
store.Add(namespaceObj) |
97 | 97 |
|
98 | 98 |
// verify create operations in the namespace cause an error |
99 |
- err = handler.Admit(admission.NewAttributesRecord(build, namespaceObj.Namespace, "builds", "CREATE")) |
|
99 |
+ err = handler.Admit(admission.NewAttributesRecord(build, "Build", namespaceObj.Namespace, "builds", "CREATE")) |
|
100 | 100 |
if err == nil { |
101 | 101 |
t.Errorf("Expected error rejecting creates in a namespace when it is terminating") |
102 | 102 |
} |
103 | 103 |
|
104 | 104 |
// verify update operations in the namespace can proceed |
105 |
- err = handler.Admit(admission.NewAttributesRecord(build, namespaceObj.Namespace, "builds", "UPDATE")) |
|
105 |
+ err = handler.Admit(admission.NewAttributesRecord(build, "Build", namespaceObj.Namespace, "builds", "UPDATE")) |
|
106 | 106 |
if err != nil { |
107 | 107 |
t.Errorf("Unexpected error returned from admission handler: %v", err) |
108 | 108 |
} |
109 | 109 |
|
110 | 110 |
// verify delete operations in the namespace can proceed |
111 |
- err = handler.Admit(admission.NewAttributesRecord(nil, namespaceObj.Namespace, "builds", "DELETE")) |
|
111 |
+ err = handler.Admit(admission.NewAttributesRecord(nil, "Build", namespaceObj.Namespace, "builds", "DELETE")) |
|
112 | 112 |
if err != nil { |
113 | 113 |
t.Errorf("Unexpected error returned from admission handler: %v", err) |
114 | 114 |
} |
... | ... |
@@ -117,7 +117,7 @@ func (registry *Etcd) WatchRoutes(ctx kapi.Context, label labels.Selector, field |
117 | 117 |
if err != nil { |
118 | 118 |
return nil, err |
119 | 119 |
} |
120 |
- return registry.Watch(key, version), nil |
|
120 |
+ return registry.Watch(key, version, tools.Everything) |
|
121 | 121 |
} |
122 | 122 |
|
123 | 123 |
if field.Empty() { |
... | ... |
@@ -11,6 +11,7 @@ import ( |
11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
14 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
14 | 15 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
15 | 16 |
"github.com/coreos/go-etcd/etcd" |
16 | 17 |
|
... | ... |
@@ -40,7 +41,7 @@ func makeTestDefaultRouteListKey() string { |
40 | 40 |
} |
41 | 41 |
|
42 | 42 |
func NewTestEtcd(client tools.EtcdClient) *Etcd { |
43 |
- return New(tools.NewEtcdHelper(client, latest.Codec)) |
|
43 |
+ return New(tools.NewEtcdHelper(client, latest.Codec, etcdtest.PathPrefix())) |
|
44 | 44 |
} |
45 | 45 |
|
46 | 46 |
func TestEtcdListEmptyRoutes(t *testing.T) { |
... | ... |
@@ -7,6 +7,7 @@ import ( |
7 | 7 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/rest" |
8 | 8 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/rest/resttest" |
9 | 9 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
10 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
10 | 11 |
|
11 | 12 |
"github.com/openshift/origin/pkg/api/latest" |
12 | 13 |
"github.com/openshift/origin/pkg/template/api" |
... | ... |
@@ -15,7 +16,7 @@ import ( |
15 | 15 |
func newHelper(t *testing.T) (*tools.FakeEtcdClient, tools.EtcdHelper) { |
16 | 16 |
fakeEtcdClient := tools.NewFakeEtcdClient(t) |
17 | 17 |
fakeEtcdClient.TestIndex = true |
18 |
- helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec) |
|
18 |
+ helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) |
|
19 | 19 |
return fakeEtcdClient, helper |
20 | 20 |
} |
21 | 21 |
|
... | ... |
@@ -12,6 +12,7 @@ import ( |
12 | 12 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
13 | 13 |
kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
14 | 14 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/master" |
15 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
15 | 16 |
|
16 | 17 |
"github.com/openshift/origin/pkg/api/latest" |
17 | 18 |
"github.com/openshift/origin/pkg/auth/authenticator/request/headerrequest" |
... | ... |
@@ -54,7 +55,7 @@ func TestFrontProxyOnAuthorize(t *testing.T) { |
54 | 54 |
|
55 | 55 |
// setup |
56 | 56 |
etcdClient := testutil.NewEtcdClient() |
57 |
- etcdHelper, _ := master.NewEtcdHelper(etcdClient, latest.Version) |
|
57 |
+ etcdHelper, _ := master.NewEtcdHelper(etcdClient, latest.Version, etcdtest.PathPrefix()) |
|
58 | 58 |
|
59 | 59 |
accessTokenStorage := accesstokenetcd.NewREST(etcdHelper) |
60 | 60 |
accessTokenRegistry := accesstokenregistry.NewRegistry(accessTokenStorage) |
... | ... |
@@ -100,7 +100,7 @@ func TestOverwritePolicyCommand(t *testing.T) { |
100 | 100 |
t.Errorf("unexpected error: %v", err) |
101 | 101 |
} |
102 | 102 |
|
103 |
- etcdHelper, err := origin.NewEtcdHelper(etcdClient, masterConfig.EtcdStorageConfig.OpenShiftStorageVersion) |
|
103 |
+ etcdHelper, err := origin.NewEtcdHelper(etcdClient, masterConfig.EtcdStorageConfig.OpenShiftStorageVersion, "openshift") |
|
104 | 104 |
if err != nil { |
105 | 105 |
t.Errorf("unexpected error: %v", err) |
106 | 106 |
} |
... | ... |
@@ -17,6 +17,7 @@ import ( |
17 | 17 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields" |
18 | 18 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
19 | 19 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/master" |
20 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
20 | 21 |
"github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/admission/admit" |
21 | 22 |
|
22 | 23 |
"github.com/openshift/origin/pkg/api/latest" |
... | ... |
@@ -178,7 +179,7 @@ func NewTestBuildOpenshift(t *testing.T) *testBuildOpenshift { |
178 | 178 |
openshift.lock.Lock() |
179 | 179 |
defer openshift.lock.Unlock() |
180 | 180 |
etcdClient := testutil.NewEtcdClient() |
181 |
- etcdHelper, _ := master.NewEtcdHelper(etcdClient, latest.Version) |
|
181 |
+ etcdHelper, _ := master.NewEtcdHelper(etcdClient, latest.Version, etcdtest.PathPrefix()) |
|
182 | 182 |
|
183 | 183 |
osMux := http.NewServeMux() |
184 | 184 |
openshift.server = httptest.NewServer(osMux) |
... | ... |
@@ -13,6 +13,7 @@ import ( |
13 | 13 |
|
14 | 14 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
15 | 15 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/master" |
16 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
16 | 17 |
|
17 | 18 |
// for osinserver setup. |
18 | 19 |
"github.com/openshift/origin/pkg/api/latest" |
... | ... |
@@ -52,7 +53,7 @@ func TestGetToken(t *testing.T) { |
52 | 52 |
|
53 | 53 |
// setup |
54 | 54 |
etcdClient := testutil.NewEtcdClient() |
55 |
- etcdHelper, _ := master.NewEtcdHelper(etcdClient, latest.Version) |
|
55 |
+ etcdHelper, _ := master.NewEtcdHelper(etcdClient, latest.Version, etcdtest.PathPrefix()) |
|
56 | 56 |
|
57 | 57 |
accessTokenStorage := accesstokenetcd.NewREST(etcdHelper) |
58 | 58 |
accessTokenRegistry := accesstokenregistry.NewRegistry(accessTokenStorage) |
... | ... |
@@ -9,6 +9,7 @@ import ( |
9 | 9 |
|
10 | 10 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools" |
12 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
12 | 13 |
"github.com/RangelReale/osin" |
13 | 14 |
"github.com/RangelReale/osincli" |
14 | 15 |
"golang.org/x/oauth2" |
... | ... |
@@ -60,7 +61,7 @@ func TestOAuthStorage(t *testing.T) { |
60 | 60 |
testutil.DeleteAllEtcdKeys() |
61 | 61 |
interfaces, _ := latest.InterfacesFor(latest.Version) |
62 | 62 |
etcdClient := testutil.NewEtcdClient() |
63 |
- etcdHelper := tools.NewEtcdHelper(etcdClient, interfaces.Codec) |
|
63 |
+ etcdHelper := tools.NewEtcdHelper(etcdClient, interfaces.Codec, etcdtest.PathPrefix()) |
|
64 | 64 |
|
65 | 65 |
accessTokenStorage := accesstokenetcd.NewREST(etcdHelper) |
66 | 66 |
accessTokenRegistry := accesstokenregistry.NewRegistry(accessTokenStorage) |
... | ... |
@@ -15,6 +15,7 @@ import ( |
15 | 15 |
kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
16 | 16 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/master" |
17 | 17 |
namespaceetcd "github.com/GoogleCloudPlatform/kubernetes/pkg/registry/namespace/etcd" |
18 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" |
|
18 | 19 |
"github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/admission/admit" |
19 | 20 |
|
20 | 21 |
"github.com/openshift/origin/pkg/api/latest" |
... | ... |
@@ -34,7 +35,7 @@ func init() { |
34 | 34 |
func TestProjectIsNamespace(t *testing.T) { |
35 | 35 |
testutil.DeleteAllEtcdKeys() |
36 | 36 |
etcdClient := testutil.NewEtcdClient() |
37 |
- etcdHelper, err := master.NewEtcdHelper(etcdClient, "") |
|
37 |
+ etcdHelper, err := master.NewEtcdHelper(etcdClient, "", etcdtest.PathPrefix()) |
|
38 | 38 |
if err != nil { |
39 | 39 |
t.Fatalf("Unexpected error: %v", err) |
40 | 40 |
} |
... | ... |
@@ -84,7 +84,7 @@ func TestUserInitialization(t *testing.T) { |
84 | 84 |
t.Errorf("unexpected error: %v", err) |
85 | 85 |
} |
86 | 86 |
|
87 |
- etcdHelper, err := origin.NewEtcdHelper(etcdClient, masterConfig.EtcdStorageConfig.OpenShiftStorageVersion) |
|
87 |
+ etcdHelper, err := origin.NewEtcdHelper(etcdClient, masterConfig.EtcdStorageConfig.OpenShiftStorageVersion, "openshift") |
|
88 | 88 |
if err != nil { |
89 | 89 |
t.Errorf("unexpected error: %v", err) |
90 | 90 |
} |