Open ghost opened 5 years ago
another approach i was following in my own chart was to use the headless service direct adressing feature :
- name: "ZK_HOST"
value: "solr-cloud-zookeeper-0.solr-cloud-zookeeper-headless:2181,solr-cloud-zookeeper-1.solr-cloud-zookeeper-headless:2181,solr-cloud-zookeeper-2.solr-cloud-zookeeper-headless:2181"
So it can just be a for loop in helm templating i guess.
I’ve done this same thing for now. But it would be good if the chart supported this so zookeeper doesn’t show as a red status with just the one headless service.
I’ve also added node selectors so we can run solr in the same cluster, but in a node pool.
https://github.com/helm/charts/pull/17515
Showing red status is an issue in Solr, will be filing a bug. Please use the headless service, so solr can switch IP quickly and does not go down for a few minutes. The K8s loadbalancer is slow to change server.
I have created custom function "zoo-pods" in file: charts/solr/charts/zookeeper/templates/_helpers.tpl and include that function in solr stateful template. There is no harding coding of zookeeper pod name and its count.
file: charts/solr/charts/zookeeper/templates/_helpers.tpl
{{- define "zoo-pods" -}} {{- $podCount := .Values.zookeeper.replicaCount | int }} {{- range $index0 := until $podCount -}} {{- $index1 := $index0 | add1 -}} {{ include "zookeeper.fullname" $ }}-zookeeper-{{ $index0 }}.{{ include "solr.zookeeper-service-name" $ }}:2181{{ if ne $index1 $podCount }},{{ end }} {{- end -}} {{- end -}}
charts/solr/templates/statefulset.yaml
`
I have created custom function "zoo-pods" in the helper file and included that function in solr stateful template. It will avoid future issue of increasing replica count of zookeeper.
{{- define "zoo-pods" -}}
{{- $podCount := .Values.zookeeper.replicaCount | int }}
{{- range $index0 := until $podCount -}}
{{- $index1 := $index0 | add1 -}}
{{ include "zookeeper.fullname" $ }}-zookeeper-{{ $index0 }}.{{ include "solr.zookeeper-service-name" $ }}:2181{{ if ne $index1 $podCount }},{{ end }}
{{- end -}}
{{- end -}}
charts/solr/templates/statefulset.yaml
- name: "ZK_HOST"
value: "{{ template "zoo-pods" . }}"
I have created custom function "zoo-pods" in the helper file and included that function in solr stateful template. It will avoid future issue of increasing replica count of zookeeper.
{{- define "zoo-pods" -}} {{- $podCount := .Values.zookeeper.replicaCount | int }} {{- range $index0 := until $podCount -}} {{- $index1 := $index0 | add1 -}} {{ include "zookeeper.fullname" $ }}-zookeeper-{{ $index0 }}.{{ include "solr.zookeeper-service-name" $ }}:2181{{ if ne $index1 $podCount }},{{ end }} {{- end -}} {{- end -}}
charts/solr/templates/statefulset.yaml
- name: "ZK_HOST" value: "{{ template "zoo-pods" . }}"
Follow your method zk status For input string: "null"
@loginvarun
Right now it seems as though this chart only creates 1 service for zookeeper and because of this if you have one of the pods fail for zookeeper and its the leader, solr goes down for a few minutes.
I suggest having the chart create 3 services, 1 per zookeeper pod and then update the zkhosts accordingly.
Each service could be similar to the one below.