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
cd1ac360
Commit
cd1ac360
authored
Sep 09, 2015
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename "minion" to "node" in few places.
parent
45742e88
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
80 additions
and
80 deletions
+80
-80
doc.go
pkg/controller/node/doc.go
+1
-1
resource_printer_test.go
pkg/kubectl/resource_printer_test.go
+14
-14
kubelet.go
pkg/kubelet/kubelet.go
+2
-2
master.go
pkg/master/master.go
+6
-6
master_test.go
pkg/master/master_test.go
+1
-1
doc.go
pkg/registry/node/doc.go
+2
-2
etcd.go
pkg/registry/node/etcd/etcd.go
+7
-7
etcd_test.go
pkg/registry/node/etcd/etcd_test.go
+0
-0
registry.go
pkg/registry/node/registry.go
+13
-13
strategy.go
pkg/registry/node/strategy.go
+1
-1
strategy_test.go
pkg/registry/node/strategy_test.go
+1
-1
node.go
pkg/registry/registrytest/node.go
+32
-32
No files found.
pkg/controller/node/doc.go
View file @
cd1ac360
...
...
@@ -15,5 +15,5 @@ limitations under the License.
*/
// Package nodecontroller contains code for syncing cloud instances with
//
minion
registry
//
node
registry
package
nodecontroller
pkg/kubectl/resource_printer_test.go
View file @
cd1ac360
...
...
@@ -545,21 +545,21 @@ func TestPrintEventsResultSorted(t *testing.T) {
VerifyDatesInOrder
(
out
,
"
\n
"
/* rowDelimiter */
,
" "
/* columnDelimiter */
,
t
)
}
func
TestPrint
Minion
Status
(
t
*
testing
.
T
)
{
func
TestPrint
Node
Status
(
t
*
testing
.
T
)
{
printer
:=
NewHumanReadablePrinter
(
false
,
false
,
false
,
false
,
[]
string
{})
table
:=
[]
struct
{
minion
api
.
Node
node
api
.
Node
status
string
}{
{
minion
:
api
.
Node
{
node
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo1"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionTrue
}}},
},
status
:
"Ready"
,
},
{
minion
:
api
.
Node
{
node
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo2"
},
Spec
:
api
.
NodeSpec
{
Unschedulable
:
true
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionTrue
}}},
...
...
@@ -567,7 +567,7 @@ func TestPrintMinionStatus(t *testing.T) {
status
:
"Ready,SchedulingDisabled"
,
},
{
minion
:
api
.
Node
{
node
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo3"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionTrue
},
...
...
@@ -576,14 +576,14 @@ func TestPrintMinionStatus(t *testing.T) {
status
:
"Ready"
,
},
{
minion
:
api
.
Node
{
node
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo4"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFalse
}}},
},
status
:
"NotReady"
,
},
{
minion
:
api
.
Node
{
node
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo5"
},
Spec
:
api
.
NodeSpec
{
Unschedulable
:
true
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFalse
}}},
...
...
@@ -591,21 +591,21 @@ func TestPrintMinionStatus(t *testing.T) {
status
:
"NotReady,SchedulingDisabled"
,
},
{
minion
:
api
.
Node
{
node
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo6"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
"InvalidValue"
,
Status
:
api
.
ConditionTrue
}}},
},
status
:
"Unknown"
,
},
{
minion
:
api
.
Node
{
node
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo7"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{}}},
},
status
:
"Unknown"
,
},
{
minion
:
api
.
Node
{
node
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo8"
},
Spec
:
api
.
NodeSpec
{
Unschedulable
:
true
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
"InvalidValue"
,
Status
:
api
.
ConditionTrue
}}},
...
...
@@ -613,7 +613,7 @@ func TestPrintMinionStatus(t *testing.T) {
status
:
"Unknown,SchedulingDisabled"
,
},
{
minion
:
api
.
Node
{
node
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo9"
},
Spec
:
api
.
NodeSpec
{
Unschedulable
:
true
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{}}},
...
...
@@ -624,12 +624,12 @@ func TestPrintMinionStatus(t *testing.T) {
for
_
,
test
:=
range
table
{
buffer
:=
&
bytes
.
Buffer
{}
err
:=
printer
.
PrintObj
(
&
test
.
minion
,
buffer
)
err
:=
printer
.
PrintObj
(
&
test
.
node
,
buffer
)
if
err
!=
nil
{
t
.
Fatalf
(
"An error occurred printing
Minion
: %#v"
,
err
)
t
.
Fatalf
(
"An error occurred printing
Node
: %#v"
,
err
)
}
if
!
contains
(
strings
.
Fields
(
buffer
.
String
()),
test
.
status
)
{
t
.
Fatalf
(
"Expect printing
minion %s with status %#v, got: %#v"
,
test
.
minion
.
Name
,
test
.
status
,
buffer
.
String
())
t
.
Fatalf
(
"Expect printing
node %s with status %#v, got: %#v"
,
test
.
node
.
Name
,
test
.
status
,
buffer
.
String
())
}
}
}
...
...
pkg/kubelet/kubelet.go
View file @
cd1ac360
...
...
@@ -214,8 +214,8 @@ func NewMainKubelet(
}
nodeLister
:=
&
cache
.
StoreToNodeLister
{
Store
:
nodeStore
}
// TODO: get the real
minion
object of ourself,
// and use the real
minion
name and UID.
// TODO: get the real
node
object of ourself,
// and use the real
node
name and UID.
// TODO: what is namespace for node?
nodeRef
:=
&
api
.
ObjectReference
{
Kind
:
"Node"
,
...
...
pkg/master/master.go
View file @
cd1ac360
...
...
@@ -56,10 +56,10 @@ import (
eventetcd
"k8s.io/kubernetes/pkg/registry/event/etcd"
expcontrolleretcd
"k8s.io/kubernetes/pkg/registry/experimental/controller/etcd"
limitrangeetcd
"k8s.io/kubernetes/pkg/registry/limitrange/etcd"
"k8s.io/kubernetes/pkg/registry/minion"
nodeetcd
"k8s.io/kubernetes/pkg/registry/minion/etcd"
"k8s.io/kubernetes/pkg/registry/namespace"
namespaceetcd
"k8s.io/kubernetes/pkg/registry/namespace/etcd"
"k8s.io/kubernetes/pkg/registry/node"
nodeetcd
"k8s.io/kubernetes/pkg/registry/node/etcd"
pvetcd
"k8s.io/kubernetes/pkg/registry/persistentvolume/etcd"
pvcetcd
"k8s.io/kubernetes/pkg/registry/persistentvolumeclaim/etcd"
podetcd
"k8s.io/kubernetes/pkg/registry/pod/etcd"
...
...
@@ -100,7 +100,7 @@ type Config struct {
DatabaseStorage
storage
.
Interface
ExpDatabaseStorage
storage
.
Interface
EventTTL
time
.
Duration
MinionRegexp
string
NodeRegexp
string
KubeletClient
client
.
KubeletClient
// allow downstream consumers to disable the core controller loops
EnableCoreControllers
bool
...
...
@@ -219,7 +219,7 @@ type Master struct {
// registries are internal client APIs for accessing the storage layer
// TODO: define the internal typed interface in a way that clients can
// also be replaced
nodeRegistry
minion
.
Registry
nodeRegistry
node
.
Registry
namespaceRegistry
namespace
.
Registry
serviceRegistry
service
.
Registry
endpointRegistry
endpoint
.
Registry
...
...
@@ -446,7 +446,7 @@ func (m *Master) init(c *Config) {
m
.
endpointRegistry
=
endpoint
.
NewRegistry
(
endpointsStorage
)
nodeStorage
,
nodeStatusStorage
:=
nodeetcd
.
NewREST
(
c
.
DatabaseStorage
,
c
.
EnableWatchCache
,
c
.
KubeletClient
)
m
.
nodeRegistry
=
minion
.
NewRegistry
(
nodeStorage
)
m
.
nodeRegistry
=
node
.
NewRegistry
(
nodeStorage
)
serviceStorage
:=
serviceetcd
.
NewREST
(
c
.
DatabaseStorage
)
m
.
serviceRegistry
=
service
.
NewRegistry
(
serviceStorage
)
...
...
@@ -911,7 +911,7 @@ func (m *Master) needToReplaceTunnels(addrs []string) bool {
}
func
(
m
*
Master
)
getNodeAddresses
()
([]
string
,
error
)
{
nodes
,
err
:=
m
.
nodeRegistry
.
List
Minion
s
(
api
.
NewDefaultContext
(),
labels
.
Everything
(),
fields
.
Everything
())
nodes
,
err
:=
m
.
nodeRegistry
.
List
Node
s
(
api
.
NewDefaultContext
(),
labels
.
Everything
(),
fields
.
Everything
())
if
err
!=
nil
{
return
nil
,
err
}
...
...
pkg/master/master_test.go
View file @
cd1ac360
...
...
@@ -45,7 +45,7 @@ func TestGetServersToValidate(t *testing.T) {
config
.
DatabaseStorage
=
etcdstorage
.
NewEtcdStorage
(
fakeClient
,
latest
.
Codec
,
etcdtest
.
PathPrefix
())
config
.
ExpDatabaseStorage
=
etcdstorage
.
NewEtcdStorage
(
fakeClient
,
explatest
.
Codec
,
etcdtest
.
PathPrefix
())
master
.
nodeRegistry
=
registrytest
.
New
Minion
Registry
([]
string
{
"node1"
,
"node2"
},
api
.
NodeResources
{})
master
.
nodeRegistry
=
registrytest
.
New
Node
Registry
([]
string
{
"node1"
,
"node2"
},
api
.
NodeResources
{})
servers
:=
master
.
getServersToValidate
(
&
config
)
...
...
pkg/registry/
minion
/doc.go
→
pkg/registry/
node
/doc.go
View file @
cd1ac360
...
...
@@ -14,5 +14,5 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package
minion provides Registry interface and implementation for storing Minion
s.
package
minion
// Package
node provides Registry interface and implementation for storing Node
s.
package
node
pkg/registry/
minion
/etcd/etcd.go
→
pkg/registry/
node
/etcd/etcd.go
View file @
cd1ac360
...
...
@@ -24,7 +24,7 @@ import (
"k8s.io/kubernetes/pkg/api/rest"
client
"k8s.io/kubernetes/pkg/client/unversioned"
etcdgeneric
"k8s.io/kubernetes/pkg/registry/generic/etcd"
"k8s.io/kubernetes/pkg/registry/
minion
"
"k8s.io/kubernetes/pkg/registry/
node
"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/storage"
)
...
...
@@ -79,17 +79,17 @@ func NewREST(s storage.Interface, useCacher bool, connection client.ConnectionIn
ObjectNameFunc
:
func
(
obj
runtime
.
Object
)
(
string
,
error
)
{
return
obj
.
(
*
api
.
Node
)
.
Name
,
nil
},
PredicateFunc
:
minion
.
MatchNode
,
PredicateFunc
:
node
.
MatchNode
,
EndpointName
:
"node"
,
CreateStrategy
:
minion
.
Strategy
,
UpdateStrategy
:
minion
.
Strategy
,
CreateStrategy
:
node
.
Strategy
,
UpdateStrategy
:
node
.
Strategy
,
Storage
:
storageInterface
,
}
statusStore
:=
*
store
statusStore
.
UpdateStrategy
=
minion
.
StatusStrategy
statusStore
.
UpdateStrategy
=
node
.
StatusStrategy
return
&
REST
{
store
,
connection
},
&
StatusREST
{
store
:
&
statusStore
}
}
...
...
@@ -97,7 +97,7 @@ func NewREST(s storage.Interface, useCacher bool, connection client.ConnectionIn
// Implement Redirector.
var
_
=
rest
.
Redirector
(
&
REST
{})
// ResourceLocation returns a URL to which one can send traffic for the specified
minion
.
// ResourceLocation returns a URL to which one can send traffic for the specified
node
.
func
(
r
*
REST
)
ResourceLocation
(
ctx
api
.
Context
,
id
string
)
(
*
url
.
URL
,
http
.
RoundTripper
,
error
)
{
return
minion
.
ResourceLocation
(
r
,
r
.
connection
,
ctx
,
id
)
return
node
.
ResourceLocation
(
r
,
r
.
connection
,
ctx
,
id
)
}
pkg/registry/
minion
/etcd/etcd_test.go
→
pkg/registry/
node
/etcd/etcd_test.go
View file @
cd1ac360
File moved
pkg/registry/
minion
/registry.go
→
pkg/registry/
node
/registry.go
View file @
cd1ac360
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
minion
package
node
import
(
"k8s.io/kubernetes/pkg/api"
...
...
@@ -26,12 +26,12 @@ import (
// Registry is an interface for things that know how to store node.
type
Registry
interface
{
List
Minion
s
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
)
(
*
api
.
NodeList
,
error
)
Create
Minion
(
ctx
api
.
Context
,
minion
*
api
.
Node
)
error
Update
Minion
(
ctx
api
.
Context
,
minion
*
api
.
Node
)
error
Get
Minion
(
ctx
api
.
Context
,
minion
ID
string
)
(
*
api
.
Node
,
error
)
Delete
Minion
(
ctx
api
.
Context
,
minion
ID
string
)
error
Watch
Minion
s
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
,
resourceVersion
string
)
(
watch
.
Interface
,
error
)
List
Node
s
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
)
(
*
api
.
NodeList
,
error
)
Create
Node
(
ctx
api
.
Context
,
node
*
api
.
Node
)
error
Update
Node
(
ctx
api
.
Context
,
node
*
api
.
Node
)
error
Get
Node
(
ctx
api
.
Context
,
node
ID
string
)
(
*
api
.
Node
,
error
)
Delete
Node
(
ctx
api
.
Context
,
node
ID
string
)
error
Watch
Node
s
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
,
resourceVersion
string
)
(
watch
.
Interface
,
error
)
}
// storage puts strong typing around storage calls
...
...
@@ -45,7 +45,7 @@ func NewRegistry(s rest.StandardStorage) Registry {
return
&
storage
{
s
}
}
func
(
s
*
storage
)
List
Minion
s
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
)
(
*
api
.
NodeList
,
error
)
{
func
(
s
*
storage
)
List
Node
s
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
)
(
*
api
.
NodeList
,
error
)
{
obj
,
err
:=
s
.
List
(
ctx
,
label
,
field
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -54,21 +54,21 @@ func (s *storage) ListMinions(ctx api.Context, label labels.Selector, field fiel
return
obj
.
(
*
api
.
NodeList
),
nil
}
func
(
s
*
storage
)
Create
Minion
(
ctx
api
.
Context
,
node
*
api
.
Node
)
error
{
func
(
s
*
storage
)
Create
Node
(
ctx
api
.
Context
,
node
*
api
.
Node
)
error
{
_
,
err
:=
s
.
Create
(
ctx
,
node
)
return
err
}
func
(
s
*
storage
)
Update
Minion
(
ctx
api
.
Context
,
node
*
api
.
Node
)
error
{
func
(
s
*
storage
)
Update
Node
(
ctx
api
.
Context
,
node
*
api
.
Node
)
error
{
_
,
_
,
err
:=
s
.
Update
(
ctx
,
node
)
return
err
}
func
(
s
*
storage
)
Watch
Minion
s
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
,
resourceVersion
string
)
(
watch
.
Interface
,
error
)
{
func
(
s
*
storage
)
Watch
Node
s
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
,
resourceVersion
string
)
(
watch
.
Interface
,
error
)
{
return
s
.
Watch
(
ctx
,
label
,
field
,
resourceVersion
)
}
func
(
s
*
storage
)
Get
Minion
(
ctx
api
.
Context
,
name
string
)
(
*
api
.
Node
,
error
)
{
func
(
s
*
storage
)
Get
Node
(
ctx
api
.
Context
,
name
string
)
(
*
api
.
Node
,
error
)
{
obj
,
err
:=
s
.
Get
(
ctx
,
name
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -76,7 +76,7 @@ func (s *storage) GetMinion(ctx api.Context, name string) (*api.Node, error) {
return
obj
.
(
*
api
.
Node
),
nil
}
func
(
s
*
storage
)
Delete
Minion
(
ctx
api
.
Context
,
name
string
)
error
{
func
(
s
*
storage
)
Delete
Node
(
ctx
api
.
Context
,
name
string
)
error
{
_
,
err
:=
s
.
Delete
(
ctx
,
name
,
nil
)
return
err
}
pkg/registry/
minion
/strategy.go
→
pkg/registry/
node
/strategy.go
View file @
cd1ac360
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
minion
package
node
import
(
"fmt"
...
...
pkg/registry/
minion
/strategy_test.go
→
pkg/registry/
node
/strategy_test.go
View file @
cd1ac360
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
minion
package
node
import
(
"testing"
...
...
pkg/registry/registrytest/
minion
.go
→
pkg/registry/registrytest/
node
.go
View file @
cd1ac360
...
...
@@ -26,92 +26,92 @@ import (
"k8s.io/kubernetes/pkg/watch"
)
//
MinionRegistry implements minion
.Registry interface.
type
Minion
Registry
struct
{
Err
error
Minion
string
Minion
s
api
.
NodeList
//
NodeRegistry implements node
.Registry interface.
type
Node
Registry
struct
{
Err
error
Node
string
Node
s
api
.
NodeList
sync
.
Mutex
}
// Make
MinionList constructs api.MinionList from list of minion
names and a NodeResource.
func
Make
MinionList
(
minion
s
[]
string
,
nodeResources
api
.
NodeResources
)
*
api
.
NodeList
{
// Make
NodeList constructs api.NodeList from list of node
names and a NodeResource.
func
Make
NodeList
(
node
s
[]
string
,
nodeResources
api
.
NodeResources
)
*
api
.
NodeList
{
list
:=
api
.
NodeList
{
Items
:
make
([]
api
.
Node
,
len
(
minion
s
)),
Items
:
make
([]
api
.
Node
,
len
(
node
s
)),
}
for
i
:=
range
minion
s
{
list
.
Items
[
i
]
.
Name
=
minion
s
[
i
]
for
i
:=
range
node
s
{
list
.
Items
[
i
]
.
Name
=
node
s
[
i
]
list
.
Items
[
i
]
.
Status
.
Capacity
=
nodeResources
.
Capacity
}
return
&
list
}
func
New
MinionRegistry
(
minions
[]
string
,
nodeResources
api
.
NodeResources
)
*
Minion
Registry
{
return
&
Minion
Registry
{
Minions
:
*
MakeMinionList
(
minion
s
,
nodeResources
),
func
New
NodeRegistry
(
nodes
[]
string
,
nodeResources
api
.
NodeResources
)
*
Node
Registry
{
return
&
Node
Registry
{
Nodes
:
*
MakeNodeList
(
node
s
,
nodeResources
),
}
}
func
(
r
*
Minion
Registry
)
SetError
(
err
error
)
{
func
(
r
*
Node
Registry
)
SetError
(
err
error
)
{
r
.
Lock
()
defer
r
.
Unlock
()
r
.
Err
=
err
}
func
(
r
*
MinionRegistry
)
ListMinion
s
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
)
(
*
api
.
NodeList
,
error
)
{
func
(
r
*
NodeRegistry
)
ListNode
s
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
)
(
*
api
.
NodeList
,
error
)
{
r
.
Lock
()
defer
r
.
Unlock
()
return
&
r
.
Minion
s
,
r
.
Err
return
&
r
.
Node
s
,
r
.
Err
}
func
(
r
*
MinionRegistry
)
CreateMinion
(
ctx
api
.
Context
,
minion
*
api
.
Node
)
error
{
func
(
r
*
NodeRegistry
)
CreateNode
(
ctx
api
.
Context
,
node
*
api
.
Node
)
error
{
r
.
Lock
()
defer
r
.
Unlock
()
r
.
Minion
=
minion
.
Name
r
.
Minions
.
Items
=
append
(
r
.
Minions
.
Items
,
*
minion
)
r
.
Node
=
node
.
Name
r
.
Nodes
.
Items
=
append
(
r
.
Nodes
.
Items
,
*
node
)
return
r
.
Err
}
func
(
r
*
MinionRegistry
)
UpdateMinion
(
ctx
api
.
Context
,
minion
*
api
.
Node
)
error
{
func
(
r
*
NodeRegistry
)
UpdateNode
(
ctx
api
.
Context
,
node
*
api
.
Node
)
error
{
r
.
Lock
()
defer
r
.
Unlock
()
for
i
,
node
:=
range
r
.
Minion
s
.
Items
{
if
node
.
Name
==
minion
.
Name
{
r
.
Minions
.
Items
[
i
]
=
*
minion
for
i
,
item
:=
range
r
.
Node
s
.
Items
{
if
item
.
Name
==
node
.
Name
{
r
.
Nodes
.
Items
[
i
]
=
*
node
return
r
.
Err
}
}
return
r
.
Err
}
func
(
r
*
MinionRegistry
)
GetMinion
(
ctx
api
.
Context
,
minion
ID
string
)
(
*
api
.
Node
,
error
)
{
func
(
r
*
NodeRegistry
)
GetNode
(
ctx
api
.
Context
,
node
ID
string
)
(
*
api
.
Node
,
error
)
{
r
.
Lock
()
defer
r
.
Unlock
()
if
r
.
Err
!=
nil
{
return
nil
,
r
.
Err
}
for
_
,
node
:=
range
r
.
Minion
s
.
Items
{
if
node
.
Name
==
minion
ID
{
for
_
,
node
:=
range
r
.
Node
s
.
Items
{
if
node
.
Name
==
node
ID
{
return
&
node
,
nil
}
}
return
nil
,
errors
.
NewNotFound
(
"node"
,
minion
ID
)
return
nil
,
errors
.
NewNotFound
(
"node"
,
node
ID
)
}
func
(
r
*
MinionRegistry
)
DeleteMinion
(
ctx
api
.
Context
,
minion
ID
string
)
error
{
func
(
r
*
NodeRegistry
)
DeleteNode
(
ctx
api
.
Context
,
node
ID
string
)
error
{
r
.
Lock
()
defer
r
.
Unlock
()
var
newList
[]
api
.
Node
for
_
,
node
:=
range
r
.
Minion
s
.
Items
{
if
node
.
Name
!=
minion
ID
{
for
_
,
node
:=
range
r
.
Node
s
.
Items
{
if
node
.
Name
!=
node
ID
{
newList
=
append
(
newList
,
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
node
.
Name
}})
}
}
r
.
Minion
s
.
Items
=
newList
r
.
Node
s
.
Items
=
newList
return
r
.
Err
}
func
(
r
*
MinionRegistry
)
WatchMinion
s
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
,
resourceVersion
string
)
(
watch
.
Interface
,
error
)
{
func
(
r
*
NodeRegistry
)
WatchNode
s
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
,
resourceVersion
string
)
(
watch
.
Interface
,
error
)
{
return
nil
,
r
.
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