imbajin commented on code in PR #3322:
URL: https://github.com/apache/hugegraph/pull/3322#discussion_r4251129941
##########
helm/hugegraph/templates/_helpers.tpl:
##########
@@ -851,7 +851,7 @@ start-hugegraph-pd.sh, start-hugegraph-store.sh, and
hugegraph-server.sh).
{{- $reservedEnv := dict
"pd" (list "HG_PD_GRPC_HOST" "HG_PD_GRPC_PORT" "HG_PD_REST_PORT"
"HG_PD_RAFT_ADDRESS" "HG_PD_RAFT_PEERS_LIST" "HG_PD_INITIAL_STORE_LIST"
"HG_PD_INITIAL_STORE_COUNT" "HG_PD_DATA_PATH" "HG_PD_AUTH_SECRET_KEY"
"JAVA_OPTS" "JAVA_OPTIONS")
"store" (list "HG_STORE_PD_ADDRESS" "HG_STORE_GRPC_HOST"
"HG_STORE_GRPC_PORT" "HG_STORE_REST_PORT" "HG_STORE_RAFT_ADDRESS"
"HG_STORE_DATA_PATH" "JAVA_OPTS" "JAVA_OPTIONS")
- "server" (list "POD_IP" "HG_SERVER_BACKEND" "HG_SERVER_PD_PEERS"
"HG_SERVER_PD_REST_ENDPOINT" "STORE_REST" "HG_SERVER_INIT_STORE_ENABLED"
"HG_SERVER_URLS_TO_PD" "HG_SERVER_STARTUP_TIMEOUT_S" "PD_AUTH_PASSWORD"
"PASSWORD" "HG_SERVER_AUTH_TOKEN_SECRET" "JAVA_OPTS" "JAVA_OPTIONS")
+ "server" (list "POD_IP" "HG_SERVER_SERVICE_ID" "HG_SERVER_GRAPHSPACE"
"HG_SERVER_BACKEND" "HG_SERVER_PD_PEERS" "HG_SERVER_PD_REST_ENDPOINT"
"STORE_REST" "HG_SERVER_INIT_STORE_ENABLED" "HG_SERVER_URLS_TO_PD"
"HG_SERVER_STARTUP_TIMEOUT_S" "PD_AUTH_PASSWORD" "PASSWORD"
"HG_SERVER_AUTH_TOKEN_SECRET" "JAVA_OPTS" "JAVA_OPTIONS")
Review Comment:
Both SERVICE_ID and GRAPH_SPACE are now reserved in Server extraEnv,
alongside the new identity variables. The new cases fail with the old helper
and pass after the change. Full Helm and deployment-contract tests passed;
unrelated extraEnv entries remain allowed.
##########
helm/hugegraph/templates/server-deployment.yaml:
##########
@@ -258,6 +258,14 @@ spec:
fieldPath: status.podIP
- name: HG_SERVER_BACKEND
value: {{ .Values.server.backend | quote }}
+ {{- if ne (.Values.server.serviceId | default "DEFAULT") "DEFAULT"
}}
+ - name: HG_SERVER_SERVICE_ID
+ value: {{ .Values.server.serviceId | quote }}
Review Comment:
The template now escapes every dollar before Kubernetes environment
expansion, preserving references, existing double dollars and ordinary/trailing
dollar signs as literal service IDs. The old/new rendered values were checked
through the pinned Kubernetes expansion implementation, the entrypoint and
actual HugeConfig reads. Helm regressions passed. This is local pipeline
validation, not live cluster acceptance.
##########
hugegraph-server/hugegraph-dist/docker/docker-entrypoint-test.sh:
##########
@@ -329,5 +329,102 @@ done
)
assert_start_timeout 120
+# Identity mappings apply on every start and leave mounted config alone when
unset.
+identity_conf="${TEST_HOME}/conf/rest-server.properties"
+printf
'\nserver.service_id=mounted-service\nserver.graphspace=mounted_space\n' >>
"${identity_conf}"
+(cd "${TEST_HOME}"; bash ./docker-entrypoint.sh)
+grep -qx 'server.service_id=mounted-service' "${identity_conf}"
+grep -qx 'server.graphspace=mounted_space' "${identity_conf}"
+(cd "${TEST_HOME}"; HG_SERVER_SERVICE_ID=DEFAULT HG_SERVER_GRAPHSPACE=DEFAULT \
+ bash ./docker-entrypoint.sh)
+grep -qx 'server.service_id=DEFAULT' "${identity_conf}"
+grep -qx 'server.graphspace=DEFAULT' "${identity_conf}"
+(cd "${TEST_HOME}"; HG_SERVER_SERVICE_ID=service-a
HG_SERVER_GRAPHSPACE=space_a bash ./docker-entrypoint.sh)
+grep -qx 'server.service_id=service-a' "${identity_conf}"
+grep -qx 'server.graphspace=space_a' "${identity_conf}"
+(cd "${TEST_HOME}"; SERVICE_ID=legacy-service GRAPH_SPACE=legacy_space bash
./docker-entrypoint.sh)
+grep -qx 'server.service_id=legacy-service' "${identity_conf}"
+grep -qx 'server.graphspace=legacy_space' "${identity_conf}"
+(cd "${TEST_HOME}"; SERVICE_ID=legacy-service GRAPH_SPACE=legacy_space \
+ HG_SERVER_SERVICE_ID=service-b HG_SERVER_GRAPHSPACE=space_b bash
./docker-entrypoint.sh)
+grep -qx 'server.service_id=service-b' "${identity_conf}"
+grep -qx 'server.graphspace=space_b' "${identity_conf}"
+(cd "${TEST_HOME}"; HG_SERVER_SERVICE_ID= HG_SERVER_GRAPHSPACE= bash
./docker-entrypoint.sh)
+grep -qx 'server.service_id=service-b' "${identity_conf}"
+grep -qx 'server.graphspace=space_b' "${identity_conf}"
+
+# Empty new variables still allow the legacy driver values to apply.
+(cd "${TEST_HOME}"; HG_SERVER_SERVICE_ID= HG_SERVER_GRAPHSPACE= \
+ SERVICE_ID=legacy-empty GRAPH_SPACE=legacy_empty bash
./docker-entrypoint.sh)
+grep -qx 'server.service_id=legacy-empty' "${identity_conf}"
+grep -qx 'server.graphspace=legacy_empty' "${identity_conf}"
+
+# Service permits spaces; Unicode escapes round-trip through the Server parser.
+(cd "${TEST_HOME}"; HG_SERVER_SERVICE_ID='ops team' bash
./docker-entrypoint.sh)
+grep -Fxq 'server.service_id=ops\u0020team' "${identity_conf}"
Review Comment:
Added a permanent Java helper that reads the generated properties with the
current HugeConfig implementation. Docker CI now builds the Commons classpath
and uses it for the whitespace, backslash, literal unicode-escape and dollar
cases. The existing encoder passes these readbacks, so no runtime encoding
change was needed. Actual ServerOptions readback also passed locally.
--
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]