Copilot commented on code in PR #17538: URL: https://github.com/apache/pinot/pull/17538#discussion_r2720422838
########## helm/pinot/templates/minion-stateless/poddisruptionbudget.yaml: ########## @@ -0,0 +1,41 @@ +# +# 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. +# + +{{- $pdb := .Values.minionStateless.pdb }} + +{{- if $pdb.enabled }} +{{- 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 }} Review Comment: The template creates an invalid PDB when both `minAvailable` and `maxUnavailable` are undefined. After the mutual exclusion check passes (neither or only one is set), if a user sets `enabled: true` without specifying either field, the spec will have no disruption constraint, which is invalid for a PDB. Add validation to ensure at least one field is set when `enabled` is true. ########## helm/pinot/templates/minion/poddisruptionbudget.yaml: ########## @@ -0,0 +1,41 @@ +# +# 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. +# + +{{- $pdb := .Values.minion.pdb }} + +{{- if $pdb.enabled }} +{{- if and $pdb.minAvailable $pdb.maxUnavailable }} +{{- fail "minion.pdb: specify only one of minAvailable or maxUnavailable" }} +{{- end }} + +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "pinot.minion.fullname" . }} + namespace: {{ include "pinot.namespace" . }} +spec: + {{- if $pdb.minAvailable }} + minAvailable: {{ $pdb.minAvailable }} + {{- else if $pdb.maxUnavailable }} + maxUnavailable: {{ $pdb.maxUnavailable }} + {{- end }} Review Comment: The template creates an invalid PDB when both `minAvailable` and `maxUnavailable` are undefined. After the mutual exclusion check passes (neither or only one is set), if a user sets `enabled: true` without specifying either field, the spec will have no disruption constraint, which is invalid for a PDB. Add validation to ensure at least one field is set when `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]
