pmcf 1.59.12 → 1.59.13
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/cluster.mjs +30 -18
package/package.json
CHANGED
package/src/cluster.mjs
CHANGED
|
@@ -50,6 +50,7 @@ export class Cluster extends Host {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
async *preparePackages(stagingDir) {
|
|
53
|
+
|
|
53
54
|
const result = {
|
|
54
55
|
sources: [],
|
|
55
56
|
outputs: this.outputs,
|
|
@@ -58,26 +59,36 @@ export class Cluster extends Host {
|
|
|
58
59
|
access: "private"
|
|
59
60
|
}
|
|
60
61
|
};
|
|
62
|
+
|
|
63
|
+
let interfaces = new Set();
|
|
61
64
|
|
|
62
|
-
for
|
|
63
|
-
|
|
65
|
+
for(const cluster of this.owner.clusters()) {
|
|
66
|
+
interfaces = interfaces.union(cluster.masters.union(cluster.backups));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
for (const ni of interfaces) {
|
|
70
|
+
const name = `keepalived-${ni.host.name}`;
|
|
64
71
|
const packageStagingDir = join(stagingDir, name);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
|
|
72
|
+
|
|
73
|
+
const cfg = [];
|
|
74
|
+
|
|
75
|
+
for(const cluster of this.owner.clusters()) {
|
|
76
|
+
cfg.push(`vrrp_instance ${cluster.name} {`);
|
|
77
|
+
cfg.push(` state ${cluster.masters.has(ni) ? "MASTER" : "BACKUP"}`);
|
|
78
|
+
cfg.push(` interface ${ni.name}`,);
|
|
79
|
+
cfg.push(" virtual_ipaddress {");
|
|
80
|
+
cfg.push(` ${cluster.rawAddress}`);
|
|
81
|
+
cfg.push(" }");
|
|
82
|
+
cfg.push(" virtual_router_id 101");
|
|
83
|
+
cfg.push(" priority 255");
|
|
84
|
+
cfg.push(" advert_int 1");
|
|
85
|
+
cfg.push(" authentication {");
|
|
86
|
+
cfg.push(" auth_type PASS");
|
|
87
|
+
cfg.push(" auth_pass pass1234");
|
|
88
|
+
cfg.push(" }");
|
|
89
|
+
cfg.push("}");
|
|
90
|
+
cfg.push("");
|
|
91
|
+
}
|
|
81
92
|
|
|
82
93
|
await writeLines(
|
|
83
94
|
join(packageStagingDir, "etc/keepalived"),
|
|
@@ -87,6 +98,7 @@ export class Cluster extends Host {
|
|
|
87
98
|
|
|
88
99
|
result.properties.name = name;
|
|
89
100
|
result.properties.dependencies = ["keepalived"];
|
|
101
|
+
result.properties.replaces = [`${this.typeName}-${this.owner.name}-${this.name}-${ni.host.name}`];
|
|
90
102
|
|
|
91
103
|
result.sources.push(
|
|
92
104
|
new FileContentProvider(packageStagingDir + "/")[Symbol.asyncIterator]()
|