Skip to content

Commit 41513c3

Browse files
authored
feat: continue installation if the cluster validation cannnot be perf… (#1538)
1 parent 6b4d70d commit 41513c3

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/cmd/validate-cluster.ts

+16-11
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,28 @@ import { getFilename } from 'src/common/utils'
33
import { BasicArguments, helmOptions, setParsedArgs } from 'src/common/yargs'
44
import { supportedK8sVersions } from 'src/supportedK8sVersions.json'
55
import { Argv } from 'yargs'
6-
import { $, nothrow } from 'zx'
6+
import { $ } from 'zx'
77

88
const cmdName = getFilename(__filename)
99

1010
export const validateCluster = async (): Promise<void> => {
1111
const d = terminal(`cmd:${cmdName}:validateCluster`)
1212
d.log('Cluster validation STARTED')
13-
const result = await nothrow($`kubectl version -o json`)
14-
const data = JSON.parse(result.stdout)
15-
const k8sVersion: string = data.serverVersion.gitVersion.slice(1, 5)
16-
if (!supportedK8sVersions.includes(k8sVersion)) {
17-
const k8sVersions = supportedK8sVersions.join(', ')
18-
d.error(
19-
`The cluster with kubernetes version ${k8sVersion} is utilizing a less compatible version for otomi. For optimal performance and features, we recommend using one of our supported versions: [${k8sVersions}]. Make sure to align your cluster with these versions to take full advantage of our services.`,
20-
)
21-
process.exit(1)
22-
} else d.log('Cluster validation SUCCESS')
13+
try {
14+
const result = await $`kubectl version -o json`
15+
const data = JSON.parse(result.stdout)
16+
const k8sVersion: string = data.serverVersion.gitVersion.slice(1, 5)
17+
if (!supportedK8sVersions.includes(k8sVersion)) {
18+
const k8sVersions = supportedK8sVersions.join(', ')
19+
d.error(
20+
`The cluster with kubernetes version ${k8sVersion} is utilizing a less compatible version for otomi. For optimal performance and features, we recommend using one of our supported versions: [${k8sVersions}]. Make sure to align your cluster with these versions to take full advantage of our services.`,
21+
)
22+
process.exit(1)
23+
} else d.log('Cluster validation SUCCESS')
24+
} catch (e) {
25+
d.warn(e)
26+
d.warn('Could not validate cluster kubernetes version. Assuming that it is compatible. Proceeding.')
27+
}
2328
}
2429

2530
export const module = {

0 commit comments

Comments
 (0)