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
0e5b478b
Commit
0e5b478b
authored
Apr 09, 2015
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ListMinions support for selectors
parent
6ef0f8c3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
7 deletions
+9
-7
master.go
pkg/master/master.go
+3
-1
registry.go
pkg/registry/minion/registry.go
+3
-3
registry.go
pkg/registry/pod/registry.go
+1
-1
minion.go
pkg/registry/registrytest/minion.go
+1
-1
rest.go
pkg/registry/service/rest.go
+1
-1
No files found.
pkg/master/master.go
View file @
0e5b478b
...
@@ -41,6 +41,8 @@ import (
...
@@ -41,6 +41,8 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/auth/handlers"
"github.com/GoogleCloudPlatform/kubernetes/pkg/auth/handlers"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/master/ports"
"github.com/GoogleCloudPlatform/kubernetes/pkg/master/ports"
controlleretcd
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/controller/etcd"
controlleretcd
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/controller/etcd"
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/endpoint"
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/endpoint"
...
@@ -567,7 +569,7 @@ func (m *Master) getServersToValidate(c *Config) map[string]apiserver.Server {
...
@@ -567,7 +569,7 @@ func (m *Master) getServersToValidate(c *Config) map[string]apiserver.Server {
}
}
serversToValidate
[
fmt
.
Sprintf
(
"etcd-%d"
,
ix
)]
=
apiserver
.
Server
{
Addr
:
addr
,
Port
:
port
,
Path
:
"/v2/keys/"
}
serversToValidate
[
fmt
.
Sprintf
(
"etcd-%d"
,
ix
)]
=
apiserver
.
Server
{
Addr
:
addr
,
Port
:
port
,
Path
:
"/v2/keys/"
}
}
}
nodes
,
err
:=
m
.
nodeRegistry
.
ListMinions
(
api
.
NewDefaultContext
())
nodes
,
err
:=
m
.
nodeRegistry
.
ListMinions
(
api
.
NewDefaultContext
()
,
labels
.
Everything
(),
fields
.
Everything
()
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to list minions: %v"
,
err
)
glog
.
Errorf
(
"Failed to list minions: %v"
,
err
)
}
}
...
...
pkg/registry/minion/registry.go
View file @
0e5b478b
...
@@ -26,7 +26,7 @@ import (
...
@@ -26,7 +26,7 @@ import (
// Registry is an interface for things that know how to store node.
// Registry is an interface for things that know how to store node.
type
Registry
interface
{
type
Registry
interface
{
ListMinions
(
ctx
api
.
Context
)
(
*
api
.
NodeList
,
error
)
ListMinions
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
)
(
*
api
.
NodeList
,
error
)
CreateMinion
(
ctx
api
.
Context
,
minion
*
api
.
Node
)
error
CreateMinion
(
ctx
api
.
Context
,
minion
*
api
.
Node
)
error
UpdateMinion
(
ctx
api
.
Context
,
minion
*
api
.
Node
)
error
UpdateMinion
(
ctx
api
.
Context
,
minion
*
api
.
Node
)
error
GetMinion
(
ctx
api
.
Context
,
minionID
string
)
(
*
api
.
Node
,
error
)
GetMinion
(
ctx
api
.
Context
,
minionID
string
)
(
*
api
.
Node
,
error
)
...
@@ -45,8 +45,8 @@ func NewRegistry(s rest.StandardStorage) Registry {
...
@@ -45,8 +45,8 @@ func NewRegistry(s rest.StandardStorage) Registry {
return
&
storage
{
s
}
return
&
storage
{
s
}
}
}
func
(
s
*
storage
)
ListMinions
(
ctx
api
.
Context
)
(
*
api
.
NodeList
,
error
)
{
func
(
s
*
storage
)
ListMinions
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
)
(
*
api
.
NodeList
,
error
)
{
obj
,
err
:=
s
.
List
(
ctx
,
label
s
.
Everything
(),
fields
.
Everything
()
)
obj
,
err
:=
s
.
List
(
ctx
,
label
,
field
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
pkg/registry/pod/registry.go
View file @
0e5b478b
...
@@ -27,7 +27,7 @@ import (
...
@@ -27,7 +27,7 @@ import (
// Registry is an interface implemented by things that know how to store Pod objects.
// Registry is an interface implemented by things that know how to store Pod objects.
type
Registry
interface
{
type
Registry
interface
{
// ListPods obtains a list of pods having labels which match selector.
// ListPods obtains a list of pods having labels which match selector.
ListPods
(
ctx
api
.
Context
,
selector
labels
.
Selector
)
(
*
api
.
PodList
,
error
)
ListPods
(
ctx
api
.
Context
,
label
labels
.
Selector
)
(
*
api
.
PodList
,
error
)
// Watch for new/changed/deleted pods
// Watch for new/changed/deleted pods
WatchPods
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
,
resourceVersion
string
)
(
watch
.
Interface
,
error
)
WatchPods
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
,
resourceVersion
string
)
(
watch
.
Interface
,
error
)
// Get a specific pod
// Get a specific pod
...
...
pkg/registry/registrytest/minion.go
View file @
0e5b478b
...
@@ -59,7 +59,7 @@ func (r *MinionRegistry) SetError(err error) {
...
@@ -59,7 +59,7 @@ func (r *MinionRegistry) SetError(err error) {
r
.
Err
=
err
r
.
Err
=
err
}
}
func
(
r
*
MinionRegistry
)
ListMinions
(
ctx
api
.
Context
)
(
*
api
.
NodeList
,
error
)
{
func
(
r
*
MinionRegistry
)
ListMinions
(
ctx
api
.
Context
,
label
labels
.
Selector
,
field
fields
.
Selector
)
(
*
api
.
NodeList
,
error
)
{
r
.
Lock
()
r
.
Lock
()
defer
r
.
Unlock
()
defer
r
.
Unlock
()
return
&
r
.
Minions
,
r
.
Err
return
&
r
.
Minions
,
r
.
Err
...
...
pkg/registry/service/rest.go
View file @
0e5b478b
...
@@ -295,7 +295,7 @@ func (rs *REST) createExternalLoadBalancer(ctx api.Context, service *api.Service
...
@@ -295,7 +295,7 @@ func (rs *REST) createExternalLoadBalancer(ctx api.Context, service *api.Service
if
!
ok
{
if
!
ok
{
return
fmt
.
Errorf
(
"the cloud provider does not support zone enumeration."
)
return
fmt
.
Errorf
(
"the cloud provider does not support zone enumeration."
)
}
}
hosts
,
err
:=
rs
.
machines
.
ListMinions
(
ctx
)
hosts
,
err
:=
rs
.
machines
.
ListMinions
(
ctx
,
labels
.
Everything
(),
fields
.
Everything
()
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
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