mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Rename makeContainerKey -> make BoundPodsKey.
Fix some typos too.
This commit is contained in:
parent
9f5ebef3d8
commit
20a8e4bf19
@ -152,7 +152,7 @@ func (r *Registry) GetPod(ctx api.Context, id string) (*api.Pod, error) {
|
|||||||
return &pod, nil
|
return &pod, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeContainerKey(machine string) string {
|
func makeBoundPodsKey(machine string) string {
|
||||||
return "/registry/nodes/" + machine + "/boundpods"
|
return "/registry/nodes/" + machine + "/boundpods"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ func (r *Registry) assignPod(ctx api.Context, podID string, machine string) erro
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Doing the constraint check this way provides atomicity guarantees.
|
// Doing the constraint check this way provides atomicity guarantees.
|
||||||
contKey := makeContainerKey(machine)
|
contKey := makeBoundPodsKey(machine)
|
||||||
err = r.AtomicUpdate(contKey, &api.BoundPods{}, func(in runtime.Object) (runtime.Object, error) {
|
err = r.AtomicUpdate(contKey, &api.BoundPods{}, func(in runtime.Object) (runtime.Object, error) {
|
||||||
boundPodList := in.(*api.BoundPods)
|
boundPodList := in.(*api.BoundPods)
|
||||||
boundPodList.Items = append(boundPodList.Items, *boundPod)
|
boundPodList.Items = append(boundPodList.Items, *boundPod)
|
||||||
@ -257,7 +257,7 @@ func (r *Registry) UpdatePod(ctx api.Context, pod *api.Pod) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
containerKey := makeContainerKey(podOut.Status.Host)
|
containerKey := makeBoundPodsKey(podOut.Status.Host)
|
||||||
return r.AtomicUpdate(containerKey, &api.BoundPods{}, func(in runtime.Object) (runtime.Object, error) {
|
return r.AtomicUpdate(containerKey, &api.BoundPods{}, func(in runtime.Object) (runtime.Object, error) {
|
||||||
boundPods := in.(*api.BoundPods)
|
boundPods := in.(*api.BoundPods)
|
||||||
for ix := range boundPods.Items {
|
for ix := range boundPods.Items {
|
||||||
@ -295,7 +295,7 @@ func (r *Registry) DeletePod(ctx api.Context, podID string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// Next, remove the pod from the machine atomically.
|
// Next, remove the pod from the machine atomically.
|
||||||
contKey := makeContainerKey(machine)
|
contKey := makeBoundPodsKey(machine)
|
||||||
return r.AtomicUpdate(contKey, &api.BoundPods{}, func(in runtime.Object) (runtime.Object, error) {
|
return r.AtomicUpdate(contKey, &api.BoundPods{}, func(in runtime.Object) (runtime.Object, error) {
|
||||||
pods := in.(*api.BoundPods)
|
pods := in.(*api.BoundPods)
|
||||||
newPods := make([]api.BoundPod, 0, len(pods.Items))
|
newPods := make([]api.BoundPod, 0, len(pods.Items))
|
||||||
@ -395,7 +395,7 @@ func makeServiceListKey(ctx api.Context) string {
|
|||||||
return MakeEtcdListKey(ctx, ServicePath)
|
return MakeEtcdListKey(ctx, ServicePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// makePodKey constructs etcd paths to service items enforcing namespace rules.
|
// makeServiceKey constructs etcd paths to service items enforcing namespace rules.
|
||||||
func makeServiceKey(ctx api.Context, name string) (string, error) {
|
func makeServiceKey(ctx api.Context, name string) (string, error) {
|
||||||
return MakeEtcdItemKey(ctx, ServicePath, name)
|
return MakeEtcdItemKey(ctx, ServicePath, name)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user