Adding lib changes

This commit is contained in:
Shivam Gupta
2020-01-09 12:27:50 +05:30
parent ad0b77acbe
commit 31a423057f
4 changed files with 28 additions and 11 deletions
+9
View File
@@ -69,3 +69,12 @@ function downloadKubectl(version) {
});
}
exports.downloadKubectl = downloadKubectl;
function getTrafficSplitAPIVersion(kubectl) {
const result = kubectl.executeCommand('api-versions');
const trafficSplitAPIVersion = result.stdout.split('\n').find(version => version.startsWith('split.smi-spec.io'));
if (trafficSplitAPIVersion == null || typeof trafficSplitAPIVersion == 'undefined') {
throw new Error('UnableToCreateTrafficSplitManifestFile');
}
return trafficSplitAPIVersion;
}
exports.getTrafficSplitAPIVersion = getTrafficSplitAPIVersion;