Skip to content

Commit 4113072

Browse files
Add Breaking Changes viewer to assessing-your-cluster-for-migration.md (#9443) (#9580)
1 parent 2e8f7c1 commit 4113072

File tree

10 files changed

+1417
-26
lines changed

10 files changed

+1417
-26
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Breaking changes data for migration paths
2+
#
3+
# Data structure:
4+
# breaking_changes: Array of breaking change objects with:
5+
# - title: Display name of the breaking change
6+
# - url: Link to documentation
7+
# - introducedIn: Version where the breaking change was introduced
8+
# - affects (optional): Object with minSource and maxTarget versions
9+
# - minSource: Minimum source version affected
10+
# - maxTarget: Maximum target version affected
11+
# - comp: Array of components affected (e.g., ["dashboards"])
12+
# - transformation (optional): Optional object with transformation information
13+
# - title: Title of the transformation guide
14+
# - url: Link to transformation guide
15+
breaking_changes:
16+
- title: "Amazon OpenSearch Service: Upgrade Guidance"
17+
url: "https://docs.aws.amazon.com/opensearch-service/latest/developerguide/version-migration.html"
18+
introducedIn: "OpenSearch 1.3"
19+
comp: []
20+
- title: "Amazon OpenSearch Service: Rename - Summary of changes"
21+
url: "https://docs.aws.amazon.com/opensearch-service/latest/developerguide/rename.html"
22+
introducedIn: "OpenSearch 1.3"
23+
comp: []
24+
- title: "OpenSearch 2.0: Remove mapping types parameter"
25+
url: "/docs/latest/breaking-changes/#remove-mapping-types-parameter"
26+
introducedIn: "OpenSearch 2.19"
27+
comp: []
28+
transformation:
29+
title: "Type Mapping Deprecation"
30+
url: "/docs/latest/migration-assistant/migration-phases/planning-your-migration/handling-type-mapping-deprecation/"
31+
- title: "OpenSearch Notifications Plugins"
32+
url: "/breaking-changes/#add-opensearch-notifications-plugins"
33+
introducedIn: "OpenSearch 2.19"
34+
comp: []
35+
- title: "OpenSearch 2.0: Client JDK 8 Support Dropped"
36+
url: "/docs/latest/breaking-changes/#drop-support-for-jdk-8"
37+
introducedIn: "OpenSearch 2.19"
38+
comp: []
39+
- title: "Removal of Types in Elasticsearch 7.x"
40+
url: "https://www.elastic.co/guide/en/elasticsearch/reference/7.10/removal-of-types.html"
41+
introducedIn: "Elasticsearch 7.10"
42+
comp: []
43+
transformation:
44+
title: "Type Mapping Deprecation"
45+
url: "/docs/latest/migration-assistant/migration-phases/planning-your-migration/handling-type-mapping-deprecation/"
46+
- title: "Elasticsearch 6.0 - 6.6 Breaking Changes"
47+
url: "https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes.html"
48+
introducedIn: "Elasticsearch 6.8"
49+
comp: []
50+
- title: "Elasticsearch 7.0 - 7.10 Breaking Changes"
51+
url: "https://www.elastic.co/guide/en/elasticsearch/reference/7.10/breaking-changes.html"
52+
introducedIn: "Elasticsearch 7.10"
53+
comp: []
54+
- title: "Kibana 6 Breaking Changes"
55+
url: "https://www.elastic.co/guide/en/kibana/6.8/breaking-changes.html"
56+
introducedIn: "Elasticsearch 6.8"
57+
comp: ["dashboards"]
58+
- title: "Kibana 7 Breaking Changes"
59+
url: "https://www.elastic.co/guide/en/kibana/7.10/breaking-changes.html"
60+
introducedIn: "Elasticsearch 7.10"
61+
comp: ["dashboards"]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Migration paths for Migration Assistant
2+
migration_paths:
3+
- source: "Elasticsearch 5.6"
4+
targets:
5+
- "OpenSearch 1.3"
6+
- "OpenSearch 2.19"
7+
- source: "Elasticsearch 6.8"
8+
targets:
9+
- "OpenSearch 1.3"
10+
- "OpenSearch 2.19"
11+
- source: "Elasticsearch 7.10"
12+
targets:
13+
- "OpenSearch 1.3"
14+
- "OpenSearch 2.19"
15+
- source: "Elasticsearch 7.17"
16+
targets:
17+
- "OpenSearch 1.3"
18+
- "OpenSearch 2.19"
19+
- source: "OpenSearch 1.3"
20+
targets:
21+
- "OpenSearch 2.19"
22+
- source: "OpenSearch 2.19"
23+
targets:
24+
- "OpenSearch 2.19"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
.breaking-changes-selector {
2+
background: #f5f7f7;
3+
padding: 15px;
4+
border-radius: 4px;
5+
margin-bottom: 20px;
6+
}
7+
8+
.breaking-changes-selector div {
9+
margin: 10px 0;
10+
}
11+
12+
.breaking-changes-selector label {
13+
margin-right: 8px;
14+
}
15+
16+
.breaking-changes-selector select {
17+
margin-right: 15px;
18+
padding: 4px;
19+
}
20+
21+
.breaking-changes-selector input[type="checkbox"] {
22+
margin-right: 4px;
23+
}
24+
25+
#breaking-changes-results {
26+
margin-top: 15px;
27+
}
28+
29+
#breaking-changes-results ul {
30+
margin-top: 10px;
31+
}
32+
33+
.transformation-info {
34+
margin-left: 20px;
35+
padding: 5px 10px;
36+
background-color: #e6f7ff;
37+
border-left: 3px solid #1890ff;
38+
margin-top: 5px;
39+
margin-bottom: 5px;
40+
font-size: 0.9em;
41+
}
42+
43+
.component-checkbox {
44+
display: inline-block;
45+
margin-left: 20px;
46+
}
47+
48+
.transformation-request {
49+
margin-top: 15px;
50+
padding: 10px;
51+
background-color: #f0f0f0;
52+
border-radius: 4px;
53+
font-size: 0.9em;
54+
font-style: italic;
55+
}
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
/**
2+
* Breaking changes data for migration paths
3+
*
4+
* Data structure:
5+
* - VERSIONS: Array of version strings derived from valid_migrations.yml
6+
* - VERSION_ORDER: Array of version strings in strict order (derived from VERSIONS)
7+
* - breakingChanges: Array of breaking change objects with:
8+
* - title: Display name of the breaking change
9+
* - url: Link to documentation
10+
* - introducedIn: Version where the breaking change was introduced
11+
* - affects (optional): Object with minSource and maxTarget versions
12+
* - minSource: Minimum source version affected
13+
* - maxTarget: Maximum target version affected
14+
* - comp: Array of components affected
15+
* - transformation (optional): Optional object with transformation information
16+
*/
17+
18+
// Variables to store version ordering
19+
let VERSION_ORDER = [];
20+
21+
// Version utility functions that use the dynamically determined version order
22+
export function getVersionIndex(version) {
23+
const index = VERSION_ORDER.indexOf(version);
24+
if (index === -1) throw new Error(`Unknown version: ${version}`);
25+
return index;
26+
}
27+
28+
export function isVersionBetween(target, min, max) {
29+
const targetIdx = getVersionIndex(target);
30+
const minIdx = getVersionIndex(min);
31+
const maxIdx = getVersionIndex(max);
32+
return targetIdx >= minIdx && targetIdx <= maxIdx;
33+
}
34+
35+
// Helper function to determine version ordering based on migration paths
36+
function determineVersionOrder(versions, migrationMap) {
37+
// Start with a copy of all versions
38+
const remainingVersions = [...versions];
39+
const orderedVersions = [];
40+
41+
// First, find versions that are only sources (not targets)
42+
// These are the oldest versions
43+
const onlySources = versions.filter(v =>
44+
!Object.values(migrationMap.targetToSources).flat().includes(v) &&
45+
migrationMap.sourceToTargets[v]
46+
);
47+
48+
// Add oldest versions first
49+
onlySources.forEach(v => {
50+
orderedVersions.push(v);
51+
const index = remainingVersions.indexOf(v);
52+
if (index !== -1) remainingVersions.splice(index, 1);
53+
});
54+
55+
// Then add the rest based on migration paths
56+
while (remainingVersions.length > 0) {
57+
let added = false;
58+
59+
for (let i = 0; i < remainingVersions.length; i++) {
60+
const version = remainingVersions[i];
61+
const sources = migrationMap.targetToSources[version] || [];
62+
63+
// If all sources of this version are already in orderedVersions,
64+
// we can add this version next
65+
if (sources.every(s => orderedVersions.includes(s))) {
66+
orderedVersions.push(version);
67+
remainingVersions.splice(i, 1);
68+
added = true;
69+
break;
70+
}
71+
}
72+
73+
// If we couldn't add any version in this pass, there might be a cycle
74+
// Just add the first remaining version to break the cycle
75+
if (!added && remainingVersions.length > 0) {
76+
orderedVersions.push(remainingVersions[0]);
77+
remainingVersions.splice(0, 1);
78+
}
79+
}
80+
81+
return orderedVersions;
82+
}
83+
84+
// Variables to store migration data
85+
let VALID_MIGRATIONS = {};
86+
let VERSIONS = [];
87+
let MIGRATION_MAP = {
88+
sourceToTargets: {},
89+
targetToSources: {}
90+
};
91+
92+
// Variables to store breaking changes data
93+
let breakingChanges = [];
94+
95+
// Extract all unique versions for dropdowns
96+
function extractUniqueVersions(migrationsMap) {
97+
const versions = new Set();
98+
99+
// Add all sources
100+
Object.keys(migrationsMap).forEach(source => {
101+
versions.add(source);
102+
});
103+
104+
// Add all targets
105+
Object.values(migrationsMap).forEach(targets => {
106+
targets.forEach(target => {
107+
versions.add(target);
108+
});
109+
});
110+
111+
return Array.from(versions).sort();
112+
}
113+
114+
// Function to generate the reverse mapping (target -> sources)
115+
function generateReverseMigrationMap(forwardMap) {
116+
const reverseMap = {};
117+
118+
Object.entries(forwardMap).forEach(([source, targets]) => {
119+
targets.forEach(target => {
120+
if (!reverseMap[target]) {
121+
reverseMap[target] = [];
122+
}
123+
reverseMap[target].push(source);
124+
});
125+
});
126+
127+
return reverseMap;
128+
}
129+
130+
// Function to initialize the migration data from the data attribute
131+
function initializeMigrationData() {
132+
const migrationDataElement = document.getElementById('migration-data');
133+
134+
if (migrationDataElement && migrationDataElement.dataset.migrationPaths) {
135+
try {
136+
// Parse the JSON data from the data attribute
137+
const migrationPaths = JSON.parse(migrationDataElement.dataset.migrationPaths);
138+
139+
// Transform the data structure from YAML format to the expected JavaScript object format
140+
VALID_MIGRATIONS = migrationPaths.reduce((acc, path) => {
141+
acc[path.source] = path.targets;
142+
return acc;
143+
}, {});
144+
145+
// Now that we have the migration data, create the derived data structures
146+
VERSIONS = extractUniqueVersions(VALID_MIGRATIONS);
147+
MIGRATION_MAP = {
148+
sourceToTargets: VALID_MIGRATIONS,
149+
targetToSources: generateReverseMigrationMap(VALID_MIGRATIONS)
150+
};
151+
152+
// Determine version ordering based on migration paths
153+
VERSION_ORDER = determineVersionOrder(VERSIONS, MIGRATION_MAP);
154+
console.log('Determined version order:', VERSION_ORDER);
155+
} catch (error) {
156+
console.error('Failed to parse migration data:', error);
157+
// Fallback to empty object if parsing fails
158+
VALID_MIGRATIONS = {};
159+
VERSIONS = [];
160+
MIGRATION_MAP = { sourceToTargets: {}, targetToSources: {} };
161+
VERSION_ORDER = [];
162+
}
163+
} else {
164+
console.error('Migration data element not found or empty');
165+
}
166+
}
167+
168+
// Function to initialize the breaking changes data from the data attribute
169+
function initializeBreakingChangesData() {
170+
const migrationDataElement = document.getElementById('migration-data');
171+
172+
if (!migrationDataElement || !migrationDataElement.dataset.breakingChanges) {
173+
console.error('Breaking changes data not found in migration-data element. Make sure to add data-breaking-changes attribute.');
174+
return;
175+
}
176+
177+
try {
178+
// Parse the JSON data from the data attribute
179+
breakingChanges = JSON.parse(migrationDataElement.dataset.breakingChanges);
180+
console.log('Loaded breaking changes data:', breakingChanges.length);
181+
} catch (error) {
182+
console.error('Failed to parse breaking changes data:', error);
183+
// Fallback to empty array if parsing fails
184+
breakingChanges = [];
185+
}
186+
}
187+
188+
// Initialize the data when the DOM is loaded
189+
document.addEventListener('DOMContentLoaded', () => {
190+
initializeMigrationData();
191+
initializeBreakingChangesData();
192+
});
193+
194+
// Export the breaking changes array for use in other modules
195+
export { breakingChanges };

0 commit comments

Comments
 (0)