From 358aeed44a43e2501f79c4e9e79539f8b6acddce Mon Sep 17 00:00:00 2001 From: Francesco de Virgilio Date: Thu, 21 Nov 2024 10:30:47 +0100 Subject: [PATCH 1/3] web: allow for custom service type * It explicitly set the default as `ClusterIP` inside `values.yaml`. --- charts/invenio/templates/web-service.yaml | 1 + charts/invenio/values.yaml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/charts/invenio/templates/web-service.yaml b/charts/invenio/templates/web-service.yaml index 6973872..c38412d 100644 --- a/charts/invenio/templates/web-service.yaml +++ b/charts/invenio/templates/web-service.yaml @@ -15,3 +15,4 @@ spec: targetPort: 8080 selector: app: web + type: {{ .Values.web.service.type }} diff --git a/charts/invenio/values.yaml b/charts/invenio/values.yaml index efc3327..0b6d2cf 100644 --- a/charts/invenio/values.yaml +++ b/charts/invenio/values.yaml @@ -134,6 +134,8 @@ web: cpu: '1' memory: 100Mi annotations: [] + service: + type: ClusterIP worker: enabled: true From ef0735b48a60204808d6f0891651fd9261e70642 Mon Sep 17 00:00:00 2001 From: Francesco de Virgilio Date: Thu, 21 Nov 2024 10:35:51 +0100 Subject: [PATCH 2/3] rabbitmq: allow setting protocol and vhost --- charts/invenio/templates/_helpers.tpl | 28 ++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/charts/invenio/templates/_helpers.tpl b/charts/invenio/templates/_helpers.tpl index 27351c8..340ad7c 100644 --- a/charts/invenio/templates/_helpers.tpl +++ b/charts/invenio/templates/_helpers.tpl @@ -103,6 +103,30 @@ {{- end }} {{- end -}} +########################## RabbitMQ protocol ########################## +{{/* + This template renders the protocol for RabbitMQ. +*/}} +{{- define "invenio.rabbitmq.protocol" -}} + {{- if .Values.rabbitmq.enabled }} + {{- "amqp" }} + {{- else }} + {{- required "Missing .Values.rabbitmqExternal.protocol" .Values.rabbitmqExternal.protocol }} + {{- end }} +{{- end -}} + +########################## RabbitMQ vhost ########################## +{{/* + This template renders the vhost for RabbitMQ. +*/}} +{{- define "invenio.rabbitmq.vhost" -}} + {{- if .Values.rabbitmq.enabled }} + {{- "" }} + {{- else }} + {{- required "Missing .Values.rabbitmqExternal.vhost" .Values.rabbitmqExternal.vhost }} + {{- end }} +{{- end -}} + ########################## Celery broker URI ########################## {{/* This template renders the URI for connecting to RabbitMQ. @@ -112,7 +136,9 @@ {{- $password := (include "invenio.rabbitmq.password" .) -}} {{- $port := (include "invenio.rabbitmq.amqpPort" .) -}} {{- $hostname := (include "invenio.rabbitmq.hostname" .) -}} - {{- printf "amqp://%s:%s@%s:%v/" $username $password $hostname $port }} + {{- $protocol := (include "invenio.rabbitmq.protocol" .) -}} + {{- $vhost := (include "invenio.rabbitmq.vhost" .) -}} + {{- printf "%s://%s:%s@%s:%v/%s" $protocol $username $password $hostname $port $vhost}} {{- end -}} ########################### RabbitMQ API URI ########################### From d77b78da24d2b5d2d642f337dd377dd578969725 Mon Sep 17 00:00:00 2001 From: Francesco de Virgilio Date: Thu, 21 Nov 2024 10:37:34 +0100 Subject: [PATCH 3/3] configmap: avoid duplication of INVENIO_SEARCH_HOSTS --- charts/invenio/templates/invenio-configmap.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/invenio/templates/invenio-configmap.yaml b/charts/invenio/templates/invenio-configmap.yaml index 5175473..b69814b 100644 --- a/charts/invenio/templates/invenio-configmap.yaml +++ b/charts/invenio/templates/invenio-configmap.yaml @@ -11,7 +11,9 @@ data: INVENIO_CELERY_RESULT_BACKEND: 'redis://{{ include "invenio.redis.hostname" . }}:6379/2' INVENIO_RATELIMIT_STORAGE_URL: 'redis://{{ include "invenio.redis.hostname" . }}:6379/3' INVENIO_COMMUNITIES_IDENTITIES_CACHE_REDIS_URL: 'redis://{{ include "invenio.redis.hostname" . }}:6379/4' + {{- if not (hasKey .Values.invenio.extra_config "INVENIO_SEARCH_HOSTS") }} INVENIO_SEARCH_HOSTS: {{ printf "[{'host': '%s'}]" (include "invenio.opensearch.hostname" .) | quote }} + {{- end }} INVENIO_SITE_HOSTNAME: '{{ include "invenio.hostname" $ }}' INVENIO_SITE_UI_URL: 'https://{{ include "invenio.hostname" $ }}' INVENIO_SITE_API_URL: 'https://{{ include "invenio.hostname" $ }}/api'