mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 13:02:14 +00:00
Rename InsertMinion to CreateMinion.
This commit is contained in:
parent
4a35325f29
commit
c3d9197a4b
@ -113,7 +113,7 @@ func makeMinionRegistry(c *Config) minion.Registry {
|
||||
if minionRegistry == nil {
|
||||
minionRegistry = etcd.NewRegistry(c.EtcdHelper, nil)
|
||||
for _, minionID := range c.Minions {
|
||||
minionRegistry.InsertMinion(nil, &api.Minion{
|
||||
minionRegistry.CreateMinion(nil, &api.Minion{
|
||||
JSONBase: api.JSONBase{ID: minionID},
|
||||
NodeResources: c.NodeResources,
|
||||
})
|
||||
|
@ -392,7 +392,7 @@ func (r *Registry) ListMinions(ctx api.Context) (*api.MinionList, error) {
|
||||
return minions, err
|
||||
}
|
||||
|
||||
func (r *Registry) InsertMinion(ctx api.Context, minion *api.Minion) error {
|
||||
func (r *Registry) CreateMinion(ctx api.Context, minion *api.Minion) error {
|
||||
err := r.CreateObj(makeMinionKey(minion.ID), minion, 0)
|
||||
return etcderr.InterpretCreateError(err, "minion", minion.ID)
|
||||
}
|
||||
|
@ -1053,11 +1053,11 @@ func TestEtcdListMinions(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestEtcdInsertMinion(t *testing.T) {
|
||||
func TestEtcdCreateMinion(t *testing.T) {
|
||||
ctx := api.NewContext()
|
||||
fakeClient := tools.NewFakeEtcdClient(t)
|
||||
registry := NewTestEtcdRegistry(fakeClient)
|
||||
err := registry.InsertMinion(ctx, &api.Minion{
|
||||
err := registry.CreateMinion(ctx, &api.Minion{
|
||||
JSONBase: api.JSONBase{ID: "foo"},
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -81,8 +81,8 @@ func (r *CachingRegistry) DeleteMinion(ctx api.Context, minionID string) error {
|
||||
return r.refresh(ctx, true)
|
||||
}
|
||||
|
||||
func (r *CachingRegistry) InsertMinion(ctx api.Context, minion *api.Minion) error {
|
||||
if err := r.delegate.InsertMinion(ctx, minion); err != nil {
|
||||
func (r *CachingRegistry) CreateMinion(ctx api.Context, minion *api.Minion) error {
|
||||
if err := r.delegate.CreateMinion(ctx, minion); err != nil {
|
||||
return err
|
||||
}
|
||||
return r.refresh(ctx, true)
|
||||
|
@ -94,7 +94,7 @@ func TestCachingInsert(t *testing.T) {
|
||||
lastUpdate: fakeClock.Now().Unix(),
|
||||
nodes: expected,
|
||||
}
|
||||
err := cache.InsertMinion(ctx, &api.Minion{
|
||||
err := cache.CreateMinion(ctx, &api.Minion{
|
||||
JSONBase: api.JSONBase{ID: "foo"},
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -55,7 +55,7 @@ func (r CloudRegistry) DeleteMinion(ctx api.Context, minionID string) error {
|
||||
return fmt.Errorf("unsupported")
|
||||
}
|
||||
|
||||
func (r CloudRegistry) InsertMinion(ctx api.Context, minion *api.Minion) error {
|
||||
func (r CloudRegistry) CreateMinion(ctx api.Context, minion *api.Minion) error {
|
||||
return fmt.Errorf("unsupported")
|
||||
}
|
||||
|
||||
|
@ -14,6 +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 Minions.
|
||||
// Package minion provides Registry interface and implementation for storing Minions.
|
||||
package minion
|
||||
|
@ -62,8 +62,8 @@ func (r *HealthyRegistry) DeleteMinion(ctx api.Context, minionID string) error {
|
||||
return r.delegate.DeleteMinion(ctx, minionID)
|
||||
}
|
||||
|
||||
func (r *HealthyRegistry) InsertMinion(ctx api.Context, minion *api.Minion) error {
|
||||
return r.delegate.InsertMinion(ctx, minion)
|
||||
func (r *HealthyRegistry) CreateMinion(ctx api.Context, minion *api.Minion) error {
|
||||
return r.delegate.CreateMinion(ctx, minion)
|
||||
}
|
||||
|
||||
func (r *HealthyRegistry) ListMinions(ctx api.Context) (currentMinions *api.MinionList, err error) {
|
||||
|
@ -54,7 +54,7 @@ func TestBasicDelegation(t *testing.T) {
|
||||
if !reflect.DeepEqual(list, &mockMinionRegistry.Minions) {
|
||||
t.Errorf("Expected %v, Got %v", mockMinionRegistry.Minions, list)
|
||||
}
|
||||
err = healthy.InsertMinion(ctx, &api.Minion{
|
||||
err = healthy.CreateMinion(ctx, &api.Minion{
|
||||
JSONBase: api.JSONBase{ID: "foo"},
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -21,7 +21,7 @@ import "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
// MinionRegistry is an interface for things that know how to store minions.
|
||||
type Registry interface {
|
||||
ListMinions(ctx api.Context) (*api.MinionList, error)
|
||||
InsertMinion(ctx api.Context, minion *api.Minion) error
|
||||
CreateMinion(ctx api.Context, minion *api.Minion) error
|
||||
ContainsMinion(ctx api.Context, minionID string) (bool, error)
|
||||
DeleteMinion(ctx api.Context, minionID string) error
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func (rs *REST) Create(ctx api.Context, obj runtime.Object) (<-chan runtime.Obje
|
||||
minion.CreationTimestamp = util.Now()
|
||||
|
||||
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
||||
err := rs.registry.InsertMinion(ctx, minion)
|
||||
err := rs.registry.CreateMinion(ctx, minion)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func (r *MinionRegistry) ListMinions(ctx api.Context) (*api.MinionList, error) {
|
||||
return &r.Minions, r.Err
|
||||
}
|
||||
|
||||
func (r *MinionRegistry) InsertMinion(ctx api.Context, minion *api.Minion) error {
|
||||
func (r *MinionRegistry) CreateMinion(ctx api.Context, minion *api.Minion) error {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
r.Minion = minion.ID
|
||||
|
Loading…
Reference in New Issue
Block a user