Databases, Temporal, and telemetry
Use this page to connect NRO to a CloudNativePG operator, PostgreSQL, Temporal or telemetry collector you already run, to tune managed Temporal and to turn on monitoring. You make each change in your state file. If you do not have one yet, follow Write your state file.
Several sections mention bootstrap, the set of Jobs that run NRO database schema migrations and verify or create Temporal prerequisites before Helmfile installs or upgrades NRO.
Use an existing CloudNativePG operator
CloudNativePG (CNPG) is the Kubernetes operator that runs this stack’s managed
PostgreSQL clusters. Set cnpg.install: false to use an operator already installed in
the cluster.
Tell the stack where that operator lives. Set cnpg.operatorNamespace to its namespace
and cnpg.operatorDeployment to its Deployment name. The default name is
cnpg-cloudnative-pg. For example, a Helm release
named postgres-operator normally creates the Deployment
postgres-operator-cloudnative-pg. Check the operator’s compatibility with the pinned
database charts, then set cnpg.expectedImage to its exact image reference.
cnpg.operatorDeployment must be a lowercase DNS label of at most 63 characters.
With cnpg.install: true, it also names the operator that the stack installs, which
keeps the Deployment and the presync gate aligned. Choose it before installation, because
changing it later renames the operator resources. The gate still expects the standard
CNPG webhook names, so an installation with custom webhook names needs a Helmfile
adaptation.
Use existing backing services
A backing service is a database, Temporal server or telemetry collector that NRO
connects to. In managed mode, this Helmfile installs and updates that service’s
releases in your cluster. In external mode, you supply an existing service and its
connection settings; it can run in the same cluster or elsewhere. Choose a mode for each
service:
namespace sets the Kubernetes namespace for NRO and its managed backing-service
releases. The CloudNativePG operator’s release uses cnpg.operatorNamespace.
temporal.namespace selects the workflow scope inside Temporal; the two names do not
have to match.
Have these prerequisites in place before sync:
Mount any certificate files named in the connection string in both NRO and the migration Job (Connect to PostgreSQL over TLS).
The following example uses an existing database, Temporal server and collector. Replace
your temporal: block with the one below and add the database: and telemetry:
blocks. Also set cnpg.install: false, because no managed database remains:
temporal.auth has the same shape as the NRO chart’s temporal.auth
(Temporal authentication)
and applies only to an external server. External Temporal rejects temporal.web: true,
so set temporal.uiUrl to your existing UI instead. NRO appends workflows/<id>/... to
that URL, so it must end with /namespaces/<temporal.namespace>/, trailing slash
included.
With telemetry.collector: external, a signal whose endpoint is empty keeps the binary
default 127.0.0.1:4318, and NRO logs export errors for that signal if nothing listens
there. Set both endpoints unless you want only one signal.
telemetry.collector: none leaves the NRO telemetry endpoints unset. The binary then
logs export errors unless something listens at its
default target.
Several steps wait for the backing services. Presync gates run only for managed
databases. First, wait-for-postgresql runs before nro-temporal for the Temporal
database and before nro-bootstrap for the NRO database. Then, in every mode, the
migration Job’s wait-postgres init container waits for the database. When the optional
Temporal Job runs, its temporal container retries each Temporal command while the
frontend is unavailable
(Skip the bootstrap Temporal Job).
An unreachable external service, or a rejected credential, makes the bootstrap Job retry. The bootstrap Jobs’ own deadlines bound those retries (Deadlines and render checks), and other errors can fail the Job sooner. Any failure prevents bootstrap from completing. If bootstrap does not finish, refer to Bootstrap, application and login.
Switch an installed service to external
The Helmfile renders no release for an external service. Switching a service from
managed to external therefore leaves its old release and data in place, and neither
sync nor destroy touches them again. After moving the data and taking a backup,
remove the old release as a separate step. For the NRO database, run
helm -n "$nro_namespace" uninstall nro-db, with nro_namespace set to your state’s
namespace. For Temporal, uninstall nro-temporal and then nro-temporal-db.
This retention is Helmfile behavior. A controller that applies a raw render must keep those resources out of its own pruning. It must also apply each release’s namespaced resources into that release’s namespace, because some manifests name no namespace.
Connect to PostgreSQL over TLS
If the connection string names certificate files, such as
sslrootcert=/database-tls/ca.crt, those files must exist at the same paths in NRO and
in the migration Job. The Job’s wait-postgres init container receives the same mounts.
Keep the certificates in a Secret and mount it in both places:
The bootstrap chart’s Database connection
section lists the reserved volume names and paths. After changing a certificate behind
an unchanged Secret name, restart NRO and change bootstrap.runToken to rerun the
migration Job (Rerun the bootstrap Jobs
explains the token).
Skip the bootstrap Temporal Job
By default, the bootstrap Temporal Job checks the Temporal namespace and the five search
attributes before NRO starts. In manage mode, it creates them when they are missing.
Even verify mode needs an identity that can describe the namespace and list its search
attributes. If a platform team prepares both on an external server and bootstrap cannot
reach that server’s admin APIs, set:
The Helmfile then sets the bootstrap chart’s temporal.job.enabled: false. The bootstrap
chart omits the Temporal Job and its address, namespace and credential requirements. NRO
still uses temporal.address, temporal.namespace and temporal.auth. The migration
Job still runs. A managed database also keeps its presync gate.
bootstrapJob: false fails with managed Temporal, whose server starts empty. It also
fails with temporal.management: manage, because nothing would then create what is
missing. The bootstrap chart likewise rejects temporal.management: manage with its Job
off. With the Job off, nothing checks the namespace or the search attributes before NRO
starts, so keep the Job on whenever bootstrap can reach those APIs.
Managed Temporal
With temporal.mode: managed, the nro-temporal release installs the pinned upstream
temporal/temporal 1.7.0 chart against the managed PostgreSQL cluster nro-temporal-db.
Tune it through temporal.values
(Tune the charts through passthroughs).
Temporal schema migration
The chart’s schema Job nro-temporal-schema is a Helm pre-install,pre-upgrade hook of
nro-temporal. It sets up and then updates the temporal and temporal_visibility
stores in nro-temporal-db, with the password from Secret nro-temporal-db-app, before
Helm creates or updates any Temporal server. CNPG creates both databases, so the Job
creates none. Repeating the setup on an initialized store changes nothing, so the hook
runs on every upgrade. Before the release, the presync gate wait-for-postgresql checks
authenticated SQL on both databases.
A rollback does not revert the schema, so back up nro-temporal-db before a Temporal
upgrade. Helm’s --no-hooks (for example through Helmfile --args) skips the
migration, so do not pass it.
The schema hook runs within these limits:
- Its Job deadline (
activeDeadlineSeconds) is the top-level state keyreadiness.timeoutSeconds(default 900), with up to three retries. - Helm waits
readiness.timeoutSecondsplus 60 seconds fornro-temporalonly; every other release keepsreadiness.timeoutSeconds. The extra minute is diagnostic headroom for Kubernetes to mark an overrunning JobDeadlineExceededwhile Helm is still waiting. It does not guarantee that Helm prints the Job’s final status, so check the Job itself after a failure. - A failed hook fails
nro-temporal, and Helmfile then deploys none of the releases that need it; the existing servers keep running. - A successful Job is deleted. A failed one stays for inspection until the next attempt
replaces it, or until
schema.ttlSecondsAfterFinished(default 86400 seconds, settable throughtemporal.values) after the Job finishes. - To retry, fix the cause and run
sync, as diff and apply explains.
On a fresh database, the first servers create the cluster metadata record when they
start. Servers that start at the same time race for it. A loser exits, and its restart
reads the winner’s record. That is why a few restarts right after the first install are
expected.
The bootstrap Temporal Job retries its commands until the frontend answers, and
helm test nro-temporal checks temporal operator cluster health.
Anything the schema hook mounts through temporal.values, such as
admintools.additionalVolumes, must reference objects that exist before the hook runs,
because a pre-install hook runs before the release’s other resources exist.
The chart appends admintools.additionalEnv to the migration containers after the
variables that point them at nro-temporal-db, so a later duplicate would override them.
For that reason, the stack rejects entries named SQL_PLUGIN, SQL_HOST, SQL_PORT,
SQL_DATABASE, SQL_USER or SQL_PASSWORD, with value or valueFrom.
Other names stay open, including SQL_CONNECT_ATTRIBUTES and the SQL_TLS* settings.
admintools.additionalEnvSecretName and additionalEnvConfigMapName also stay open,
because explicit env entries take precedence over envFrom.
The Temporal ServiceAccount
temporal.values.serviceAccount passes through to the chart. With create: true, the
chart creates the account (serviceAccount.name, default nro-temporal) as a
pre-install, pre-upgrade hook. Helm deletes and recreates it on every install and
upgrade, so its UID changes each time. Helm replaces an existing account of that name,
whatever created it. Helm also leaves the account in place on helm uninstall and on a
full destroy. The servers, the web UI, the test Pod and the schema hook run as it, so
bind roles to it by name.
With create: true, give the account a dedicated serviceAccount.name that nothing else
in the namespace uses. Never set it to default or to an account that an application, a
database or another release runs as: Helm would delete and recreate that account on
every upgrade. The stack does not reject such a name.
When the UID must stay stable, or the account already exists, create it outside the
release and set create: false with its name. The servers and the schema hook then run
as that account, which must exist (default default). serviceAccount.extraAnnotations
and per-component accounts follow the chart’s own values.
To delete a created account after an uninstall, follow Uninstall.
Monitor the stack
NRO and the managed services can create Prometheus Operator monitoring objects. All are off by default.
When remediation-orchestrator.networkPolicy.enabled is true with ingressPeers, as
every proxy mode requires, add your Prometheus pods as a peer. The chart never adds one.
/metrics shares the HTTP port, so in the proxy modes a scrape peer also reaches the port
the identity layer guards
(NetworkPolicy).
To turn the monitoring objects on, merge these keys into your state file. Put
temporal.values inside your existing temporal: block, and metrics inside any
existing remediation-orchestrator: block:
For NRO’s own health, request /status. It answers HTTP 503 when its PostgreSQL or
Temporal check fails
(Endpoints without authentication).
Next steps
- Apply the change: render, then sync, as in Render, deploy and verify. After a mode switch, sync NRO together with what it depends on as Components shows.
- Tune the managed services’ charts, such as backups or resources: Tune the charts through passthroughs.
- A bootstrap Job waits or fails: Bootstrap, application and login.