@codiac.io/codiac-cli 1.3.274 → 1.3.275
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 +207 -177
- package/dist/commands/config/import.d.ts +12 -0
- package/dist/commands/config/import.js +37 -5
- package/dist/commands/config/import.js.map +1 -1
- package/dist/commands/import/cluster.d.ts +80 -3
- package/dist/commands/import/cluster.js +273 -6
- package/dist/commands/import/cluster.js.map +1 -1
- package/oclif.manifest.json +67 -2
- package/package.json +1 -1
|
@@ -19,6 +19,8 @@ type ConfigImportRequest = IEnterpriseEntity & {
|
|
|
19
19
|
scopeLevel: ScopeLevel;
|
|
20
20
|
scopeName: string;
|
|
21
21
|
escapeExpressions?: boolean;
|
|
22
|
+
/** True when --type was given explicitly, so buildCommandString can round-trip it. */
|
|
23
|
+
typeWasExplicit?: boolean;
|
|
22
24
|
};
|
|
23
25
|
export default class ConfigImport extends CommandBaseExec<ConfigImportRequest> {
|
|
24
26
|
static description: string;
|
|
@@ -26,6 +28,8 @@ export default class ConfigImport extends CommandBaseExec<ConfigImportRequest> {
|
|
|
26
28
|
static flags: {
|
|
27
29
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
28
30
|
enterprise: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
31
|
+
"enterprise-code": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
32
|
+
type: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
29
33
|
environment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
30
34
|
asset: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
31
35
|
cabinet: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
@@ -39,6 +43,14 @@ export default class ConfigImport extends CommandBaseExec<ConfigImportRequest> {
|
|
|
39
43
|
static args: {};
|
|
40
44
|
static examples: Command.Example[];
|
|
41
45
|
captureArgs(): Promise<[Partial<ConfigImportRequest>, boolean]>;
|
|
46
|
+
/**
|
|
47
|
+
* Resolves which settings type this import writes into.
|
|
48
|
+
*
|
|
49
|
+
* Explicit --type always wins. Without it the historical default stands: helm assets import
|
|
50
|
+
* helm values, everything else imports a config file. Only `file` carries a runtime path;
|
|
51
|
+
* every other type is bracket-encoded (`[env]`, `[helm]`, ...) and has no file to land in.
|
|
52
|
+
*/
|
|
53
|
+
private resolveConfigType;
|
|
42
54
|
buildCandidate_silently(partial: AtLeast<ConfigImportRequest, "enterprise">, rootMap: RootMap): Promise<ConfigImportRequest | undefined>;
|
|
43
55
|
buildCandidate_interactively(partial: AtLeast<ConfigImportRequest, "enterprise">, rootMap: RootMap, takeDefaults: boolean): Promise<ConfigImportRequest | undefined>;
|
|
44
56
|
buildCommandString(candidate: ConfigImportRequest, cmd: string[]): string[];
|
|
@@ -6,6 +6,7 @@ const fs = require("fs");
|
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const core_1 = require("@oclif/core");
|
|
8
8
|
const contracts_1 = require("../../apis/codiac-api/contracts");
|
|
9
|
+
const codiac_domain_1 = require("@codiac.io/codiac-domain");
|
|
9
10
|
const command_base_exec_1 = require("../../command-base-exec");
|
|
10
11
|
const config_file_target_1 = require("../../uilogic/config-file-target");
|
|
11
12
|
/** The value provided as input that indicates
|
|
@@ -20,13 +21,29 @@ class ConfigImport extends command_base_exec_1.CommandBaseExec {
|
|
|
20
21
|
// Note: --enterprise (char 'n') is the scope flag here, not the enterprise context.
|
|
21
22
|
// The enterprise context is resolved by the base class lifecycle using partial.enterprise.
|
|
22
23
|
// If the user provides --enterprise, it doubles as both scope and context.
|
|
23
|
-
|
|
24
|
+
// --enterprise-code names the owning enterprise outright; --enterprise only doubles as the
|
|
25
|
+
// context when it is present, and it cannot be combined with --environment/--cabinet.
|
|
26
|
+
if (flags["enterprise-code"])
|
|
27
|
+
partial.enterprise = flags["enterprise-code"];
|
|
28
|
+
else if (flags.enterprise)
|
|
24
29
|
partial.enterprise = flags.enterprise;
|
|
25
30
|
if (flags['escape-expressions'])
|
|
26
31
|
partial.escapeExpressions = true;
|
|
27
32
|
return [partial, false];
|
|
28
33
|
});
|
|
29
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Resolves which settings type this import writes into.
|
|
37
|
+
*
|
|
38
|
+
* Explicit --type always wins. Without it the historical default stands: helm assets import
|
|
39
|
+
* helm values, everything else imports a config file. Only `file` carries a runtime path;
|
|
40
|
+
* every other type is bracket-encoded (`[env]`, `[helm]`, ...) and has no file to land in.
|
|
41
|
+
*/
|
|
42
|
+
resolveConfigType(assetType, explicitType) {
|
|
43
|
+
if (explicitType)
|
|
44
|
+
return explicitType;
|
|
45
|
+
return assetType === contracts_1.AssetTypesEnum.helm ? contracts_1.ConfigDefTypesEnum.helm : contracts_1.ConfigDefTypesEnum.file;
|
|
46
|
+
}
|
|
30
47
|
buildCandidate_silently(partial, rootMap) {
|
|
31
48
|
var _a;
|
|
32
49
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -45,7 +62,7 @@ class ConfigImport extends command_base_exec_1.CommandBaseExec {
|
|
|
45
62
|
const sourceFileAbs = path.isAbsolute(flags.sourceFile) ? flags.sourceFile : path.posix.join(process.cwd(), flags.sourceFile);
|
|
46
63
|
if (!fs.existsSync(sourceFileAbs))
|
|
47
64
|
throw new Error(`Source file not found: ${sourceFileAbs}`);
|
|
48
|
-
const configType = asset.type
|
|
65
|
+
const configType = this.resolveConfigType(asset.type, flags.type);
|
|
49
66
|
let runtimeTargetFile;
|
|
50
67
|
if (configType === contracts_1.ConfigDefTypesEnum.file) {
|
|
51
68
|
const runtimePathName = (_a = flags["runtime-path"]) !== null && _a !== void 0 ? _a : path.basename(sourceFileAbs);
|
|
@@ -65,7 +82,7 @@ class ConfigImport extends command_base_exec_1.CommandBaseExec {
|
|
|
65
82
|
scopeLevel = contracts_1.ScopeLevel.cabinet;
|
|
66
83
|
scopeName = flags.cabinet;
|
|
67
84
|
}
|
|
68
|
-
return { enterprise: partial.enterprise, assetName: asset.name, fqImportFilePath: sourceFileAbs, configType, runtimeTargetFile, scopeLevel, scopeName, escapeExpressions: partial.escapeExpressions };
|
|
85
|
+
return { enterprise: partial.enterprise, assetName: asset.name, fqImportFilePath: sourceFileAbs, configType, runtimeTargetFile, scopeLevel, scopeName, escapeExpressions: partial.escapeExpressions, typeWasExplicit: Boolean(flags.type) };
|
|
69
86
|
});
|
|
70
87
|
}
|
|
71
88
|
buildCandidate_interactively(partial, rootMap, takeDefaults) {
|
|
@@ -120,7 +137,7 @@ class ConfigImport extends command_base_exec_1.CommandBaseExec {
|
|
|
120
137
|
this._ui.userMessage("Importing ".concat(this._styler.hilite(sourceFileAbs)));
|
|
121
138
|
}
|
|
122
139
|
// Determine config type and target path
|
|
123
|
-
const configType = asset.type
|
|
140
|
+
const configType = this.resolveConfigType(asset.type, flags.type);
|
|
124
141
|
let runtimeTargetFile;
|
|
125
142
|
if (configType === contracts_1.ConfigDefTypesEnum.file) {
|
|
126
143
|
let runtimeAppRootPath = "/app";
|
|
@@ -179,7 +196,7 @@ class ConfigImport extends command_base_exec_1.CommandBaseExec {
|
|
|
179
196
|
this._ui.userMessage("Operation cancelled. No work was done.");
|
|
180
197
|
return undefined;
|
|
181
198
|
}
|
|
182
|
-
return { enterprise: partial.enterprise, assetName: asset.name, fqImportFilePath: sourceFileAbs, configType, runtimeTargetFile, scopeLevel, scopeName, escapeExpressions: partial.escapeExpressions };
|
|
199
|
+
return { enterprise: partial.enterprise, assetName: asset.name, fqImportFilePath: sourceFileAbs, configType, runtimeTargetFile, scopeLevel, scopeName, escapeExpressions: partial.escapeExpressions, typeWasExplicit: Boolean(flags.type) };
|
|
183
200
|
});
|
|
184
201
|
}
|
|
185
202
|
buildCommandString(candidate, cmd) {
|
|
@@ -191,6 +208,12 @@ class ConfigImport extends command_base_exec_1.CommandBaseExec {
|
|
|
191
208
|
cmd.push("-e", candidate.scopeName);
|
|
192
209
|
else if (candidate.scopeLevel === contracts_1.ScopeLevel.cabinet)
|
|
193
210
|
cmd.push("-c", candidate.scopeName);
|
|
211
|
+
// An environment- or cabinet-scoped command carries no --enterprise, so the owning
|
|
212
|
+
// enterprise has to be restated for the emitted command to replay in a multi-enterprise tenant.
|
|
213
|
+
if (candidate.scopeLevel !== contracts_1.ScopeLevel.enterprise)
|
|
214
|
+
cmd.push("--enterprise-code", candidate.enterprise);
|
|
215
|
+
if (candidate.typeWasExplicit)
|
|
216
|
+
cmd.push("-t", candidate.configType);
|
|
194
217
|
if (candidate.runtimeTargetFile)
|
|
195
218
|
cmd.push("-f", path.basename(candidate.runtimeTargetFile));
|
|
196
219
|
cmd.push("--silent");
|
|
@@ -239,6 +262,13 @@ ConfigImport.aliases = ['cfg:add'];
|
|
|
239
262
|
ConfigImport.flags = {
|
|
240
263
|
help: core_1.Flags.help({ char: 'h' }),
|
|
241
264
|
enterprise: core_1.Flags.string({ char: 'n', exclusive: ["environment", "cabinet"], description: 'The name of the enterprise scope to which this import applies.' }),
|
|
265
|
+
// `-n/--enterprise` is the SCOPE flag here and is mutually exclusive with --environment/--cabinet,
|
|
266
|
+
// which left no way to name the owning enterprise on an environment- or cabinet-scoped import.
|
|
267
|
+
// That was invisible while `main` was the only enterprise; multi-enterprise tenants (k8sinfrx)
|
|
268
|
+
// need to state the owner explicitly. This flag sets the enterprise CONTEXT only and composes
|
|
269
|
+
// with every scope flag.
|
|
270
|
+
"enterprise-code": core_1.Flags.string({ description: 'The code (name) of the enterprise that owns the asset. Use with --environment or --cabinet, which cannot be combined with --enterprise. Defaults to the --enterprise scope when that is given.' }),
|
|
271
|
+
type: core_1.Flags.string({ char: 't', exclusive: ["runtime-path"], options: Object.keys(codiac_domain_1.SpecialConfigTypesEnum), description: 'Imports into a non-file settings type (such as env or helm) instead of a config file. Defaults to helm for helm assets and file for all others.' }),
|
|
242
272
|
environment: core_1.Flags.string({ char: 'e', exclusive: ["enterprise", "cabinet"], description: 'The name of the environment scope to which this import applies.' }),
|
|
243
273
|
asset: core_1.Flags.string({ char: 'a', required: false, description: `Name of the asset for which to import the config (use ${exports.PROMPT_ME_DESIGNATOR} to be prompted).` }),
|
|
244
274
|
cabinet: core_1.Flags.string({ char: 'c', exclusive: ["enterprise", "environment"], description: 'The name of the cabinet scope to which this import applies.' }),
|
|
@@ -256,6 +286,8 @@ ConfigImport.examples = [
|
|
|
256
286
|
{ description: "Import at cabinet scope.", command: "<%= config.bin %> <%= command.id %> -a myApi -s ./dist/app-config.json -c dev" },
|
|
257
287
|
{ description: "Non-interactive (scripted) invocation.", command: "<%= config.bin %> <%= command.id %> -a myApi -s ./dist/app-config.json -n myEnterprise --silent" },
|
|
258
288
|
{ description: "Renders the equivalent silent command without executing.", command: "<%= config.bin %> <%= command.id %> -a myApi -s ./dist/app-config.json -n myEnterprise --to-script" },
|
|
289
|
+
{ description: "Import at cabinet scope in a tenant with more than one enterprise (--enterprise cannot be combined with --cabinet, so name the owner with --enterprise-code).", command: "<%= config.bin %> <%= command.id %> -a myApi -s ./app-config.json -c dev --enterprise-code k8sinfrx --silent" },
|
|
290
|
+
{ description: "Bulk-import environment variables from a file instead of applying them one at a time with `config set`.", command: "<%= config.bin %> <%= command.id %> -a myApi -s ./env.yaml -c dev --enterprise-code main -t env --silent" },
|
|
259
291
|
{ description: "Import a config file that contains third-party @{...} syntax — escapes all occurrences to @@{...} so Codiac stores them as literals rather than evaluating them at deploy time.", command: "<%= config.bin %> <%= command.id %> -a my-asset -s ./helm-values.yaml -c dev --escape-expressions" },
|
|
260
292
|
];
|
|
261
293
|
//# sourceMappingURL=import.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.js","sourceR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E,CAAC;CACnJ,CAAC;AAEK,iBAAI,GAAG,EAAE,CAAC;AAEV,qBAAQ,GAAsB;IACnC,EAAE,WAAW,EAAE,qCAAqC,EAAE,OAAO,EAAE,qCAAqC,EAAE;IACtG,EAAE,WAAW,EAAE,6CAA6C,EAAE,OAAO,EAAE,wFAAwF,EAAE;IACjK,EAAE,WAAW,EAAE,0BAA0B,EAAE,OAAO,EAAE,+EAA+E,EAAE;IACrI,EAAE,WAAW,EAAE,wCAAwC,EAAE,OAAO,EAAE,iGAAiG,EAAE;IACrK,EAAE,WAAW,EAAE,0DAA0D,EAAE,OAAO,EAAE,oGAAoG,EAAE;IAC1L,EAAE,WAAW,EAAE,+JAA+J,EAAE,OAAO,EAAE,8GAA8G,EAAE;IACzS,EAAE,WAAW,EAAE,yGAAyG,EAAE,OAAO,EAAE,0GAA0G,EAAE;IAC/O,EAAE,WAAW,EAAE,iLAAiL,EAAE,OAAO,EAAE,mGAAmG,EAAE;CACjT,CAAC"}
|
|
@@ -14,7 +14,36 @@ export default class ImportCluster extends Command {
|
|
|
14
14
|
"generate-volume-mounts": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
15
|
"include-default": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
16
|
"keyvault-name": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
17
|
+
"bulk-config": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
"generate-metadata": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
"generate-footprint": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
"generate-probing": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
21
|
};
|
|
22
|
+
/** Field managers whose metadata writes are machine-generated rather than authored.
|
|
23
|
+
*
|
|
24
|
+
* Kubernetes records which actor last set each field in `metadata.managedFields`, which lets the
|
|
25
|
+
* exporter tell an operator-injected annotation from one a human wrote — without maintaining a
|
|
26
|
+
* denylist of annotation keys, a list that would rot as new controllers appear.
|
|
27
|
+
*
|
|
28
|
+
* Note this filter alone is NOT sufficient: Codiac's own injected labels are written by the same
|
|
29
|
+
* field manager as the user's authored ones, so they are additionally excluded by name via
|
|
30
|
+
* CODIAC_INJECTED_KEYS. Provenance handles controllers; the name list handles ourselves. */
|
|
31
|
+
/** Machine-written bookkeeping keys that provenance does NOT catch, because the field manager
|
|
32
|
+
* that wrote them (kubectl, helm) is an authoring tool rather than a controller.
|
|
33
|
+
*
|
|
34
|
+
* `last-applied-configuration` is the worst of these: it holds a JSON copy of the entire previous
|
|
35
|
+
* object, so exporting it would create one enormous, meaningless setting. */
|
|
36
|
+
private static readonly BOOKKEEPING_METADATA_KEYS;
|
|
37
|
+
private static readonly CONTROLLER_FIELD_MANAGERS;
|
|
38
|
+
/** Env var names and metadata keys that Codiac itself stamps onto every deployment it owns.
|
|
39
|
+
*
|
|
40
|
+
* Re-exporting these would feed Codiac's own output back into Codiac: an imported asset would
|
|
41
|
+
* carry a hard-coded `assetVersion` or `cabinet` that then overrides the real deploy-time value.
|
|
42
|
+
* Excluded unconditionally — this is a correctness rule, not a noise-reduction preference.
|
|
43
|
+
* Mirrors the constants on K8sDomainMapper in codiac-relay. */
|
|
44
|
+
private static readonly CODIAC_INJECTED_KEYS;
|
|
45
|
+
/** True when the key is stamped by Codiac (either bare or under the `codiac.io/` prefix). */
|
|
46
|
+
private isCodiacInjectedKey;
|
|
18
47
|
/** Accumulates unique secret store names discovered during the scan. */
|
|
19
48
|
private discoveredStores;
|
|
20
49
|
/** Accumulates enterprise-scoped `codiac pvc create` lines keyed by their prefixed FileStoreDef name (`<namespace>-<pvc>`).
|
|
@@ -48,9 +77,21 @@ export default class ImportCluster extends Command {
|
|
|
48
77
|
* default values and (when present) cabinet-scoped override values, each delivered via a heredoc to keep the output
|
|
49
78
|
* a single self-contained script stream. */
|
|
50
79
|
private buildHelmReleaseCommands;
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
80
|
+
/**
|
|
81
|
+
* Builds the command that stores a Helm values document.
|
|
82
|
+
*
|
|
83
|
+
* Default (`--bulk-config`) imports the document, which FLATTENS it into one scoped setting per
|
|
84
|
+
* leaf — `image.tag`, `resources.limits.cpu` and so on — which is what makes the values
|
|
85
|
+
* individually addressable, overridable per scope, and visible in the config UI.
|
|
86
|
+
*
|
|
87
|
+
* `--no-bulk-config` restores the historical `config set --entire-file` form, which stores the
|
|
88
|
+
* whole document as the value of a SINGLE setting. That is a deliberate escape hatch for charts
|
|
89
|
+
* whose values must round-trip byte-for-byte; it forfeits per-key config management, so it is
|
|
90
|
+
* not the default.
|
|
91
|
+
*
|
|
92
|
+
* `--escape-expressions` is passed either way so third-party `@{...}` tokens are stored as
|
|
93
|
+
* literals rather than evaluated by Codiac at deploy time.
|
|
94
|
+
*/
|
|
54
95
|
private buildHelmValuesConfigBlock;
|
|
55
96
|
private scanNamespacePvcs;
|
|
56
97
|
/** Resolves a PVC's FileStoreType using the cluster-wide StorageClass map, falling back to the PV's CSI driver
|
|
@@ -71,6 +112,42 @@ export default class ImportCluster extends Command {
|
|
|
71
112
|
* can render an accurate `cod imageRegistry capture --provider <p> --name <code>` suggestion. */
|
|
72
113
|
private toRegistryCode;
|
|
73
114
|
private buildConfigCommands;
|
|
115
|
+
/**
|
|
116
|
+
* Returns the annotation and label keys on this deployment that a controller owns.
|
|
117
|
+
*
|
|
118
|
+
* Reads `metadata.managedFields`, Kubernetes' own record of which actor last set each field.
|
|
119
|
+
* kubectl strips managedFields from its output unless --show-managed-fields is passed, but the
|
|
120
|
+
* API returns it by default, so the client used here already has it.
|
|
121
|
+
*/
|
|
122
|
+
private controllerOwnedMetadataKeys;
|
|
123
|
+
/** Builds the -t annotation and -t label bulk imports for a deployment, minus controller-owned
|
|
124
|
+
* and Codiac-injected keys. Returns nothing when every key was filtered out. */
|
|
125
|
+
private buildMetadataConfigCommands;
|
|
126
|
+
/** Builds the -t footprint bulk import from the first container's resource requests and limits.
|
|
127
|
+
* Uses Codiac's flat canonical keys; the nested k8s shape is not what the footprint schema stores. */
|
|
128
|
+
private buildFootprintConfigCommands;
|
|
129
|
+
/** Builds the -t probing bulk import from the first container's probes.
|
|
130
|
+
* Only the timing/threshold fields are exported: Codiac probing TUNES a probe the asset already
|
|
131
|
+
* has, so the handler (httpGet/exec) is deliberately not carried across. */
|
|
132
|
+
private buildProbingConfigCommands;
|
|
133
|
+
/**
|
|
134
|
+
* Returns the literal string an env var resolves to, or undefined when it cannot be expressed
|
|
135
|
+
* as one. Direct values pass through; secretKeyRefs become the `#REF|azKeyVault|...` string,
|
|
136
|
+
* which is just as literal. fieldRefs and configMapKeyRefs return undefined so the caller
|
|
137
|
+
* falls back to a per-setting command.
|
|
138
|
+
*/
|
|
139
|
+
private literalEnvValue;
|
|
140
|
+
/**
|
|
141
|
+
* Emits a heredoc-fed `codiac config import` covering every setting for one asset and type.
|
|
142
|
+
*
|
|
143
|
+
* The document is written to a temp file because `config import` reads from --sourceFile; the
|
|
144
|
+
* file is removed on the next line, so nothing is left behind in the working tree.
|
|
145
|
+
*
|
|
146
|
+
* Env values are stringified before serialization so YAML quotes the ambiguous ones. The importer
|
|
147
|
+
* parses with the YAML serializer, so an unquoted 250 or false would deserialize as a number/bool
|
|
148
|
+
* and Kubernetes rejects non-string env values.
|
|
149
|
+
*/
|
|
150
|
+
private buildBulkConfigImportBlock;
|
|
74
151
|
private buildConfigCommand;
|
|
75
152
|
/** Builds a standard codiac config add for a direct env value. */
|
|
76
153
|
private buildConfigAddEnvCommand;
|
|
@@ -37,6 +37,10 @@ class ImportCluster extends core_1.Command {
|
|
|
37
37
|
* `DockerHub|official` is intentionally excluded to keep the banner focused on registries the user must capture themselves. */
|
|
38
38
|
this.discoveredRegistries = new Map();
|
|
39
39
|
}
|
|
40
|
+
/** True when the key is stamped by Codiac (either bare or under the `codiac.io/` prefix). */
|
|
41
|
+
isCodiacInjectedKey(key) {
|
|
42
|
+
return ImportCluster.CODIAC_INJECTED_KEYS.has(key) || key.startsWith("codiac.io/");
|
|
43
|
+
}
|
|
40
44
|
run() {
|
|
41
45
|
var _a, _b, _c, _d;
|
|
42
46
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -55,8 +59,25 @@ class ImportCluster extends core_1.Command {
|
|
|
55
59
|
if (flags["generate-cabinet"] && (!flags.environment || !flags.cluster)) {
|
|
56
60
|
throw new Error("--generate-cabinet requires both --environment and --cluster.");
|
|
57
61
|
}
|
|
62
|
+
// In-pod service-account config is the intended path. Fall back to the ambient kubeconfig
|
|
63
|
+
// when there is no service account mounted, so the generated script can be reviewed against a
|
|
64
|
+
// real cluster from a workstation before it is run for real.
|
|
65
|
+
// In-pod service-account config is the intended path. Fall back to the ambient kubeconfig when
|
|
66
|
+
// there is no service account mounted, so the generated script can be reviewed against a real
|
|
67
|
+
// cluster from a workstation before it is run for real.
|
|
68
|
+
//
|
|
69
|
+
// Detected by probing for the injected env vars rather than by try/catch: loadFromCluster()
|
|
70
|
+
// does NOT throw when they are absent, it builds a server URL of "https://:" and the failure
|
|
71
|
+
// surfaces much later as an opaque "Invalid URL" on the first API call.
|
|
58
72
|
const kubeConfig = new k8s.KubeConfig();
|
|
59
|
-
|
|
73
|
+
const inCluster = Boolean(process.env.KUBERNETES_SERVICE_HOST && process.env.KUBERNETES_SERVICE_PORT);
|
|
74
|
+
if (inCluster) {
|
|
75
|
+
kubeConfig.loadFromCluster();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
kubeConfig.loadFromDefault();
|
|
79
|
+
this.log(`# NOTE: no in-cluster service account found; read from the current kubeconfig context [${kubeConfig.getCurrentContext()}].`);
|
|
80
|
+
}
|
|
60
81
|
const coreApi = kubeConfig.makeApiClient(k8s.CoreV1Api);
|
|
61
82
|
const appsApi = kubeConfig.makeApiClient(k8s.AppsV1Api);
|
|
62
83
|
const networkingApi = kubeConfig.makeApiClient(k8s.NetworkingV1Api);
|
|
@@ -306,10 +327,25 @@ class ImportCluster extends core_1.Command {
|
|
|
306
327
|
}
|
|
307
328
|
return lines;
|
|
308
329
|
}
|
|
309
|
-
/**
|
|
310
|
-
*
|
|
311
|
-
*
|
|
330
|
+
/**
|
|
331
|
+
* Builds the command that stores a Helm values document.
|
|
332
|
+
*
|
|
333
|
+
* Default (`--bulk-config`) imports the document, which FLATTENS it into one scoped setting per
|
|
334
|
+
* leaf — `image.tag`, `resources.limits.cpu` and so on — which is what makes the values
|
|
335
|
+
* individually addressable, overridable per scope, and visible in the config UI.
|
|
336
|
+
*
|
|
337
|
+
* `--no-bulk-config` restores the historical `config set --entire-file` form, which stores the
|
|
338
|
+
* whole document as the value of a SINGLE setting. That is a deliberate escape hatch for charts
|
|
339
|
+
* whose values must round-trip byte-for-byte; it forfeits per-key config management, so it is
|
|
340
|
+
* not the default.
|
|
341
|
+
*
|
|
342
|
+
* `--escape-expressions` is passed either way so third-party `@{...}` tokens are stored as
|
|
343
|
+
* literals rather than evaluated by Codiac at deploy time.
|
|
344
|
+
*/
|
|
312
345
|
buildHelmValuesConfigBlock(assetName, values, scope, namespace, flags) {
|
|
346
|
+
if (flags["bulk-config"] !== false) {
|
|
347
|
+
return this.buildBulkConfigImportBlock(assetName, namespace, "helm", values, scope, flags);
|
|
348
|
+
}
|
|
313
349
|
const parts = ["codiac config set --silent"];
|
|
314
350
|
if (flags.enterprise)
|
|
315
351
|
parts.push(`--enterprise ${flags.enterprise}`);
|
|
@@ -470,14 +506,206 @@ class ImportCluster extends core_1.Command {
|
|
|
470
506
|
const deploymentName = (_b = (_a = deployment.metadata) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "unnamed";
|
|
471
507
|
const containers = (_f = (_e = (_d = (_c = deployment.spec) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.spec) === null || _e === void 0 ? void 0 : _e.containers) !== null && _f !== void 0 ? _f : [];
|
|
472
508
|
const commands = [];
|
|
509
|
+
// Literal-valued env vars (direct values and secret #REFs) collapse into ONE bulk import.
|
|
510
|
+
// Everything else keeps its own command: fieldRefs become a different settings type
|
|
511
|
+
// (k8spatch), and unresolvable refs become TODO comments that a human has to read.
|
|
512
|
+
const bulkable = new Map();
|
|
473
513
|
for (const container of containers) {
|
|
474
514
|
for (const envVar of (_g = container.env) !== null && _g !== void 0 ? _g : []) {
|
|
475
|
-
|
|
476
|
-
|
|
515
|
+
if (this.isCodiacInjectedKey(envVar.name))
|
|
516
|
+
continue;
|
|
517
|
+
if (flags["bulk-config"] !== false) {
|
|
518
|
+
const literal = this.literalEnvValue(envVar, flags);
|
|
519
|
+
if (literal !== undefined) {
|
|
520
|
+
bulkable.set(envVar.name, literal);
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
commands.push(this.buildConfigCommand(deploymentName, namespace, envVar, flags));
|
|
477
525
|
}
|
|
478
526
|
}
|
|
527
|
+
if (bulkable.size > 0) {
|
|
528
|
+
commands.unshift(this.buildBulkConfigImportBlock(deploymentName, namespace, "env", bulkable, "cabinet", flags));
|
|
529
|
+
}
|
|
530
|
+
// Opt-in settings types. Off by default: these are derived from the live pod spec, where most
|
|
531
|
+
// values were put there by the platform rather than authored by anyone, so exporting them
|
|
532
|
+
// wholesale buries the settings that actually matter.
|
|
533
|
+
if (flags["generate-metadata"])
|
|
534
|
+
commands.push(...this.buildMetadataConfigCommands(deployment, namespace, flags));
|
|
535
|
+
if (flags["generate-footprint"])
|
|
536
|
+
commands.push(...this.buildFootprintConfigCommands(deployment, namespace, flags));
|
|
537
|
+
if (flags["generate-probing"])
|
|
538
|
+
commands.push(...this.buildProbingConfigCommands(deployment, namespace, flags));
|
|
539
|
+
return commands;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Returns the annotation and label keys on this deployment that a controller owns.
|
|
543
|
+
*
|
|
544
|
+
* Reads `metadata.managedFields`, Kubernetes' own record of which actor last set each field.
|
|
545
|
+
* kubectl strips managedFields from its output unless --show-managed-fields is passed, but the
|
|
546
|
+
* API returns it by default, so the client used here already has it.
|
|
547
|
+
*/
|
|
548
|
+
controllerOwnedMetadataKeys(deployment) {
|
|
549
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
550
|
+
const annotations = new Set();
|
|
551
|
+
const labels = new Set();
|
|
552
|
+
for (const entry of (_b = (_a = deployment.metadata) === null || _a === void 0 ? void 0 : _a.managedFields) !== null && _b !== void 0 ? _b : []) {
|
|
553
|
+
if (!ImportCluster.CONTROLLER_FIELD_MANAGERS.has((_c = entry.manager) !== null && _c !== void 0 ? _c : ""))
|
|
554
|
+
continue;
|
|
555
|
+
const meta = (_e = (_d = entry.fieldsV1) === null || _d === void 0 ? void 0 : _d["f:metadata"]) !== null && _e !== void 0 ? _e : {};
|
|
556
|
+
for (const key of Object.keys((_f = meta["f:annotations"]) !== null && _f !== void 0 ? _f : {}))
|
|
557
|
+
if (key.startsWith("f:"))
|
|
558
|
+
annotations.add(key.slice(2));
|
|
559
|
+
for (const key of Object.keys((_g = meta["f:labels"]) !== null && _g !== void 0 ? _g : {}))
|
|
560
|
+
if (key.startsWith("f:"))
|
|
561
|
+
labels.add(key.slice(2));
|
|
562
|
+
}
|
|
563
|
+
return { annotations, labels };
|
|
564
|
+
}
|
|
565
|
+
/** Builds the -t annotation and -t label bulk imports for a deployment, minus controller-owned
|
|
566
|
+
* and Codiac-injected keys. Returns nothing when every key was filtered out. */
|
|
567
|
+
buildMetadataConfigCommands(deployment, namespace, flags) {
|
|
568
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
569
|
+
const assetName = (_b = (_a = deployment.metadata) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "unnamed";
|
|
570
|
+
const owned = this.controllerOwnedMetadataKeys(deployment);
|
|
571
|
+
const commands = [];
|
|
572
|
+
const keep = (source, controllerOwned) => {
|
|
573
|
+
const out = new Map();
|
|
574
|
+
for (const [key, value] of Object.entries(source !== null && source !== void 0 ? source : {})) {
|
|
575
|
+
if (controllerOwned.has(key))
|
|
576
|
+
continue;
|
|
577
|
+
if (ImportCluster.BOOKKEEPING_METADATA_KEYS.has(key))
|
|
578
|
+
continue;
|
|
579
|
+
if (this.isCodiacInjectedKey(key))
|
|
580
|
+
continue;
|
|
581
|
+
out.set(key, value);
|
|
582
|
+
}
|
|
583
|
+
return out;
|
|
584
|
+
};
|
|
585
|
+
// Selector labels are structural, not descriptive: they wire the Deployment to its pods and are
|
|
586
|
+
// derived from the asset on the way back in. Re-importing them as label settings duplicates
|
|
587
|
+
// something Codiac already sets, so they are dropped alongside the controller-owned keys.
|
|
588
|
+
const selectorLabels = new Set(Object.keys((_e = (_d = (_c = deployment.spec) === null || _c === void 0 ? void 0 : _c.selector) === null || _d === void 0 ? void 0 : _d.matchLabels) !== null && _e !== void 0 ? _e : {}));
|
|
589
|
+
const annotations = keep((_f = deployment.metadata) === null || _f === void 0 ? void 0 : _f.annotations, owned.annotations);
|
|
590
|
+
const labels = keep((_g = deployment.metadata) === null || _g === void 0 ? void 0 : _g.labels, new Set([...owned.labels, ...selectorLabels]));
|
|
591
|
+
if (annotations.size > 0)
|
|
592
|
+
commands.push(this.buildBulkConfigImportBlock(assetName, namespace, "annotation", annotations, "cabinet", flags));
|
|
593
|
+
if (labels.size > 0)
|
|
594
|
+
commands.push(this.buildBulkConfigImportBlock(assetName, namespace, "label", labels, "cabinet", flags));
|
|
479
595
|
return commands;
|
|
480
596
|
}
|
|
597
|
+
/** Builds the -t footprint bulk import from the first container's resource requests and limits.
|
|
598
|
+
* Uses Codiac's flat canonical keys; the nested k8s shape is not what the footprint schema stores. */
|
|
599
|
+
buildFootprintConfigCommands(deployment, namespace, flags) {
|
|
600
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
601
|
+
const assetName = (_b = (_a = deployment.metadata) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "unnamed";
|
|
602
|
+
const resources = (_g = (_f = (_e = (_d = (_c = deployment.spec) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.spec) === null || _e === void 0 ? void 0 : _e.containers) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.resources;
|
|
603
|
+
if (!resources)
|
|
604
|
+
return [];
|
|
605
|
+
const values = new Map();
|
|
606
|
+
if ((_h = resources.requests) === null || _h === void 0 ? void 0 : _h.cpu)
|
|
607
|
+
values.set("cpuRequest", String(resources.requests.cpu));
|
|
608
|
+
if ((_j = resources.requests) === null || _j === void 0 ? void 0 : _j.memory)
|
|
609
|
+
values.set("memRequest", String(resources.requests.memory));
|
|
610
|
+
if ((_k = resources.limits) === null || _k === void 0 ? void 0 : _k.cpu)
|
|
611
|
+
values.set("cpuLimit", String(resources.limits.cpu));
|
|
612
|
+
if ((_l = resources.limits) === null || _l === void 0 ? void 0 : _l.memory)
|
|
613
|
+
values.set("memLimit", String(resources.limits.memory));
|
|
614
|
+
if (values.size === 0)
|
|
615
|
+
return [];
|
|
616
|
+
return [this.buildBulkConfigImportBlock(assetName, namespace, "footprint", values, "cabinet", flags)];
|
|
617
|
+
}
|
|
618
|
+
/** Builds the -t probing bulk import from the first container's probes.
|
|
619
|
+
* Only the timing/threshold fields are exported: Codiac probing TUNES a probe the asset already
|
|
620
|
+
* has, so the handler (httpGet/exec) is deliberately not carried across. */
|
|
621
|
+
buildProbingConfigCommands(deployment, namespace, flags) {
|
|
622
|
+
var _a, _b, _c, _d, _e, _f;
|
|
623
|
+
const assetName = (_b = (_a = deployment.metadata) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "unnamed";
|
|
624
|
+
const container = (_f = (_e = (_d = (_c = deployment.spec) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.spec) === null || _e === void 0 ? void 0 : _e.containers) === null || _f === void 0 ? void 0 : _f[0];
|
|
625
|
+
if (!container)
|
|
626
|
+
return [];
|
|
627
|
+
const values = new Map();
|
|
628
|
+
const probes = [
|
|
629
|
+
["startup", container.startupProbe],
|
|
630
|
+
["liveness", container.livenessProbe],
|
|
631
|
+
["readiness", container.readinessProbe],
|
|
632
|
+
];
|
|
633
|
+
const fields = ["initialDelaySeconds", "periodSeconds", "timeoutSeconds", "successThreshold", "failureThreshold"];
|
|
634
|
+
for (const [name, probe] of probes) {
|
|
635
|
+
if (!probe)
|
|
636
|
+
continue;
|
|
637
|
+
for (const field of fields) {
|
|
638
|
+
const value = probe[field];
|
|
639
|
+
if (typeof value === "number")
|
|
640
|
+
values.set(`${name}.${String(field)}`, value);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
if (values.size === 0)
|
|
644
|
+
return [];
|
|
645
|
+
return [this.buildBulkConfigImportBlock(assetName, namespace, "probing", values, "cabinet", flags)];
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Returns the literal string an env var resolves to, or undefined when it cannot be expressed
|
|
649
|
+
* as one. Direct values pass through; secretKeyRefs become the `#REF|azKeyVault|...` string,
|
|
650
|
+
* which is just as literal. fieldRefs and configMapKeyRefs return undefined so the caller
|
|
651
|
+
* falls back to a per-setting command.
|
|
652
|
+
*/
|
|
653
|
+
literalEnvValue(envVar, flags) {
|
|
654
|
+
var _a, _b, _c;
|
|
655
|
+
if (envVar.value !== undefined)
|
|
656
|
+
return envVar.value;
|
|
657
|
+
if (!envVar.valueFrom)
|
|
658
|
+
return "";
|
|
659
|
+
if (envVar.valueFrom.secretKeyRef) {
|
|
660
|
+
const storeName = (_b = (_a = flags["keyvault-name"]) !== null && _a !== void 0 ? _a : envVar.valueFrom.secretKeyRef.name) !== null && _b !== void 0 ? _b : "<unknown>";
|
|
661
|
+
this.discoveredStores.add(storeName);
|
|
662
|
+
return `#REF|azKeyVault|${storeName}|${(_c = envVar.valueFrom.secretKeyRef.key) !== null && _c !== void 0 ? _c : "<unknown>"}`;
|
|
663
|
+
}
|
|
664
|
+
return undefined;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Emits a heredoc-fed `codiac config import` covering every setting for one asset and type.
|
|
668
|
+
*
|
|
669
|
+
* The document is written to a temp file because `config import` reads from --sourceFile; the
|
|
670
|
+
* file is removed on the next line, so nothing is left behind in the working tree.
|
|
671
|
+
*
|
|
672
|
+
* Env values are stringified before serialization so YAML quotes the ambiguous ones. The importer
|
|
673
|
+
* parses with the YAML serializer, so an unquoted 250 or false would deserialize as a number/bool
|
|
674
|
+
* and Kubernetes rejects non-string env values.
|
|
675
|
+
*/
|
|
676
|
+
buildBulkConfigImportBlock(assetName, namespace, settingType, values, scope, flags) {
|
|
677
|
+
// Kubernetes requires env, label and annotation values to be strings, so those are stringified
|
|
678
|
+
// and YAML quotes whichever of them would otherwise deserialize as a number or bool. The probing
|
|
679
|
+
// schema declares its fields as numbers, so those are left native — quoting them would store the
|
|
680
|
+
// wrong type.
|
|
681
|
+
const stringify = settingType !== "probing";
|
|
682
|
+
const doc = values instanceof Map
|
|
683
|
+
? YAML.stringify(Object.fromEntries([...values].map(([k, v]) => [k, stringify ? String(v) : v])))
|
|
684
|
+
: YAML.stringify(values);
|
|
685
|
+
// At enterprise scope `-n` already carries the enterprise context, so --enterprise-code would be
|
|
686
|
+
// redundant. At cabinet scope `-n` is not allowed, which is exactly why --enterprise-code exists.
|
|
687
|
+
const parts = ["codiac config import --silent", `-a ${assetName}`];
|
|
688
|
+
if (scope === "enterprise") {
|
|
689
|
+
if (flags.enterprise)
|
|
690
|
+
parts.push(`-n ${flags.enterprise}`);
|
|
691
|
+
}
|
|
692
|
+
else {
|
|
693
|
+
if (flags.enterprise)
|
|
694
|
+
parts.push(`--enterprise-code ${flags.enterprise}`);
|
|
695
|
+
parts.push(`-c ${namespace}`);
|
|
696
|
+
}
|
|
697
|
+
parts.push(`-t ${settingType}`, '-s "$_codiac_cfg"', "--escape-expressions");
|
|
698
|
+
const count = values instanceof Map ? values.size : Object.keys(values).length;
|
|
699
|
+
return [
|
|
700
|
+
`# ${count} ${settingType} setting(s) for ${assetName}, imported in one call.`,
|
|
701
|
+
`_codiac_cfg=$(mktemp -t codiac-${settingType}-XXXXXX)`,
|
|
702
|
+
`cat > "$_codiac_cfg" <<'CODIAC_IMPORT_EOF'`,
|
|
703
|
+
doc.replace(/\n+$/, ""),
|
|
704
|
+
"CODIAC_IMPORT_EOF",
|
|
705
|
+
parts.join(" "),
|
|
706
|
+
`rm -f "$_codiac_cfg"`,
|
|
707
|
+
].join("\n");
|
|
708
|
+
}
|
|
481
709
|
buildConfigCommand(assetName, namespace, envVar, flags) {
|
|
482
710
|
const settingName = envVar.name;
|
|
483
711
|
// Direct value
|
|
@@ -830,5 +1058,44 @@ ImportCluster.flags = {
|
|
|
830
1058
|
"generate-volume-mounts": core_1.Flags.boolean({ description: 'Include codiac asset volume create commands for every container volumeMount backed by a PVC on a discovered deployment.' }),
|
|
831
1059
|
"include-default": core_1.Flags.boolean({ description: 'Include the "default" namespace (excluded by default).' }),
|
|
832
1060
|
"keyvault-name": core_1.Flags.string({ description: 'Azure Key Vault name to use in generated secret references. When omitted, the K8s Secret name is used as a placeholder.' }),
|
|
1061
|
+
"bulk-config": core_1.Flags.boolean({ default: true, allowNo: true, description: 'Emit one bulk `codiac config import` per asset for env vars and Helm values instead of one `codiac config set` per setting. Far fewer round trips on large clusters. Use --no-bulk-config to emit the historical one-command-per-setting output.' }),
|
|
1062
|
+
"generate-metadata": core_1.Flags.boolean({ description: 'Include -t annotation and -t label settings for pod metadata. Off by default: most annotations and labels on a live workload are stamped by controllers and operators rather than authored, so exporting them wholesale produces noise. Controller-owned keys are filtered out by field-manager provenance; what remains still deserves review.' }),
|
|
1063
|
+
"generate-footprint": core_1.Flags.boolean({ description: 'Include -t footprint settings (cpuRequest/memRequest/cpuLimit/memLimit) from container resource requests and limits. Off by default.' }),
|
|
1064
|
+
"generate-probing": core_1.Flags.boolean({ description: 'Include -t probing settings from container liveness/readiness/startup probes. Off by default. Only the timing and threshold fields are exported; Codiac probing tunes an existing probe and cannot define one.' }),
|
|
833
1065
|
};
|
|
1066
|
+
/** Field managers whose metadata writes are machine-generated rather than authored.
|
|
1067
|
+
*
|
|
1068
|
+
* Kubernetes records which actor last set each field in `metadata.managedFields`, which lets the
|
|
1069
|
+
* exporter tell an operator-injected annotation from one a human wrote — without maintaining a
|
|
1070
|
+
* denylist of annotation keys, a list that would rot as new controllers appear.
|
|
1071
|
+
*
|
|
1072
|
+
* Note this filter alone is NOT sufficient: Codiac's own injected labels are written by the same
|
|
1073
|
+
* field manager as the user's authored ones, so they are additionally excluded by name via
|
|
1074
|
+
* CODIAC_INJECTED_KEYS. Provenance handles controllers; the name list handles ourselves. */
|
|
1075
|
+
/** Machine-written bookkeeping keys that provenance does NOT catch, because the field manager
|
|
1076
|
+
* that wrote them (kubectl, helm) is an authoring tool rather than a controller.
|
|
1077
|
+
*
|
|
1078
|
+
* `last-applied-configuration` is the worst of these: it holds a JSON copy of the entire previous
|
|
1079
|
+
* object, so exporting it would create one enormous, meaningless setting. */
|
|
1080
|
+
ImportCluster.BOOKKEEPING_METADATA_KEYS = new Set([
|
|
1081
|
+
"kubectl.kubernetes.io/last-applied-configuration",
|
|
1082
|
+
"kubectl.kubernetes.io/restartedAt",
|
|
1083
|
+
"deployment.kubernetes.io/revision",
|
|
1084
|
+
"meta.helm.sh/release-name",
|
|
1085
|
+
"meta.helm.sh/release-namespace",
|
|
1086
|
+
]);
|
|
1087
|
+
ImportCluster.CONTROLLER_FIELD_MANAGERS = new Set([
|
|
1088
|
+
"kube-controller-manager", "deployment-controller", "replicaset-controller",
|
|
1089
|
+
"kubelet", "cluster-autoscaler", "vpa-updater", "kube-scheduler",
|
|
1090
|
+
]);
|
|
1091
|
+
/** Env var names and metadata keys that Codiac itself stamps onto every deployment it owns.
|
|
1092
|
+
*
|
|
1093
|
+
* Re-exporting these would feed Codiac's own output back into Codiac: an imported asset would
|
|
1094
|
+
* carry a hard-coded `assetVersion` or `cabinet` that then overrides the real deploy-time value.
|
|
1095
|
+
* Excluded unconditionally — this is a correctness rule, not a noise-reduction preference.
|
|
1096
|
+
* Mirrors the constants on K8sDomainMapper in codiac-relay. */
|
|
1097
|
+
ImportCluster.CODIAC_INJECTED_KEYS = new Set([
|
|
1098
|
+
"codiacEntityType", "assetName", "assetVersion", "assetType", "assetEnterprise",
|
|
1099
|
+
"assetRecycledOn", "startupReplicas", "enterprise", "environment", "cabinet",
|
|
1100
|
+
]);
|
|
834
1101
|
//# sourceMappingURL=cluster.js.map
|