byteayan opened a new pull request, #3352: URL: https://github.com/apache/hugegraph/pull/3352
## Purpose of the PR - Part of #3286 (the env mapping; the writable-conf half is left for a follow-up, see below) The Server entrypoint maps a set of `HG_SERVER_*` variables onto the conf files, but nothing mapped the two keys that decide which address a Server registers in PD: `server.urls_to_pd` and `server.deploy_in_k8s`. `GraphManager` registers the `urls_to_pd` list only when `deploy_in_k8s` is true, and `restserver.url` otherwise. Without a mapping, the Helm chart rewrites `rest-server.properties` in a shell wrapper before it runs the entrypoint, and the TODO in `docker-entrypoint.sh` asked for these mappings. ## Main Changes - `HG_SERVER_URLS_TO_PD` sets `server.urls_to_pd`. Whitespace is stripped first: the Server splits the list on bare commas, and `http://a:8080, http://b:8080` was written as `http://a:8080,\ http://b:8080`, which registered `\ http://b:8080` in PD without any error. - `HG_SERVER_DEPLOY_IN_K8S` sets `server.deploy_in_k8s`. It accepts the same case-insensitive spellings as `HG_SERVER_INIT_STORE_ENABLED` (the set `HugeConfig` accepts, which excludes `0` and `1`). The check runs before the mapping block, so an invalid value stops the container with both conf files untouched. - Unset variables leave the conf files alone, so the compose files and the default image behave as before. - The chart now lists `HG_SERVER_DEPLOY_IN_K8S` among the reserved `server.extraEnv` names. Its wrapper forces the flag on, and with this image an `extraEnv` value of `false` would turn it back off; an invalid one would crash-loop the Pod. The wrapper itself stays: it also holds the password checks, `usePD`, the custom-port `restserver.url` and IPv6 bracketing, and it can only shrink once the chart's minimum image has these mappings. I reworded the TODO to say that. - `hugegraph-server/hugegraph-dist/docker/README.md` documents both variables. Left for later: rendering the conf into a writable copy (the second half of #3286). It needs the start scripts to take a conf directory (#3253), and it needs `enable-auth.sh` to decide from the files rather than from `conf-bak/`. Otherwise a freshly rendered conf would silently start without auth after the first boot. Overlap with #3322: it adds lines to the same mapping block and to `_helpers.tpl`'s reserved list. `git merge-tree` merges the entrypoint and its tests cleanly; the reserved-list line would need a one-line resolution. ## Verifying these changes - [x] Need tests and can be verified as follows: - `docker-entrypoint-test.sh` covers both variables. Unset variables write no `server.*` key. A list with surrounding and inner spaces is written without them, and a rerun with new values replaces each key once instead of appending. For `1`, `0` and `enabled` the entrypoint exits non-zero and both conf files compare equal to their earlier copies. - The new cases fail against the entrypoint on master. - Full suite, including `test-docker-entrypoint-process.sh`, run in `python:3.12-slim-bookworm` with `procps` and `curl`: passes. - `helm unittest helm/hugegraph` (helm-unittest 3.21.0-1.0.3): 295 tests pass, including a new case that rejects `HG_SERVER_DEPLOY_IN_K8S` in `server.extraEnv`. ## Does this PR potentially affect the following parts? - [ ] Dependencies ([add/update license](https://hugegraph.apache.org/docs/contribution-guidelines/contribute/#321-check-licenses) info & [regenerate_known_dependencies.sh](../install-dist/scripts/dependency/regenerate_known_dependencies.sh)) - [x] Modify configurations - [ ] The public API - [x] Other affects (typed here): Helm chart rejects `HG_SERVER_DEPLOY_IN_K8S` in `server.extraEnv` - [ ] Nope ## Documentation Status - [x] `Doc - TODO`: required documentation is pending; complete it before merging. - [ ] `Doc - Done`: documentation is included here or linked below. - [ ] `Doc - No Need`: no user-visible documentation is affected. Documentation files in this PR or paired hugegraph-doc PR: - `hugegraph-server/hugegraph-dist/docker/README.md` - Paired apache/hugegraph-doc PR, link to follow: `content/{en,cn}/docs/guides/hugegraph-docker-cluster.md`, `content/{en,cn}/docs/config/config-guide.md` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
