apiVersion: apps/v1
kind: StatefulSet
metadata:
  creationTimestamp: "2026-04-02T13:58:13Z"
  generation: 3
  labels:
    app.kubernetes.io/component: rabbitmq
    app.kubernetes.io/name: rabbitmq-cell1
    app.kubernetes.io/part-of: rabbitmq
  name: rabbitmq-cell1-server
  namespace: openstack
  ownerReferences:
  - apiVersion: rabbitmq.openstack.org/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: RabbitMq
    name: rabbitmq-cell1
    uid: 72b9570b-8be0-4ba3-a43b-aa9788338f23
  resourceVersion: "50224"
  uid: f42aac1f-c0bf-4ac0-adef-dfe745955d37
spec:
  persistentVolumeClaimRetentionPolicy:
    whenDeleted: Retain
    whenScaled: Retain
  podManagementPolicy: Parallel
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app.kubernetes.io/name: rabbitmq-cell1
  serviceName: rabbitmq-cell1-nodes
  template:
    metadata:
      annotations:
        config-hash: nd6h5f9h5d9h68chf8hfdh689h596h5cdhcbh5f5h87h594h5bdh99h574h67bh67hdch599h9fhb9h669hb8h5cdh89h659h549h5f5h586h574h59q
      creationTimestamp: null
      labels:
        app.kubernetes.io/component: rabbitmq
        app.kubernetes.io/name: rabbitmq-cell1
        app.kubernetes.io/part-of: rabbitmq
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app.kubernetes.io/name
                  operator: In
                  values:
                  - rabbitmq-cell1
              topologyKey: kubernetes.io/hostname
            weight: 100
      automountServiceAccountToken: true
      containers:
      - command:
        - rabbitmq-server
        env:
        - name: MY_POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        - name: MY_POD_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        - name: K8S_SERVICE_NAME
          value: rabbitmq-cell1-nodes
        - name: RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS
          value: -proto_dist inet_tls -ssl_dist_optfile /etc/rabbitmq/inter-node-tls.config
        - name: RABBITMQ_CTL_ERL_ARGS
          value: -proto_dist inet_tls -ssl_dist_optfile /etc/rabbitmq/inter-node-tls.config
        - name: RABBITMQ_CONFIG_FILES
          value: /etc/rabbitmq/conf.d
        - name: RABBITMQ_UPGRADE_LOG
          value: /var/lib/rabbitmq/rabbitmq_upgrade.log
        - name: HOME
          value: /var/lib/rabbitmq
        - name: PATH
          value: /usr/lib/rabbitmq/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        - name: RABBITMQ_ENABLED_PLUGINS_FILE
          value: /operator/enabled_plugins
        - name: RABBITMQ_USE_LONGNAME
          value: "true"
        - name: RABBITMQ_NODENAME
          value: rabbit@$(MY_POD_NAME).$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE)
        - name: K8S_ADDRESS_TYPE
          value: hostname
        - name: K8S_HOSTNAME_SUFFIX
          value: .$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE)
        image: quay.io/podified-antelope-centos9/openstack-rabbitmq:current-podified
        imagePullPolicy: IfNotPresent
        lifecycle:
          preStop:
            exec:
              command:
              - /bin/bash
              - -c
              - if [ ! -z "$(cat /etc/pod-info/skipPreStopChecks)" ]; then exit 0;
                fi; rabbitmq-upgrade drain -t 600
        name: rabbitmq
        ports:
        - containerPort: 4369
          name: epmd
          protocol: TCP
        - containerPort: 5671
          name: amqps
          protocol: TCP
        - containerPort: 15671
          name: management-tls
          protocol: TCP
        - containerPort: 15691
          name: prometheus-tls
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: amqps
          timeoutSeconds: 5
        resources:
          limits:
            cpu: "2"
            memory: 2Gi
          requests:
            cpu: 500m
            memory: 500Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/rabbitmq/
          name: rabbitmq-erlang-cookie
        - mountPath: /var/lib/rabbitmq/mnesia/
          name: persistence
        - mountPath: /operator
          name: rabbitmq-plugins
        - mountPath: /etc/rabbitmq/conf.d/10-operatorDefaults.conf
          name: rabbitmq-confd
          subPath: operatorDefaults.conf
        - mountPath: /etc/rabbitmq/conf.d/90-userDefinedConfiguration.conf
          name: rabbitmq-confd
          subPath: userDefinedConfiguration.conf
        - mountPath: /etc/pod-info/
          name: pod-info
        - mountPath: /etc/rabbitmq/conf.d/11-default_user.conf
          name: rabbitmq-confd
          subPath: default_user.conf
        - mountPath: /etc/rabbitmq/advanced.config
          name: server-conf
          subPath: advanced.config
        - mountPath: /etc/rabbitmq/inter-node-tls.config
          name: config-data
          readOnly: true
          subPath: inter_node_tls.config
        - mountPath: /etc/rabbitmq-tls/
          name: rabbitmq-tls
          readOnly: true
      dnsPolicy: ClusterFirst
      initContainers:
      - args:
        - |-
          set -e
          cp /tmp/erlang-cookie-secret/.erlang.cookie /var/lib/rabbitmq/.erlang.cookie
          chmod 600 /var/lib/rabbitmq/.erlang.cookie
          cp /tmp/rabbitmq-plugins/enabled_plugins /operator/enabled_plugins
          echo '[default]' > /var/lib/rabbitmq/.rabbitmqadmin.conf
          sed -e 's/default_user/username/' -e 's/default_pass/password/' /tmp/default_user.conf >> /var/lib/rabbitmq/.rabbitmqadmin.conf
          chmod 600 /var/lib/rabbitmq/.rabbitmqadmin.conf
          # Allow time for multi-pod clusters to complete peer discovery
          sleep 30
        command:
        - sh
        - -c
        image: quay.io/podified-antelope-centos9/openstack-rabbitmq:current-podified
        imagePullPolicy: IfNotPresent
        name: setup-container
        resources:
          limits:
            cpu: 20m
            memory: 64Mi
          requests:
            cpu: 20m
            memory: 64Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /tmp/rabbitmq-plugins/
          name: plugins-conf
        - mountPath: /var/lib/rabbitmq/
          name: rabbitmq-erlang-cookie
        - mountPath: /tmp/erlang-cookie-secret/
          name: erlang-cookie-secret
        - mountPath: /operator
          name: rabbitmq-plugins
        - mountPath: /var/lib/rabbitmq/mnesia/
          name: persistence
        - mountPath: /tmp/default_user.conf
          name: rabbitmq-confd
          subPath: default_user.conf
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext:
        fsGroup: 0
        runAsUser: 999
      serviceAccount: rabbitmq-cell1-server
      serviceAccountName: rabbitmq-cell1-server
      terminationGracePeriodSeconds: 60
      topologySpreadConstraints:
      - labelSelector:
          matchLabels:
            app.kubernetes.io/name: rabbitmq-cell1
        maxSkew: 1
        topologyKey: topology.kubernetes.io/zone
        whenUnsatisfiable: ScheduleAnyway
      volumes:
      - emptyDir: {}
        name: rabbitmq-erlang-cookie
      - name: erlang-cookie-secret
        secret:
          defaultMode: 420
          secretName: rabbitmq-cell1-erlang-cookie
      - emptyDir: {}
        name: rabbitmq-plugins
      - configMap:
          defaultMode: 420
          name: rabbitmq-cell1-plugins-conf
        name: plugins-conf
      - name: rabbitmq-confd
        projected:
          defaultMode: 420
          sources:
          - configMap:
              items:
              - key: operatorDefaults.conf
                path: operatorDefaults.conf
              - key: userDefinedConfiguration.conf
                path: userDefinedConfiguration.conf
              name: rabbitmq-cell1-server-conf
          - secret:
              items:
              - key: default_user.conf
                path: default_user.conf
              name: rabbitmq-cell1-default-user
      - downwardAPI:
          defaultMode: 420
          items:
          - fieldRef:
              apiVersion: v1
              fieldPath: metadata.labels['skipPreStopChecks']
            path: skipPreStopChecks
        name: pod-info
      - configMap:
          defaultMode: 420
          name: rabbitmq-cell1-server-conf
        name: server-conf
      - configMap:
          defaultMode: 420
          items:
          - key: inter_node_tls.config
            path: inter_node_tls.config
          name: rabbitmq-cell1-config-data
        name: config-data
      - name: rabbitmq-tls
        projected:
          defaultMode: 256
          sources:
          - secret:
              items:
              - key: tls.crt
                path: tls.crt
              - key: tls.key
                path: tls.key
              name: cert-rabbitmq-cell1-svc
              optional: true
          - secret:
              items:
              - key: ca.crt
                path: ca.crt
              name: cert-rabbitmq-cell1-svc
              optional: true
  updateStrategy:
    rollingUpdate:
      partition: 0
    type: RollingUpdate
  volumeClaimTemplates:
  - apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      creationTimestamp: null
      name: persistence
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi
      storageClassName: local-storage
      volumeMode: Filesystem
    status:
      phase: Pending
status:
  availableReplicas: 1
  collisionCount: 0
  currentReplicas: 1
  currentRevision: rabbitmq-cell1-server-598d9dd654
  observedGeneration: 3
  readyReplicas: 1
  replicas: 1
  updateRevision: rabbitmq-cell1-server-598d9dd654
  updatedReplicas: 1
