diff --git a/helm/config/dataone-indexer.properties b/helm/config/dataone-indexer.properties index 57cb921e..9f84f2cc 100644 --- a/helm/config/dataone-indexer.properties +++ b/helm/config/dataone-indexer.properties @@ -5,7 +5,7 @@ index.tdb.directory={{ .Values.idxworker.tripleDbDirectory }} #The section for the rabbitMQ configuration index.rabbitmq.hostname={{ include "idxworker.rabbitmq.hostname" . }} -index.rabbitmq.hostport={{ default .Values.rabbitmq.service.ports.amqp .Values.rabbitmq.hostport }} +index.rabbitmq.hostport={{- include "idxworker.rabbitmq.hostport" . }} index.rabbitmq.username={{ .Values.rabbitmq.auth.username }} ## index.rabbitmq.password will be read from RABBITMQ_PASSWORD env var index.rabbitmq.password=${env:RABBITMQ_PASSWORD} diff --git a/helm/templates/NOTES.txt b/helm/templates/NOTES.txt index 40f62ce5..79c53e72 100644 --- a/helm/templates/NOTES.txt +++ b/helm/templates/NOTES.txt @@ -4,19 +4,20 @@ APP VERSION: {{ .Chart.AppVersion }} ** Please be patient while the chart is being deployed ** + RABBITMQ: ========= Credentials: echo "Username: {{ .Values.rabbitmq.auth.username }}" - echo "Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ .Values.rabbitmq.auth.existingPasswordSecret }} -o jsonpath="{.data.rabbitmq-password}" | base64 -d)" + echo "To get password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ .Values.rabbitmq.auth.existingPasswordSecret }} -o jsonpath="{.data.rabbitmq-password}" | base64 -d)" -Note that the credentials are saved in persistent volume claims and will not be changed upon upgrade or reinstallation unless the persistent volume claim has been deleted. If this is not the first installation of this chart, the credentials may not be valid. +IMPORTANT NOTE: the credentials are saved in persistent volume claims and will not be changed upon upgrade or re-installation unless the persistent volume claim has been deleted. If this is not the first installation of this chart, the credentials may not be valid. This is applicable when no passwords are set and therefore the random password is autogenerated. In case of using a fixed password, you should specify it when upgrading. More information about the credentials may be found at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases. -{{- $rmqHostPort := default .Values.rabbitmq.service.ports.amqp .Values.rabbitmq.hostport -}} +{{- $rmqHostPort := include "idxworker.rabbitmq.hostport" . -}} RabbitMQ can be accessed within the cluster on port {{ $rmqHostPort }} at {{ include "idxworker.rabbitmq.hostname" . }} @@ -37,12 +38,13 @@ Then, open the obtained URL in a browser. {{- end }} + SOLR: ===== Solr can be accessed via port {{ .Values.global.solrPort }} on the following DNS name from within your cluster: - {{ .Values.solr.hostname }}:{{ .Values.global.solrPort }} + {{ include "idxworker.solr.hostname" . }}:{{ .Values.global.solrPort }} {{- if .Values.solr.auth.enabled }} diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index c79413eb..66962069 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -63,14 +63,17 @@ Create the name of the service account to use {{/* set MN url -e.g. https://metacat-dev.test.dataone.org/metacat/d1/mn +If we're running as a subchart, can use direct access without needing to go through ingress/https; + e.g. http://metacatbrooke-hl:8080/metacat/d1/mn +If connecting to an instance outside the cluster, should use https; + e.g. https://metacat-dev.test.dataone.org/metacat/d1/mn */}} {{- define "idxworker.mn.url" -}} -{{- if not .Values.idxworker.mn_url }} -{{- printf "https://%s-metacat-hl/%s/d1/mn" .Release.Name .Values.global.metacatAppContext }} -{{- else }} -{{- .Values.idxworker.mn_url }} +{{- $mn_url := .Values.idxworker.mn_url }} +{{- if not $mn_url }} +{{- $mn_url = printf "http://%s-hl:8080/%s/d1/mn" .Release.Name .Values.global.metacatAppContext }} {{- end }} +{{- $mn_url }} {{- end }} {{/* @@ -79,31 +82,49 @@ Either use the value set in .Values.persistence.claimName, or if blank, autopopu {podname}-metacat-{releaseName}-0 (e.g. metacatbrooke-metacat-metacatbrooke-0) */}} {{- define "idxworker.shared.claimName" -}} -{{- if not .Values.persistence.claimName }} -{{- .Release.Name }}-metacat-{{- .Release.Name }}-0 -{{- else }} -{{- .Values.persistence.claimName }} +{{- $claimName := .Values.persistence.claimName }} +{{- if not $claimName }} +{{- $claimName = .Release.Name }}-metacat-{{- .Release.Name }}-0 {{- end }} +{{- $claimName }} {{- end }} +{{/* +Check if RabbitMQ SubChart is enabled +*/}} +{{- define "rmq.enabled" -}} +{{ $rmqEnabled := (or (((.Values.global).rabbitmq).enabled) ((.Values.rabbitmq).enabled)) }} +{{ end }} + {{/* set RabbitMQ HostName */}} {{- define "idxworker.rabbitmq.hostname" -}} -{{- if not .Values.rabbitmq.hostname }} -{{- .Release.Name }}-rabbitmq-headless -{{- else }} -{{- .Values.rabbitmq.hostname }} +{{- $rmqHost := .Values.idxworker.rabbitmqHostname }} +{{- if and (include "rmq.enabled" .) (not $rmqHost) -}} +{{- $rmqHost = printf "%s-rabbitmq-headless" .Release.Name -}} {{- end }} +{{- $rmqHost }} +{{- end }} + +{{/* +set RabbitMQ HostPort +*/}} +{{- define "idxworker.rabbitmq.hostport" }} +{{- $rmqPort := .Values.idxworker.rabbitmqHostPort }} +{{- if and (include "rmq.enabled" .) (not $rmqPort) -}} +{{ $rmqPort = .Values.rabbitmq.service.ports.amqp }} +{{- end }} +{{- $rmqPort }} {{- end }} {{/* set Solr HostName */}} {{- define "idxworker.solr.hostname" -}} -{{- if not .Values.solr.hostname }} -{{- .Release.Name }}-solr-headless -{{- else }} -{{- .Values.solr.hostname }} +{{- $solrHost := .Values.idxworker.solrHostname }} +{{- if and (or (((.Values.global).solr).enabled) ((.Values.solr).enabled)) (not $solrHost) -}} + {{- $solrHost = printf "%s-solr-headless" .Release.Name -}} {{- end }} +{{- $solrHost }} {{- end }} diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 12916ef3..1976c82c 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -85,9 +85,10 @@ spec: - sh - -c - > - until nc -z {{ include "idxworker.rabbitmq.hostname" . }}{{- print " " }} - {{- default .Values.rabbitmq.service.ports.amqp .Values.rabbitmq.hostport }} > - {{- print " " }}/dev/null; do echo waiting for RabbitMQ; sleep 2; done; + HOST="{{ include "idxworker.rabbitmq.hostname" . }}"; + PORT={{ include "idxworker.rabbitmq.hostport" . }}; + until nc -z $HOST $PORT > /dev/null; do + echo waiting for RabbitMQ at $HOST - port $PORT; sleep 1; done; - name: init-solr image: busybox:latest command: diff --git a/helm/values.yaml b/helm/values.yaml index 4c00f3f5..97f48ee9 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -17,6 +17,7 @@ global: ## @param global.ephemeralVolumeStorageClass Optional override of global.storageClass. ## Can be used to assign a storageClass that has a 'Delete' Reclaim Policy, thus allowing ## ephemeral volumes to be cleaned up automatically (eg "csi-cephfs-sc-ephemeral") + ## Comment out to use default StorageClass, if one is set on your cluster ## ephemeralVolumeStorageClass: csi-cephfs-sc-ephemeral @@ -103,6 +104,21 @@ idxworker: ## cn_url: "https://cn.dataone.org/cn" + ## @param idxworker.solrHostname hostname of the solr service to use + ## Leave unset (solrHostname: "") to automatically populate when using solr bitnami subchart + ## + solrHostname: "" + + ## @param idxworker.rabbitmqHostname hostname of the rabbitmq service to use + ## Leave unset (rabbitmqHostname: "") to automatically populate when using rmq bitnami subchart + ## + rabbitmqHostname: "" + + ## @param idxworker.rabbitmqHostPort hostport of the rabbitmq service + ## Leave unset (rabbitmqHostPort: "") to automatically populate when using rmq bitnami subchart + ## + rabbitmqHostPort: "" + ## @param idxworker.data_directory Location of data within the metacat shared volume ## data_directory: /var/metacat/data @@ -119,19 +135,10 @@ idxworker: ## tripleDbDirectory: /etc/dataone/tdb-cache -## @section RabbitMQ Configuration +## @section RabbitMQ Bitnami Sub-Chart Configuration ## rabbitmq: enabled: true - ## @param rabbitmq.hostname (idxworker-specific param): hostname of the rabbitmq service to use - ## Leave this value unset (hostname: "") to have it automatically populated - ## - hostname: "" - ## @param rabbitmq.hostport (idxworker-specific param): hostport of the rabbitmq service - ## Leave this value unset (hostport: "") to have it automatically populated - ## - hostport: "" - persistence: size: 10Gi #replicaCount: 3 @@ -150,9 +157,10 @@ rabbitmq: existingPasswordSecret: "" -## @section Solr Configuration +## @section Solr Bitnami Sub-Chart Configuration ## solr: + enabled: true collection: temp_collection ## @param solr.customCollection (required) name of the solr collection to use @@ -163,11 +171,10 @@ solr: - dataone_core #javaMem: "-Xms512m -Xmx2g" - ## @param solr.hostname (idxworker-specific param): hostname of the solr service to use - ## Leave this value unset (hostname: "") to have it automatically populated - ## - hostname: "" - + containerSecurityContext: + runAsUser: 1000 + persistence: + size: 10Gi service: ports: ## @param solr.service.ports.http: see global.solrPort (required) @@ -183,8 +190,6 @@ solr: ## instead connecting to a solr instance outside the cluster ## enabled: false - persistence: - size: 10Gi extraVolumes: - name: solr-config configMap: @@ -200,5 +205,3 @@ solr: postStart: exec: command: ["/bin/bash", "-c", "/solrconfig/config-solr.sh"] - containerSecurityContext: - runAsUser: 1000