Copilot commented on code in PR #17538:
URL: https://github.com/apache/pinot/pull/17538#discussion_r2710630032
##########
helm/pinot/values.yaml:
##########
@@ -631,6 +631,11 @@ minion:
configs: |-
pinot.set.instance.id.to.hostname=true
+ pdb:
+ enabled: false
+ minAvailable: ""
Review Comment:
Setting `minAvailable` to an empty string by default while `maxUnavailable`
is set to 1 may cause confusion. When both are specified in the template,
Kubernetes will reject the PDB as these fields are mutually exclusive. Consider
either removing the `minAvailable` field entirely from the default
configuration or adding a comment explaining that users should set only one of
these fields.
```suggestion
# NOTE: Kubernetes PodDisruptionBudgets treat minAvailable and
maxUnavailable as mutually exclusive.
# Set only one of them. By default, this chart uses maxUnavailable.
# minAvailable: 1
```
##########
helm/pinot/templates/minion-stateless/poddisruptionbudget.yaml:
##########
@@ -0,0 +1,36 @@
+#
+# 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.minionStateless.pdb.enabled }}
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+ name: {{ include "pinot.minionStateless.fullname" . }}
+ namespace: {{ include "pinot.namespace" . }}
+spec:
+ {{- if .Values.minionStateless.pdb.minAvailable }}
+ minAvailable: {{ .Values.minionStateless.pdb.minAvailable }}
+ {{- end }}
+ {{- if .Values.minionStateless.pdb.maxUnavailable }}
+ maxUnavailable: {{ .Values.minionStateless.pdb.maxUnavailable }}
+ {{- end }}
Review Comment:
The template allows both `minAvailable` and `maxUnavailable` to be rendered
simultaneously. Kubernetes PodDisruptionBudgets require exactly one of these
fields, not both. Add logic to ensure only one is specified, or add validation
to prevent users from setting both values.
```suggestion
{{- $pdb := .Values.minionStateless.pdb }}
{{- if and $pdb.minAvailable $pdb.maxUnavailable }}
{{- fail "minionStateless.pdb: specify only one of minAvailable or
maxUnavailable" }}
{{- end }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "pinot.minionStateless.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
spec:
{{- if $pdb.minAvailable }}
minAvailable: {{ $pdb.minAvailable }}
{{- else if $pdb.maxUnavailable }}
maxUnavailable: {{ $pdb.maxUnavailable }}
{{- end }}
```
##########
helm/pinot/values.yaml:
##########
@@ -736,6 +741,11 @@ minionStateless:
configs: |-
pinot.set.instance.id.to.hostname=true
+ pdb:
+ enabled: false
+ minAvailable: ""
Review Comment:
Setting `minAvailable` to an empty string by default while `maxUnavailable`
is set to 1 may cause confusion. When both are specified in the template,
Kubernetes will reject the PDB as these fields are mutually exclusive. Consider
either removing the `minAvailable` field entirely from the default
configuration or adding a comment explaining that users should set only one of
these fields.
```suggestion
# In a PodDisruptionBudget, only one of minAvailable or maxUnavailable
may be set.
# By default we use maxUnavailable; override this section carefully if
you prefer minAvailable.
```
##########
helm/pinot/templates/minion/poddisruptionbudget.yaml:
##########
@@ -0,0 +1,36 @@
+#
+# 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.minion.pdb.enabled }}
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+ name: {{ include "pinot.minion.fullname" . }}
+ namespace: {{ include "pinot.namespace" . }}
+spec:
+ {{- if .Values.minion.pdb.minAvailable }}
+ minAvailable: {{ .Values.minion.pdb.minAvailable }}
+ {{- end }}
+ {{- if .Values.minion.pdb.maxUnavailable }}
+ maxUnavailable: {{ .Values.minion.pdb.maxUnavailable }}
Review Comment:
The template allows both `minAvailable` and `maxUnavailable` to be rendered
simultaneously. Kubernetes PodDisruptionBudgets require exactly one of these
fields, not both. Add logic to ensure only one is specified, or add validation
to prevent users from setting both values.
```suggestion
{{- if and .Values.minion.pdb.minAvailable
.Values.minion.pdb.maxUnavailable }}
{{- fail "Exactly one of minion.pdb.minAvailable or
minion.pdb.maxUnavailable must be set when minion.pdb.enabled is true" }}
{{- else if .Values.minion.pdb.minAvailable }}
minAvailable: {{ .Values.minion.pdb.minAvailable }}
{{- else if .Values.minion.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.minion.pdb.maxUnavailable }}
{{- else }}
{{- fail "You must set either minion.pdb.minAvailable or
minion.pdb.maxUnavailable when minion.pdb.enabled is true" }}
```
--
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]