pmcf 6.66.6 → 6.66.8
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 +2 -2
- package/src/core-service.mjs +11 -9
- package/src/endpoint.mjs +18 -11
- package/src/service-types.mjs +6 -5
- package/src/services/influxdb.mjs +3 -3
- package/src/services/kea.mjs +2 -2
- package/src/services/keepalived.mjs +16 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "6.66.
|
|
3
|
+
"version": "6.66.8",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"aggregated-map": "^1.0.11",
|
|
54
|
-
"content-entry-transform": "^1.7.
|
|
54
|
+
"content-entry-transform": "^1.7.10",
|
|
55
55
|
"filtered-map": "^1.0.0",
|
|
56
56
|
"ip-utilties": "^3.13.1",
|
|
57
57
|
"npm-pkgbuild": "^22.2.9",
|
package/src/core-service.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
host,
|
|
18
18
|
Endpoint,
|
|
19
19
|
DomainNameEndpoint,
|
|
20
|
-
|
|
20
|
+
url_endpoint,
|
|
21
21
|
unix_endpoint
|
|
22
22
|
} from "pmcf";
|
|
23
23
|
import { addType } from "./type.mjs";
|
|
@@ -127,7 +127,7 @@ export class CoreService extends base {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
get url() {
|
|
130
|
-
return this.
|
|
130
|
+
return this.endpoints().find(e => e.url)?.url;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
get serviceTypeEndpoints() {
|
|
@@ -166,15 +166,17 @@ export class CoreService extends base {
|
|
|
166
166
|
delete options.kind;
|
|
167
167
|
|
|
168
168
|
for (const na of this.host.networkAddresses()) {
|
|
169
|
-
if (
|
|
170
|
-
(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
if (e.family !== FAMILY_DNS) {
|
|
170
|
+
if (
|
|
171
|
+
(e.family && e.family !== na.family) ||
|
|
172
|
+
(e.kind && e.kind !== na.networkInterface.kind)
|
|
173
|
+
) {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
174
176
|
}
|
|
175
177
|
|
|
176
178
|
if (e.scheme || e.pathname) {
|
|
177
|
-
const he = new
|
|
179
|
+
const he = new url_endpoint(this, na, options);
|
|
178
180
|
if (!seen.has(he.url.toString())) {
|
|
179
181
|
seen.add(he.url.toString());
|
|
180
182
|
result.push(he);
|
|
@@ -332,7 +334,7 @@ export class CoreService extends base {
|
|
|
332
334
|
}
|
|
333
335
|
}
|
|
334
336
|
|
|
335
|
-
for(const st of this.types) {
|
|
337
|
+
for (const st of this.types) {
|
|
336
338
|
const dnsRecord = ServiceTypes[st]?.dnsRecord;
|
|
337
339
|
if (dnsRecord) {
|
|
338
340
|
let parameters = dnsRecord.parameters;
|
package/src/endpoint.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getAttribute, string_attribute, url_attribute } from "pacc";
|
|
2
|
-
import { FAMILY_IPV6 } from "ip-utilties";
|
|
2
|
+
import { FAMILY_IPV6, FAMILY_IPV4 } from "ip-utilties";
|
|
3
3
|
import { addType } from "./type.mjs";
|
|
4
4
|
import { CoreService } from "./core-service.mjs";
|
|
5
5
|
import { family_attribute, endpointAttributes } from "./common-attributes.mjs";
|
|
@@ -171,8 +171,7 @@ export class DomainNameEndpoint extends PortEndpoint {
|
|
|
171
171
|
/**
|
|
172
172
|
* Endpoint based on url
|
|
173
173
|
*/
|
|
174
|
-
export class
|
|
175
|
-
static name = "url_endpoint";
|
|
174
|
+
export class url_endpoint extends BaseEndpoint {
|
|
176
175
|
static attributes = {
|
|
177
176
|
url: url_attribute,
|
|
178
177
|
addressType: { ...string_attribute, name: "addressType" }
|
|
@@ -205,17 +204,25 @@ export class HTTPEndpoint extends BaseEndpoint {
|
|
|
205
204
|
|
|
206
205
|
const scheme = data.scheme ? data.scheme : data.tls ? "https" : "http";
|
|
207
206
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
207
|
+
let hostname;
|
|
208
|
+
|
|
209
|
+
switch (this.family) {
|
|
210
|
+
case FAMILY_DNS:
|
|
211
|
+
hostname = [...address.domainNames][0];
|
|
212
|
+
this.hostname = hostname;
|
|
213
|
+
break;
|
|
214
|
+
case FAMILY_IPV4:
|
|
215
|
+
hostname = address.address;
|
|
216
|
+
this.hostname = address.address;
|
|
217
|
+
break;
|
|
218
|
+
case FAMILY_IPV6:
|
|
219
|
+
hostname = "[" + address.address + "]";
|
|
220
|
+
this.hostname = address.address;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
215
223
|
this.url = new URL(
|
|
216
224
|
`${scheme}://${hostname}:${data.port}` + (data.pathname ?? "/")
|
|
217
225
|
);
|
|
218
|
-
this.hostname = domainName ?? address.address;
|
|
219
226
|
}
|
|
220
227
|
}
|
|
221
228
|
|
package/src/service-types.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { FAMILY_IPV6 } from "ip-utilties";
|
|
|
3
3
|
import {
|
|
4
4
|
FAMILY_UNIX,
|
|
5
5
|
FAMILY_IPV4_IPV6,
|
|
6
|
+
FAMILY_DNS_IPV4_IPV6,
|
|
6
7
|
PROTOCOL_UDP,
|
|
7
8
|
PROTOCOL_TCP
|
|
8
9
|
} from "./constants.mjs";
|
|
@@ -103,7 +104,7 @@ export const ServiceTypes = {
|
|
|
103
104
|
ldap: {
|
|
104
105
|
endpoints: [
|
|
105
106
|
{
|
|
106
|
-
family:
|
|
107
|
+
family: FAMILY_DNS_IPV4_IPV6,
|
|
107
108
|
scheme: "ldap",
|
|
108
109
|
protocol: PROTOCOL_TCP,
|
|
109
110
|
port: 389,
|
|
@@ -114,7 +115,7 @@ export const ServiceTypes = {
|
|
|
114
115
|
ldaps: {
|
|
115
116
|
endpoints: [
|
|
116
117
|
{
|
|
117
|
-
family:
|
|
118
|
+
family: FAMILY_DNS_IPV4_IPV6,
|
|
118
119
|
scheme: "ldaps",
|
|
119
120
|
protocol: PROTOCOL_TCP,
|
|
120
121
|
port: 636,
|
|
@@ -128,7 +129,7 @@ export const ServiceTypes = {
|
|
|
128
129
|
http: {
|
|
129
130
|
endpoints: [
|
|
130
131
|
{
|
|
131
|
-
family:
|
|
132
|
+
family: FAMILY_DNS_IPV4_IPV6,
|
|
132
133
|
scheme: "http",
|
|
133
134
|
protocol: PROTOCOL_TCP,
|
|
134
135
|
port: 80,
|
|
@@ -139,7 +140,7 @@ export const ServiceTypes = {
|
|
|
139
140
|
https: {
|
|
140
141
|
endpoints: [
|
|
141
142
|
{
|
|
142
|
-
family:
|
|
143
|
+
family: FAMILY_DNS_IPV4_IPV6,
|
|
143
144
|
scheme: "https",
|
|
144
145
|
protocol: PROTOCOL_TCP,
|
|
145
146
|
port: 443,
|
|
@@ -151,7 +152,7 @@ export const ServiceTypes = {
|
|
|
151
152
|
http3: {
|
|
152
153
|
endpoints: [
|
|
153
154
|
{
|
|
154
|
-
family:
|
|
155
|
+
family: FAMILY_DNS_IPV4_IPV6,
|
|
155
156
|
scheme: "https",
|
|
156
157
|
protocol: PROTOCOL_UDP,
|
|
157
158
|
port: 443,
|
|
@@ -3,7 +3,7 @@ import { stringify } from "yaml";
|
|
|
3
3
|
import { boolean_attribute_writable_true } from "pacc";
|
|
4
4
|
import { CoreService, addType } from "pmcf";
|
|
5
5
|
import { writeLines, filterConfigurable } from "../utils.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { FAMILY_DNS_IPV4_IPV6, PROTOCOL_TCP } from "../constants.mjs";
|
|
7
7
|
|
|
8
8
|
export class influxdb extends CoreService {
|
|
9
9
|
static attributes = {
|
|
@@ -17,11 +17,11 @@ export class influxdb extends CoreService {
|
|
|
17
17
|
static service = {
|
|
18
18
|
endpoints: [
|
|
19
19
|
{
|
|
20
|
-
family:
|
|
20
|
+
family: FAMILY_DNS_IPV4_IPV6,
|
|
21
21
|
port: 8086,
|
|
22
22
|
protocol: PROTOCOL_TCP,
|
|
23
23
|
tls: false,
|
|
24
|
-
|
|
24
|
+
scheme: "http"
|
|
25
25
|
}
|
|
26
26
|
]
|
|
27
27
|
};
|
package/src/services/kea.mjs
CHANGED
|
@@ -136,8 +136,8 @@ export class kea extends CoreService {
|
|
|
136
136
|
{
|
|
137
137
|
family: FAMILY_IPV4,
|
|
138
138
|
port: 53003,
|
|
139
|
-
pathname: "/",
|
|
140
139
|
protocol: PROTOCOL_TCP,
|
|
140
|
+
scheme: "http",
|
|
141
141
|
tls: false
|
|
142
142
|
}
|
|
143
143
|
]
|
|
@@ -165,8 +165,8 @@ export class kea extends CoreService {
|
|
|
165
165
|
{
|
|
166
166
|
family: FAMILY_IPV6,
|
|
167
167
|
port: 53004,
|
|
168
|
-
pathname: "/",
|
|
169
168
|
protocol: PROTOCOL_TCP,
|
|
169
|
+
scheme: "http",
|
|
170
170
|
tls: false
|
|
171
171
|
}
|
|
172
172
|
]
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
enum_string_attribute_writable,
|
|
6
6
|
priority_attribute_writable
|
|
7
7
|
} from "pacc";
|
|
8
|
-
import { FAMILY_IPV4 } from "ip-utilties";
|
|
8
|
+
import { FAMILY_IPV4, FAMILY_IPV6 } from "ip-utilties";
|
|
9
9
|
import { addType } from "../type.mjs";
|
|
10
10
|
import { PROTOCOL_TCP } from "../constants.mjs";
|
|
11
11
|
import { core } from "../core.mjs";
|
|
@@ -125,14 +125,18 @@ export class keepalived extends CoreService {
|
|
|
125
125
|
|
|
126
126
|
cfg.push(` interface ${ni.name}`);
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
function vip(slot, family) {
|
|
129
|
+
cfg.push(` ${slot} {`);
|
|
130
|
+
for (const na of cluster.networkAddresses(
|
|
131
|
+
na => na.networkInterface.kind !== "loopback" && na.family === family
|
|
132
|
+
)) {
|
|
133
|
+
cfg.push(` ${na.cidrAddress} dev ${ni.name} label ${clusterName}`);
|
|
134
|
+
}
|
|
135
|
+
cfg.push(" }");
|
|
134
136
|
}
|
|
135
|
-
|
|
137
|
+
|
|
138
|
+
vip("virtual_ipaddress", FAMILY_IPV4);
|
|
139
|
+
vip("virtual_ipaddress_excluded", FAMILY_IPV6);
|
|
136
140
|
|
|
137
141
|
cfg.push(` virtual_router_id ${cluster.id}`);
|
|
138
142
|
|
|
@@ -220,7 +224,10 @@ export class keepalived extends CoreService {
|
|
|
220
224
|
"[Unit]",
|
|
221
225
|
`Description=${state} state of cluster ${clusterName}`,
|
|
222
226
|
"PartOf=keepalived.service",
|
|
223
|
-
`Conflicts=${states
|
|
227
|
+
`Conflicts=${states
|
|
228
|
+
.filter(s => s !== state)
|
|
229
|
+
.map(other => `${clusterName}-${other}.target`)
|
|
230
|
+
.join(" ")}`
|
|
224
231
|
]
|
|
225
232
|
);
|
|
226
233
|
}
|