@@ -90,9 +90,7 @@ public void dispatchPodWatch(Watch.Response<V1Pod> item) {
90
90
DomainPresenceInfo existing = getExisting (metadata .getNamespace (), domainUID );
91
91
if (existing != null ) {
92
92
ServerKubernetesObjects sko =
93
- existing
94
- .getServers ()
95
- .computeIfAbsent (metadata .getName (), k -> new ServerKubernetesObjects ());
93
+ existing .getServers ().computeIfAbsent (serverName , k -> new ServerKubernetesObjects ());
96
94
if (sko != null ) {
97
95
switch (item .type ) {
98
96
case "ADDED" :
@@ -189,7 +187,7 @@ public void dispatchServiceWatch(Watch.Response<V1Service> item) {
189
187
ServerKubernetesObjects sko =
190
188
existing
191
189
.getServers ()
192
- .computeIfAbsent (metadata . getName () , k -> new ServerKubernetesObjects ());
190
+ .computeIfAbsent (serverName , k -> new ServerKubernetesObjects ());
193
191
if (channelName != null ) {
194
192
sko .getChannels ()
195
193
.compute (
@@ -235,7 +233,7 @@ public void dispatchServiceWatch(Watch.Response<V1Service> item) {
235
233
ServerKubernetesObjects sko =
236
234
existing
237
235
.getServers ()
238
- .computeIfAbsent (metadata . getName () , k -> new ServerKubernetesObjects ());
236
+ .computeIfAbsent (serverName , k -> new ServerKubernetesObjects ());
239
237
if (channelName != null ) {
240
238
sko .getChannels ()
241
239
.compute (
@@ -282,7 +280,7 @@ public void dispatchServiceWatch(Watch.Response<V1Service> item) {
282
280
makeRightDomainPresence (existing , true , false , true );
283
281
}
284
282
} else if (serverName != null ) {
285
- ServerKubernetesObjects sko = existing .getServers ().get (metadata . getName () );
283
+ ServerKubernetesObjects sko = existing .getServers ().get (serverName );
286
284
if (sko != null ) {
287
285
if (channelName != null ) {
288
286
boolean removed =
@@ -456,11 +454,15 @@ private static void onEvent(V1Event event) {
456
454
ConcurrentMap <String , DomainPresenceInfo > map = domains .get (ns );
457
455
if (map != null ) {
458
456
for (DomainPresenceInfo d : map .values ()) {
459
- ServerKubernetesObjects sko = d .getServers ().get (name );
460
- if (sko != null ) {
461
- int idx = message .lastIndexOf (':' );
462
- sko .getLastKnownStatus ().set (message .substring (idx + 1 ).trim ());
463
- break ;
457
+ String domainUIDPlusDash = d .getDomainUID () + "-" ;
458
+ if (name .startsWith (domainUIDPlusDash )) {
459
+ String serverName = name .substring (domainUIDPlusDash .length ());
460
+ ServerKubernetesObjects sko = d .getServers ().get (serverName );
461
+ if (sko != null ) {
462
+ int idx = message .lastIndexOf (':' );
463
+ sko .getLastKnownStatus ().set (message .substring (idx + 1 ).trim ());
464
+ break ;
465
+ }
464
466
}
465
467
}
466
468
}
@@ -632,29 +634,29 @@ public void makeRightDomainPresence(
632
634
boolean explicitRecheck ,
633
635
boolean isDeleting ,
634
636
boolean isWillInterrupt ) {
637
+ Domain domain = info .getDomain ();
635
638
DomainSpec spec = null ;
636
- String ns = info .getNamespace ();
637
- String domainUID = info .getDomainUID ();
638
- Domain dom = info .getDomain ();
639
- if (dom != null ) {
640
- spec = dom .getSpec ();
639
+ if (domain != null ) {
640
+ spec = domain .getSpec ();
641
641
DomainPresenceControl .normalizeDomainSpec (spec );
642
642
}
643
+ String ns = info .getNamespace ();
644
+ String domainUID = info .getDomainUID ();
643
645
644
646
if (!Main .isNamespaceStopping (ns ).get ()) {
645
647
DomainPresenceInfo existing = getExisting (ns , domainUID );
646
648
if (existing != null ) {
647
649
Domain current = existing .getDomain ();
648
650
if (current != null ) {
649
651
// Is this an outdated watch event?
650
- if (isOutdated (current .getMetadata (), dom .getMetadata ())) {
652
+ if (domain != null && isOutdated (current .getMetadata (), domain .getMetadata ())) {
651
653
LOGGER .fine (MessageKeys .NOT_STARTING_DOMAINUID_THREAD , domainUID );
652
654
return ;
653
655
}
654
656
// Has the spec actually changed? We will get watch events for status updates
655
657
if (!explicitRecheck && spec != null && spec .equals (current .getSpec ())) {
656
658
// nothing in the spec has changed, but status likely did; update current
657
- existing .setDomain (dom );
659
+ existing .setDomain (domain );
658
660
LOGGER .fine (MessageKeys .NOT_STARTING_DOMAINUID_THREAD , domainUID );
659
661
return ;
660
662
}
0 commit comments