@oondemand/oon-core-back 0.7.19 → 0.7.20
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/delivery/runtime.js +23 -3
package/package.json
CHANGED
package/src/delivery/runtime.js
CHANGED
|
@@ -280,6 +280,27 @@ spec:
|
|
|
280
280
|
${customDomainIngress({ context, infra })}`;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
/**
|
|
284
|
+
* F4.6: sem domínios ativos, o Ingress dos domínios personalizados sai. O
|
|
285
|
+
* publisher não tem permissão de delete (contrato do oon-k8s-infra), então
|
|
286
|
+
* só tenta remover quando o Ingress existe; se o cluster recusar, avisa e
|
|
287
|
+
* segue, e a remoção fica para quem administra o cluster.
|
|
288
|
+
*/
|
|
289
|
+
function removeStaleCustomDomainIngress(context, run = kubectl) {
|
|
290
|
+
if (customDomains(context).length) return "domains";
|
|
291
|
+
const name = `${context.appCode}-custom`;
|
|
292
|
+
const found = run(["-n", context.namespace, "get", "ingress", name, "--ignore-not-found", "-o", "name"], { capture: true });
|
|
293
|
+
if (!found) return "absent";
|
|
294
|
+
try {
|
|
295
|
+
run(["-n", context.namespace, "delete", "ingress", name], { capture: true });
|
|
296
|
+
return "deleted";
|
|
297
|
+
} catch (error) {
|
|
298
|
+
if (!/forbidden/i.test(error.message)) throw error;
|
|
299
|
+
console.warn(`[oon-delivery] Ingress ${context.namespace}/${name} sem domínio ativo não pôde ser removido (sem permissão de delete). Remova-o manualmente.`);
|
|
300
|
+
return "kept";
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
283
304
|
function copyPullSecret(namespace, infra) {
|
|
284
305
|
const source = infra.REGISTRY_PULL_SECRET_NAME || "ghcr-oon";
|
|
285
306
|
try {
|
|
@@ -389,8 +410,7 @@ function deployRuntime({ context, infra, imageDigest, resourceProfile = "small"
|
|
|
389
410
|
copyPullSecret(context.namespace, infra);
|
|
390
411
|
const imageRef = `${context.imageRepository}@${imageDigest}`;
|
|
391
412
|
applyYaml(runtimeManifest({ context, infra, imageRef, profile: resourceProfile }));
|
|
392
|
-
|
|
393
|
-
if (!customDomains(context).length) kubectl(["-n", context.namespace, "delete", "ingress", `${context.appCode}-custom`, "--ignore-not-found"]);
|
|
413
|
+
removeStaleCustomDomainIngress(context);
|
|
394
414
|
kubectl(["-n", context.namespace, "rollout", "status", `deployment/${context.appCode}`, "--timeout=10m"]);
|
|
395
415
|
return { infraVersion: infra.INFRA_SCHEMA_VERSION, imageRef };
|
|
396
416
|
}
|
|
@@ -433,4 +453,4 @@ async function activateMember(context) {
|
|
|
433
453
|
return data;
|
|
434
454
|
}
|
|
435
455
|
|
|
436
|
-
module.exports = { supportsSecretsV1: true, RESOURCE_PROFILES, MAX_REPLICAS, replicaCount, PERFORMANCE_MODES, performanceMode, MAX_CUSTOM_DOMAINS, customDomains, namespaceQuota, randomSecret, dnsLabel, kubernetesLabelValue, provisionMongo, validateMongoUri, baselineManifest, runtimeManifest, provisionRuntime, deployRuntime, waitHttp, activateMember };
|
|
456
|
+
module.exports = { supportsSecretsV1: true, RESOURCE_PROFILES, MAX_REPLICAS, replicaCount, PERFORMANCE_MODES, performanceMode, MAX_CUSTOM_DOMAINS, customDomains, namespaceQuota, randomSecret, dnsLabel, kubernetesLabelValue, provisionMongo, validateMongoUri, baselineManifest, runtimeManifest, provisionRuntime, deployRuntime, removeStaleCustomDomainIngress, waitHttp, activateMember };
|