Skip to content

Commit

Permalink
Fix nil map for cluster builder (#46024)
Browse files Browse the repository at this point in the history
Co-authored-by: Sergii Shapar <sshapar@google.com>
  • Loading branch information
istio-testing and sergii-ssh authored Jul 14, 2023
1 parent f937989 commit fc7ca46
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pilot/pkg/networking/core/v1alpha3/cluster_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,9 @@ func (cb *ClusterBuilder) buildLocalityLbEndpoints(proxyView model.ProxyView, se
svcLabels := service.Attributes.Labels
if _, ok := svcLabels[model.IstioCanonicalServiceLabelName]; ok {
metadata = instance.Endpoint.MetadataClone()
if metadata.Labels == nil {
metadata.Labels = make(map[string]string)
}
metadata.Labels[model.IstioCanonicalServiceLabelName] = svcLabels[model.IstioCanonicalServiceLabelName]
metadata.Labels[model.IstioCanonicalServiceRevisionLabelName] = svcLabels[model.IstioCanonicalServiceRevisionLabelName]
} else {
Expand Down

0 comments on commit fc7ca46

Please sign in to comment.