Skip to content

Commit 6e332bf

Browse files
fixing kubectl version output parsing to work properly with Kubernetes 1.25+ (#217)
1 parent 4a527ec commit 6e332bf

File tree

5 files changed

+31
-14
lines changed

5 files changed

+31
-14
lines changed

electron/app/js/kubectlUtils.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ async function getOperatorVersionFromDomainConfigMap(kubectlExe, domainNamespace
281281
}
282282

283283
async function verifyClusterConnectivity(kubectlExe, options) {
284-
const args = [ 'version', '--short' ];
284+
const args = [ 'version', '-o', 'json' ];
285285
const httpsProxyUrl = getHttpsProxyUrl();
286286
const bypassProxyHosts = getBypassProxyHosts();
287287

@@ -293,11 +293,11 @@ async function verifyClusterConnectivity(kubectlExe, options) {
293293
return new Promise(resolve => {
294294
executeFileCommand(kubectlExe, args, env).then(stdout => {
295295
if (stdout) {
296-
const lines = stdout.split(/\r?\n/);
297-
results.clientVersion = lines[0].trim().match(/.*(\d+\.\d+\.\d+).*/)[1];
296+
const jsonOutput = JSON.parse(stdout);
297+
results.clientVersion = jsonOutput?.clientVersion?.gitVersion;
298298
getLogger().debug('Kubernetes Client Version = %s', results.clientVersion);
299-
if (lines.length > 1 && lines[1]) {
300-
results.serverVersion = lines[1].trim().match(/.*(\d+\.\d+\.\d+).*/)[1];
299+
if (jsonOutput?.serverVersion?.gitVersion) {
300+
results.serverVersion = jsonOutput?.serverVersion?.gitVersion;
301301
getLogger().debug('Kubernetes Server Version = %s', results.serverVersion);
302302
}
303303
}

webui/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"dependencies": {
1313
"@oracle/oraclejet": "^13.1.7",
14-
"@oracle/wrc-jet-pack": "~2.4.2-develop",
14+
"@oracle/wrc-jet-pack": "^2.4.2-develop.202303071626",
1515
"ace-builds": "^1.15.0",
1616
"i18next": "^22.4.9",
1717
"jquery": "^3.6.3",

webui/src/js/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
'wdt-model-designer': 'jet-composites/wdt-model-designer/1.0.0',
4747
'cfe-navtree': 'jet-composites/cfe-navtree/1.0.0',
4848
'cfe-multi-select': 'jet-composites/cfe-multi-select/1.0.0',
49-
'cfe-property-list-editor': 'jet-composites/cfe-property-list-editor/1.0.0'
49+
'cfe-property-list-editor': 'jet-composites/cfe-property-list-editor/1.0.0',
50+
'cfe-policy-editor': 'jet-composites/cfe-policy-editor/1.0.0'
5051
}
5152
// endinjector
5253

webui/src/js/path_mapping.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@
272272
"cdnPath": "preact/compat/dist/compat.umd"
273273
}
274274
},
275+
275276
"preact/jsx-runtime": {
276277
"cdn": "3rdparty",
277278
"cwd": "node_modules/preact/jsx-runtime/dist",
@@ -499,6 +500,21 @@
499500
"path": "jet-composites/cfe-property-list-editor/1.0.0",
500501
"cdnPath": ""
501502
}
503+
},
504+
505+
"cfe-policy-editor": {
506+
"cdn": "3rdparty",
507+
"cwd": "node_modules/@oracle/wrc-jet-pack/dist/jet-composites/cfe-policy-editor",
508+
"debug": {
509+
"src": ["**"],
510+
"path": "jet-composites/cfe-policy-editor/1.0.0",
511+
"cdnPath": ""
512+
},
513+
"release": {
514+
"src": ["**"],
515+
"path": "jet-composites/cfe-policy-editor/1.0.0",
516+
"cdnPath": ""
517+
}
502518
}
503519
}
504520
}

0 commit comments

Comments
 (0)