pmcf 1.64.2 → 1.64.4
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/package.json +1 -1
- package/src/base.mjs +1 -1
- package/src/cluster.mjs +21 -10
- package/src/host.mjs +11 -8
- package/src/service.mjs +8 -1
package/package.json
CHANGED
package/src/base.mjs
CHANGED
package/src/cluster.mjs
CHANGED
|
@@ -75,9 +75,15 @@ export class Cluster extends Host {
|
|
|
75
75
|
const name = `keepalived-${host.name}`;
|
|
76
76
|
const packageStagingDir = join(stagingDir, name);
|
|
77
77
|
|
|
78
|
-
const cfg = [
|
|
78
|
+
const cfg = [
|
|
79
|
+
"global_defs {",
|
|
80
|
+
" notification_email {",
|
|
81
|
+
" " + this.administratorEmail,
|
|
82
|
+
" }",
|
|
79
83
|
" smtp_server 192.168.1.1",
|
|
80
|
-
|
|
84
|
+
` notification_email_from keepalived@${host.domainName}`,
|
|
85
|
+
"}"
|
|
86
|
+
];
|
|
81
87
|
|
|
82
88
|
for (const cluster of [...this.owner.clusters()].sort((a, b) =>
|
|
83
89
|
a.name.localeCompare(b.name)
|
|
@@ -101,7 +107,6 @@ export class Cluster extends Host {
|
|
|
101
107
|
cfg.push("");
|
|
102
108
|
|
|
103
109
|
for (const service of cluster.findServices({ type: "http" })) {
|
|
104
|
-
console.log("S", service.host.name, service.name);
|
|
105
110
|
cfg.push(`virtual_server ${cluster.rawAddress} ${service.port} {`);
|
|
106
111
|
cfg.push(" delay_loop 6");
|
|
107
112
|
cfg.push(" lb_algo wlc");
|
|
@@ -109,13 +114,19 @@ export class Cluster extends Host {
|
|
|
109
114
|
cfg.push(` protocol ${service.protocol.toUpperCase()}`);
|
|
110
115
|
|
|
111
116
|
for (const member of this.members) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
const memberService = member.findService({ type: service.type });
|
|
118
|
+
|
|
119
|
+
cfg.push(
|
|
120
|
+
` real_server ${member.rawAddress} ${memberService.port} {`
|
|
121
|
+
);
|
|
122
|
+
cfg.push(` weight ${memberService.weight}`);
|
|
123
|
+
|
|
124
|
+
switch (service.protocol) {
|
|
125
|
+
case "tcp":
|
|
126
|
+
cfg.push(` TCP_CHECK {`);
|
|
127
|
+
cfg.push(" connect_timeout 3");
|
|
128
|
+
cfg.push(" }");
|
|
129
|
+
break;
|
|
119
130
|
}
|
|
120
131
|
|
|
121
132
|
cfg.push(" }");
|
package/src/host.mjs
CHANGED
|
@@ -263,15 +263,18 @@ export class Host extends Base {
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
*findServices(filter) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
266
|
+
if (filter) {
|
|
267
|
+
for (const service of this.#services) {
|
|
268
|
+
if (
|
|
269
|
+
filter.type === "*" ||
|
|
270
|
+
filter.type === service.type ||
|
|
271
|
+
filter.name === service.name
|
|
272
|
+
) {
|
|
273
|
+
yield service;
|
|
274
|
+
}
|
|
274
275
|
}
|
|
276
|
+
} else {
|
|
277
|
+
yield* this.#services;
|
|
275
278
|
}
|
|
276
279
|
}
|
|
277
280
|
|
package/src/service.mjs
CHANGED
|
@@ -131,7 +131,14 @@ export class Service extends Base {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
get weight() {
|
|
134
|
-
|
|
134
|
+
if (this.#weight !== undefined) {
|
|
135
|
+
return this.#weight;
|
|
136
|
+
}
|
|
137
|
+
if (this.owner.weight !== undefined) {
|
|
138
|
+
return this.owner.weight;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return 1;
|
|
135
142
|
}
|
|
136
143
|
|
|
137
144
|
set type(value) {
|