Browse Source

fix different cookies on rabbitmq nodes

pull/3/head
Andrey Inishev 1 year ago
parent
commit
803a7862f4
2 changed files with 8 additions and 6 deletions
  1. +4
    -5
      pkg/controller/rabbitmq/rabbitmq_configmaps.go
  2. +4
    -1
      pkg/controller/rabbitmq/rabbitmq_controller.go

+ 4
- 5
pkg/controller/rabbitmq/rabbitmq_configmaps.go View File

@@ -52,11 +52,10 @@ rabbitmq_shovel_management
`

const initRabbitmqScript = `# RabbitMQ Init script
rm -rf /var/lib/rabbitmq/*
rm -rf /etc/rabbitmq/*
cp /rabbit-config/* /etc/rabbitmq/
cp /rabbit-config/.* /etc/rabbitmq/
chmod 600 /etc/rabbitmq/.erlang.cookie
rm -f /var/lib/rabbitmq/.erlang.cookie
cp /rabbit-config/* /etc/rabbitmq
cp /rabbit-config/.* /etc/rabbitmq
chmod 600 /etc/rabbitmq/.erlang.cookie
`

func applyDataOnTemplate(reqLogger logr.Logger, templateContent string, cr templateDataStruct) (string, error) {


+ 4
- 1
pkg/controller/rabbitmq/rabbitmq_controller.go View File

@@ -315,7 +315,10 @@ func newStatefulSet(cr *rabbitmqv1.Rabbitmq) *v1.StatefulSet {
{
Name: "rabbitmq",
Image: cr.Spec.K8SImage.Name + ":" + cr.Spec.K8SImage.Tag,
Env: appendNodeVariables(cr.Spec.K8SENV, cr),
Env: append(appendNodeVariables(cr.Spec.K8SENV, cr), corev1.EnvVar{
Name: "RABBITMQ_ERLANG_COOKIE",
ValueFrom: &corev1.EnvVarSource{ConfigMapKeyRef: &corev1.ConfigMapKeySelector{LocalObjectReference: corev1.LocalObjectReference{Name: cr.Name}, Key: ".erlang.cookie"}},
}),
Resources: corev1.ResourceRequirements{
Requests: cr.Spec.RabbitmqPodRequests,
Limits: cr.Spec.RabbitmqPodLimits,


Loading…
Cancel
Save