Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for custom AMQP protocol and external INVENIO_SEARCH_HOSTS #125

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fradeve
Copy link

@fradeve fradeve commented Aug 16, 2024

Description

This PR solves 3 issues with the Helm chart

RabbitMQ protocol can't be customized

The default protocol for RabbitMQ is amqp and can't be edited -- this is probably fine when running RabbitMQ locally, but most hosted RMQ instances will only accept connections on amqps; this PR adds support for a custom protocol when using .Values.rabbitmqExternal; in any other case, amqp is used as a default.

Files affected:

Impossible to define custom Search username, password or port

The easiest way to use an external {Open/Elastic}Search instance is to pass INVENIO_SEARCH_HOSTS in the environment; however, the way INVENIO_SEARCH_HOSTS is set in the Configmap:

INVENIO_SEARCH_HOSTS: {{ printf "[{'host': '%s'}]" (include "invenio.opensearch.hostname" .) | quote }}

means that only the hostname can be configured, without port, user or password; this is of course unworkable when using an hosted {Elastic/Open}Search that needs proper authentication to be passed to the application.

A possible way around this is to add the INVENIO_SEARCH_HOSTS string into Values.invenio.extra_config; this will however force Helm to have 2 INVENIO_SEARCH_HOSTS in the Configmap -- which won't work either.

In this PR, if INVENIO_SEARCH_HOSTS is set in extra_config, it is removed from the Configmap so we don't get this defined twice, avoiding clashes and allowing the app to connect to an externally hosted search engine.

Files affected:

Web service type cannot be changed

service.type defaults to ClusterIP, however when using some cloud reverse proxies like Traefik, this should be set to NodePort and currently there is no way to change it.
I have added Values.web.service.type; if not specified, it defaults to ClusterIP -- which is the current default anyway.

Files affected

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Frontend

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

@@ -124,6 +124,8 @@ web:
cpu: 1000m
memory: 1Gi
annotations: []
service:
type: NodePort
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a breaking change to the chart's default behavior. I think it would be better to let the default value be empty (type: ""). You have already defined ClusterIP as default using the default function in the template, so having another default value here is a bit confusing.

Comment on lines +14 to +15
{{- if hasKey .Values.invenio.extra_config "INVENIO_SEARCH_HOSTS" }}
{{- else }}
Copy link
Contributor

@lindhe lindhe Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having an empty if statement, it is preferable to negate the condition using not.

This template renders the protocol for RabbitMQ.
*/}}
{{- define "invenio.rabbitmq.protocol" -}}
{{- if .Values.rabbitmq.enabled }}amqp{{- else }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the same style as elsewhere in the code. Example:

########################## RabbitMQ AMQP port ##########################
{{/*
This template renders the AMQP port number for RabbitMQ.
*/}}
{{- define "invenio.rabbitmq.amqpPort" -}}
{{- if .Values.rabbitmq.enabled }}
{{- required "Missing .Values.rabbitmq.service.ports.amqp" .Values.rabbitmq.service.ports.amqp -}}
{{- else }}
{{- required "Missing .Values.rabbitmqExternal.amqpPort" .Values.rabbitmqExternal.amqpPort -}}
{{- end }}
{{- end -}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants