Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 8648969

Browse files
committed
address comments
1 parent 59a8b11 commit 8648969

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

pkg/envoy/ads/profile.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ func xdsPathTimeTrack(startedAt time.Time, typeURI envoy.TypeURI, proxy *envoy.P
2828
Observe(elapsed.Seconds())
2929
}
3030

31-
func (s *Server) trackXDSLog(proxyID string, typeURL envoy.TypeURI) {
31+
func (s *Server) trackXDSLog(proxyUUID string, typeURL envoy.TypeURI) {
3232
s.withXdsLogMutex(func() {
33-
if _, ok := s.xdsLog[proxyID]; !ok {
34-
s.xdsLog[proxyID] = make(map[envoy.TypeURI][]time.Time)
33+
if _, ok := s.xdsLog[proxyUUID]; !ok {
34+
s.xdsLog[proxyUUID] = make(map[envoy.TypeURI][]time.Time)
3535
}
3636

37-
timeSlice, ok := s.xdsLog[proxyID][typeURL]
37+
timeSlice, ok := s.xdsLog[proxyUUID][typeURL]
3838
if !ok {
39-
s.xdsLog[proxyID][typeURL] = []time.Time{time.Now()}
39+
s.xdsLog[proxyUUID][typeURL] = []time.Time{time.Now()}
4040
return
4141
}
4242

4343
timeSlice = append(timeSlice, time.Now())
4444
if len(timeSlice) > MaxXdsLogsPerProxy {
4545
timeSlice = timeSlice[1:]
4646
}
47-
s.xdsLog[proxyID][typeURL] = timeSlice
47+
s.xdsLog[proxyUUID][typeURL] = timeSlice
4848
})
4949
}
5050

pkg/envoy/ads/stream.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ func isCNforProxy(proxy *envoy.Proxy, cn certificate.CommonName) bool {
333333
}
334334

335335
func getCertificateCommonNameMeta(cn certificate.CommonName) (envoy.ProxyKind, uuid.UUID, identity.ServiceIdentity, error) {
336-
// XDS cert CN is of the form <proxy-UUID>.<kind>.<proxy-identity>.<namespace>.<trust-domain>
336+
// XDS cert CN is of the form <proxy-UUID>.<kind>.<proxy-identity>, where proxy-identity is of the
337+
// form <name>.<namespace>
337338
chunks := strings.SplitN(cn.String(), constants.DomainDelimiter, 5)
338339
if len(chunks) < 4 {
339340
return "", uuid.UUID{}, "", errInvalidCertificateCN

pkg/envoy/proxy.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ func NewProxy(kind ProxyKind, uuid uuid.UUID, svcIdentity identity.ServiceIdenti
231231
}
232232
}
233233

234-
// NewXDSCertCommonName returns a newly generated CommonName for a certificate of the form: <ProxyUUID>.<kind>.<serviceAccount>.<namespace>
234+
// NewXDSCertCommonName returns a newly generated CommonName for a certificate of the form: <ProxyUUID>.<kind>.<identity>
235+
// where identity itself is of the form <name>.<namespace>.cluster.local
235236
func NewXDSCertCommonName(proxyUUID uuid.UUID, kind ProxyKind, serviceAccount, namespace string) certificate.CommonName {
236237
return certificate.CommonName(fmt.Sprintf("%s.%s.%s.%s.%s", proxyUUID.String(), kind, serviceAccount, namespace, identity.ClusterLocalTrustDomain))
237238
}

pkg/identity/types.go

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ func (sa K8sServiceAccount) String() string {
6161
}
6262

6363
// ToServiceIdentity converts K8sServiceAccount to the newer ServiceIdentity
64-
// TODO(draychev): ToServiceIdentity is used in many places to ease with transition from K8sServiceAccount to ServiceIdentity and should be removed (not everywhere) - [https://github.com/openservicemesh/osm/issues/2218]
6564
func (sa K8sServiceAccount) ToServiceIdentity() ServiceIdentity {
6665
return New(sa.Name, sa.Namespace)
6766
}

0 commit comments

Comments
 (0)