openstack-helm-infra/rabbitmq/templates/configmap-etc.yaml
Zhipeng Liu a2c43262cf Fix rabbitmq could not bind port to ipv6 address issue
When we use amarda to deploy openstack service for ipv6, rabbitmq
pod could not start listen on [::]:5672 and [::]:15672.
For ipv6, we need do some override as below.
conf:
  rabbitmq:
    management.listener.port: 15672
    management.listener.ip: "::"
  rabbitmq_env: |
    SERVER_ADDITIONAL_ERL_ARGS="+A 128 -kernel inetrc '/etc/rabbitmq/erl_inetrc' -proto_dist inet6_tcp"
    CTL_ERL_ARGS="-proto_dist inet6_tcp"
  erl_inetrc: |
    {inet6,true}.

We have test pass on both ipv4 and ipv6 setup for StarlingX project.

Signed-off-by: Zhipeng Liu <zhipengs.liu@intel.com>

Change-Id: I7af840ecd8960f9f1aa3f38d155c6e1bd822cb6e
2020-08-19 18:44:01 +08:00

67 lines
2.6 KiB
YAML

{{/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{/*
(aostapenko) rounds cpu limit in any permissible format to integer value (min 1)
"100m" -> 1
"1100m" -> 1
"10900m" -> 10
0.3 -> 1
5.4 -> 5
*/}}
{{- define "get_erlvm_scheduler_num" -}}
{{- $val := . | toString -}}
{{- if regexMatch "^[0-9]*m$" $val -}}
{{- $val = div (float64 (trimSuffix "m" $val)) 1000 -}}
{{- end -}}
{{/* NOTE(aostapenko) String with floating number does not convert well to int*/}}
{{- $val | float64 | int | default 1 -}}
{{- end -}}
{{- if .Values.manifests.configmap_etc }}
{{- $envAll := . }}
{{- if empty $envAll.Values.conf.rabbitmq.cluster_formation.k8s.host -}}
{{- $_ := print "kubernetes.default.svc." $envAll.Values.endpoints.cluster_domain_suffix | set $envAll.Values.conf.rabbitmq.cluster_formation.k8s "host" -}}
{{- end -}}
{{- $_ := print ":::" ( tuple "oslo_messaging" "internal" "amqp" . | include "helm-toolkit.endpoints.endpoint_port_lookup") | set $envAll.Values.conf.rabbitmq.listeners.tcp "1" -}}
{{- $_ := tuple "oslo_messaging" "internal" "http" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set $envAll.Values.conf.rabbitmq "management.listener.port" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" $envAll.Release.Name "rabbitmq-etc" | quote }}
data:
enabled_plugins: |
{{ tuple "etc/_enabled_plugins.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
rabbitmq.conf: |
{{ include "rabbitmq.utils.to_rabbit_config" $envAll.Values.conf.rabbitmq | indent 4 }}
{{- $erlvm_scheduler_num := include "get_erlvm_scheduler_num" .Values.pod.resources.server.limits.cpu }}
{{- $erlvm_scheduler_conf := printf "+S %s:%s" $erlvm_scheduler_num $erlvm_scheduler_num }}
{{- if .Values.manifests.config_ipv6 }}
rabbitmq-env.conf: |
SERVER_ADDITIONAL_ERL_ARGS={{ printf "+A 128 -kernel inetrc '/etc/rabbitmq/erl_inetrc' -proto_dist inet6_tcp %s" $erlvm_scheduler_conf | quote }}
CTL_ERL_ARGS="-proto_dist inet6_tcp"
erl_inetrc: |
{inet6, true}.
{{- else }}
rabbitmq-env.conf: |
SERVER_ADDITIONAL_ERL_ARGS={{ $erlvm_scheduler_conf | quote }}
{{- end }}
{{ end }}