sync dari sicabe-doc/deploy @ 733df6c
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
version: 1
|
||||
cluster:
|
||||
name: sicabe-bpkp
|
||||
env: production
|
||||
|
||||
tls:
|
||||
mode: none
|
||||
|
||||
preset: a3
|
||||
|
||||
hosts:
|
||||
control:
|
||||
address: 10.10.20.173
|
||||
tiers: [identity, policy, pipeline, governance]
|
||||
compute:
|
||||
address: 10.10.20.175
|
||||
tiers: [coord, engine]
|
||||
state:
|
||||
address: 10.10.20.178
|
||||
tiers: [state]
|
||||
|
||||
components:
|
||||
keycloak: { address: https://sso.bpkp.go.id }
|
||||
minio: { address: 10.10.20.171 }
|
||||
nessie: { address: 10.10.20.173 }
|
||||
dremio: { enabled: false }
|
||||
@@ -133,9 +133,15 @@ def external_components(doc: dict) -> set[str]:
|
||||
Komponen ini TIDAK dijalankan cluster (tak masuk `placement`/`plan`); endpoint-nya
|
||||
diarahkan ke alamat itu di SEMUA host (lihat generate.endpoint_lines). Berguna untuk
|
||||
IAM/objek-storage milik pihak lain, termasuk di host/IP yang berbeda satu per komponen.
|
||||
|
||||
Turunan: `minio-init` (pembuat bucket MinIO **LOKAL** via `mc`) IKUT eksternal bila
|
||||
`minio` eksternal — kalau tidak, ia nyasar ke bundle `state` padahal `minio` absen.
|
||||
"""
|
||||
return {n for n, s in (doc.get("components") or {}).items()
|
||||
if (s.get("address") or "").strip()}
|
||||
ext = {n for n, s in (doc.get("components") or {}).items()
|
||||
if (s.get("address") or "").strip()}
|
||||
if "minio" in ext:
|
||||
ext.add("minio-init")
|
||||
return ext
|
||||
|
||||
|
||||
def external_address(doc: dict, service: str) -> str | None:
|
||||
@@ -320,8 +326,9 @@ def validate(doc: dict) -> list[str]:
|
||||
|
||||
# (c) tiap komponen harus bisa ditempatkan
|
||||
placement = resolve(doc)
|
||||
external_all = external_components(doc)
|
||||
for service in (svc for svcs in TIER_SERVICES.values() for svc in svcs):
|
||||
if service not in placement and not external_address(doc, service):
|
||||
if service not in placement and service not in external_all:
|
||||
errors.append(
|
||||
f"komponen '{service}' tidak bisa ditempatkan — tidak ada host bertier "
|
||||
f"'{tier_of(service)}', tidak ada components.{service}.host, "
|
||||
|
||||
@@ -373,6 +373,32 @@ else
|
||||
bad "client origin airflow masih pakai AIRFLOW_HOST (origin salah di host non-pemilik)"
|
||||
fi
|
||||
|
||||
# ─── 0q. minio EKSTERNAL ⇒ `minio-init` TIDAK ditempatkan ────────────────────
|
||||
# Regresi: `TIER_SERVICES['state']` memuat minio + minio-init. Bila `minio` dijadikan
|
||||
# eksternal (P3), hanya `minio` yang di-exclude → `minio-init` nyasar ke bundle `state`
|
||||
# (padahal `minio` absen) → `install.sh --host state` menjalankannya tanpa guna.
|
||||
_qr="$(python3 - "${DEPLOY_DIR}" <<'PY'
|
||||
import importlib.util, sys
|
||||
d = sys.argv[1]
|
||||
s = importlib.util.spec_from_file_location("inv", f"{d}/lib/cluster/inventory.py")
|
||||
inv = importlib.util.module_from_spec(s); s.loader.exec_module(inv)
|
||||
doc = {"version": 1, "tls": {"mode": "none"},
|
||||
"hosts": {"control": {"address": "10.20.0.10", "tiers": ["identity", "policy", "pipeline", "governance"]},
|
||||
"compute": {"address": "10.20.0.11", "tiers": ["coord", "engine"]},
|
||||
"state": {"address": "10.20.0.12", "tiers": ["state"]}},
|
||||
"components": {"minio": {"address": "https://minio.corp:9000"}}}
|
||||
errs = inv.validate(doc)
|
||||
svcs = set(inv.plan(doc)["state"]["services"])
|
||||
ok = (not errs) and "minio" not in svcs and "minio-init" not in svcs
|
||||
print("1" if ok else f"0 err={errs} state={sorted(svcs)}")
|
||||
PY
|
||||
)"
|
||||
if [[ "${_qr}" == "1" ]]; then
|
||||
ok "minio eksternal: minio-init tak ditempatkan (bundle host bebas minio-init)"
|
||||
else
|
||||
bad "minio eksternal: minio-init masih ditempatkan → ${_qr}"
|
||||
fi
|
||||
|
||||
# ─── 1. generate ────────────────────────────────────────────────────────────
|
||||
if ! python3 "${DEPLOY_DIR}/lib/cluster/generate.py" render \
|
||||
"${INVENTORY}" "${DEPLOY_DIR}/docker-compose.yml" "${DEPLOY_DIR}/.env" \
|
||||
|
||||
Reference in New Issue
Block a user