@codiac.io/codiac-cli 1.3.262 → 1.3.263
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +279 -169
- package/dist/commands/noc/cluster/edit.d.ts +56 -0
- package/dist/commands/noc/cluster/edit.js +216 -0
- package/dist/commands/noc/cluster/edit.js.map +1 -0
- package/oclif.manifest.json +104 -1
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { ClusterDef, RootMap } from '../../../apis/codiac-api/contracts';
|
|
3
|
+
import { CommandBaseExecTenant } from '../../../command-base-exec-tenant';
|
|
4
|
+
import { AtLeast } from '@codiac.io/codiac-common/contracts';
|
|
5
|
+
/**
|
|
6
|
+
* Edits the mutable connection metadata on an existing cluster record (ClusterDef.instance).
|
|
7
|
+
*
|
|
8
|
+
* WHY this exists: `cluster define` refuses to touch a cluster that has a live instance ("destroy it
|
|
9
|
+
* first"), and `cluster capture` is the only other writer of `instance.serverUrl`. So when a cluster's
|
|
10
|
+
* apiserver url was recorded wrong — or drifted, which is what happens when a cluster is destroyed and
|
|
11
|
+
* recreated under the same name — there was no in-CLI fix short of forgetting and re-capturing the
|
|
12
|
+
* cluster, which requires tearing down every cabinet and environment attached to it first.
|
|
13
|
+
*
|
|
14
|
+
* The cluster name is the record's identity (it is the join key that environments, cabinets and the
|
|
15
|
+
* kube-context cache all resolve against), so it is immutable here; renaming a cluster is a capture,
|
|
16
|
+
* not an edit.
|
|
17
|
+
*
|
|
18
|
+
* SIDE EFFECT worth knowing: `instance.serverUrl` is the value the ops kube-context cache stamps its
|
|
19
|
+
* entries with, so changing it here also invalidates the cached kube context for this cluster on every
|
|
20
|
+
* ops replica the next time each one connects. That is the supported way to force a credential
|
|
21
|
+
* re-fetch without restarting pods.
|
|
22
|
+
*/
|
|
23
|
+
export default class NocClusterEdit extends CommandBaseExecTenant<ClusterDef> {
|
|
24
|
+
static description: string;
|
|
25
|
+
static aliases: string[];
|
|
26
|
+
static examples: Command.Example[];
|
|
27
|
+
static args: {
|
|
28
|
+
name: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
|
|
29
|
+
};
|
|
30
|
+
static flags: {
|
|
31
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
32
|
+
'server-url': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
33
|
+
'clear-server-url': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
34
|
+
'take-defaults': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
35
|
+
silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
36
|
+
echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
37
|
+
'to-script': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
38
|
+
};
|
|
39
|
+
captureArgs(): Promise<[Partial<ClusterDef>, boolean]>;
|
|
40
|
+
buildCandidate_silently(partial: AtLeast<ClusterDef, 'name'>, _rootMap: RootMap): Promise<ClusterDef | undefined>;
|
|
41
|
+
buildCandidate_interactively(partial: AtLeast<ClusterDef, 'name'>, takeDefaults: boolean, _rootMap: RootMap): Promise<ClusterDef | undefined>;
|
|
42
|
+
buildCommandString(candidate: ClusterDef, cmd: string[]): string[];
|
|
43
|
+
executeTask(candidate: ClusterDef): Promise<void>;
|
|
44
|
+
/** Overlays the requested edit onto the FULL existing record.
|
|
45
|
+
*
|
|
46
|
+
* The whole ClusterDef is written back (this is a PUT, not a patch) precisely because the
|
|
47
|
+
* `instance` sub-document is dropped by the backend when it arrives incomplete — so the record has
|
|
48
|
+
* to be read unprojected and returned intact with only serverUrl changed. */
|
|
49
|
+
private applyEdits;
|
|
50
|
+
private readClusterDefOrThrow;
|
|
51
|
+
private promptForClusterName;
|
|
52
|
+
private static normalizeServerUrl;
|
|
53
|
+
/** Fails fast on input that would leave the cluster unreachable, rather than storing it and
|
|
54
|
+
* surfacing as a connection error on the next deploy. */
|
|
55
|
+
private static assertUsableServerUrl;
|
|
56
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const command_base_exec_tenant_1 = require("../../../command-base-exec-tenant");
|
|
6
|
+
const prettify_1 = require("../../../prettify");
|
|
7
|
+
/**
|
|
8
|
+
* Edits the mutable connection metadata on an existing cluster record (ClusterDef.instance).
|
|
9
|
+
*
|
|
10
|
+
* WHY this exists: `cluster define` refuses to touch a cluster that has a live instance ("destroy it
|
|
11
|
+
* first"), and `cluster capture` is the only other writer of `instance.serverUrl`. So when a cluster's
|
|
12
|
+
* apiserver url was recorded wrong — or drifted, which is what happens when a cluster is destroyed and
|
|
13
|
+
* recreated under the same name — there was no in-CLI fix short of forgetting and re-capturing the
|
|
14
|
+
* cluster, which requires tearing down every cabinet and environment attached to it first.
|
|
15
|
+
*
|
|
16
|
+
* The cluster name is the record's identity (it is the join key that environments, cabinets and the
|
|
17
|
+
* kube-context cache all resolve against), so it is immutable here; renaming a cluster is a capture,
|
|
18
|
+
* not an edit.
|
|
19
|
+
*
|
|
20
|
+
* SIDE EFFECT worth knowing: `instance.serverUrl` is the value the ops kube-context cache stamps its
|
|
21
|
+
* entries with, so changing it here also invalidates the cached kube context for this cluster on every
|
|
22
|
+
* ops replica the next time each one connects. That is the supported way to force a credential
|
|
23
|
+
* re-fetch without restarting pods.
|
|
24
|
+
*/
|
|
25
|
+
class NocClusterEdit extends command_base_exec_tenant_1.CommandBaseExecTenant {
|
|
26
|
+
captureArgs() {
|
|
27
|
+
var _a;
|
|
28
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const { args, flags } = yield this.parse(NocClusterEdit);
|
|
30
|
+
// partial.name identifies WHICH cluster (immutable). The requested edit rides along on
|
|
31
|
+
// partial.instance so that an omitted flag is distinguishable from an explicit clear.
|
|
32
|
+
const partial = { name: args.name };
|
|
33
|
+
if (flags['server-url'] !== undefined) {
|
|
34
|
+
partial.instance = { serverUrl: NocClusterEdit.normalizeServerUrl(flags['server-url']) };
|
|
35
|
+
}
|
|
36
|
+
else if (flags['clear-server-url']) {
|
|
37
|
+
partial.instance = { serverUrl: '' };
|
|
38
|
+
}
|
|
39
|
+
return [partial, (_a = flags['take-defaults']) !== null && _a !== void 0 ? _a : false];
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
buildCandidate_silently(partial, _rootMap) {
|
|
43
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
if (!partial.name)
|
|
45
|
+
throw new Error('A cluster name must be provided (run `cod cluster list` to see names).');
|
|
46
|
+
if (partial.instance === undefined) {
|
|
47
|
+
throw new Error('Nothing to edit. Provide --server-url <url>, or --clear-server-url to remove the recorded value.');
|
|
48
|
+
}
|
|
49
|
+
const existing = yield this.readClusterDefOrThrow(partial.name);
|
|
50
|
+
return this.applyEdits(existing, partial);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
buildCandidate_interactively(partial, takeDefaults, _rootMap) {
|
|
54
|
+
var _a, _b, _c, _d, _e;
|
|
55
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const name = (_a = partial.name) !== null && _a !== void 0 ? _a : yield this.promptForClusterName();
|
|
57
|
+
const existing = yield this.readClusterDefOrThrow(name);
|
|
58
|
+
this._ui.userMessage(`Editing cluster ${this._styler.bold(this._styler.hilite(existing.name))} ` +
|
|
59
|
+
`${this._styler.dim(`(current apiserver url: ${((_b = existing.instance) === null || _b === void 0 ? void 0 : _b.serverUrl) || '<none recorded>'})`)}`);
|
|
60
|
+
if (partial.instance === undefined) {
|
|
61
|
+
const entered = yield this._ui.prompt('server-url', 'Apiserver url:', true, (_d = (_c = existing.instance) === null || _c === void 0 ? void 0 : _c.serverUrl) !== null && _d !== void 0 ? _d : '');
|
|
62
|
+
partial.instance = { serverUrl: NocClusterEdit.normalizeServerUrl(entered !== null && entered !== void 0 ? entered : '') };
|
|
63
|
+
}
|
|
64
|
+
const candidate = this.applyEdits(existing, Object.assign(Object.assign({}, partial), { name }));
|
|
65
|
+
this._ui.userMessage('About to save:');
|
|
66
|
+
this._ui.userMessage((0, prettify_1.prettify)({ name: candidate.name, serverUrl: (_e = candidate.instance) === null || _e === void 0 ? void 0 : _e.serverUrl }));
|
|
67
|
+
this._ui.userMessage(this._styler.dim('This also invalidates the cached kube context for this cluster; credentials will be re-fetched from the cloud provider on next use.'));
|
|
68
|
+
const confirmed = takeDefaults || (yield this._ui.promptConfirm('confirm', 'Save changes?', false));
|
|
69
|
+
if (!confirmed)
|
|
70
|
+
return undefined;
|
|
71
|
+
return candidate;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
buildCommandString(candidate, cmd) {
|
|
75
|
+
var _a;
|
|
76
|
+
cmd.push(candidate.name);
|
|
77
|
+
if ((_a = candidate.instance) === null || _a === void 0 ? void 0 : _a.serverUrl)
|
|
78
|
+
cmd.push('--server-url', candidate.instance.serverUrl);
|
|
79
|
+
else
|
|
80
|
+
cmd.push('--clear-server-url');
|
|
81
|
+
cmd.push('--silent');
|
|
82
|
+
return cmd;
|
|
83
|
+
}
|
|
84
|
+
executeTask(candidate) {
|
|
85
|
+
var _a, _b, _c;
|
|
86
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const result = yield this._codiacApi.ClusterDef.tryUpdate(candidate);
|
|
88
|
+
if (result.error) {
|
|
89
|
+
const msg = `Error editing cluster [${candidate.name}]: ${result.error.name} ${(_a = result.error.message) !== null && _a !== void 0 ? _a : result.error.stack}`;
|
|
90
|
+
this.logger.error(msg, result.error);
|
|
91
|
+
this._ui.userMessage(`${this._styler.colorCritical('ERROR!')} ${msg}`);
|
|
92
|
+
throw result.error;
|
|
93
|
+
}
|
|
94
|
+
else if (!result.success) {
|
|
95
|
+
this._ui.userMessage(`${this._styler.colorCritical('FAILED!')} Failed to edit cluster [${candidate.name}]. ${(_b = result.message) !== null && _b !== void 0 ? _b : 'Check logs for details.'}`);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const url = (_c = candidate.instance) === null || _c === void 0 ? void 0 : _c.serverUrl;
|
|
99
|
+
this._ui.userMessage(`${this._styler.colorGood('SUCCESS!')} Cluster [${this._styler.hilite(candidate.name)}] updated — apiserver url: ` +
|
|
100
|
+
`${this._styler.hilite(url || '<none recorded>')}. The cached kube context for this cluster will be re-fetched on next use.`);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
// Helpers
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
/** Overlays the requested edit onto the FULL existing record.
|
|
108
|
+
*
|
|
109
|
+
* The whole ClusterDef is written back (this is a PUT, not a patch) precisely because the
|
|
110
|
+
* `instance` sub-document is dropped by the backend when it arrives incomplete — so the record has
|
|
111
|
+
* to be read unprojected and returned intact with only serverUrl changed. */
|
|
112
|
+
applyEdits(existing, partial) {
|
|
113
|
+
var _a, _b, _c;
|
|
114
|
+
if (existing.instance == undefined) {
|
|
115
|
+
throw new Error(`Cannot edit the apiserver url for cluster [${existing.name}]: it has no infrastructure record. ` +
|
|
116
|
+
`Run \`cod cluster capture\` to register the live cluster first.`);
|
|
117
|
+
}
|
|
118
|
+
const requested = (_b = (_a = partial.instance) === null || _a === void 0 ? void 0 : _a.serverUrl) !== null && _b !== void 0 ? _b : '';
|
|
119
|
+
const current = (_c = existing.instance.serverUrl) !== null && _c !== void 0 ? _c : '';
|
|
120
|
+
if (requested === current) {
|
|
121
|
+
throw new Error(`Nothing to edit for [${existing.name}]: the apiserver url is already [${current || '<none recorded>'}].`);
|
|
122
|
+
}
|
|
123
|
+
if (requested.length > 0)
|
|
124
|
+
NocClusterEdit.assertUsableServerUrl(requested);
|
|
125
|
+
const candidate = Object.assign({}, existing);
|
|
126
|
+
candidate.instance = Object.assign(Object.assign({}, existing.instance), { serverUrl: requested.length > 0 ? requested : undefined });
|
|
127
|
+
return candidate;
|
|
128
|
+
}
|
|
129
|
+
readClusterDefOrThrow(clusterName) {
|
|
130
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
// Read unprojected: applyEdits writes the whole record back, so every field has to be present.
|
|
132
|
+
const found = yield this._codiacApi.ClusterDef.readMany({ name: { $eq: clusterName } }, { throwNotFound: false });
|
|
133
|
+
const existing = found === null || found === void 0 ? void 0 : found[0];
|
|
134
|
+
if (!existing)
|
|
135
|
+
throw new Error(`No cluster named [${clusterName}] was found. Run \`cod cluster list\` to see the available clusters.`);
|
|
136
|
+
return existing;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
promptForClusterName() {
|
|
140
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
const all = yield this._codiacApi.ClusterDef.readMany({ all: true }, { throwNotFound: false });
|
|
142
|
+
if (!all || all.length === 0)
|
|
143
|
+
throw new Error('Cannot edit: no clusters are defined yet.');
|
|
144
|
+
const chosen = yield this._ui.promptSelect('name', 'Which cluster do you want to edit?', all.map(c => c.name));
|
|
145
|
+
if (!chosen)
|
|
146
|
+
throw new Error('No cluster selected.');
|
|
147
|
+
return chosen;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
static normalizeServerUrl(url) {
|
|
151
|
+
return (url !== null && url !== void 0 ? url : '').trim();
|
|
152
|
+
}
|
|
153
|
+
/** Fails fast on input that would leave the cluster unreachable, rather than storing it and
|
|
154
|
+
* surfacing as a connection error on the next deploy. */
|
|
155
|
+
static assertUsableServerUrl(url) {
|
|
156
|
+
let parsed;
|
|
157
|
+
try {
|
|
158
|
+
parsed = new URL(url);
|
|
159
|
+
}
|
|
160
|
+
catch (_a) {
|
|
161
|
+
throw new Error(`[${url}] is not a valid url. Provide the full apiserver url, eg: https://my-cluster.hcp.centralus.azmk8s.io:443`);
|
|
162
|
+
}
|
|
163
|
+
if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {
|
|
164
|
+
throw new Error(`[${url}] must be an http(s) url. The apiserver url is the remote target for kubectl, eg: https://10.110.128.10:443`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
exports.default = NocClusterEdit;
|
|
169
|
+
NocClusterEdit.description = 'Changes the mutable connection metadata (apiserver url) on an existing cluster record. ' +
|
|
170
|
+
'DOES NOT modify any infrastructure; it only corrects what Codiac has recorded about the cluster. ' +
|
|
171
|
+
'The cluster name is immutable — use `cod cluster capture` to register a different cluster. ' +
|
|
172
|
+
'Changing the apiserver url also invalidates the cached kube context for this cluster, forcing a ' +
|
|
173
|
+
'fresh credential fetch from the cloud provider on next use.';
|
|
174
|
+
NocClusterEdit.aliases = ['cluster:edit'];
|
|
175
|
+
NocClusterEdit.examples = [
|
|
176
|
+
{
|
|
177
|
+
description: 'Edit a cluster interactively (select it, then change its apiserver url).',
|
|
178
|
+
command: '<%= config.bin %> <%= command.id %>',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
description: "Correct the apiserver url Codiac has recorded for a cluster.",
|
|
182
|
+
command: '<%= config.bin %> <%= command.id %> my-cluster --server-url https://my-cluster.hcp.centralus.azmk8s.io:443 --silent',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
description: 'Point a private cluster at its private-link address.',
|
|
186
|
+
command: '<%= config.bin %> <%= command.id %> my-cluster --server-url https://10.110.128.10:443 --silent',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
description: 'Drop the recorded url so the next capture repopulates it from the cloud provider.',
|
|
190
|
+
command: '<%= config.bin %> <%= command.id %> my-cluster --clear-server-url --silent',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
description: 'Renders the equivalent silent command without executing it.',
|
|
194
|
+
command: '<%= config.bin %> <%= command.id %> my-cluster --server-url https://10.110.128.10:443 --to-script',
|
|
195
|
+
},
|
|
196
|
+
];
|
|
197
|
+
NocClusterEdit.args = {
|
|
198
|
+
name: core_1.Args.string({ description: 'Name of the cluster whose record you want to edit. Run `cod cluster list` to see names.' }),
|
|
199
|
+
};
|
|
200
|
+
NocClusterEdit.flags = {
|
|
201
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
202
|
+
'server-url': core_1.Flags.string({
|
|
203
|
+
exclusive: ['clear-server-url'],
|
|
204
|
+
description: 'The apiserver url Codiac should record for this cluster (the remote target for kubectl), ' +
|
|
205
|
+
'eg: https://my-cluster.hcp.centralus.azmk8s.io:443. Omit to leave it unchanged.',
|
|
206
|
+
}),
|
|
207
|
+
'clear-server-url': core_1.Flags.boolean({
|
|
208
|
+
exclusive: ['server-url'],
|
|
209
|
+
description: 'Removes the recorded apiserver url, leaving it for the next `cod cluster capture` to repopulate.',
|
|
210
|
+
}),
|
|
211
|
+
'take-defaults': core_1.Flags.boolean({ description: 'Prevents prompting for confirmation on parameters that were passed in or defaulted.' }),
|
|
212
|
+
silent: core_1.Flags.boolean({ exclusive: ['echo', 'to-script'], description: 'Executes without any user interaction; fails on missing or invalid arguments.' }),
|
|
213
|
+
echo: core_1.Flags.boolean({ exclusive: ['to-script', 'silent'], description: 'Renders the equivalent non-interactive command for future use before executing.' }),
|
|
214
|
+
'to-script': core_1.Flags.boolean({ exclusive: ['echo', 'silent'], description: 'Renders the equivalent non-interactive command without executing it.' }),
|
|
215
|
+
};
|
|
216
|
+
//# sourceMappingURL=edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../../src/commands/noc/cluster/edit.ts"],"names":[],"mappings":";;;AAAA,sCAAmD;AAGnD,gFAA0E;AAC1E,gDAA6C;AAI7C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAqB,cAAe,SAAQ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ACzB,SAAS,EAAE,CAAC,kBAAkB,CAAC;QAC/B,WAAW,EACT,2FAA2F;YAC3F,iFAAiF;KACpF,CAAC;IACF,kBAAkB,EAAE,YAAK,CAAC,OAAO,CAAC;QAChC,SAAS,EAAE,CAAC,YAAY,CAAC;QACzB,WAAW,EAAE,kGAAkG;KAChH,CAAC;IAEF,eAAe,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,qFAAqF,EAAE,CAAC;IACtI,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,+EAA+E,EAAE,CAAC;IACzJ,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,iFAAiF,EAAE,CAAC;IAC3J,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,sEAAsE,EAAE,CAAC;CACnJ,CAAC"}
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.3.
|
|
2
|
+
"version": "1.3.263",
|
|
3
3
|
"commands": {
|
|
4
4
|
"branch": {
|
|
5
5
|
"id": "branch",
|
|
@@ -14991,6 +14991,109 @@
|
|
|
14991
14991
|
}
|
|
14992
14992
|
}
|
|
14993
14993
|
},
|
|
14994
|
+
"noc:cluster:edit": {
|
|
14995
|
+
"id": "noc:cluster:edit",
|
|
14996
|
+
"description": "Changes the mutable connection metadata (apiserver url) on an existing cluster record. DOES NOT modify any infrastructure; it only corrects what Codiac has recorded about the cluster. The cluster name is immutable — use `cod cluster capture` to register a different cluster. Changing the apiserver url also invalidates the cached kube context for this cluster, forcing a fresh credential fetch from the cloud provider on next use.",
|
|
14997
|
+
"strict": true,
|
|
14998
|
+
"pluginName": "@codiac.io/codiac-cli",
|
|
14999
|
+
"pluginAlias": "@codiac.io/codiac-cli",
|
|
15000
|
+
"pluginType": "core",
|
|
15001
|
+
"aliases": [
|
|
15002
|
+
"cluster:edit"
|
|
15003
|
+
],
|
|
15004
|
+
"hiddenAliases": [],
|
|
15005
|
+
"examples": [
|
|
15006
|
+
{
|
|
15007
|
+
"description": "Edit a cluster interactively (select it, then change its apiserver url).",
|
|
15008
|
+
"command": "<%= config.bin %> <%= command.id %>"
|
|
15009
|
+
},
|
|
15010
|
+
{
|
|
15011
|
+
"description": "Correct the apiserver url Codiac has recorded for a cluster.",
|
|
15012
|
+
"command": "<%= config.bin %> <%= command.id %> my-cluster --server-url https://my-cluster.hcp.centralus.azmk8s.io:443 --silent"
|
|
15013
|
+
},
|
|
15014
|
+
{
|
|
15015
|
+
"description": "Point a private cluster at its private-link address.",
|
|
15016
|
+
"command": "<%= config.bin %> <%= command.id %> my-cluster --server-url https://10.110.128.10:443 --silent"
|
|
15017
|
+
},
|
|
15018
|
+
{
|
|
15019
|
+
"description": "Drop the recorded url so the next capture repopulates it from the cloud provider.",
|
|
15020
|
+
"command": "<%= config.bin %> <%= command.id %> my-cluster --clear-server-url --silent"
|
|
15021
|
+
},
|
|
15022
|
+
{
|
|
15023
|
+
"description": "Renders the equivalent silent command without executing it.",
|
|
15024
|
+
"command": "<%= config.bin %> <%= command.id %> my-cluster --server-url https://10.110.128.10:443 --to-script"
|
|
15025
|
+
}
|
|
15026
|
+
],
|
|
15027
|
+
"flags": {
|
|
15028
|
+
"help": {
|
|
15029
|
+
"name": "help",
|
|
15030
|
+
"type": "boolean",
|
|
15031
|
+
"char": "h",
|
|
15032
|
+
"description": "Show CLI help.",
|
|
15033
|
+
"allowNo": false
|
|
15034
|
+
},
|
|
15035
|
+
"server-url": {
|
|
15036
|
+
"name": "server-url",
|
|
15037
|
+
"type": "option",
|
|
15038
|
+
"description": "The apiserver url Codiac should record for this cluster (the remote target for kubectl), eg: https://my-cluster.hcp.centralus.azmk8s.io:443. Omit to leave it unchanged.",
|
|
15039
|
+
"multiple": false,
|
|
15040
|
+
"exclusive": [
|
|
15041
|
+
"clear-server-url"
|
|
15042
|
+
]
|
|
15043
|
+
},
|
|
15044
|
+
"clear-server-url": {
|
|
15045
|
+
"name": "clear-server-url",
|
|
15046
|
+
"type": "boolean",
|
|
15047
|
+
"description": "Removes the recorded apiserver url, leaving it for the next `cod cluster capture` to repopulate.",
|
|
15048
|
+
"allowNo": false,
|
|
15049
|
+
"exclusive": [
|
|
15050
|
+
"server-url"
|
|
15051
|
+
]
|
|
15052
|
+
},
|
|
15053
|
+
"take-defaults": {
|
|
15054
|
+
"name": "take-defaults",
|
|
15055
|
+
"type": "boolean",
|
|
15056
|
+
"description": "Prevents prompting for confirmation on parameters that were passed in or defaulted.",
|
|
15057
|
+
"allowNo": false
|
|
15058
|
+
},
|
|
15059
|
+
"silent": {
|
|
15060
|
+
"name": "silent",
|
|
15061
|
+
"type": "boolean",
|
|
15062
|
+
"description": "Executes without any user interaction; fails on missing or invalid arguments.",
|
|
15063
|
+
"allowNo": false,
|
|
15064
|
+
"exclusive": [
|
|
15065
|
+
"echo",
|
|
15066
|
+
"to-script"
|
|
15067
|
+
]
|
|
15068
|
+
},
|
|
15069
|
+
"echo": {
|
|
15070
|
+
"name": "echo",
|
|
15071
|
+
"type": "boolean",
|
|
15072
|
+
"description": "Renders the equivalent non-interactive command for future use before executing.",
|
|
15073
|
+
"allowNo": false,
|
|
15074
|
+
"exclusive": [
|
|
15075
|
+
"to-script",
|
|
15076
|
+
"silent"
|
|
15077
|
+
]
|
|
15078
|
+
},
|
|
15079
|
+
"to-script": {
|
|
15080
|
+
"name": "to-script",
|
|
15081
|
+
"type": "boolean",
|
|
15082
|
+
"description": "Renders the equivalent non-interactive command without executing it.",
|
|
15083
|
+
"allowNo": false,
|
|
15084
|
+
"exclusive": [
|
|
15085
|
+
"echo",
|
|
15086
|
+
"silent"
|
|
15087
|
+
]
|
|
15088
|
+
}
|
|
15089
|
+
},
|
|
15090
|
+
"args": {
|
|
15091
|
+
"name": {
|
|
15092
|
+
"name": "name",
|
|
15093
|
+
"description": "Name of the cluster whose record you want to edit. Run `cod cluster list` to see names."
|
|
15094
|
+
}
|
|
15095
|
+
}
|
|
15096
|
+
},
|
|
14994
15097
|
"noc:cluster:forget": {
|
|
14995
15098
|
"id": "noc:cluster:forget",
|
|
14996
15099
|
"description": "Permanently removes the record of a cluster. This command does NOT affect any infrastructure; it simply removes the cluster from the Codiac consciousness. You must remove all cabinets and environments in a cluster before forgetting it.",
|
package/package.json
CHANGED