mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-29 21:35:50 +00:00
Warn if pod has no labels
This commit is contained in:
parent
d97f6cd0d8
commit
8a59000472
@ -89,7 +89,7 @@ func (c *testClient) Validate(t *testing.T, received runtime.Object, err error)
|
||||
c.ValidateCommon(t, err)
|
||||
|
||||
if c.Response.Body != nil && !reflect.DeepEqual(c.Response.Body, received) {
|
||||
t.Errorf("bad response for request %#v: expected %s, got %s", c.Request, c.Response.Body, received)
|
||||
t.Errorf("bad response for request %#v: expected %#v, got %#v", c.Request, c.Response.Body, received)
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ func (c *testClient) ValidateRaw(t *testing.T, received []byte, err error) {
|
||||
c.ValidateCommon(t, err)
|
||||
|
||||
if c.Response.Body != nil && !reflect.DeepEqual(c.Response.Body, received) {
|
||||
t.Errorf("bad response for request %#v: expected %s, got %s", c.Request, c.Response.Body, received)
|
||||
t.Errorf("bad response for request %#v: expected %#v, got %#v", c.Request, c.Response.Body, received)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,10 @@ func (r RealPodControl) createReplica(namespace string, controller api.Replicati
|
||||
glog.Errorf("Unable to convert pod template: %v", err)
|
||||
return
|
||||
}
|
||||
if labels.Set(pod.Labels).AsSelector().Empty() {
|
||||
glog.Errorf("Unable to create pod replica, no labels")
|
||||
return
|
||||
}
|
||||
if _, err := r.kubeClient.Pods(namespace).Create(pod); err != nil {
|
||||
glog.Errorf("Unable to create pod replica: %v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user