pmcf 6.40.4 → 6.40.6
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 +21 -21
- package/package.json +2 -2
- package/src/cluster.mjs +27 -19
package/README.md
CHANGED
|
@@ -82,29 +82,29 @@ generates config packages for:
|
|
|
82
82
|
* [domainNames](#domainnames)
|
|
83
83
|
* [InitializationContext](#initializationcontext)
|
|
84
84
|
* [Parameters](#parameters-14)
|
|
85
|
-
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
86
|
-
* [networkAddresses](#networkaddresses)
|
|
87
|
-
* [Parameters](#parameters-15)
|
|
88
85
|
* [zones](#zones)
|
|
89
86
|
* [addressesStatement](#addressesstatement)
|
|
90
|
-
* [Parameters](#parameters-
|
|
87
|
+
* [Parameters](#parameters-15)
|
|
91
88
|
* [SystemdJournalRemoteService](#systemdjournalremoteservice)
|
|
92
89
|
* [Properties](#properties)
|
|
93
90
|
* [systemdConfigs](#systemdconfigs)
|
|
94
|
-
* [Parameters](#parameters-
|
|
91
|
+
* [Parameters](#parameters-16)
|
|
95
92
|
* [SystemdJournalUploadService](#systemdjournaluploadservice)
|
|
96
93
|
* [Properties](#properties-1)
|
|
97
94
|
* [systemdConfigs](#systemdconfigs-1)
|
|
98
|
-
* [Parameters](#parameters-
|
|
95
|
+
* [Parameters](#parameters-17)
|
|
99
96
|
* [NetworkAddress](#networkaddress)
|
|
100
|
-
* [Parameters](#parameters-
|
|
97
|
+
* [Parameters](#parameters-18)
|
|
101
98
|
* [subnet](#subnet)
|
|
102
99
|
* [networkInterface](#networkinterface)
|
|
103
100
|
* [address](#address)
|
|
104
101
|
* [addresses](#addresses)
|
|
105
|
-
* [Parameters](#parameters-
|
|
102
|
+
* [Parameters](#parameters-19)
|
|
106
103
|
* [cidrAddresses](#cidraddresses)
|
|
107
|
-
* [Parameters](#parameters-
|
|
104
|
+
* [Parameters](#parameters-20)
|
|
105
|
+
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
106
|
+
* [networkAddresses](#networkaddresses)
|
|
107
|
+
* [Parameters](#parameters-21)
|
|
108
108
|
* [families](#families)
|
|
109
109
|
* [secretName](#secretname)
|
|
110
110
|
* [directHosts](#directhosts)
|
|
@@ -309,18 +309,6 @@ Keeps track of all in flight object creations and loose ends during config initi
|
|
|
309
309
|
|
|
310
310
|
* `directory` (optional, default `"/"`)
|
|
311
311
|
|
|
312
|
-
## SkeletonNetworkInterface
|
|
313
|
-
|
|
314
|
-
**Extends ServiceOwner**
|
|
315
|
-
|
|
316
|
-
### networkAddresses
|
|
317
|
-
|
|
318
|
-
#### Parameters
|
|
319
|
-
|
|
320
|
-
* `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
|
|
321
|
-
|
|
322
|
-
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
323
|
-
|
|
324
312
|
## zones
|
|
325
313
|
|
|
326
314
|
Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<bind\_zone>
|
|
@@ -411,6 +399,18 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
|
|
|
411
399
|
|
|
412
400
|
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** 
|
|
413
401
|
|
|
402
|
+
## SkeletonNetworkInterface
|
|
403
|
+
|
|
404
|
+
**Extends ServiceOwner**
|
|
405
|
+
|
|
406
|
+
### networkAddresses
|
|
407
|
+
|
|
408
|
+
#### Parameters
|
|
409
|
+
|
|
410
|
+
* `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
|
|
411
|
+
|
|
412
|
+
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
413
|
+
|
|
414
414
|
## families
|
|
415
415
|
|
|
416
416
|
Returns **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** 
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "6.40.
|
|
3
|
+
"version": "6.40.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"yaml": "^2.9.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@types/node": "^26.4.
|
|
62
|
+
"@types/node": "^26.4.1",
|
|
63
63
|
"ava": "^8.0.1",
|
|
64
64
|
"c8": "^12.0.0",
|
|
65
65
|
"documentation": "^14.0.3",
|
package/src/cluster.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { FileContentProvider } from "npm-pkgbuild";
|
|
3
3
|
import { FAMILY_IPV4 } from "ip-utilties";
|
|
4
|
-
import {
|
|
4
|
+
import { duration_attribute_writable } from "pacc";
|
|
5
5
|
import { Host } from "./host.mjs";
|
|
6
6
|
import { addType, serviceEndpoints } from "pmcf";
|
|
7
7
|
import {
|
|
@@ -14,7 +14,6 @@ export class Cluster extends Host {
|
|
|
14
14
|
static name = "cluster";
|
|
15
15
|
static priority = 1.5;
|
|
16
16
|
static attributes = {
|
|
17
|
-
routerId: { ...number_attribute_writable, name: "routerId", default: 100 },
|
|
18
17
|
masters: {
|
|
19
18
|
...networkInterfaces_attribute,
|
|
20
19
|
name: "masters",
|
|
@@ -45,9 +44,8 @@ export class Cluster extends Host {
|
|
|
45
44
|
routerId = 100;
|
|
46
45
|
checkInterval = 60;
|
|
47
46
|
|
|
48
|
-
get content()
|
|
49
|
-
|
|
50
|
-
return this.masters.map(m=>m.host)[0]?.content;
|
|
47
|
+
get content() {
|
|
48
|
+
return this.masters.map(m => m.host)[0]?.content;
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
get members() {
|
|
@@ -60,16 +58,18 @@ export class Cluster extends Host {
|
|
|
60
58
|
new Set()
|
|
61
59
|
)) {
|
|
62
60
|
const host = ni.host;
|
|
63
|
-
const packageStagingDir = join(stagingDir, host.name);
|
|
64
|
-
const name = `${this.owner.name}-${host.name}`;
|
|
65
61
|
|
|
62
|
+
const packageStagingDir = join(stagingDir, host.name);
|
|
66
63
|
const packageData = await host.packageData;
|
|
64
|
+
|
|
67
65
|
packageData.sources.push(
|
|
68
|
-
|
|
66
|
+
await Array.fromAsync(this.templateContent()),
|
|
67
|
+
new FileContentProvider({
|
|
68
|
+
dir: packageStagingDir,
|
|
69
|
+
pattern: "**/*",
|
|
70
|
+
permissions: this.content.permissions
|
|
71
|
+
})
|
|
69
72
|
);
|
|
70
|
-
packageData.properties.name = `keepalived-${name}`;
|
|
71
|
-
packageData.properties.description = `${this.typeName} definitions for ${this.fullName}`;
|
|
72
|
-
packageData.properties.groups.push("config", name, "keepalived");
|
|
73
73
|
|
|
74
74
|
const extra = [];
|
|
75
75
|
|
|
@@ -118,7 +118,7 @@ export class Cluster extends Host {
|
|
|
118
118
|
cfg.push(" }");
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
cfg.push(` virtual_router_id ${cluster.
|
|
121
|
+
cfg.push(` virtual_router_id ${cluster.id}`);
|
|
122
122
|
|
|
123
123
|
let reducedPrio = cluster.masters.indexOf(ni);
|
|
124
124
|
if (reducedPrio < 0) {
|
|
@@ -126,7 +126,7 @@ export class Cluster extends Host {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
const credential = name.toUpperCase() + "_PASSWORD";
|
|
129
|
-
credentials.set(credential,name);
|
|
129
|
+
credentials.set(credential, name);
|
|
130
130
|
cfg.push(` priority ${host.priority - reducedPrio}`);
|
|
131
131
|
cfg.push(" smtp_alert");
|
|
132
132
|
cfg.push(" advert_int 5");
|
|
@@ -157,9 +157,15 @@ export class Cluster extends Host {
|
|
|
157
157
|
cfg.push(` protocol ${endpoint.protocol.toUpperCase()}`);
|
|
158
158
|
|
|
159
159
|
for (const member of this.members) {
|
|
160
|
-
const memberService = member.expression(
|
|
160
|
+
const memberService = member.expression(
|
|
161
|
+
`services[types[${endpoint.type}]][0]`
|
|
162
|
+
);
|
|
161
163
|
|
|
162
|
-
console.log(
|
|
164
|
+
console.log(
|
|
165
|
+
member.fullName,
|
|
166
|
+
endpoint.type,
|
|
167
|
+
memberService?.fullName
|
|
168
|
+
);
|
|
163
169
|
cfg.push(` real_server ${member.address} ${memberService.port} {`);
|
|
164
170
|
cfg.push(` weight ${memberService.weight}`);
|
|
165
171
|
|
|
@@ -228,10 +234,12 @@ export class Cluster extends Host {
|
|
|
228
234
|
"credentials.conf",
|
|
229
235
|
[
|
|
230
236
|
"[Service]",
|
|
231
|
-
...credentials
|
|
232
|
-
(
|
|
233
|
-
|
|
234
|
-
|
|
237
|
+
...credentials
|
|
238
|
+
.entries()
|
|
239
|
+
.map(
|
|
240
|
+
([credName, instance]) =>
|
|
241
|
+
`LoadCredentialEncrypted=${credName}:/etc/credstore.encrypted/keepalived.${instance}.password`
|
|
242
|
+
)
|
|
235
243
|
]
|
|
236
244
|
);
|
|
237
245
|
}
|