ui: [BUGFIX] Fix missing or duplicate service instance health checks (#9660)

* Use NodeName not Node for cross checking proxies/instances

* Also copy over the meta data to keep the correct cursor/index

* When we sync checks to the ProxyInstance replace rather than accumulate
This commit is contained in:
John Cowen 2021-01-29 15:51:23 +00:00 committed by GitHub
parent 2eea58bcc4
commit 55ea532f88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -41,7 +41,9 @@ export default class ProxyService extends RepositoryService {
return this.findAllBySlug(slug, dc, nspace, configuration).then(function(items) { return this.findAllBySlug(slug, dc, nspace, configuration).then(function(items) {
let res = {}; let res = {};
if (get(items, 'length') > 0) { if (get(items, 'length') > 0) {
let instance = items.filterBy('ServiceProxy.DestinationServiceID', id).findBy('Node', node); let instance = items
.filterBy('ServiceProxy.DestinationServiceID', id)
.findBy('NodeName', node);
if (instance) { if (instance) {
res = instance; res = instance;
} else { } else {

View File

@ -48,10 +48,13 @@ export default class ServiceInstanceService extends RepositoryService {
// } // }
// Copy over all the things to the ProxyServiceInstance // Copy over all the things to the ProxyServiceInstance
['Service', 'Node'].forEach(prop => { ['Service', 'Node', 'meta'].forEach(prop => {
set(proxy, prop, instance[prop]); set(proxy, prop, instance[prop]);
}); });
['Checks'].forEach(prop => { ['Checks'].forEach(prop => {
// completely wipe out any previous values so we don't accumulate things
// eternally
proxy.set(prop, []);
instance[prop].forEach(item => { instance[prop].forEach(item => {
if (typeof item !== 'undefined') { if (typeof item !== 'undefined') {
proxy[prop].addFragment(item.copy()); proxy[prop].addFragment(item.copy());