NMS-19753: Core: Investigate if its possible to move away from Confd#8497
NMS-19753: Core: Investigate if its possible to move away from Confd#8497mershad-manesh wants to merge 20 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the confd-based runtime templating approach from the OpenNMS core container image and replaces it with environment-variable-driven configuration (static files + envsubst), updating documentation and smoke tests accordingly.
Changes:
- Replace confd template processing with environment-variable config processing in the container entrypoint.
- Add static container config files/templates and default Prometheus JMX exporter config to the image; remove confd templates/TOML definitions.
- Update smoke tests to always set
OPENNMS_TIMESERIES_STRATEGYbased on the stack model.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| smoke-test/src/main/java/org/opennms/smoketest/containers/OpenNMSContainer.java | Always exports OPENNMS_TIMESERIES_STRATEGY to align with env-var-driven container config. |
| opennms-container/core/container-fs/prom-jmx-default-config.yaml | Replace confd-rendered JMX exporter config with a static default YAML. |
| opennms-container/core/container-fs/etc/templates/trapd-configuration.xml.tmpl | New envsubst template for trapd-configuration.xml. |
| opennms-container/core/container-fs/etc/templates/service-configuration.xml.tmpl | New envsubst template for service-configuration.xml service enablement toggles. |
| opennms-container/core/container-fs/etc/org.apache.karaf.shell.cfg | New static Karaf SSH config using ${env:...} substitution. |
| opennms-container/core/container-fs/etc/opennms.properties.d/_container.timeseries.properties | New properties file for timeseries/rrd config via `${env:... |
| opennms-container/core/container-fs/etc/opennms.properties.d/_container.slack.properties | New Slack notification properties via environment variables. |
| opennms-container/core/container-fs/etc/opennms.properties.d/_container.newts.properties | New Newts/Cassandra properties via environment variables. |
| opennms-container/core/container-fs/etc/opennms.properties.d/_container.mattermost.properties | New Mattermost notification properties via environment variables. |
| opennms-container/core/container-fs/entrypoint.sh | Introduce processEnvConfig() and switch startup flow away from confd -onetime. |
| opennms-container/core/container-fs/confd/templates/trapd-configuration.xml.tmpl | Remove confd template (replaced by envsubst template). |
| opennms-container/core/container-fs/confd/templates/timeseries.properties.tmpl | Remove confd template (replaced by _container.timeseries.properties). |
| opennms-container/core/container-fs/confd/templates/slack.properties.tmpl | Remove confd template (replaced by _container.slack.properties). |
| opennms-container/core/container-fs/confd/templates/service-configuration.xml.tmpl | Remove confd template (replaced by envsubst template). |
| opennms-container/core/container-fs/confd/templates/org.apache.karaf.shell.cfg.tmpl | Remove confd template (replaced by static cfg file). |
| opennms-container/core/container-fs/confd/templates/newts.properties.tmpl | Remove confd template (replaced by _container.newts.properties). |
| opennms-container/core/container-fs/confd/templates/mattermost.properties.tmpl | Remove confd template (replaced by _container.mattermost.properties). |
| opennms-container/core/container-fs/confd/confd.toml | Remove confd configuration. |
| opennms-container/core/container-fs/confd/conf.d/trapd-configuration.xml.toml | Remove confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/timeseries.properties.toml | Remove confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/slack.properties.toml | Remove confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/service-configuration.xml.toml | Remove confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/prom-jmx-exporter.yaml.toml | Remove confd template mapping (replaced by static default config). |
| opennms-container/core/container-fs/confd/conf.d/org.apache.karaf.shell.cfg.toml | Remove confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/newts.properties.toml | Remove confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/mattermost.properties.toml | Remove confd template mapping. |
| opennms-container/core/Dockerfile | Add gettext (for envsubst) and copy new container config files + prom-jmx default config into the image. |
| opennms-container/core/CONFD_README.md | Update documentation from confd/yaml-driven config to environment-variable-driven config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR migrates the opennms-container/core image startup configuration away from confd-generated templates toward environment-variable-driven configuration (plus optional overlay mounts), as part of NMS-19753.
Changes:
- Replace confd template processing with
envsubst+ static config files copied into the runtime/opt/opennms/etc. - Add container-managed templates/config for service enablement, Trapd, Karaf SSH config, and multiple
opennms.properties.dfragments. - Install a static default Prometheus JMX exporter config and add
gettext(forenvsubst) to the container image.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| smoke-test/src/main/java/org/opennms/smoketest/containers/OpenNMSContainer.java | Always sets OPENNMS_TIMESERIES_STRATEGY env var for the smoke-test container. |
| opennms-container/core/container-fs/prom-jmx-default-config.yaml | Replaces confd-templated Prom JMX YAML with a static default config. |
| opennms-container/core/container-fs/etc/templates/trapd-configuration.xml.tmpl | Adds envsubst-driven Trapd XML template. |
| opennms-container/core/container-fs/etc/templates/service-configuration.xml.tmpl | Adds envsubst-driven service enablement template (per-service env vars). |
| opennms-container/core/container-fs/etc/org.apache.karaf.shell.cfg | Adds Karaf SSH config with env-based port/host defaults. |
| opennms-container/core/container-fs/etc/opennms.properties.d/_container.timeseries.properties | Adds env-driven timeseries/RRD property fragment. |
| opennms-container/core/container-fs/etc/opennms.properties.d/_container.slack.properties | Adds env-driven Slack notification properties fragment. |
| opennms-container/core/container-fs/etc/opennms.properties.d/_container.newts.properties | Adds env-driven Newts/Cassandra properties fragment. |
| opennms-container/core/container-fs/etc/opennms.properties.d/_container.mattermost.properties | Adds env-driven Mattermost notification properties fragment. |
| opennms-container/core/container-fs/entrypoint.sh | Replaces confd run with env-based config generation/copying and legacy cleanup. |
| opennms-container/core/Dockerfile | Installs gettext and ships new container-fs config + default prom-jmx config. |
| opennms-container/core/CONFD_README.md | Updates documentation to describe the env-var based configuration and migration notes. |
| opennms-container/core/container-fs/confd/templates/trapd-configuration.xml.tmpl | Removes confd Trapd template (no longer used). |
| opennms-container/core/container-fs/confd/templates/timeseries.properties.tmpl | Removes confd timeseries template (no longer used). |
| opennms-container/core/container-fs/confd/templates/slack.properties.tmpl | Removes confd Slack template (no longer used). |
| opennms-container/core/container-fs/confd/templates/service-configuration.xml.tmpl | Removes confd service configuration template (no longer used). |
| opennms-container/core/container-fs/confd/templates/org.apache.karaf.shell.cfg.tmpl | Removes confd Karaf SSH template (no longer used). |
| opennms-container/core/container-fs/confd/templates/newts.properties.tmpl | Removes confd Newts template (no longer used). |
| opennms-container/core/container-fs/confd/templates/mattermost.properties.tmpl | Removes confd Mattermost template (no longer used). |
| opennms-container/core/container-fs/confd/confd.toml | Removes confd runtime config. |
| opennms-container/core/container-fs/confd/conf.d/trapd-configuration.xml.toml | Removes confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/timeseries.properties.toml | Removes confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/slack.properties.toml | Removes confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/service-configuration.xml.toml | Removes confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/prom-jmx-exporter.yaml.toml | Removes confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/org.apache.karaf.shell.cfg.toml | Removes confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/newts.properties.toml | Removes confd template mapping. |
| opennms-container/core/container-fs/confd/conf.d/mattermost.properties.toml | Removes confd template mapping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (TimeSeriesStrategy.NEWTS.equals(model.getTimeSeriesStrategy())) { | ||
| this.withEnv("OPENNMS_TIMESERIES_STRATEGY", model.getTimeSeriesStrategy().name().toLowerCase()); | ||
| } | ||
| this.withEnv("OPENNMS_TIMESERIES_STRATEGY", model.getTimeSeriesStrategy().name().toLowerCase()); |
| @@ -0,0 +1,6 @@ | |||
| sshPort=${env:KARAF_SSH_PORT:-8101} | |||
| # OPENNMS: Restrict SSH on all interfaces by default; | |||
|
|
||
| If you are upgrading from a version that used `horizon-config.yaml` / confd: | ||
|
|
||
| - The `horizon-config.yaml` mount is no longer used. Switch to environment variables using the tables above. |
|
I looked through everything I could and there wasn't anything that felt truly off to me. I also used CC and did a review on this. These were the only two things that I think were worth mentioning here that got flagged and both seem mostly minor:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
opennms-container/core/container-fs/etc/templates/prom-jmx-exporter-config.yaml.tmpl:4
envsubstdoes not evaluate shell default expressions such as${VAR:-default}; it only substitutes simple$VAR/${VAR}references. SinceprocessEnvConfig()already exports defaults before callingenvsubst, these lines should use simple variable references, otherwise the generated YAML will retain the literal${...:-...}strings.
All Contributors
External References