Skip to content

Commit f377a40

Browse files
Merge pull request #19801 from knobunc/fix/add-namespaces-to-unidler
Added namespaces to log messages in the hybid proxy
2 parents 552944f + 1a6435d commit f377a40

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

pkg/proxy/hybrid/proxy.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ func (p *HybridProxier) OnServiceAdd(service *api.Service) {
7474
// since this is an Add, we know the service isn't already in another
7575
// proxy, so don't bother trying to remove like on an update
7676
if isUsingUserspace, ok := p.usingUserspace[svcName]; ok && isUsingUserspace {
77-
glog.V(6).Infof("hybrid proxy: add svc %s in unidling proxy", service.Name)
77+
glog.V(6).Infof("hybrid proxy: add svc %s/%s in unidling proxy", service.Namespace, service.Name)
7878
p.unidlingServiceHandler.OnServiceAdd(service)
7979
} else {
80-
glog.V(6).Infof("hybrid proxy: add svc %s in main proxy", service.Name)
80+
glog.V(6).Infof("hybrid proxy: add svc %s/%s in main proxy", service.Namespace, service.Name)
8181
p.mainServicesHandler.OnServiceAdd(service)
8282
}
8383
}
@@ -94,10 +94,10 @@ func (p *HybridProxier) OnServiceUpdate(oldService, service *api.Service) {
9494
// NB: usingUserspace can only change in the endpoints handler,
9595
// so that should deal with calling OnServiceDelete on switches
9696
if isUsingUserspace, ok := p.usingUserspace[svcName]; ok && isUsingUserspace {
97-
glog.V(6).Infof("hybrid proxy: update svc %s in unidling proxy", service.Name)
97+
glog.V(6).Infof("hybrid proxy: update svc %s/%s in unidling proxy", service.Namespace, service.Name)
9898
p.unidlingServiceHandler.OnServiceUpdate(oldService, service)
9999
} else {
100-
glog.V(6).Infof("hybrid proxy: update svc %s in main proxy", service.Name)
100+
glog.V(6).Infof("hybrid proxy: update svc %s/%s in main proxy", service.Namespace, service.Name)
101101
p.mainServicesHandler.OnServiceUpdate(oldService, service)
102102
}
103103
}
@@ -112,10 +112,10 @@ func (p *HybridProxier) OnServiceDelete(service *api.Service) {
112112
defer p.usingUserspaceLock.Unlock()
113113

114114
if isUsingUserspace, ok := p.usingUserspace[svcName]; ok && isUsingUserspace {
115-
glog.V(6).Infof("hybrid proxy: del svc %s in unidling proxy", service.Name)
115+
glog.V(6).Infof("hybrid proxy: del svc %s/%s in unidling proxy", service.Namespace, service.Name)
116116
p.unidlingServiceHandler.OnServiceDelete(service)
117117
} else {
118-
glog.V(6).Infof("hybrid proxy: del svc %s in main proxy", service.Name)
118+
glog.V(6).Infof("hybrid proxy: del svc %s/%s in main proxy", service.Namespace, service.Name)
119119
p.mainServicesHandler.OnServiceDelete(service)
120120
}
121121
}
@@ -149,16 +149,16 @@ func (p *HybridProxier) shouldEndpointsUseUserspace(endpoints *api.Endpoints) bo
149149
func (p *HybridProxier) switchService(name types.NamespacedName) {
150150
svc, err := p.serviceLister.Services(name.Namespace).Get(name.Name)
151151
if err != nil {
152-
utilruntime.HandleError(fmt.Errorf("Error while getting service %s from cache: %v", name.String(), err))
152+
utilruntime.HandleError(fmt.Errorf("Error while getting service %s/%s from cache: %v", name.Namespace, name.String(), err))
153153
return
154154
}
155155

156156
if p.usingUserspace[name] {
157-
glog.V(6).Infof("hybrid proxy: switching svc %s to unidling proxy", svc.Name)
157+
glog.V(6).Infof("hybrid proxy: switching svc %s/%s to unidling proxy", svc.Namespace, svc.Name)
158158
p.unidlingServiceHandler.OnServiceAdd(svc)
159159
p.mainServicesHandler.OnServiceDelete(svc)
160160
} else {
161-
glog.V(6).Infof("hybrid proxy: switching svc %s to main proxy", svc.Name)
161+
glog.V(6).Infof("hybrid proxy: switching svc %s/%s to main proxy", svc.Namespace, svc.Name)
162162
p.mainServicesHandler.OnServiceAdd(svc)
163163
p.unidlingServiceHandler.OnServiceDelete(svc)
164164
}
@@ -167,7 +167,7 @@ func (p *HybridProxier) switchService(name types.NamespacedName) {
167167
func (p *HybridProxier) OnEndpointsAdd(endpoints *api.Endpoints) {
168168
// we track all endpoints in the unidling endpoints handler so that we can succesfully
169169
// detect when a service become unidling
170-
glog.V(6).Infof("hybrid proxy: (always) add ep %s in unidling proxy", endpoints.Name)
170+
glog.V(6).Infof("hybrid proxy: (always) add ep %s/%s in unidling proxy", endpoints.Namespace, endpoints.Name)
171171
p.unidlingEndpointsHandler.OnEndpointsAdd(endpoints)
172172

173173
p.usingUserspaceLock.Lock()
@@ -182,7 +182,7 @@ func (p *HybridProxier) OnEndpointsAdd(endpoints *api.Endpoints) {
182182
p.usingUserspace[svcName] = p.shouldEndpointsUseUserspace(endpoints)
183183

184184
if !p.usingUserspace[svcName] {
185-
glog.V(6).Infof("hybrid proxy: add ep %s in main proxy", endpoints.Name)
185+
glog.V(6).Infof("hybrid proxy: add ep %s/%s in main proxy", endpoints.Namespace, endpoints.Name)
186186
p.mainEndpointsHandler.OnEndpointsAdd(endpoints)
187187
}
188188

@@ -196,7 +196,7 @@ func (p *HybridProxier) OnEndpointsAdd(endpoints *api.Endpoints) {
196196
func (p *HybridProxier) OnEndpointsUpdate(oldEndpoints, endpoints *api.Endpoints) {
197197
// we track all endpoints in the unidling endpoints handler so that we can succesfully
198198
// detect when a service become unidling
199-
glog.V(6).Infof("hybrid proxy: (always) update ep %s in unidling proxy", endpoints.Name)
199+
glog.V(6).Infof("hybrid proxy: (always) update ep %s/%s in unidling proxy", endpoints.Namespace, endpoints.Name)
200200
p.unidlingEndpointsHandler.OnEndpointsUpdate(oldEndpoints, endpoints)
201201

202202
p.usingUserspaceLock.Lock()
@@ -218,16 +218,16 @@ func (p *HybridProxier) OnEndpointsUpdate(oldEndpoints, endpoints *api.Endpoints
218218
isSwitch := wasUsingUserspace != p.usingUserspace[svcName]
219219

220220
if !isSwitch && !p.usingUserspace[svcName] {
221-
glog.V(6).Infof("hybrid proxy: update ep %s in main proxy", endpoints.Name)
221+
glog.V(6).Infof("hybrid proxy: update ep %s/%s in main proxy", endpoints.Namespace, endpoints.Name)
222222
p.mainEndpointsHandler.OnEndpointsUpdate(oldEndpoints, endpoints)
223223
return
224224
}
225225

226226
if p.usingUserspace[svcName] {
227-
glog.V(6).Infof("hybrid proxy: del ep %s in main proxy", endpoints.Name)
227+
glog.V(6).Infof("hybrid proxy: del ep %s/%s in main proxy", endpoints.Namespace, endpoints.Name)
228228
p.mainEndpointsHandler.OnEndpointsDelete(oldEndpoints)
229229
} else {
230-
glog.V(6).Infof("hybrid proxy: add ep %s in main proxy", endpoints.Name)
230+
glog.V(6).Infof("hybrid proxy: add ep %s/%s in main proxy", endpoints.Namespace, endpoints.Name)
231231
p.mainEndpointsHandler.OnEndpointsAdd(endpoints)
232232
}
233233

@@ -237,7 +237,7 @@ func (p *HybridProxier) OnEndpointsUpdate(oldEndpoints, endpoints *api.Endpoints
237237
func (p *HybridProxier) OnEndpointsDelete(endpoints *api.Endpoints) {
238238
// we track all endpoints in the unidling endpoints handler so that we can succesfully
239239
// detect when a service become unidling
240-
glog.V(6).Infof("hybrid proxy: (always) del ep %s in unidling proxy", endpoints.Name)
240+
glog.V(6).Infof("hybrid proxy: (always) del ep %s/%s in unidling proxy", endpoints.Namespace, endpoints.Name)
241241
p.unidlingEndpointsHandler.OnEndpointsDelete(endpoints)
242242

243243
p.usingUserspaceLock.Lock()
@@ -256,7 +256,7 @@ func (p *HybridProxier) OnEndpointsDelete(endpoints *api.Endpoints) {
256256
}
257257

258258
if !usingUserspace {
259-
glog.V(6).Infof("hybrid proxy: del ep %s in main proxy", endpoints.Name)
259+
glog.V(6).Infof("hybrid proxy: del ep %s/%s in main proxy", endpoints.Namespace, endpoints.Name)
260260
p.mainEndpointsHandler.OnEndpointsDelete(endpoints)
261261
}
262262

0 commit comments

Comments
 (0)