mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-07 12:11:43 +00:00
Internal rename api.Minion -> api.Node
This commit is contained in:
@@ -73,7 +73,7 @@ func (s *MinionController) SyncStatic(period time.Duration) error {
|
||||
if registered.Has(minionID) {
|
||||
continue
|
||||
}
|
||||
_, err := s.kubeClient.Minions().Create(&api.Minion{
|
||||
_, err := s.kubeClient.Minions().Create(&api.Node{
|
||||
ObjectMeta: api.ObjectMeta{Name: minionID},
|
||||
Spec: api.NodeSpec{
|
||||
Capacity: s.staticResources.Capacity,
|
||||
@@ -101,7 +101,7 @@ func (s *MinionController) SyncCloud() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
minionMap := make(map[string]*api.Minion)
|
||||
minionMap := make(map[string]*api.Node)
|
||||
for _, minion := range minions.Items {
|
||||
minionMap[minion.Name] = &minion
|
||||
}
|
||||
@@ -128,8 +128,8 @@ func (s *MinionController) SyncCloud() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// cloudMinions constructs and returns api.MinionList from cloudprovider.
|
||||
func (s *MinionController) cloudMinions() (*api.MinionList, error) {
|
||||
// cloudMinions constructs and returns api.NodeList from cloudprovider.
|
||||
func (s *MinionController) cloudMinions() (*api.NodeList, error) {
|
||||
instances, ok := s.cloud.Instances()
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("cloud doesn't support instances")
|
||||
@@ -138,8 +138,8 @@ func (s *MinionController) cloudMinions() (*api.MinionList, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := &api.MinionList{
|
||||
Items: make([]api.Minion, len(matches)),
|
||||
result := &api.NodeList{
|
||||
Items: make([]api.Node, len(matches)),
|
||||
}
|
||||
for i := range matches {
|
||||
result.Items[i].Name = matches[i]
|
||||
|
@@ -26,8 +26,8 @@ import (
|
||||
fake_cloud "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/fake"
|
||||
)
|
||||
|
||||
func newMinion(name string) *api.Minion {
|
||||
return &api.Minion{ObjectMeta: api.ObjectMeta{Name: name}}
|
||||
func newMinion(name string) *api.Node {
|
||||
return &api.Node{ObjectMeta: api.ObjectMeta{Name: name}}
|
||||
}
|
||||
|
||||
type FakeMinionHandler struct {
|
||||
@@ -35,12 +35,12 @@ type FakeMinionHandler struct {
|
||||
client.FakeMinions
|
||||
|
||||
// Input: Hooks determine if request is valid or not
|
||||
CreateHook func(*FakeMinionHandler, *api.Minion) bool
|
||||
Existing []*api.Minion
|
||||
CreateHook func(*FakeMinionHandler, *api.Node) bool
|
||||
Existing []*api.Node
|
||||
|
||||
// Output
|
||||
CreatedMinions []*api.Minion
|
||||
DeletedMinions []*api.Minion
|
||||
CreatedMinions []*api.Node
|
||||
DeletedMinions []*api.Node
|
||||
RequestCount int
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func (c *FakeMinionHandler) Minions() client.MinionInterface {
|
||||
return c
|
||||
}
|
||||
|
||||
func (m *FakeMinionHandler) Create(minion *api.Minion) (*api.Minion, error) {
|
||||
func (m *FakeMinionHandler) Create(minion *api.Node) (*api.Node, error) {
|
||||
defer func() { m.RequestCount++ }()
|
||||
if m.CreateHook == nil || m.CreateHook(m, minion) {
|
||||
m.CreatedMinions = append(m.CreatedMinions, minion)
|
||||
@@ -58,9 +58,9 @@ func (m *FakeMinionHandler) Create(minion *api.Minion) (*api.Minion, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *FakeMinionHandler) List() (*api.MinionList, error) {
|
||||
func (m *FakeMinionHandler) List() (*api.NodeList, error) {
|
||||
defer func() { m.RequestCount++ }()
|
||||
minions := []api.Minion{}
|
||||
minions := []api.Node{}
|
||||
for i := 0; i < len(m.Existing); i++ {
|
||||
if !contains(m.Existing[i], m.DeletedMinions) {
|
||||
minions = append(minions, *m.Existing[i])
|
||||
@@ -71,7 +71,7 @@ func (m *FakeMinionHandler) List() (*api.MinionList, error) {
|
||||
minions = append(minions, *m.CreatedMinions[i])
|
||||
}
|
||||
}
|
||||
return &api.MinionList{Items: minions}, nil
|
||||
return &api.NodeList{Items: minions}, nil
|
||||
}
|
||||
|
||||
func (m *FakeMinionHandler) Delete(id string) error {
|
||||
@@ -82,7 +82,7 @@ func (m *FakeMinionHandler) Delete(id string) error {
|
||||
|
||||
func TestSyncStaticCreateMinion(t *testing.T) {
|
||||
fakeMinionHandler := &FakeMinionHandler{
|
||||
CreateHook: func(fake *FakeMinionHandler, minion *api.Minion) bool {
|
||||
CreateHook: func(fake *FakeMinionHandler, minion *api.Node) bool {
|
||||
return true
|
||||
},
|
||||
}
|
||||
@@ -104,7 +104,7 @@ func TestSyncStaticCreateMinion(t *testing.T) {
|
||||
|
||||
func TestSyncStaticCreateMinionWithError(t *testing.T) {
|
||||
fakeMinionHandler := &FakeMinionHandler{
|
||||
CreateHook: func(fake *FakeMinionHandler, minion *api.Minion) bool {
|
||||
CreateHook: func(fake *FakeMinionHandler, minion *api.Node) bool {
|
||||
if fake.RequestCount == 0 {
|
||||
return false
|
||||
}
|
||||
@@ -129,7 +129,7 @@ func TestSyncStaticCreateMinionWithError(t *testing.T) {
|
||||
|
||||
func TestSyncCloudCreateMinion(t *testing.T) {
|
||||
fakeMinionHandler := &FakeMinionHandler{
|
||||
Existing: []*api.Minion{newMinion("minion0")},
|
||||
Existing: []*api.Node{newMinion("minion0")},
|
||||
}
|
||||
instances := []string{"minion0", "minion1"}
|
||||
fakeCloud := fake_cloud.FakeCloud{
|
||||
@@ -153,7 +153,7 @@ func TestSyncCloudCreateMinion(t *testing.T) {
|
||||
|
||||
func TestSyncCloudDeleteMinion(t *testing.T) {
|
||||
fakeMinionHandler := &FakeMinionHandler{
|
||||
Existing: []*api.Minion{newMinion("minion0"), newMinion("minion1")},
|
||||
Existing: []*api.Node{newMinion("minion0"), newMinion("minion1")},
|
||||
}
|
||||
instances := []string{"minion0"}
|
||||
fakeCloud := fake_cloud.FakeCloud{
|
||||
@@ -177,7 +177,7 @@ func TestSyncCloudDeleteMinion(t *testing.T) {
|
||||
|
||||
func TestSyncCloudRegexp(t *testing.T) {
|
||||
fakeMinionHandler := &FakeMinionHandler{
|
||||
Existing: []*api.Minion{newMinion("minion0")},
|
||||
Existing: []*api.Node{newMinion("minion0")},
|
||||
}
|
||||
instances := []string{"minion0", "minion1", "node0"}
|
||||
fakeCloud := fake_cloud.FakeCloud{
|
||||
@@ -199,7 +199,7 @@ func TestSyncCloudRegexp(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func contains(minion *api.Minion, minions []*api.Minion) bool {
|
||||
func contains(minion *api.Node, minions []*api.Node) bool {
|
||||
for i := 0; i < len(minions); i++ {
|
||||
if minion.Name == minions[i].Name {
|
||||
return true
|
||||
|
Reference in New Issue
Block a user