imbajin commented on code in PR #3450:
URL: https://github.com/apache/hugegraph/pull/3450#discussion_r4456890379


##########
helm/hugegraph/templates/rag-deployment.yaml:
##########
@@ -0,0 +1,210 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+{{ include "hugegraph.resolveValues" . }}
+{{- $rag := get .Values "rag" | default dict }}
+{{- if get $rag "enabled" | default false }}
+{{- include "hugegraph.rag.validate" . }}
+{{- $graph := get $rag "hugegraph" | default dict }}
+{{- $autoConfigure := true }}
+{{- if hasKey $graph "autoConfigure" }}{{- $autoConfigure = get $graph 
"autoConfigure" }}{{- end }}
+{{- $persistence := get $rag "persistence" | default dict }}
+{{- $persistenceEnabled := get $persistence "enabled" | default false }}
+{{- $envNames := dict }}
+{{- range get $rag "env" | default list }}
+{{- $_ := set $envNames (.name | toString) true }}
+{{- end }}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ include "hugegraph.rag.name" . }}
+  labels:
+    {{- include "hugegraph.labels" . | nindent 4 }}
+    app.kubernetes.io/component: rag
+spec:
+  replicas: {{ include "hugegraph.rag.replicas" . }}
+  strategy:
+    type: {{ ternary "Recreate" "RollingUpdate" (and $persistenceEnabled (eq 
(include "hugegraph.rag.replicas" . | int) 1)) }}
+  selector:
+    matchLabels:
+      {{- include "hugegraph.selectorLabels" . | nindent 6 }}
+      app.kubernetes.io/component: rag
+  template:
+    metadata:
+      labels:
+        {{- include "hugegraph.selectorLabels" . | nindent 8 }}
+        app.kubernetes.io/component: rag
+        {{- with get $rag "podLabels" }}{{ toYaml . | nindent 8 }}{{- end }}
+      {{- with get $rag "podAnnotations" }}
+      annotations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+    spec:
+      {{- $serviceAccount := get $rag "serviceAccount" | default dict }}
+      {{- $serviceAccountCreate := true }}
+      {{- if hasKey $serviceAccount "create" }}{{- $serviceAccountCreate = get 
$serviceAccount "create" }}{{- end }}
+      automountServiceAccountToken: {{ get $serviceAccount 
"automountServiceAccountToken" | default false }}
+      {{- if get $serviceAccount "name" | default "" }}
+      serviceAccountName: {{ get $serviceAccount "name" }}
+      {{- else if $serviceAccountCreate }}
+      serviceAccountName: {{ include "hugegraph.rag.name" . }}
+      {{- else }}
+      serviceAccountName: default
+      {{- end }}
+      {{- if hasKey $rag "terminationGracePeriodSeconds" }}
+      terminationGracePeriodSeconds: {{ get $rag 
"terminationGracePeriodSeconds" }}
+      {{- end }}
+      {{- with get $rag "priorityClassName" }}
+      priorityClassName: {{ . | quote }}
+      {{- end }}
+      {{- with get $rag "nodeSelector" }}
+      nodeSelector:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with get $rag "tolerations" }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with get $rag "topologySpreadConstraints" }}
+      topologySpreadConstraints:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with get $rag "affinity" }}
+      affinity:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with get $rag "podSecurityContext" }}
+      securityContext:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.imagePullSecrets }}
+      imagePullSecrets:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- if $persistenceEnabled }}
+      initContainers:
+        - name: seed-resources
+          image: {{ include "hugegraph.rag.image" . | quote }}
+          imagePullPolicy: {{ get (get $rag "image" | default dict) 
"pullPolicy" | default "Always" }}
+          command: ["/bin/sh", "-ec"]
+          args:
+            - |
+              cp -a -n /home/work/hugegraph-llm/src/hugegraph_llm/resources/. 
/data/
+              touch /data/.hugegraph-rag-seeded
+          {{- with get $rag "securityContext" }}
+          securityContext:
+            {{- toYaml . | nindent 12 }}
+          {{- end }}
+          resources:
+            {{- toYaml (get $rag "initResources" | default dict) | nindent 12 
}}
+          volumeMounts:
+            - name: data
+              mountPath: /data
+      {{- end }}
+      containers:
+        - name: rag
+          image: {{ include "hugegraph.rag.image" . | quote }}
+          imagePullPolicy: {{ get (get $rag "image" | default dict) 
"pullPolicy" | default "Always" }}
+          {{- with get $rag "securityContext" }}
+          securityContext:
+            {{- toYaml . | nindent 12 }}
+          {{- end }}
+          ports:
+            - name: http
+              containerPort: {{ include "hugegraph.rag.port" . }}

Review Comment:
   Please align the configured port with the application listener.
   
   `rag.port` changes this declared container port, the Service target and the 
named probe port, but this Deployment does not change the application 
arguments. The [official hugegraph-ai source Dockerfile at 
1cfad720](https://github.com/hugegraph/hugegraph-ai/blob/1cfad720/docker/Dockerfile.llm#L50-L56)
 starts the application with `--port 8001`. A non-default `rag.port` therefore 
mismatches an image built from that source. Pass the listener argument through 
to the application, or separate the Service port from a fixed listener port.
   
   This is a static finding for that inspected source version; the mutable 
latest image and Kubernetes behavior were not inspected or run, and this is not 
a proven cause of current CI failures.



##########
helm/hugegraph/tests/rag_component_test.yaml:
##########
@@ -0,0 +1,155 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+suite: Optional RAG component
+tests:
+  - it: renders no RAG deployment while the component is disabled
+    template: rag-deployment.yaml
+    asserts:
+      - hasDocuments:
+          count: 0
+
+  - it: connects an enabled RAG pod to the same-release Server service
+    template: rag-deployment.yaml
+    set:
+      rag.enabled: true

Review Comment:
   Please load the RAG overlay for enabled test fixtures.
   
   The enabled cases set only `rag.enabled`, but the root chart values do not 
supply the overlay's RAG defaults. [Validation requires an image 
repository](https://github.com/apache/hugegraph/blob/4b10f1f72311b0bc41823149189dadb717c9f61d/helm/hugegraph/templates/_rag.tpl#L107-L120),
 so these cases cannot reach their success assertions. The [provider Secret 
example](https://github.com/apache/hugegraph/blob/4b10f1f72311b0bc41823149189dadb717c9f61d/helm/hugegraph/docs/rag.md#L51-L65)
 likewise omits the overlay and fails validation. Load `values-rag.yaml` or 
supply complete fixtures, and update the example to include it.
   
   This is a static finding; Helm was not run and this is not a proven cause of 
the current CI failures.



-- 
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]

Reply via email to