mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 22:20:18 +00:00
Enforce unique constraint at namespace boundary in etcd, make client and server namespace aware
This commit is contained in:
@@ -184,7 +184,8 @@ func (factory *ConfigFactory) makeDefaultErrorFunc(backoff *podBackoff, podQueue
|
||||
backoff.wait(podID)
|
||||
// Get the pod again; it may have changed/been scheduled already.
|
||||
pod = &api.Pod{}
|
||||
err := factory.Client.Get().Path("pods").Path(podID).Do().Into(pod)
|
||||
ctx := api.WithNamespace(api.NewContext(), pod.Namespace)
|
||||
err := factory.Client.Get().Namespace(api.Namespace(ctx)).Path("pods").Path(podID).Do().Into(pod)
|
||||
if err != nil {
|
||||
glog.Errorf("Error getting pod %v for retry: %v; abandoning", podID, err)
|
||||
return
|
||||
@@ -256,7 +257,8 @@ type binder struct {
|
||||
// Bind just does a POST binding RPC.
|
||||
func (b *binder) Bind(binding *api.Binding) error {
|
||||
glog.V(2).Infof("Attempting to bind %v to %v", binding.PodID, binding.Host)
|
||||
return b.Post().Path("bindings").Body(binding).Do().Error()
|
||||
ctx := api.WithNamespace(api.NewContext(), binding.Namespace)
|
||||
return b.Post().Namespace(api.Namespace(ctx)).Path("bindings").Body(binding).Do().Error()
|
||||
}
|
||||
|
||||
type clock interface {
|
||||
|
@@ -73,8 +73,9 @@ func (s *Scheduler) scheduleOne() {
|
||||
return
|
||||
}
|
||||
b := &api.Binding{
|
||||
PodID: pod.ID,
|
||||
Host: dest,
|
||||
TypeMeta: api.TypeMeta{Namespace: pod.Namespace},
|
||||
PodID: pod.ID,
|
||||
Host: dest,
|
||||
}
|
||||
if err := s.config.Binder.Bind(b); err != nil {
|
||||
record.Eventf(pod, "", string(api.PodWaiting), "failedScheduling", "Binding rejected: %v", err)
|
||||
|
Reference in New Issue
Block a user