Skip to content

Commit a289487

Browse files
ziv-codefreshitai-codefresh
authored andcommitted
Support gcloud clusters (#243)
1 parent d03f763 commit a289487

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/interface/cli/commands/runtimeEnvironments/create.cmd.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,18 @@ const command = new Command({
5757
describe: 'kubectl context name',
5858
alias: 'kc',
5959
})
60+
.option('gcloud', {
61+
describe: 'set if your cluster provider is gcloud',
62+
type: Boolean,
63+
})
6064
.example('codefresh create re --cluster prod --namespace codefresh --kube-context kubeCodefresh', 'Creating a runtime environment which configured to cluster prod and namespace codefresh');
6165
},
6266
handler: async (argv) => {
6367
const currentContext = authManager.getCurrentContext();
6468
const { namespace } = argv;
6569
const clusterName = argv.cluster;
66-
let context = argv['kube-context'];
67-
if (!context) {
68-
context = '';
69-
}
70+
const context = argv['kube-context'] || '';
71+
const gcloud = argv.gcloud || '';
7072
const clusters = await cluster.getAllClusters();
7173
const validCluster = _.find(clusters, (c) => {
7274
return _.isEqual(c.info.name, clusterName);
@@ -89,12 +91,12 @@ const command = new Command({
8991
throw err;
9092
}
9193
fs.chmodSync(filePath, '644');
92-
const k8sScript = spawn('bash', [filePath, '--api-token', currentContext.token, '--api-host', currentContext.url, '--namespace', namespace, '--image-tag', 'master', '--remote', '--context', context, clusterName]);
94+
const k8sScript = spawn('bash', [filePath, '--api-token', currentContext.token, '--api-host', currentContext.url, '--namespace', namespace, '--image-tag', 'master', '--remote', '--context', context, '--gcloud', gcloud, clusterName]);
9395
callToScript(k8sScript);
9496
});
9597
} else {
9698
filePath = './codefresh-k8s-configure.sh';
97-
const k8sScript = spawn('bash', [filePath, '--api-token', currentContext.token, '--api-host', currentContext.url, '--namespace', namespace,'--context', context, '--image-tag', 'master', clusterName]);
99+
const k8sScript = spawn('bash', [filePath, '--api-token', currentContext.token, '--api-host', currentContext.url, '--namespace', namespace,'--context', context, '--image-tag', 'master','--gcloud', gcloud, clusterName]);
98100
callToScript(k8sScript);
99101
}
100102
} else {

0 commit comments

Comments
 (0)