@catladder/pipeline 1.35.0 → 1.36.2
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/dist/constants.js +1 -1
- package/dist/context/index.js +15 -1
- package/dist/deploy/custom/index.d.ts +2 -1
- package/dist/deploy/custom/index.js +12 -18
- package/dist/deploy/index.d.ts +6 -6
- package/dist/deploy/index.js +2 -12
- package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +2 -0
- package/dist/deploy/kubernetes/additionalSecretKeys.js +27 -0
- package/dist/deploy/kubernetes/deployJob.js +5 -62
- package/dist/deploy/kubernetes/index.d.ts +2 -1
- package/dist/deploy/kubernetes/index.js +11 -17
- package/dist/deploy/kubernetes/kubeEnv.d.ts +10 -0
- package/dist/deploy/kubernetes/kubeEnv.js +90 -0
- package/dist/deploy/kubernetes/kubeValues.d.ts +136 -0
- package/dist/deploy/kubernetes/kubeValues.js +62 -0
- package/dist/deploy/kubernetes/mongodb.d.ts +17 -4
- package/dist/deploy/kubernetes/mongodb.js +118 -8
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +1 -3
- package/dist/deploy/types.d.ts +22 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/context/index.ts +14 -2
- package/src/deploy/custom/index.ts +8 -1
- package/src/deploy/index.ts +12 -15
- package/src/deploy/kubernetes/additionalSecretKeys.ts +20 -0
- package/src/deploy/kubernetes/deployJob.ts +2 -70
- package/src/deploy/kubernetes/index.ts +9 -1
- package/src/deploy/kubernetes/kubeEnv.ts +48 -0
- package/src/deploy/kubernetes/kubeValues.ts +60 -0
- package/src/deploy/kubernetes/mongodb.ts +103 -7
- package/src/deploy/types.ts +28 -5
package/dist/constants.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
5
|
-
exports.PIPELINE_IMAGE_TAG = "v1-
|
|
5
|
+
exports.PIPELINE_IMAGE_TAG = "v1-36-2-31ffc00e" || "";
|
|
6
6
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
|
package/dist/context/index.js
CHANGED
|
@@ -39,6 +39,16 @@ var __read = this && this.__read || function (o, n) {
|
|
|
39
39
|
return ar;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
43
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
44
|
+
if (ar || !(i in from)) {
|
|
45
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
46
|
+
ar[i] = from[i];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
50
|
+
};
|
|
51
|
+
|
|
42
52
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
43
53
|
return mod && mod.__esModule ? mod : {
|
|
44
54
|
"default": mod
|
|
@@ -158,7 +168,11 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
158
168
|
}
|
|
159
169
|
|
|
160
170
|
var publicEnvVarsRaw = (_h = (_g = mergedConfig.vars) === null || _g === void 0 ? void 0 : _g.public) !== null && _h !== void 0 ? _h : {};
|
|
161
|
-
var
|
|
171
|
+
var additionalSecretKeys = componentConfig.deploy ? deploy_1.DEPLOY_TYPES[componentConfig.deploy.type].additionalSecretKeys( // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
172
|
+
componentConfig.deploy) : [];
|
|
173
|
+
|
|
174
|
+
var secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_k = (_j = mergedConfig.vars) === null || _j === void 0 ? void 0 : _j.secret) !== null && _k !== void 0 ? _k : []), false), __read(additionalSecretKeys), false);
|
|
175
|
+
|
|
162
176
|
var secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
|
|
163
177
|
return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
|
|
164
178
|
})); // this is deprecated, we now support: $componentname:FOO
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { DeployTypeDefinition } from "..";
|
|
2
|
+
export declare const CUSTOM_DEPLOY_TYPE: DeployTypeDefinition<"custom">;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
Object.defineProperty(o, k2, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function () {
|
|
8
|
-
return m[k];
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
} : function (o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
o[k2] = m[k];
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
17
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
3
|
exports.__esModule = true;
|
|
4
|
+
exports.CUSTOM_DEPLOY_TYPE = void 0;
|
|
5
|
+
|
|
6
|
+
var deployJob_1 = require("./deployJob");
|
|
21
7
|
|
|
22
|
-
|
|
8
|
+
exports.CUSTOM_DEPLOY_TYPE = {
|
|
9
|
+
jobs: deployJob_1.createCustomDeployJobs,
|
|
10
|
+
defaults: function () {
|
|
11
|
+
return {};
|
|
12
|
+
},
|
|
13
|
+
additionalSecretKeys: function () {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
};
|
package/dist/deploy/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Context } from "../types/context";
|
|
2
2
|
import { CatladderJob } from "../types/jobs";
|
|
3
|
-
import {
|
|
3
|
+
import { DeployConfigGeneric, DeployConfigType } from "./types";
|
|
4
4
|
export * from "./kubernetes";
|
|
5
5
|
export * from "./types";
|
|
6
6
|
export * from "./utils";
|
|
7
|
-
export declare type
|
|
7
|
+
export declare type DeployTypeDefinition<T extends DeployConfigType> = {
|
|
8
8
|
jobs: (context: Context) => CatladderJob[];
|
|
9
|
-
defaults: () => Partial<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
defaults: () => Partial<DeployConfigGeneric<T>>;
|
|
10
|
+
additionalSecretKeys: (config: DeployConfigGeneric<T>) => string[];
|
|
11
|
+
};
|
|
12
|
+
export declare type DeployTypes = { [T in DeployConfigType]: DeployTypeDefinition<T> };
|
|
13
13
|
export declare const DEPLOY_TYPES: DeployTypes;
|
package/dist/deploy/index.js
CHANGED
|
@@ -31,16 +31,6 @@ __exportStar(require("./types"), exports);
|
|
|
31
31
|
__exportStar(require("./utils"), exports);
|
|
32
32
|
|
|
33
33
|
exports.DEPLOY_TYPES = {
|
|
34
|
-
kubernetes:
|
|
35
|
-
|
|
36
|
-
defaults: function () {
|
|
37
|
-
return {};
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
custom: {
|
|
41
|
-
jobs: custom_1.createCustomDeployJobs,
|
|
42
|
-
defaults: function () {
|
|
43
|
-
return {};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
34
|
+
kubernetes: kubernetes_1.KUBERNETES_DEPLOY_TYPE,
|
|
35
|
+
custom: custom_1.CUSTOM_DEPLOY_TYPE
|
|
46
36
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.additionalKubernetesSecretKeys = void 0;
|
|
5
|
+
|
|
6
|
+
var additionalKubernetesSecretKeys = function (config) {
|
|
7
|
+
var _a, _b, _c, _d;
|
|
8
|
+
|
|
9
|
+
var keys = [];
|
|
10
|
+
|
|
11
|
+
if ((_b = (_a = config.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) {
|
|
12
|
+
keys.push("MONGODB_ROOT_PASSWORD");
|
|
13
|
+
|
|
14
|
+
if (config.values.mongodb.architecture === "replicaset") {
|
|
15
|
+
keys.push("MONGODB_REPLICASET_KEY");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if ((_d = (_c = config.values) === null || _c === void 0 ? void 0 : _c.cloudsql) === null || _d === void 0 ? void 0 : _d.enabled) {
|
|
20
|
+
keys.push("POSTGRESQL_PASSWORD");
|
|
21
|
+
keys.push("cloudsqlProxyCredentials");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return keys;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
|
|
@@ -60,20 +60,14 @@ var __1 = require("../..");
|
|
|
60
60
|
|
|
61
61
|
var runner_1 = require("../../runner");
|
|
62
62
|
|
|
63
|
-
var utils_1 = require("../../utils");
|
|
64
|
-
|
|
65
63
|
var base_1 = require("../base");
|
|
66
64
|
|
|
67
65
|
var types_1 = require("../types");
|
|
68
66
|
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
var mongodb_1 = require("./mongodb");
|
|
72
|
-
|
|
73
|
-
var processSecretsAsFiles_1 = require("./processSecretsAsFiles");
|
|
67
|
+
var kubeValues_1 = require("./kubeValues");
|
|
74
68
|
|
|
75
69
|
var createKubernetesDeployJobs = function (context) {
|
|
76
|
-
var _a, _b
|
|
70
|
+
var _a, _b;
|
|
77
71
|
|
|
78
72
|
var deployConfig = context.componentConfig.deploy;
|
|
79
73
|
|
|
@@ -86,58 +80,7 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
86
80
|
throw new Error("deploy config is not kubernetes");
|
|
87
81
|
}
|
|
88
82
|
|
|
89
|
-
var
|
|
90
|
-
/**
|
|
91
|
-
* separate by secrets and public.
|
|
92
|
-
* we evalulate the actual values later, but want to store the secrets in kubernetes secrets
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
|
-
var env = Object.entries(allEnvVars).reduce(function (acc, _a) {
|
|
96
|
-
var _b, _c;
|
|
97
|
-
|
|
98
|
-
var _d;
|
|
99
|
-
|
|
100
|
-
var _e = __read(_a, 2),
|
|
101
|
-
key = _e[0],
|
|
102
|
-
value = _e[1];
|
|
103
|
-
|
|
104
|
-
if ((_d = String(value)) === null || _d === void 0 ? void 0 : _d.startsWith("$CL_")) {
|
|
105
|
-
acc.secret = __assign(__assign({}, acc.secret), (_b = {}, _b[key] = value, _b));
|
|
106
|
-
return acc;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
acc.public = __assign(__assign({}, acc.public), (_c = {}, _c[key] = value, _c));
|
|
110
|
-
return acc;
|
|
111
|
-
}, {
|
|
112
|
-
secret: {},
|
|
113
|
-
public: {}
|
|
114
|
-
});
|
|
115
|
-
var defaultAppConfig = {
|
|
116
|
-
host: context.environment.host,
|
|
117
|
-
command: context.componentConfig.build.startCommand,
|
|
118
|
-
livenessProbe: {
|
|
119
|
-
httpGet: {
|
|
120
|
-
path: (_c = (_b = (_a = deployConfig.values) === null || _a === void 0 ? void 0 : _a.application) === null || _b === void 0 ? void 0 : _b.healthRoute) !== null && _c !== void 0 ? _c : "__health"
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
readinessProbe: {
|
|
124
|
-
httpGet: {
|
|
125
|
-
path: (_f = (_e = (_d = deployConfig.values) === null || _d === void 0 ? void 0 : _d.application) === null || _e === void 0 ? void 0 : _e.healthRoute) !== null && _f !== void 0 ? _f : "__health"
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
startupProbe: {
|
|
129
|
-
httpGet: {
|
|
130
|
-
path: (_j = (_h = (_g = deployConfig.values) === null || _g === void 0 ? void 0 : _g.application) === null || _h === void 0 ? void 0 : _h.healthRoute) !== null && _j !== void 0 ? _j : "__health"
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
var defaultKubeValues = __assign(__assign({
|
|
136
|
-
application: defaultAppConfig,
|
|
137
|
-
env: env
|
|
138
|
-
}, ((_l = (_k = deployConfig.values) === null || _k === void 0 ? void 0 : _k.cloudsql) === null || _l === void 0 ? void 0 : _l.enabled) ? (0, cloudsql_1.createCloudsqlBaseConfig)(context) : {}), ((_o = (_m = deployConfig.values) === null || _m === void 0 ? void 0 : _m.mongodb) === null || _o === void 0 ? void 0 : _o.enabled) ? (0, mongodb_1.createMongodbBaseConfig)(context) : {});
|
|
139
|
-
|
|
140
|
-
var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, deployConfig.values));
|
|
83
|
+
var kubeValues = (0, kubeValues_1.createKubeValues)(context);
|
|
141
84
|
var kubernetesEnvironment = {
|
|
142
85
|
namespace: context.environment.envVars.KUBE_NAMESPACE
|
|
143
86
|
};
|
|
@@ -152,9 +95,9 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
152
95
|
forceQuotes: true
|
|
153
96
|
}),
|
|
154
97
|
HELM_GITLAB_CHART_NAME: "the-panter-chart",
|
|
155
|
-
HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((
|
|
98
|
+
HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_a = deployConfig.additionalHelmArgs) !== null && _a !== void 0 ? _a : []), false).join(" "),
|
|
156
99
|
COMPONENT_NAME: context.componentName,
|
|
157
|
-
BUILD_ID: (
|
|
100
|
+
BUILD_ID: (_b = context.commitInfo) === null || _b === void 0 ? void 0 : _b.buildId
|
|
158
101
|
})
|
|
159
102
|
};
|
|
160
103
|
var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { DeployTypeDefinition } from "..";
|
|
2
|
+
export declare const KUBERNETES_DEPLOY_TYPE: DeployTypeDefinition<"kubernetes">;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(o, k2, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function () {
|
|
8
|
-
return m[k];
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
} : function (o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
o[k2] = m[k];
|
|
14
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.KUBERNETES_DEPLOY_TYPE = void 0;
|
|
15
5
|
|
|
16
|
-
var
|
|
17
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
-
};
|
|
6
|
+
var additionalSecretKeys_1 = require("./additionalSecretKeys");
|
|
19
7
|
|
|
20
|
-
|
|
8
|
+
var deployJob_1 = require("./deployJob");
|
|
21
9
|
|
|
22
|
-
|
|
10
|
+
exports.KUBERNETES_DEPLOY_TYPE = {
|
|
11
|
+
jobs: deployJob_1.createKubernetesDeployJobs,
|
|
12
|
+
defaults: function () {
|
|
13
|
+
return {};
|
|
14
|
+
},
|
|
15
|
+
additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Context } from "../../types";
|
|
2
|
+
/**
|
|
3
|
+
* separate by secrets and public.
|
|
4
|
+
* we evalulate the actual values later, but want to store the secrets in kubernetes secrets
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export declare const createKubeEnv: (context: Context) => {
|
|
8
|
+
secret: Record<string, string>;
|
|
9
|
+
public: Record<string, string>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __assign = this && this.__assign || function () {
|
|
4
|
+
__assign = Object.assign || function (t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
|
|
8
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var __read = this && this.__read || function (o, n) {
|
|
18
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
|
+
if (!m) return o;
|
|
20
|
+
var i = m.call(o),
|
|
21
|
+
r,
|
|
22
|
+
ar = [],
|
|
23
|
+
e;
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
e = {
|
|
29
|
+
error: error
|
|
30
|
+
};
|
|
31
|
+
} finally {
|
|
32
|
+
try {
|
|
33
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
34
|
+
} finally {
|
|
35
|
+
if (e) throw e.error;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return ar;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.__esModule = true;
|
|
43
|
+
exports.createKubeEnv = void 0;
|
|
44
|
+
|
|
45
|
+
var types_1 = require("../types");
|
|
46
|
+
|
|
47
|
+
var shouldGoIntoSecrets = function (key, value) {
|
|
48
|
+
var _a;
|
|
49
|
+
|
|
50
|
+
if ((_a = String(value)) === null || _a === void 0 ? void 0 : _a.includes("$CL_")) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return false;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* separate by secrets and public.
|
|
58
|
+
* we evalulate the actual values later, but want to store the secrets in kubernetes secrets
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
var createKubeEnv = function (context) {
|
|
63
|
+
if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
|
|
64
|
+
// should not happen
|
|
65
|
+
throw new Error("deploy config is not kubernetes");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var allEnvVars = context.environment.envVars;
|
|
69
|
+
var env = Object.entries(allEnvVars).reduce(function (acc, _a) {
|
|
70
|
+
var _b, _c;
|
|
71
|
+
|
|
72
|
+
var _d = __read(_a, 2),
|
|
73
|
+
key = _d[0],
|
|
74
|
+
value = _d[1];
|
|
75
|
+
|
|
76
|
+
if (shouldGoIntoSecrets(key, value)) {
|
|
77
|
+
acc.secret = __assign(__assign({}, acc.secret), (_b = {}, _b[key] = value, _b));
|
|
78
|
+
return acc;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
acc.public = __assign(__assign({}, acc.public), (_c = {}, _c[key] = value, _c));
|
|
82
|
+
return acc;
|
|
83
|
+
}, {
|
|
84
|
+
secret: {},
|
|
85
|
+
public: {}
|
|
86
|
+
});
|
|
87
|
+
return env;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
exports.createKubeEnv = createKubeEnv;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Context } from "../../types/context";
|
|
2
|
+
export declare const createKubeValues: (context: Context) => never[] | ({
|
|
3
|
+
application: {
|
|
4
|
+
redirects?: ({
|
|
5
|
+
host: string;
|
|
6
|
+
} & Record<string, unknown>)[] | undefined;
|
|
7
|
+
hostAliases?: string[] | undefined;
|
|
8
|
+
replicas?: number | undefined;
|
|
9
|
+
autoscale?: import("..").KubernetesAutoscale | undefined;
|
|
10
|
+
updateStrategy?: import("..").KubernetesUpdateStrategy | undefined;
|
|
11
|
+
resources?: import("..").KubernetesResourcesDef | undefined;
|
|
12
|
+
healthRoute?: string | undefined;
|
|
13
|
+
startupProbe?: {
|
|
14
|
+
httpGet?: {
|
|
15
|
+
path?: string | undefined;
|
|
16
|
+
port?: number | undefined;
|
|
17
|
+
httpHeaders?: {
|
|
18
|
+
name: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}[] | undefined;
|
|
21
|
+
failureThreshold?: number | undefined;
|
|
22
|
+
timeoutSeconds?: number | undefined;
|
|
23
|
+
periodSeconds?: number | undefined;
|
|
24
|
+
successThreshold?: number | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
readinessProbe?: {
|
|
28
|
+
httpGet?: {
|
|
29
|
+
path?: string | undefined;
|
|
30
|
+
port?: number | undefined;
|
|
31
|
+
httpHeaders?: {
|
|
32
|
+
name: string;
|
|
33
|
+
value: string;
|
|
34
|
+
}[] | undefined;
|
|
35
|
+
failureThreshold?: number | undefined;
|
|
36
|
+
timeoutSeconds?: number | undefined;
|
|
37
|
+
periodSeconds?: number | undefined;
|
|
38
|
+
successThreshold?: number | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
livenessProbe?: {
|
|
42
|
+
httpGet?: {
|
|
43
|
+
path?: string | undefined;
|
|
44
|
+
port?: number | undefined;
|
|
45
|
+
httpHeaders?: {
|
|
46
|
+
name: string;
|
|
47
|
+
value: string;
|
|
48
|
+
}[] | undefined;
|
|
49
|
+
failureThreshold?: number | undefined;
|
|
50
|
+
timeoutSeconds?: number | undefined;
|
|
51
|
+
periodSeconds?: number | undefined;
|
|
52
|
+
successThreshold?: number | undefined;
|
|
53
|
+
} | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
worker?: import("..").KubernetesWorkerDef | undefined;
|
|
56
|
+
} & Record<string, unknown>;
|
|
57
|
+
env: {
|
|
58
|
+
secret: Record<string, string>;
|
|
59
|
+
public: Record<string, string>;
|
|
60
|
+
};
|
|
61
|
+
} & {
|
|
62
|
+
cloudsql?: {
|
|
63
|
+
enabled: boolean;
|
|
64
|
+
instanceId?: string | undefined;
|
|
65
|
+
projectId?: string | undefined;
|
|
66
|
+
region?: string | undefined;
|
|
67
|
+
} | undefined;
|
|
68
|
+
mongodb?: import("..").DeployConfigMongodb | undefined;
|
|
69
|
+
mailhog?: {
|
|
70
|
+
enabled: boolean;
|
|
71
|
+
} | undefined;
|
|
72
|
+
jobs?: Record<string, {
|
|
73
|
+
command: string;
|
|
74
|
+
hook?: string | undefined;
|
|
75
|
+
} & Record<string, unknown>> | undefined;
|
|
76
|
+
cronjobs?: Record<string, {
|
|
77
|
+
schedule: string;
|
|
78
|
+
command: string;
|
|
79
|
+
concurrencyPolicy?: "Forbid" | "Allow" | "Replace" | undefined;
|
|
80
|
+
} & Record<string, unknown>> | undefined;
|
|
81
|
+
application?: ({
|
|
82
|
+
redirects?: ({
|
|
83
|
+
host: string;
|
|
84
|
+
} & Record<string, unknown>)[] | undefined;
|
|
85
|
+
hostAliases?: string[] | undefined;
|
|
86
|
+
replicas?: number | undefined;
|
|
87
|
+
autoscale?: import("..").KubernetesAutoscale | undefined;
|
|
88
|
+
updateStrategy?: import("..").KubernetesUpdateStrategy | undefined;
|
|
89
|
+
resources?: import("..").KubernetesResourcesDef | undefined;
|
|
90
|
+
healthRoute?: string | undefined;
|
|
91
|
+
startupProbe?: {
|
|
92
|
+
httpGet?: {
|
|
93
|
+
path?: string | undefined;
|
|
94
|
+
port?: number | undefined;
|
|
95
|
+
httpHeaders?: {
|
|
96
|
+
name: string;
|
|
97
|
+
value: string;
|
|
98
|
+
}[] | undefined;
|
|
99
|
+
failureThreshold?: number | undefined;
|
|
100
|
+
timeoutSeconds?: number | undefined;
|
|
101
|
+
periodSeconds?: number | undefined;
|
|
102
|
+
successThreshold?: number | undefined;
|
|
103
|
+
} | undefined;
|
|
104
|
+
} | undefined;
|
|
105
|
+
readinessProbe?: {
|
|
106
|
+
httpGet?: {
|
|
107
|
+
path?: string | undefined;
|
|
108
|
+
port?: number | undefined;
|
|
109
|
+
httpHeaders?: {
|
|
110
|
+
name: string;
|
|
111
|
+
value: string;
|
|
112
|
+
}[] | undefined;
|
|
113
|
+
failureThreshold?: number | undefined;
|
|
114
|
+
timeoutSeconds?: number | undefined;
|
|
115
|
+
periodSeconds?: number | undefined;
|
|
116
|
+
successThreshold?: number | undefined;
|
|
117
|
+
} | undefined;
|
|
118
|
+
} | undefined;
|
|
119
|
+
livenessProbe?: {
|
|
120
|
+
httpGet?: {
|
|
121
|
+
path?: string | undefined;
|
|
122
|
+
port?: number | undefined;
|
|
123
|
+
httpHeaders?: {
|
|
124
|
+
name: string;
|
|
125
|
+
value: string;
|
|
126
|
+
}[] | undefined;
|
|
127
|
+
failureThreshold?: number | undefined;
|
|
128
|
+
timeoutSeconds?: number | undefined;
|
|
129
|
+
periodSeconds?: number | undefined;
|
|
130
|
+
successThreshold?: number | undefined;
|
|
131
|
+
} | undefined;
|
|
132
|
+
} | undefined;
|
|
133
|
+
worker?: import("..").KubernetesWorkerDef | undefined;
|
|
134
|
+
} & Record<string, unknown>) | undefined;
|
|
135
|
+
secretsAsFile?: string[] | undefined;
|
|
136
|
+
} & Record<string, unknown>);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.createKubeValues = void 0;
|
|
5
|
+
|
|
6
|
+
var lodash_1 = require("lodash");
|
|
7
|
+
|
|
8
|
+
var utils_1 = require("../../utils");
|
|
9
|
+
|
|
10
|
+
var types_1 = require("../types");
|
|
11
|
+
|
|
12
|
+
var cloudsql_1 = require("./cloudsql");
|
|
13
|
+
|
|
14
|
+
var kubeEnv_1 = require("./kubeEnv");
|
|
15
|
+
|
|
16
|
+
var mongodb_1 = require("./mongodb");
|
|
17
|
+
|
|
18
|
+
var processSecretsAsFiles_1 = require("./processSecretsAsFiles");
|
|
19
|
+
|
|
20
|
+
var createKubeValues = function (context) {
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
22
|
+
|
|
23
|
+
var deployConfig = context.componentConfig.deploy;
|
|
24
|
+
|
|
25
|
+
if (deployConfig === false) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
30
|
+
// should not happen
|
|
31
|
+
throw new Error("deploy config is not kubernetes");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var env = (0, kubeEnv_1.createKubeEnv)(context);
|
|
35
|
+
var defaultAppConfig = {
|
|
36
|
+
host: context.environment.host,
|
|
37
|
+
command: context.componentConfig.build.startCommand,
|
|
38
|
+
livenessProbe: {
|
|
39
|
+
httpGet: {
|
|
40
|
+
path: (_c = (_b = (_a = deployConfig.values) === null || _a === void 0 ? void 0 : _a.application) === null || _b === void 0 ? void 0 : _b.healthRoute) !== null && _c !== void 0 ? _c : "__health"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
readinessProbe: {
|
|
44
|
+
httpGet: {
|
|
45
|
+
path: (_f = (_e = (_d = deployConfig.values) === null || _d === void 0 ? void 0 : _d.application) === null || _e === void 0 ? void 0 : _e.healthRoute) !== null && _f !== void 0 ? _f : "__health"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
startupProbe: {
|
|
49
|
+
httpGet: {
|
|
50
|
+
path: (_j = (_h = (_g = deployConfig.values) === null || _g === void 0 ? void 0 : _g.application) === null || _h === void 0 ? void 0 : _h.healthRoute) !== null && _j !== void 0 ? _j : "__health"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var defaultKubeValues = (0, lodash_1.merge)({
|
|
55
|
+
application: defaultAppConfig,
|
|
56
|
+
env: env
|
|
57
|
+
}, ((_l = (_k = deployConfig.values) === null || _k === void 0 ? void 0 : _k.cloudsql) === null || _l === void 0 ? void 0 : _l.enabled) ? (0, cloudsql_1.createCloudsqlBaseConfig)(context) : {}, ((_o = (_m = deployConfig.values) === null || _m === void 0 ? void 0 : _m.mongodb) === null || _o === void 0 ? void 0 : _o.enabled) ? (0, mongodb_1.createMongodbBaseConfig)(context) : {});
|
|
58
|
+
var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, deployConfig.values));
|
|
59
|
+
return kubeValues;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
exports.createKubeValues = createKubeValues;
|
|
@@ -2,14 +2,27 @@ import { Context } from "../..";
|
|
|
2
2
|
export declare const createMongodbBaseConfig: (context: Context) => {
|
|
3
3
|
mongodb: {
|
|
4
4
|
enabled: boolean;
|
|
5
|
+
auth: {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
rootPassword: string;
|
|
8
|
+
replicaSetKey: string;
|
|
9
|
+
};
|
|
10
|
+
persistence: {
|
|
11
|
+
storageClass: string;
|
|
12
|
+
};
|
|
5
13
|
backup: {
|
|
6
14
|
enabled: boolean;
|
|
15
|
+
hostToBackup: string;
|
|
16
|
+
pvcToBackup: string;
|
|
17
|
+
image: string;
|
|
18
|
+
schedule: string;
|
|
19
|
+
volumeSnapshotClass: string;
|
|
7
20
|
};
|
|
8
21
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
env: {
|
|
23
|
+
secret: {
|
|
24
|
+
MONGO_OPLOG_URL?: string | undefined;
|
|
25
|
+
MONGO_URL: string;
|
|
13
26
|
};
|
|
14
27
|
};
|
|
15
28
|
};
|