Skip to content

[xray] RabbitMQ HA vhost and permissions are created even when haQuorum.enabled=false #2194

@gianluca-fiasco

Description

@gianluca-fiasco

Scope

  • files/load_definition.json
  • Behavioral / design discussion

Problem

  • Extra vhost and permissions are created unconditionally
  • Xray uses / when HA quorum is disabled
  • Leads to unused RabbitMQ objects and confusion

Suggested change

add {{- if .Values.rabbitmq.global.xray.rabbitmq.haQuorum.enabled }} here and there
https://github.com/jfrog/charts/blob/master/stable/xray/files/load_definition.json

{
  "permissions": [
    {
      "user": "{{ .Values.rabbitmq.auth.username }}",
      "vhost": "/",
      "configure": ".*",
      "write": ".*",
      "read": ".*"
    }{{- if .Values.rabbitmq.global.xray.rabbitmq.haQuorum.enabled }},
    {
      "user": "{{ .Values.rabbitmq.auth.username }}",
      "vhost": "{{ .Values.rabbitmq.global.xray.rabbitmq.haQuorum.vhost }}",
      "configure": ".*",
      "write": ".*",
      "read": ".*"
    }{{- end }}
  ],
  "users": [
    {
      "name": "{{ .Values.rabbitmq.auth.username }}",
      {{- if not .Values.rabbitmq.auth.existingPasswordSecret }}
      "password": "{{ .Values.rabbitmq.auth.password }}",
      {{- else }}
      {{- $secret := lookup "v1" "Secret" .Release.Namespace .Values.rabbitmq.auth.existingPasswordSecret }}
      {{- if $secret }}
      {{- if index $secret.data "rabbitmq-password" }}
      {{- $password := index $secret.data "rabbitmq-password" | b64dec -}}
      "password": "{{ $password }}",
      {{- else }}
      {{- fail "Error: rabbitmq-password key not found in the Secret." -}}
      {{- end }}
      {{- end }}
      {{- end }}
      "tags": "administrator"
    }
  ],
  "vhosts": [
    {
      "name": "/"
    }{{- if .Values.rabbitmq.global.xray.rabbitmq.haQuorum.enabled }},
    {
      "name": "{{ .Values.rabbitmq.global.xray.rabbitmq.haQuorum.vhost }}"
    }{{- end }}
  ],
  "policies": [
    {{- if not .Values.rabbitmq.global.xray.rabbitmq.haQuorum.enabled }}
    {
      "name": "ha-all",
      "apply-to": "all",
      "pattern": ".*",
      "vhost": "/",
      "definition": {
        "ha-mode": "all",
        "ha-sync-mode": "automatic"
      }
    }
    {{- end }}
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions