diff --git a/ansible/collections/requirements.yml b/ansible/collections/requirements.yml index e6dab53f7..18f0c6bd7 100644 --- a/ansible/collections/requirements.yml +++ b/ansible/collections/requirements.yml @@ -1,4 +1,4 @@ --- collections: - name: kubernetes.core - version: 2.4.0 + version: 5.0.0 diff --git a/ansible/roles/dof_rabbitmq/defaults/main.yaml b/ansible/roles/dof_rabbitmq/defaults/main.yaml index 947b208e1..9c3e095de 100644 --- a/ansible/roles/dof_rabbitmq/defaults/main.yaml +++ b/ansible/roles/dof_rabbitmq/defaults/main.yaml @@ -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" \ No newline at end of file diff --git a/ansible/roles/dof_rabbitmq/files/enable-feature-flags.sh b/ansible/roles/dof_rabbitmq/files/enable-feature-flags.sh new file mode 100755 index 000000000..60547c7d5 --- /dev/null +++ b/ansible/roles/dof_rabbitmq/files/enable-feature-flags.sh @@ -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 [--kubeconfig ] [--component-name ] [--container-name ] [--command ]" + exit 1 + ;; + esac +done + +if [[ -z "$NAMESPACE" ]]; then + echo "Error: --namespace is required" + echo "Usage: $0 --namespace [--kubeconfig ] [--component-name ] [--container-name ] [--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 diff --git a/ansible/roles/dof_rabbitmq/tasks/main.yml b/ansible/roles/dof_rabbitmq/tasks/main.yml index 8d7592ef8..2a5d24a37 100644 --- a/ansible/roles/dof_rabbitmq/tasks/main.yml +++ b/ansible/roles/dof_rabbitmq/tasks/main.yml @@ -34,3 +34,4 @@ when: RABBITMQ_SERVICE_MONITOR is undefined or RABBITMQ_SERVICE_MONITOR is defined and not RABBITMQ_SERVICE_MONITOR tags: - prometheus +