[bitnami/clickhouse] Fix clickhouse external access annotation assignment (#18015)

* fix external access annotation assignment for N shards and M replicas

Signed-off-by: Emmanuel <emmanuelm41@gmail.com>

* update value description

Signed-off-by: Emmanuel <emmanuelm41@gmail.com>

* update docs again

Signed-off-by: Emmanuel <emmanuelm41@gmail.com>

* bump version

Signed-off-by: Emmanuel <emmanuelm41@gmail.com>

---------

Signed-off-by: Emmanuel <emmanuelm41@gmail.com>
This commit is contained in:
Emmanuel
2023-09-20 06:36:52 -03:00
committed by GitHub
parent 68b6f27c8c
commit e5d0d41c98
4 changed files with 7 additions and 5 deletions

View File

@@ -35,4 +35,4 @@ maintainers:
name: clickhouse
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/clickhouse
version: 4.0.1
version: 4.0.2

View File

@@ -248,7 +248,7 @@ The command removes all the Kubernetes components associated with the chart and
| `externalAccess.service.ports.interserver` | ClickHouse service Interserver port | `9009` |
| `externalAccess.service.ports.metrics` | ClickHouse service metrics port | `8001` |
| `externalAccess.service.loadBalancerIPs` | Array of load balancer IPs for each ClickHouse . Length must be the same as replicaCount | `[]` |
| `externalAccess.service.loadBalancerAnnotations` | Array of load balancer annotations for each ClickHouse . Length must be the same as replicaCount | `[]` |
| `externalAccess.service.loadBalancerAnnotations` | Array of load balancer annotations for each ClickHouse . Length must be the same as shards multiplied by replicaCount | `[]` |
| `externalAccess.service.loadBalancerSourceRanges` | Address(es) that are allowed when service is LoadBalancer | `[]` |
| `externalAccess.service.nodePorts.http` | Node port for HTTP | `[]` |
| `externalAccess.service.nodePorts.https` | Node port for HTTPS | `[]` |
@@ -522,4 +522,4 @@ 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.
limitations under the License.

View File

@@ -9,6 +9,8 @@ SPDX-License-Identifier: APACHE-2.0
{{- $totalNodes := mul $shards $replicas }}
{{- range $shard, $e := until $shards }}
{{- range $i, $_e := until $replicas }}
{{- $loadBalancerAnnotationPosOffset := mul $shard $replicas }}
{{- $loadBalancerAnnotationPosition := add $loadBalancerAnnotationPosOffset $i }}
{{- $targetPod := printf "%s-shard%d-%d" (include "common.names.fullname" $) $shard $i }}
apiVersion: v1
kind: Service
@@ -22,7 +24,7 @@ metadata:
{{- if or $.Values.externalAccess.service.annotations $.Values.commonAnnotations $.Values.externalAccess.service.loadBalancerAnnotations }}
annotations:
{{- if and (not (empty $.Values.externalAccess.service.loadBalancerAnnotations)) (eq (len $.Values.externalAccess.service.loadBalancerAnnotations) $totalNodes) }}
{{ include "common.tplvalues.render" ( dict "value" (index $.Values.externalAccess.service.loadBalancerAnnotations $i) "context" $) | nindent 4 }}
{{ include "common.tplvalues.render" ( dict "value" (index $.Values.externalAccess.service.loadBalancerAnnotations $loadBalancerAnnotationPosition) "context" $) | nindent 4 }}
{{- end }}
{{- if $.Values.externalAccess.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" $.Values.externalAccess.service.annotations "context" $) | nindent 4 }}

View File

@@ -740,7 +740,7 @@ externalAccess:
## - Y.Y.Y.Y
##
loadBalancerIPs: []
## @param externalAccess.service.loadBalancerAnnotations Array of load balancer annotations for each ClickHouse . Length must be the same as replicaCount
## @param externalAccess.service.loadBalancerAnnotations Array of load balancer annotations for each ClickHouse . Length must be the same as shards multiplied by replicaCount
## e.g:
## loadBalancerAnnotations:
## - external-dns.alpha.kubernetes.io/hostname: 1.external.example.com.