Copilot commented on code in PR #17946:
URL: https://github.com/apache/pinot/pull/17946#discussion_r2978235893


##########
helm/pinot/templates/zookeeper/statefulset.yaml:
##########
@@ -0,0 +1,201 @@
+#
+# 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.
+#
+
+{{- if .Values.zookeeper.enabled }}
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: {{ include "pinot.zookeeper.fullname" . }}
+  namespace: {{ include "pinot.namespace" . }}
+  labels:
+    {{- include "pinot.zookeeperLabels" . | nindent 4 }}
+spec:
+  selector:
+    matchLabels:
+      {{- include "pinot.zookeeperMatchLabels" . | nindent 6 }}
+  serviceName: {{ include "pinot.zookeeper.headless" . }}
+  replicas: {{ .Values.zookeeper.replicaCount }}
+  updateStrategy:
+    type: RollingUpdate
+  podManagementPolicy: Parallel
+  template:
+    metadata:
+      labels:
+        {{- include "pinot.zookeeperLabels" . | nindent 8 }}
+      {{- with .Values.zookeeper.podAnnotations }}
+      annotations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+    spec:
+      terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds 
}}
+      serviceAccountName: {{ include "pinot.serviceAccountName" . }}
+      {{- with .Values.imagePullSecrets }}
+      imagePullSecrets:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.zookeeper.nodeSelector }}
+      nodeSelector:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.zookeeper.affinity }}
+      affinity:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.zookeeper.tolerations }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.zookeeper.podSecurityContext }}
+      securityContext:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      containers:
+      - name: zookeeper
+        image: "{{ .Values.zookeeper.image.repository }}:{{ 
.Values.zookeeper.image.tag }}"
+        imagePullPolicy: {{ .Values.zookeeper.image.pullPolicy }}
+        {{- with .Values.zookeeper.containerSecurityContext }}
+        securityContext:
+          {{- toYaml . | nindent 10 }}
+        {{- end }}
+        env:
+          - name: ZOO_SERVERS
+            value: {{ include "pinot.zookeeper.servers" . | quote }}
+          - name: ZOO_TICK_TIME
+            value: {{ .Values.zookeeper.tickTime | default 2000 | quote }}
+          - name: ZOO_INIT_LIMIT
+            value: {{ .Values.zookeeper.initLimit | default 10 | quote }}
+          - name: ZOO_SYNC_LIMIT
+            value: {{ .Values.zookeeper.syncLimit | default 5 | quote }}
+          - name: ZOO_MAX_CLIENT_CNXNS
+            value: {{ .Values.zookeeper.maxClientCnxns | default 60 | quote }}
+          - name: ZOO_AUTOPURGE_PURGE_INTERVAL
+            value: {{ .Values.zookeeper.autopurge.purgeInterval | default 1 | 
quote }}
+          - name: ZOO_AUTOPURGE_SNAP_RETAIN_COUNT
+            value: {{ .Values.zookeeper.autopurge.snapRetainCount | default 5 
| quote }}
+          - name: JVMFLAGS
+            value: "-Xmx{{ .Values.zookeeper.heapSize }}m -Xms{{ 
.Values.zookeeper.heapSize }}m {{ .Values.zookeeper.jvmFlags }}"
+          - name: ZOO_4LW_COMMANDS_WHITELIST
+            value: {{ .Values.zookeeper.fourLetterWordsWhitelist | default 
"srvr,mntr,ruok,conf" | quote }}
+          - name: ZOO_ADMINSERVER_ENABLED
+            value: {{ .Values.zookeeper.adminServer.enabled | default false | 
quote }}
+          {{- if .Values.zookeeper.adminServer.enabled }}
+          - name: ZOO_ADMINSERVER_PORT
+            value: {{ .Values.zookeeper.adminServer.port | default 8080 | 
quote }}
+          {{- end }}
+          {{- with .Values.zookeeper.extraEnv }}
+          {{- toYaml . | nindent 10 }}
+          {{- end }}
+        command:
+          - bash
+          - -c
+          - |
+            # The official ZooKeeper image uses 1-based IDs, but pod-index is 
0-based
+            HOST=$(hostname -s)
+            if [[ $HOST =~ (.*)-([0-9]+)$ ]]; then
+              export ZOO_MY_ID=$(( ${BASH_REMATCH[2]} + 1 ))
+            else
+              echo "Failed to extract ordinal from hostname $HOST"
+              exit 1
+            fi
+            exec /docker-entrypoint.sh zkServer.sh start-foreground
+        ports:
+          - name: client
+            containerPort: {{ .Values.zookeeper.port }}
+          - name: follower
+            containerPort: 2888
+          - name: election
+            containerPort: 3888
+          {{- if .Values.zookeeper.adminServer.enabled }}
+          - name: admin
+            containerPort: {{ .Values.zookeeper.adminServer.port | default 
8080 }}
+          {{- end }}
+        {{- if .Values.zookeeper.probes.livenessEnabled }}
+        livenessProbe:
+          exec:
+            command:
+              - bash
+              - -c
+              - echo ruok | nc localhost {{ .Values.zookeeper.port }} | grep 
imok

Review Comment:
   The probes depend on `nc` (netcat) being present in the ZooKeeper image and 
can be flaky if `nc` behavior differs or blocks. To improve reliability, use a 
probe approach that doesn’t rely on `nc` being installed (or explicitly ensure 
the image contains it), and/or add explicit connect/quit timeouts so the 
command fails fast within `timeoutSeconds`.



##########
helm/index.yaml:
##########
@@ -1,6 +1,29 @@
 apiVersion: v1
 entries:
   pinot:
+  - apiVersion: v1
+    appVersion: 1.0.0
+    created: "2026-03-23T13:15:00.162224-07:00"
+    description: Apache Pinot is a realtime distributed OLAP datastore, which 
is used
+      to deliver scalable real time analytics with low latency. It can ingest 
data
+      from offline data sources (such as Hadoop and flat files) as well as 
online
+      sources (such as Kafka). Pinot is designed to scale horizontally.

Review Comment:
   The `pinot-1.0.0` entry description in `helm/index.yaml` doesn’t match the 
updated `Chart.yaml` description introduced by this PR. Since `index.yaml` is a 
published metadata surface, regenerate it from the packaged chart (e.g., via 
`helm package` + `helm repo index`) so the entry reflects the actual chart 
metadata.
   ```suggestion
         sources (such as Kafka).
   ```



##########
helm/pinot/templates/zookeeper/statefulset.yaml:
##########
@@ -0,0 +1,201 @@
+#
+# 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.
+#
+
+{{- if .Values.zookeeper.enabled }}
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: {{ include "pinot.zookeeper.fullname" . }}
+  namespace: {{ include "pinot.namespace" . }}
+  labels:
+    {{- include "pinot.zookeeperLabels" . | nindent 4 }}
+spec:
+  selector:
+    matchLabels:
+      {{- include "pinot.zookeeperMatchLabels" . | nindent 6 }}
+  serviceName: {{ include "pinot.zookeeper.headless" . }}
+  replicas: {{ .Values.zookeeper.replicaCount }}
+  updateStrategy:
+    type: RollingUpdate
+  podManagementPolicy: Parallel
+  template:
+    metadata:
+      labels:
+        {{- include "pinot.zookeeperLabels" . | nindent 8 }}
+      {{- with .Values.zookeeper.podAnnotations }}
+      annotations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+    spec:
+      terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds 
}}
+      serviceAccountName: {{ include "pinot.serviceAccountName" . }}
+      {{- with .Values.imagePullSecrets }}
+      imagePullSecrets:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.zookeeper.nodeSelector }}
+      nodeSelector:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.zookeeper.affinity }}
+      affinity:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.zookeeper.tolerations }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.zookeeper.podSecurityContext }}
+      securityContext:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      containers:
+      - name: zookeeper
+        image: "{{ .Values.zookeeper.image.repository }}:{{ 
.Values.zookeeper.image.tag }}"
+        imagePullPolicy: {{ .Values.zookeeper.image.pullPolicy }}
+        {{- with .Values.zookeeper.containerSecurityContext }}
+        securityContext:
+          {{- toYaml . | nindent 10 }}
+        {{- end }}
+        env:
+          - name: ZOO_SERVERS
+            value: {{ include "pinot.zookeeper.servers" . | quote }}
+          - name: ZOO_TICK_TIME
+            value: {{ .Values.zookeeper.tickTime | default 2000 | quote }}
+          - name: ZOO_INIT_LIMIT
+            value: {{ .Values.zookeeper.initLimit | default 10 | quote }}
+          - name: ZOO_SYNC_LIMIT
+            value: {{ .Values.zookeeper.syncLimit | default 5 | quote }}
+          - name: ZOO_MAX_CLIENT_CNXNS
+            value: {{ .Values.zookeeper.maxClientCnxns | default 60 | quote }}
+          - name: ZOO_AUTOPURGE_PURGE_INTERVAL
+            value: {{ .Values.zookeeper.autopurge.purgeInterval | default 1 | 
quote }}
+          - name: ZOO_AUTOPURGE_SNAP_RETAIN_COUNT
+            value: {{ .Values.zookeeper.autopurge.snapRetainCount | default 5 
| quote }}
+          - name: JVMFLAGS
+            value: "-Xmx{{ .Values.zookeeper.heapSize }}m -Xms{{ 
.Values.zookeeper.heapSize }}m {{ .Values.zookeeper.jvmFlags }}"
+          - name: ZOO_4LW_COMMANDS_WHITELIST
+            value: {{ .Values.zookeeper.fourLetterWordsWhitelist | default 
"srvr,mntr,ruok,conf" | quote }}
+          - name: ZOO_ADMINSERVER_ENABLED
+            value: {{ .Values.zookeeper.adminServer.enabled | default false | 
quote }}
+          {{- if .Values.zookeeper.adminServer.enabled }}
+          - name: ZOO_ADMINSERVER_PORT
+            value: {{ .Values.zookeeper.adminServer.port | default 8080 | 
quote }}
+          {{- end }}
+          {{- with .Values.zookeeper.extraEnv }}
+          {{- toYaml . | nindent 10 }}
+          {{- end }}
+        command:
+          - bash
+          - -c
+          - |
+            # The official ZooKeeper image uses 1-based IDs, but pod-index is 
0-based
+            HOST=$(hostname -s)
+            if [[ $HOST =~ (.*)-([0-9]+)$ ]]; then
+              export ZOO_MY_ID=$(( ${BASH_REMATCH[2]} + 1 ))
+            else
+              echo "Failed to extract ordinal from hostname $HOST"
+              exit 1
+            fi
+            exec /docker-entrypoint.sh zkServer.sh start-foreground
+        ports:
+          - name: client
+            containerPort: {{ .Values.zookeeper.port }}
+          - name: follower
+            containerPort: 2888
+          - name: election
+            containerPort: 3888
+          {{- if .Values.zookeeper.adminServer.enabled }}
+          - name: admin
+            containerPort: {{ .Values.zookeeper.adminServer.port | default 
8080 }}
+          {{- end }}
+        {{- if .Values.zookeeper.probes.livenessEnabled }}
+        livenessProbe:
+          exec:
+            command:
+              - bash
+              - -c
+              - echo ruok | nc localhost {{ .Values.zookeeper.port }} | grep 
imok
+          initialDelaySeconds: {{ 
.Values.zookeeper.probes.liveness.initialDelaySeconds | default 30 }}
+          periodSeconds: {{ .Values.zookeeper.probes.liveness.periodSeconds | 
default 10 }}
+          timeoutSeconds: {{ .Values.zookeeper.probes.liveness.timeoutSeconds 
| default 5 }}
+          failureThreshold: {{ 
.Values.zookeeper.probes.liveness.failureThreshold | default 6 }}
+        {{- end }}
+        {{- if .Values.zookeeper.probes.readinessEnabled }}
+        readinessProbe:
+          exec:
+            command:
+              - bash
+              - -c
+              - echo ruok | nc localhost {{ .Values.zookeeper.port }} | grep 
imok

Review Comment:
   The probes depend on `nc` (netcat) being present in the ZooKeeper image and 
can be flaky if `nc` behavior differs or blocks. To improve reliability, use a 
probe approach that doesn’t rely on `nc` being installed (or explicitly ensure 
the image contains it), and/or add explicit connect/quit timeouts so the 
command fails fast within `timeoutSeconds`.



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