pmcf 6.64.1 → 6.64.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/package.json +1 -1
- package/src/cluster.mjs +14 -11
- package/src/services/keepalived.mjs +24 -24
package/package.json
CHANGED
package/src/cluster.mjs
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
duration_attribute_writable,
|
|
3
|
+
default_collection_attribute_writable
|
|
4
|
+
} from "pacc";
|
|
4
5
|
import { addType } from "./type.mjs";
|
|
5
|
-
import {
|
|
6
|
+
import { owner_attribute } from "./common-attributes.mjs";
|
|
7
|
+
import { host } from "./host.mjs";
|
|
6
8
|
|
|
7
9
|
export class cluster extends host {
|
|
8
10
|
static priority = 1.5;
|
|
9
11
|
static attributes = {
|
|
10
12
|
members: {
|
|
11
|
-
...
|
|
13
|
+
...default_collection_attribute_writable,
|
|
14
|
+
type: "core",
|
|
15
|
+
backpointer: owner_attribute,
|
|
12
16
|
name: "members"
|
|
13
17
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
checkInterval: {
|
|
19
|
+
...duration_attribute_writable,
|
|
20
|
+
name: "checkInterval",
|
|
21
|
+
default: 60
|
|
22
|
+
}
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
static {
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "pacc";
|
|
7
7
|
import { FAMILY_IPV4 } from "ip-utilties";
|
|
8
8
|
import { addType } from "../type.mjs";
|
|
9
|
+
import { PROTOCOL_TCP } from "../constants.mjs";
|
|
9
10
|
import { core } from "../core.mjs";
|
|
10
11
|
import { credential } from "../credential.mjs";
|
|
11
12
|
import { CoreService, serviceEndpoints } from "../core-service.mjs";
|
|
12
|
-
import { PROTOCOL_TCP } from "../constants.mjs";
|
|
13
13
|
|
|
14
14
|
import { writeLines } from "../utils.mjs";
|
|
15
15
|
|
|
@@ -67,39 +67,39 @@ export class keepalived extends CoreService {
|
|
|
67
67
|
addType(this);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
clusters = new
|
|
70
|
+
clusters = new Set();
|
|
71
71
|
checkInterval = 60;
|
|
72
72
|
|
|
73
73
|
async *preparePackages(dir) {
|
|
74
74
|
const packageData = await this.preparePackage(dir);
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
const cluster = clusterMember.cluster;
|
|
78
|
-
const host = cluster.host;
|
|
79
|
-
|
|
80
|
-
const extra = [];
|
|
76
|
+
const extra = [];
|
|
81
77
|
|
|
82
|
-
|
|
78
|
+
const smtp = this.smtp;
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
if (smtp) {
|
|
81
|
+
extra.push(` smtp_server ${smtp.address()}`);
|
|
82
|
+
}
|
|
87
83
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
84
|
+
const cfg = [
|
|
85
|
+
"global_defs {",
|
|
86
|
+
" notification_email {",
|
|
87
|
+
" " + this.administratorEmail,
|
|
88
|
+
" }",
|
|
89
|
+
...extra,
|
|
90
|
+
` notification_email_from keepalived@${this.domainName}`,
|
|
91
|
+
" enable_script_security",
|
|
92
|
+
" script_user root",
|
|
93
|
+
" max_auto_priority 20",
|
|
94
|
+
"}",
|
|
95
|
+
""
|
|
96
|
+
];
|
|
101
97
|
|
|
98
|
+
for (const clusterMember of this.clusters.values()) {
|
|
99
|
+
const cluster = clusterMember.cluster;
|
|
100
|
+
const host = cluster.host;
|
|
102
101
|
const clusterName = cluster.name;
|
|
102
|
+
|
|
103
103
|
cfg.push(`vrrp_instance ${clusterName} {`);
|
|
104
104
|
cfg.push(` state ${clusterMember.role.toUpperCase()}`);
|
|
105
105
|
|