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

BC-8618 update to rabbitmq 4.0.x and auto-enable feature flags #1071

Merged
merged 14 commits into from
Jan 14, 2025
2 changes: 1 addition & 1 deletion ansible/collections/requirements.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
collections:
- name: kubernetes.core
version: 2.4.0
version: 5.0.0
2 changes: 1 addition & 1 deletion ansible/roles/dof_rabbitmq/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
RABBITMQ_IMAGE_NAME: docker.io/rabbitmq
RABBITMQ_IMAGE_TAG: 3.13.7-management
RABBITMQ_IMAGE_TAG: 4.0.5-management-alpine
RABBITMQ_PER_OBJECT_METRICS: "true"
60 changes: 60 additions & 0 deletions ansible/roles/dof_rabbitmq/files/enable-feature-flags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

set -euo pipefail

KUBECONFIG_OPTION=""
NAMESPACE=""
COMPONENT_NAME="rabbitmq"
CONTAINER_NAME="rabbitmq"
COMMAND="rabbitmqctl enable_feature_flag all"

while [[ $# -gt 0 ]]; do
case $1 in
--kubeconfig)
KUBECONFIG_OPTION="--kubeconfig=$2"
shift 2
;;
--namespace)
NAMESPACE=$2
shift 2
;;
--component-name)
COMPONENT_NAME=$2
shift 2
;;
--container-name)
CONTAINER_NAME=$2
shift 2
;;
--command)
COMMAND=$2
shift 2
;;
*)
echo "Unknown argument: $1"
echo "Usage: $0 --namespace <namespace> [--kubeconfig <path>] [--component-name <name>] [--container-name <name>] [--command <command>]"
exit 1
;;
esac
done

if [[ -z "$NAMESPACE" ]]; then
echo "Error: --namespace is required"
echo "Usage: $0 --namespace <namespace> [--kubeconfig <path>] [--component-name <name>] [--container-name <name>] [--command <command>]"
exit 1
fi

PODS=$(kubectl $KUBECONFIG_OPTION get pods -n "$NAMESPACE" -l "app.kubernetes.io/component=$COMPONENT_NAME" -o jsonpath='{.items[*].metadata.name}')

if [[ -z "$PODS" ]]; then
echo "No pods found matching app.kubernetes.io/component=$COMPONENT_NAME in namespace $NAMESPACE"
exit 1
fi

for POD in $PODS; do
echo "Executing command in pod: $POD"
kubectl $KUBECONFIG_OPTION exec -n "$NAMESPACE" -c "$CONTAINER_NAME" "$POD" -- $COMMAND || {
echo "Failed to execute command in pod: $POD" >&2
exit 1
}
done
1 change: 1 addition & 0 deletions ansible/roles/dof_rabbitmq/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@
when: RABBITMQ_SERVICE_MONITOR is undefined or RABBITMQ_SERVICE_MONITOR is defined and not RABBITMQ_SERVICE_MONITOR
tags:
- prometheus

Loading