Skip to content

Commit 74890d8

Browse files
runner delete should remove app-proxy as well (#572)
1 parent 62eef63 commit 74890d8

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

lib/interface/cli/commands/hybrid/delete.cmd.js

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const {
1818
getRelatedAgents,
1919
getRelatedNamespaces,
2020
drawCodefreshFiglet,
21+
unInstallAppProxy,
2122
} = require('./helper');
2223

2324
const defaultNamespace = 'codefresh';
@@ -46,7 +47,7 @@ async function promptConfirmationMessage({
4647
console.log('Deletion process aborted, exiting...');
4748
process.exit(1);
4849
}
49-
}
50+
}
5051

5152
const deleteCmd = new Command({
5253
root: false,
@@ -66,7 +67,7 @@ const deleteCmd = new Command({
6667
})
6768
.option('url', {
6869
describe: 'Codefresh system custom url',
69-
})
70+
})
7071
.option('force', {
7172
describe: 'Run the delete operation without asking to confirm (use with caution!)',
7273
alias: 'f',
@@ -94,7 +95,7 @@ const deleteCmd = new Command({
9495
'kube-context-name': kubeContextName,
9596
'kube-namespace': kubeNamespace,
9697
name: agentName,
97-
'values': valuesFile,
98+
values: valuesFile,
9899
} = argv;
99100

100101
const [listReErr, runtimes] = await to(sdk.runtimeEnvs.list({ }));
@@ -109,28 +110,28 @@ const deleteCmd = new Command({
109110

110111
console.log(colors.green('This uninstaller will guide you through the runner uninstallation process'));
111112
if (valuesFile) {
112-
let valuesFileStr = fs.readFileSync(valuesFile, 'utf8');
113+
const valuesFileStr = fs.readFileSync(valuesFile, 'utf8');
113114
valuesObj = YAML.parse(valuesFileStr);
114115

115-
if ( !kubeConfigPath && valuesObj.ConfigPath ) {
116+
if (!kubeConfigPath && valuesObj.ConfigPath) {
116117
kubeConfigPath = valuesObj.ConfigPath;
117118
}
118-
if ( !kubeNamespace && valuesObj.Namespace ) {
119+
if (!kubeNamespace && valuesObj.Namespace) {
119120
kubeNamespace = valuesObj.Namespace;
120121
}
121-
if ( !kubeContextName && valuesObj.Context ) {
122+
if (!kubeContextName && valuesObj.Context) {
122123
kubeContextName = valuesObj.Context;
123124
}
124-
if ( !url && valuesObj.CodefreshHost ) {
125-
url = valuesObj.CodefreshHost
125+
if (!url && valuesObj.CodefreshHost) {
126+
url = valuesObj.CodefreshHost;
126127
}
127128

128-
if ( !agentName && valuesObj.AgentId ) {
129-
agentName = valuesObj.AgentId
129+
if (!agentName && valuesObj.AgentId) {
130+
agentName = valuesObj.AgentId;
130131
}
131132
}
132133
if (!url) {
133-
url = DEFAULTS.URL
134+
url = DEFAULTS.URL;
134135
}
135136

136137
if (!kubeContextName) {
@@ -216,7 +217,7 @@ const deleteCmd = new Command({
216217
await promptConfirmationMessage({ agentName, kubeNamespace, attachedRuntimes });
217218
}
218219

219-
attachedRuntimes.forEach(async (reName) => {
220+
await Promise.all(attachedRuntimes.map(async (reName) => {
220221
const uninstallRuntimeOptions = {
221222
'agent-name': agentName,
222223
'runtime-kube-namespace': kubeNamespace,
@@ -226,9 +227,17 @@ const deleteCmd = new Command({
226227
name: reName,
227228
terminateProcess: false,
228229
};
230+
const re = runtimes.find(runtime => runtime.metadata.name === reName);
231+
if (re.appProxy) {
232+
await unInstallAppProxy({
233+
kubeConfigPath,
234+
kubeContextName,
235+
kubeNamespace,
236+
});
237+
}
229238
const [uninstallReErr] = await to(unInstallRuntime.handler(uninstallRuntimeOptions));
230239
handleError(uninstallReErr, `Failed to uninstall runtime-environment "${colors.cyan(reName)}"`);
231-
});
240+
}));
232241

233242
const uninstallAgentOptions = {
234243
'kube-namespace': kubeNamespace,

lib/interface/cli/commands/hybrid/init.cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ const initCmd = new Command({
784784
await getAgents.handler({});
785785
console.log('');
786786
if (installMonitor) {
787-
console.log(`Go to ${colors.blue('https://g.codefresh.io/kubernetes/monitor/services')} to view your cluster in Codefresh dashbaord`);
787+
console.log(`Go to ${colors.blue('https://g.codefresh.io/kubernetes/services/')} to view your cluster in Codefresh dashbaord`);
788788
}
789789
console.log(`Link to the new runtime: ${colors.blue(`https://g.codefresh.io/account-admin/account-conf/runtime-environments?runtime=${encodeURI(installationPlan.getContext('runtimeName'))}`)}`);
790790
console.log(`\nDocumenation link: ${colors.blue('https://codefresh.io/docs/docs/enterprise/codefresh-runner/#codefresh-runner-preview-release')}`);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.73.5",
3+
"version": "0.73.6",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)