pmcf 1.59.10 → 1.59.12
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 +41 -35
- package/src/owner.mjs +3 -2
- package/types/base.d.mts +1 -1
- package/types/cluster.d.mts +2 -2
- package/types/owner.d.mts +1 -1
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -343,8 +343,8 @@ export class Base {
|
|
|
343
343
|
|
|
344
344
|
async *preparePackages(stagingDir) {
|
|
345
345
|
yield {
|
|
346
|
-
outputs: this.outputs,
|
|
347
346
|
sources: [],
|
|
347
|
+
outputs: this.outputs,
|
|
348
348
|
properties: {
|
|
349
349
|
description: `${this.typeName} definitions for ${this.fullName}`,
|
|
350
350
|
access: "private"
|
package/src/cluster.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { FileContentProvider } from "npm-pkgbuild";
|
|
3
3
|
import { Owner } from "./owner.mjs";
|
|
4
|
+
import { Host } from "./host.mjs";
|
|
4
5
|
import { addType } from "./types.mjs";
|
|
5
6
|
import { writeLines } from "./utils.mjs";
|
|
6
7
|
|
|
@@ -15,7 +16,7 @@ const ClusterTypeDefinition = {
|
|
|
15
16
|
}
|
|
16
17
|
};
|
|
17
18
|
|
|
18
|
-
export class Cluster extends
|
|
19
|
+
export class Cluster extends Host {
|
|
19
20
|
#masters = new Set();
|
|
20
21
|
#backups = new Set();
|
|
21
22
|
|
|
@@ -49,44 +50,49 @@ export class Cluster extends Owner {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
async *preparePackages(stagingDir) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
" virtual_router_id 101",
|
|
61
|
-
" priority 255",
|
|
62
|
-
" advert_int 1",
|
|
63
|
-
" authentication {",
|
|
64
|
-
" auth_type PASS",
|
|
65
|
-
" auth_pass pass1234",
|
|
66
|
-
" }",
|
|
67
|
-
" virtual_ipaddress {",
|
|
68
|
-
` ${ni.rawAddress}`,
|
|
69
|
-
" }",
|
|
70
|
-
"}"
|
|
71
|
-
];
|
|
53
|
+
const result = {
|
|
54
|
+
sources: [],
|
|
55
|
+
outputs: this.outputs,
|
|
56
|
+
properties: {
|
|
57
|
+
description: `${this.typeName} definitions for ${this.fullName}`,
|
|
58
|
+
access: "private"
|
|
59
|
+
}
|
|
60
|
+
};
|
|
72
61
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
for (const ni of this.masters.union(this.backups)) {
|
|
63
|
+
const name = `${this.typeName}-${this.owner.name}-${this.name}-${ni.host.name}`;
|
|
64
|
+
const packageStagingDir = join(stagingDir, name);
|
|
65
|
+
const cfg = [
|
|
66
|
+
`vrrp_instance ${this.name} {`,
|
|
67
|
+
` state ${this.masters.has(ni) ? "MASTER" : "BACKUP"}`,
|
|
68
|
+
` interface ${ni.name}`,
|
|
69
|
+
" virtual_router_id 101",
|
|
70
|
+
" priority 255",
|
|
71
|
+
" advert_int 1",
|
|
72
|
+
" authentication {",
|
|
73
|
+
" auth_type PASS",
|
|
74
|
+
" auth_pass pass1234",
|
|
75
|
+
" }",
|
|
76
|
+
" virtual_ipaddress {",
|
|
77
|
+
` ${this.rawAddress}`,
|
|
78
|
+
" }",
|
|
79
|
+
"}"
|
|
80
|
+
];
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
await writeLines(
|
|
83
|
+
join(packageStagingDir, "etc/keepalived"),
|
|
84
|
+
"keepalived.conf",
|
|
85
|
+
cfg
|
|
86
|
+
);
|
|
81
87
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Symbol.asyncIterator
|
|
85
|
-
]()
|
|
86
|
-
);
|
|
88
|
+
result.properties.name = name;
|
|
89
|
+
result.properties.dependencies = ["keepalived"];
|
|
87
90
|
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
result.sources.push(
|
|
92
|
+
new FileContentProvider(packageStagingDir + "/")[Symbol.asyncIterator]()
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
yield result;
|
|
90
96
|
}
|
|
91
97
|
}
|
|
92
98
|
}
|
package/src/owner.mjs
CHANGED
|
@@ -146,8 +146,9 @@ export class Owner extends Base {
|
|
|
146
146
|
return this.typeNamed("host", name);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
hosts() {
|
|
150
|
-
|
|
149
|
+
* hosts() {
|
|
150
|
+
yield * this.typeList("host");
|
|
151
|
+
yield * this.typeList("cluster");
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
networkNamed(name) {
|
package/types/base.d.mts
CHANGED
|
@@ -72,8 +72,8 @@ export class Base {
|
|
|
72
72
|
get derivedPackaging(): any;
|
|
73
73
|
get outputs(): Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
|
|
74
74
|
preparePackages(stagingDir: any): AsyncGenerator<{
|
|
75
|
-
outputs: Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
|
|
76
75
|
sources: any[];
|
|
76
|
+
outputs: Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
|
|
77
77
|
properties: {
|
|
78
78
|
description: string;
|
|
79
79
|
access: string;
|
package/types/cluster.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class Cluster extends
|
|
1
|
+
export class Cluster extends Host {
|
|
2
2
|
static get typeDefinition(): {
|
|
3
3
|
name: string;
|
|
4
4
|
owners: (string | {
|
|
@@ -377,4 +377,4 @@ export class Cluster extends Owner {
|
|
|
377
377
|
get backups(): Set<any>;
|
|
378
378
|
#private;
|
|
379
379
|
}
|
|
380
|
-
import {
|
|
380
|
+
import { Host } from "./host.mjs";
|
package/types/owner.d.mts
CHANGED
|
@@ -188,7 +188,7 @@ export class Owner extends Base {
|
|
|
188
188
|
locationNamed(name: any): any;
|
|
189
189
|
locations(): any;
|
|
190
190
|
hostNamed(name: any): any;
|
|
191
|
-
hosts(): any
|
|
191
|
+
hosts(): Generator<any, void, any>;
|
|
192
192
|
networkNamed(name: any): any;
|
|
193
193
|
networks(): any;
|
|
194
194
|
subnetNamed(name: any): any;
|