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
904d0d46
Commit
904d0d46
authored
Dec 12, 2014
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename ServerOp to Operation in v1beta3 and internal
Add the appropriate rename logic internally.
parent
771c5389
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
16 deletions
+24
-16
register.go
pkg/api/register.go
+6
-4
types.go
pkg/api/types.go
+5
-5
register.go
pkg/api/v1beta1/register.go
+2
-0
register.go
pkg/api/v1beta2/register.go
+2
-0
register.go
pkg/api/v1beta3/register.go
+2
-0
apiserver_test.go
pkg/apiserver/apiserver_test.go
+3
-3
operation.go
pkg/apiserver/operation.go
+3
-3
operation_test.go
pkg/apiserver/operation_test.go
+1
-1
No files found.
pkg/api/register.go
View file @
904d0d46
...
@@ -34,8 +34,8 @@ func init() {
...
@@ -34,8 +34,8 @@ func init() {
&
NodeList
{},
&
NodeList
{},
&
Node
{},
&
Node
{},
&
Status
{},
&
Status
{},
&
ServerOp
List
{},
&
Operation
List
{},
&
ServerOp
{},
&
Operation
{},
&
Endpoints
{},
&
Endpoints
{},
&
EndpointsList
{},
&
EndpointsList
{},
&
Binding
{},
&
Binding
{},
...
@@ -50,6 +50,8 @@ func init() {
...
@@ -50,6 +50,8 @@ func init() {
// Legacy names are supported
// Legacy names are supported
Scheme
.
AddKnownTypeWithName
(
""
,
"Minion"
,
&
Node
{})
Scheme
.
AddKnownTypeWithName
(
""
,
"Minion"
,
&
Node
{})
Scheme
.
AddKnownTypeWithName
(
""
,
"MinionList"
,
&
NodeList
{})
Scheme
.
AddKnownTypeWithName
(
""
,
"MinionList"
,
&
NodeList
{})
Scheme
.
AddKnownTypeWithName
(
""
,
"ServerOp"
,
&
Operation
{})
Scheme
.
AddKnownTypeWithName
(
""
,
"ServerOpList"
,
&
OperationList
{})
}
}
func
(
*
Pod
)
IsAnAPIObject
()
{}
func
(
*
Pod
)
IsAnAPIObject
()
{}
...
@@ -64,8 +66,8 @@ func (*Node) IsAnAPIObject() {}
...
@@ -64,8 +66,8 @@ func (*Node) IsAnAPIObject() {}
func
(
*
NodeList
)
IsAnAPIObject
()
{}
func
(
*
NodeList
)
IsAnAPIObject
()
{}
func
(
*
Binding
)
IsAnAPIObject
()
{}
func
(
*
Binding
)
IsAnAPIObject
()
{}
func
(
*
Status
)
IsAnAPIObject
()
{}
func
(
*
Status
)
IsAnAPIObject
()
{}
func
(
*
ServerOp
)
IsAnAPIObject
()
{}
func
(
*
Operation
)
IsAnAPIObject
()
{}
func
(
*
ServerOpList
)
IsAnAPIObject
()
{}
func
(
*
OperationList
)
IsAnAPIObject
()
{}
func
(
*
Event
)
IsAnAPIObject
()
{}
func
(
*
Event
)
IsAnAPIObject
()
{}
func
(
*
EventList
)
IsAnAPIObject
()
{}
func
(
*
EventList
)
IsAnAPIObject
()
{}
func
(
*
ContainerManifest
)
IsAnAPIObject
()
{}
func
(
*
ContainerManifest
)
IsAnAPIObject
()
{}
...
...
pkg/api/types.go
View file @
904d0d46
...
@@ -920,18 +920,18 @@ const (
...
@@ -920,18 +920,18 @@ const (
CauseTypeFieldValueNotSupported
CauseType
=
"FieldValueNotSupported"
CauseTypeFieldValueNotSupported
CauseType
=
"FieldValueNotSupported"
)
)
//
ServerOp
is an operation delivered to API clients.
//
Operation
is an operation delivered to API clients.
type
ServerOp
struct
{
type
Operation
struct
{
TypeMeta
`json:",inline"`
TypeMeta
`json:",inline"`
ObjectMeta
`json:"metadata,omitempty"`
ObjectMeta
`json:"metadata,omitempty"`
}
}
//
ServerOp
List is a list of operations, as delivered to API clients.
//
Operation
List is a list of operations, as delivered to API clients.
type
ServerOp
List
struct
{
type
Operation
List
struct
{
TypeMeta
`json:",inline"`
TypeMeta
`json:",inline"`
ListMeta
`json:"metadata,omitempty"`
ListMeta
`json:"metadata,omitempty"`
Items
[]
ServerOp
`json:"items"`
Items
[]
Operation
`json:"items"`
}
}
// ObjectReference contains enough information to let you inspect or modify the referred object.
// ObjectReference contains enough information to let you inspect or modify the referred object.
...
...
pkg/api/v1beta1/register.go
View file @
904d0d46
...
@@ -28,6 +28,8 @@ func init() {
...
@@ -28,6 +28,8 @@ func init() {
// Future names are supported, and declared first so they take precedence
// Future names are supported, and declared first so they take precedence
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta1"
,
"Node"
,
&
Minion
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta1"
,
"Node"
,
&
Minion
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta1"
,
"NodeList"
,
&
MinionList
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta1"
,
"NodeList"
,
&
MinionList
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta1"
,
"Operation"
,
&
ServerOp
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta1"
,
"OperationList"
,
&
ServerOpList
{})
api
.
Scheme
.
AddKnownTypes
(
"v1beta1"
,
api
.
Scheme
.
AddKnownTypes
(
"v1beta1"
,
&
Pod
{},
&
Pod
{},
...
...
pkg/api/v1beta2/register.go
View file @
904d0d46
...
@@ -28,6 +28,8 @@ func init() {
...
@@ -28,6 +28,8 @@ func init() {
// Future names are supported, and declared first so they take precedence
// Future names are supported, and declared first so they take precedence
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta2"
,
"Node"
,
&
Minion
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta2"
,
"Node"
,
&
Minion
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta2"
,
"NodeList"
,
&
MinionList
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta2"
,
"NodeList"
,
&
MinionList
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta2"
,
"Operation"
,
&
ServerOp
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta2"
,
"OperationList"
,
&
ServerOpList
{})
api
.
Scheme
.
AddKnownTypes
(
"v1beta2"
,
api
.
Scheme
.
AddKnownTypes
(
"v1beta2"
,
&
Pod
{},
&
Pod
{},
...
...
pkg/api/v1beta3/register.go
View file @
904d0d46
...
@@ -51,6 +51,8 @@ func init() {
...
@@ -51,6 +51,8 @@ func init() {
// Legacy names are supported
// Legacy names are supported
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta3"
,
"Minion"
,
&
Node
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta3"
,
"Minion"
,
&
Node
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta3"
,
"MinionList"
,
&
NodeList
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta3"
,
"MinionList"
,
&
NodeList
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta3"
,
"ServerOp"
,
&
Operation
{})
api
.
Scheme
.
AddKnownTypeWithName
(
"v1beta3"
,
"ServerOpList"
,
&
OperationList
{})
}
}
func
(
*
Pod
)
IsAnAPIObject
()
{}
func
(
*
Pod
)
IsAnAPIObject
()
{}
...
...
pkg/apiserver/apiserver_test.go
View file @
904d0d46
...
@@ -70,15 +70,15 @@ func interfacesFor(version string) (*meta.VersionInterfaces, error) {
...
@@ -70,15 +70,15 @@ func interfacesFor(version string) (*meta.VersionInterfaces, error) {
func
init
()
{
func
init
()
{
// Certain API objects are returned regardless of the contents of storage:
// Certain API objects are returned regardless of the contents of storage:
// api.Status is returned in errors
// api.Status is returned in errors
// api.
ServerOp/api.ServerOp
List are returned by /operations
// api.
Operation/api.Operation
List are returned by /operations
// "internal" version
// "internal" version
api
.
Scheme
.
AddKnownTypes
(
""
,
&
Simple
{},
&
SimpleList
{},
api
.
Scheme
.
AddKnownTypes
(
""
,
&
Simple
{},
&
SimpleList
{},
&
api
.
Status
{},
&
api
.
ServerOp
{},
&
api
.
ServerOp
List
{})
&
api
.
Status
{},
&
api
.
Operation
{},
&
api
.
Operation
List
{})
// "version" version
// "version" version
// TODO: Use versioned api objects?
// TODO: Use versioned api objects?
api
.
Scheme
.
AddKnownTypes
(
testVersion
,
&
Simple
{},
&
SimpleList
{},
api
.
Scheme
.
AddKnownTypes
(
testVersion
,
&
Simple
{},
&
SimpleList
{},
&
api
.
Status
{},
&
api
.
ServerOp
{},
&
api
.
ServerOp
List
{})
&
api
.
Status
{},
&
api
.
Operation
{},
&
api
.
Operation
List
{})
defMapper
:=
meta
.
NewDefaultRESTMapper
(
defMapper
:=
meta
.
NewDefaultRESTMapper
(
versions
,
versions
,
...
...
pkg/apiserver/operation.go
View file @
904d0d46
...
@@ -115,7 +115,7 @@ func (ops *Operations) insert(op *Operation) {
...
@@ -115,7 +115,7 @@ func (ops *Operations) insert(op *Operation) {
}
}
// List lists operations for an API client.
// List lists operations for an API client.
func
(
ops
*
Operations
)
List
()
*
api
.
ServerOp
List
{
func
(
ops
*
Operations
)
List
()
*
api
.
Operation
List
{
ops
.
lock
.
Lock
()
ops
.
lock
.
Lock
()
defer
ops
.
lock
.
Unlock
()
defer
ops
.
lock
.
Unlock
()
...
@@ -124,9 +124,9 @@ func (ops *Operations) List() *api.ServerOpList {
...
@@ -124,9 +124,9 @@ func (ops *Operations) List() *api.ServerOpList {
ids
=
append
(
ids
,
id
)
ids
=
append
(
ids
,
id
)
}
}
sort
.
StringSlice
(
ids
)
.
Sort
()
sort
.
StringSlice
(
ids
)
.
Sort
()
ol
:=
&
api
.
ServerOp
List
{}
ol
:=
&
api
.
Operation
List
{}
for
_
,
id
:=
range
ids
{
for
_
,
id
:=
range
ids
{
ol
.
Items
=
append
(
ol
.
Items
,
api
.
ServerOp
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
id
}})
ol
.
Items
=
append
(
ol
.
Items
,
api
.
Operation
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
id
}})
}
}
return
ol
return
ol
}
}
...
...
pkg/apiserver/operation_test.go
View file @
904d0d46
...
@@ -149,7 +149,7 @@ func TestOperationsList(t *testing.T) {
...
@@ -149,7 +149,7 @@ func TestOperationsList(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %v"
,
err
)
t
.
Errorf
(
"unexpected error: %v"
,
err
)
}
}
oplist
,
ok
:=
obj
.
(
*
api
.
ServerOp
List
)
oplist
,
ok
:=
obj
.
(
*
api
.
Operation
List
)
if
!
ok
{
if
!
ok
{
t
.
Fatalf
(
"expected ServerOpList, got %#v"
,
obj
)
t
.
Fatalf
(
"expected ServerOpList, got %#v"
,
obj
)
}
}
...
...
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