github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/thanos/templates/storegateway/service-sharded.yaml (about)

     1  {{- if and .Values.storegateway.enabled .Values.storegateway.sharded.enabled }}
     2  
     3  {{- $shards := int 0 }}
     4  {{- if .Values.storegateway.sharded.hashPartitioning.shards }}
     5    {{- $shards = int .Values.storegateway.sharded.hashPartitioning.shards }}
     6  {{- else }}
     7    {{- $shards = len .Values.storegateway.sharded.timePartitioning }}
     8  {{- end }}
     9  
    10  {{- range $index, $_ := until $shards }}
    11  apiVersion: v1
    12  kind: Service
    13  metadata:
    14    {{- $svcNamePrefix := printf "%s-storegateway" (include "common.names.fullname" $) | trunc 61 | trimSuffix "-" }}
    15    name: {{ printf "%s-%s" $svcNamePrefix (toString $index) }}
    16    namespace: {{ $.Release.Namespace | quote }}
    17    labels: {{- include "common.labels.standard" $ | nindent 4 }}
    18      app.kubernetes.io/component: storegateway
    19      shard: {{ $index | quote }}
    20      {{- if and $.Values.metrics.enabled $.Values.metrics.serviceMonitor.enabled }}
    21      prometheus-operator/monitor: 'true'
    22      {{- end }}
    23      {{- if $.Values.commonLabels }}
    24      {{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }}
    25      {{- end }}
    26    annotations:
    27      {{- if $.Values.commonAnnotations }}
    28      {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
    29      {{- end }}
    30      {{- if $.Values.storegateway.service.annotations }}
    31      {{- include "common.tplvalues.render" (dict "value" $.Values.storegateway.service.annotations "context" $) | nindent 4 }}
    32      {{- end }}
    33  spec:
    34    type: {{ $.Values.storegateway.service.type }}
    35    {{- if ne "false" (include "thanos.validateValues.storegateway.sharded.length" (dict "property" $.Values.storegateway.sharded.service.clusterIPs "context" $) ) }}
    36    clusterIP: {{ index $.Values.storegateway.sharded.service.clusterIPs $index }}
    37    {{- end }}
    38    {{- if ne $.Values.storegateway.service.type "ClusterIP" }}
    39    externalTrafficPolicy: {{ $.Values.storegateway.service.externalTrafficPolicy }}
    40    {{- end }}
    41    {{- if ne "false" (include "thanos.validateValues.storegateway.sharded.length" (dict "property" $.Values.storegateway.sharded.service.loadBalancerIPs "context" $) ) }}
    42    loadBalancerIP: {{ $.Values.storegateway.sharded.service.loadBalancerIPs }}
    43    {{- end }}
    44    {{- if and (eq $.Values.storegateway.service.type "LoadBalancer") $.Values.storegateway.service.loadBalancerSourceRanges }}
    45    loadBalancerSourceRanges: {{- toYaml $.Values.storegateway.service.loadBalancerSourceRanges | nindent 4 }}
    46    {{- end }}
    47    ports:
    48      - port: {{ if $.Values.storegateway.service.http }}{{ coalesce $.Values.storegateway.service.ports.http $.Values.storegateway.service.http.port }}{{ else }}{{ $.Values.storegateway.service.ports.http }}{{ end }}
    49        targetPort: http
    50        protocol: TCP
    51        name: http
    52        {{- if ne "false" (include "thanos.validateValues.storegateway.sharded.length" (dict "property" $.Values.storegateway.sharded.service.http.nodePorts "context" $) ) }}
    53        nodePort: {{ index $.Values.storegateway.sharded.service.http.nodePorts $index }}
    54        {{- else if eq $.Values.storegateway.service.type "ClusterIP" }}
    55        nodePort: null
    56        {{- end }}
    57      - port: {{ if $.Values.storegateway.service.grpc }}{{ coalesce $.Values.storegateway.service.ports.grpc $.Values.storegateway.service.grpc.port }}{{ else }}{{ $.Values.storegateway.service.ports.grpc }}{{ end }}
    58        targetPort: grpc
    59        protocol: TCP
    60        name: grpc
    61        {{- if ne "false" (include "thanos.validateValues.storegateway.sharded.length" (dict "property" $.Values.storegateway.sharded.service.grpc.nodePorts "context" $) ) }}
    62        nodePort: {{ index $.Values.storegateway.sharded.service.grpc.nodePorts $index }}
    63        {{- else if eq $.Values.storegateway.service.type "ClusterIP" }}
    64        nodePort: null
    65        {{- end }}
    66      {{- if $.Values.storegateway.service.extraPorts }}
    67      {{- include "common.tplvalues.render" (dict "value" $.Values.storegateway.service.extraPorts "context" $) | nindent 4 }}
    68      {{- end }}
    69    selector:
    70      {{- if $.Values.storegateway.service.labelSelectorsOverride }}
    71      {{- include "common.tplvalues.render" (dict "value" $.Values.storegateway.service.labelSelectorsOverride "context" $) | nindent 4 }}
    72      {{- else }}
    73      {{- include "common.labels.matchLabels" $ | nindent 4 }}
    74      app.kubernetes.io/component: storegateway
    75      shard: {{ $index | quote }}
    76      {{- end }}
    77  ---
    78  {{- end }}
    79  {{- end }}