[Infrastructure UI] Upgrade assistand: Extend deprecation errors rules for 8.x (#153094)

Closes #152954

## Summary

This PR fixes the issue with deprecation errors in the Upgrade
assistance for versions newer than 8.x

### Testing

1. First check that they are no error - go to Kibana > Stack Management
> Upgrade assistant and there shouldn't be any critical errors:

![image](https://user-images.githubusercontent.com/14139027/224307316-70b800c6-ec8e-442e-8b93-5b53886b13e8.png)

2. Go to Kibana > Infrastructure > Settings and change the default value
from `metrics-*,metricbeat-*` to anything else - even
`metricbeat-*,metrics-*` (swapping the order) will work. Apply the
changes. <img width="1725" alt="image"
src="https://user-images.githubusercontent.com/14139027/224307871-bd710809-c1da-4403-8b48-1e0f9ad8298b.png">

3. Go to Kibana > Stack Management > Upgrade assistant and there
shouldn't be any critical errors.
This commit is contained in:
jennypavlova 2023-03-20 11:29:52 +01:00 committed by GitHub
parent 7a0b6ba524
commit ecd98ef5cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -198,7 +198,7 @@ export const getInfraDeprecationsFactory =
const { name, fields } = configuration;
for (const [key, defaultValue] of Object.entries(DEFAULT_VALUES)) {
const configuredValue = Reflect.get(fields, key);
if (configuredValue !== defaultValue) {
if (configuredValue !== undefined && configuredValue !== defaultValue) {
const affectedConfigNames = deprecatedFieldsToSourceConfigMap.get(key) ?? [];
affectedConfigNames.push(name);
deprecatedFieldsToSourceConfigMap.set(key, affectedConfigNames);