Hi team :wave: as discussed, I opened the follow-u...
# opal
u
Hi team 👋 as discussed, I opened the follow-up issue for external OPA rehydration: github.com/permitio/opal/issues/1032 It covers the case from the #990 design notes: an external OPA (e.g. a sidecar) that restarts comes back with an empty store, and nothing reloads it until the next update. The proposal is opt-in and reuses the inline runner’s rehydration callbacks. I listed two ways to detect the restart (hooking the #904 liveness probe vs. a small marker document) and would love your view on which fits better before I open a PR. Thanks!
a
Hi @3kd1000, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
I can't open or review github.com/permitio/opal/issues/1032, issue #990, or issue #904 from the sources I have, so I can't weigh in on the proposal's design or tell you which detection approach the maintainers would prefer. Your question of which fits better is a maintainer call. What the documentation does cover is relevant to your two detection options: ​*Liveness probe (your first option)*​ The OPAL Client already runs a background probe against the policy store's health endpoint, controlled by these settings: •
OPAL_POLICY_STORE_LIVENESS_PROBE_ENABLED
(default
True
) •
OPAL_POLICY_STORE_LIVENESS_PROBE_INTERVAL_SECONDS
(default
10
) •
OPAL_POLICY_STORE_LIVENESS_PROBE_TIMEOUT_SECONDS
(default
2
) The probe factors its result into the
/healthy
response and recovers automatically once the policy store returns. (1) (2) The documentation doesn't say whether this probe can distinguish "OPA restarted with an empty store" from "OPA briefly unreachable", or whether it exposes any hook to trigger a reload. ​*Marker document (your second option)*​ OPAL can load a healthcheck policy into OPA as the
system.opal
package when this is set:
Copy code
OPAL_OPA_HEALTH_CHECK_POLICY_ENABLED=True
(2) This document holds
ready
,
healthy
, and the last policy and data transaction details. (2) Querying it works like this:
Copy code
curl --request GET http://localhost:8181/v1/data/system/opal
(2) Since OPAL persists this state into OPA, an OPA restart with an empty store would lose it, which is the same idea as your marker approach. The documentation doesn't describe using it to detect restarts, though. ​*Offline mode and backup*​ Separately,
OPAL_OFFLINE_MODE_ENABLED
and
OPAL_STORE_BACKUP_PATH
restore the policy store from a backup file. These are documented as ignored when
OPAL_INLINE_OPA_ENABLED=False
, so they don't cover the external OPA case. (1) ​*Related gap*​ Discussion #887 shows another case where OPAL's readiness signals don't cover externally managed OPA state. A maintainer there said that OPAL has no way of tracking externally loaded policy. (3) For a decision on which approach to take, I'd suggest asking in the issue thread itself so the maintainers can respond directly. If you'd like, I can give a general answer from my own knowledge of the tradeoffs, but it wouldn't be grounded in the documentation.
To learn more, see the sources I considered: [[1] OPAL Configuration Guide | OPAL](https://docs.opal.ac/getting-started/configuration) [[2] How to use data update callbacks and OPA healthcheck policy](https://docs.opal.ac/tutorials/healthcheck_policy_and_update_callbacks) [[3] How to detect all OPAL_DATA_CONFIG_SOURCES have been fully loaded at startup](https://github.com/permitio/opal/discussions/887)
d
Hi @3kd1000 I will make sure someone from the team takes a look at it. Thank you for your contribution