minor fix for making map (#6076)

Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
This commit is contained in:
Yao Zengzeng 2019-10-26 10:06:00 +08:00 committed by Chris Marchbanks
parent fbcf41c90b
commit 1afa476b8a
3 changed files with 6 additions and 3 deletions

View file

@ -144,7 +144,8 @@ const (
)
func ingressLabels(ingress *v1beta1.Ingress) model.LabelSet {
ls := make(model.LabelSet, len(ingress.Labels)+len(ingress.Annotations)+2)
// Each label and annotation will create two key-value pairs in the map.
ls := make(model.LabelSet, 2*(len(ingress.Labels)+len(ingress.Annotations))+2)
ls[ingressNameLabel] = lv(ingress.Name)
ls[namespaceLabel] = lv(ingress.Namespace)

View file

@ -151,7 +151,8 @@ const (
)
func nodeLabels(n *apiv1.Node) model.LabelSet {
ls := make(model.LabelSet, len(n.Labels)+len(n.Annotations)+1)
// Each label and annotation will create two key-value pairs in the map.
ls := make(model.LabelSet, 2*(len(n.Labels)+len(n.Annotations))+1)
ls[nodeNameLabel] = lv(n.Name)

View file

@ -149,7 +149,8 @@ const (
)
func serviceLabels(svc *apiv1.Service) model.LabelSet {
ls := make(model.LabelSet, len(svc.Labels)+len(svc.Annotations)+2)
// Each label and annotation will create two key-value pairs in the map.
ls := make(model.LabelSet, 2*(len(svc.Labels)+len(svc.Annotations))+2)
ls[serviceNameLabel] = lv(svc.Name)
ls[namespaceLabel] = lv(svc.Namespace)