Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
65cf5f29
Commit
65cf5f29
authored
Dec 22, 2014
by
Daniel Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3095 from derekwaynecarr/events_not_namespace
Namespace scope events in storage
parents
f67c7bc8
b47cde24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
registry.go
pkg/registry/event/registry.go
+2
-5
registry_test.go
pkg/registry/event/registry_test.go
+9
-4
No files found.
pkg/registry/event/registry.go
View file @
65cf5f29
...
...
@@ -17,8 +17,6 @@ limitations under the License.
package
event
import
(
"path"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
etcderr
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors/etcd"
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/generic"
...
...
@@ -52,11 +50,10 @@ func NewEtcdRegistry(h tools.EtcdHelper, ttl uint64) generic.Registry {
NewListFunc
:
func
()
runtime
.
Object
{
return
&
api
.
EventList
{}
},
EndpointName
:
"events"
,
KeyRootFunc
:
func
(
ctx
api
.
Context
)
string
{
return
"/registry/events"
return
etcdgeneric
.
NamespaceKeyRootFunc
(
ctx
,
"/registry/events"
)
},
KeyFunc
:
func
(
ctx
api
.
Context
,
id
string
)
(
string
,
error
)
{
// TODO - we need to store this in a namespace relative path
return
path
.
Join
(
"/registry/events"
,
id
),
nil
return
etcdgeneric
.
NamespaceKeyFunc
(
ctx
,
"/registry/events"
,
id
)
},
Helper
:
h
,
},
...
...
pkg/registry/event/registry_test.go
View file @
65cf5f29
...
...
@@ -24,6 +24,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/generic"
etcdgeneric
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/generic/etcd"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
...
...
@@ -42,11 +43,11 @@ func NewTestEventEtcdRegistry(t *testing.T) (*tools.FakeEtcdClient, generic.Regi
func
TestEventCreate
(
t
*
testing
.
T
)
{
eventA
:=
&
api
.
Event
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Namespace
:
api
.
NamespaceDefault
},
Reason
:
"forTesting"
,
}
eventB
:=
&
api
.
Event
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Namespace
:
api
.
NamespaceDefault
},
Reason
:
"forTesting"
,
}
...
...
@@ -67,8 +68,12 @@ func TestEventCreate(t *testing.T) {
E
:
tools
.
EtcdErrorNotFound
,
}
path
:=
"/registry/events/foo"
ctx
:=
api
.
NewDefaultContext
()
key
:=
"foo"
path
,
err
:=
etcdgeneric
.
NamespaceKeyFunc
(
ctx
,
"/registry/events"
,
key
)
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error: %v"
,
err
)
}
table
:=
map
[
string
]
struct
{
existing
tools
.
EtcdResponseWithError
...
...
@@ -93,7 +98,7 @@ func TestEventCreate(t *testing.T) {
for
name
,
item
:=
range
table
{
fakeClient
,
registry
:=
NewTestEventEtcdRegistry
(
t
)
fakeClient
.
Data
[
path
]
=
item
.
existing
err
:=
registry
.
Create
(
api
.
NewContext
()
,
key
,
item
.
toCreate
)
err
:=
registry
.
Create
(
ctx
,
key
,
item
.
toCreate
)
if
!
item
.
errOK
(
err
)
{
t
.
Errorf
(
"%v: unexpected error: %v"
,
name
,
err
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment