Upgrade to RabbitMQ 3.7, remove need for etcd2

Signed-off-by: Shane McDonald <me@shanemcd.com>
This commit is contained in:
Shane McDonald 2018-03-27 23:28:16 -04:00
parent 3f685c42fe
commit 935dc8bca7
7 changed files with 152 additions and 80 deletions

View File

@ -8,7 +8,7 @@ localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env pyth
# by default the base will be used to search for ansible/awx_web and ansible/awx_task
dockerhub_base=ansible
dockerhub_version=latest
rabbitmq_version=3.6.14
rabbitmq_version=3.7.4
# Openshift Install
# Will need to set -e openshift_password=developer -e docker_registry_password=$(oc whoami -t)

View File

@ -82,11 +82,6 @@
path: "{{ kubernetes_base_path }}"
state: directory
- name: Template Kubernetes AWX etcd2
template:
src: etcd.yml.j2
dest: "{{ kubernetes_base_path }}/etcd.yml"
mode: '0600'
- name: Template Kubernetes AWX Config
template:
@ -100,9 +95,6 @@
dest: "{{ kubernetes_base_path }}/deployment.yml"
mode: '0600'
- name: Apply etcd deployment
shell: "{{ kubectl_or_oc }} apply -f {{ kubernetes_base_path }}/etcd.yml"
- name: Apply Configmap
shell: "{{ kubectl_or_oc }} apply -f {{ kubernetes_base_path }}/configmap.yml"

View File

@ -1,3 +1,115 @@
---
kind: Service
apiVersion: v1
metadata:
namespace: {{ awx_kubernetes_namespace }}
name: rabbitmq
labels:
app: rabbitmq
type: LoadBalancer
spec:
type: NodePort
ports:
- name: http
protocol: TCP
port: 15672
targetPort: 15672
nodePort: 31672
- name: amqp
protocol: TCP
port: 5672
targetPort: 5672
nodePort: 30672
selector:
app: rabbitmq
---
apiVersion: v1
kind: ConfigMap
metadata:
name: rabbitmq-config
namespace: {{ awx_kubernetes_namespace }}
data:
enabled_plugins: |
[rabbitmq_management,rabbitmq_peer_discovery_k8s].
rabbitmq.conf: |
default_user = awx
default_pass = abcdefg
default_vhost = awx
## Clustering
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_k8s
cluster_formation.k8s.host = kubernetes.default.svc.cluster.local
cluster_formation.k8s.address_type = ip
cluster_formation.node_cleanup.interval = 10
cluster_formation.node_cleanup.only_log_warning = false
cluster_partition_handling = autoheal
## queue master locator
queue_master_locator=min-masters
## enable guest user
loopback_users.guest = false
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: rabbitmq
namespace: {{ awx_kubernetes_namespace }}
{% if kubernetes_context is defined %}
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: endpoint-reader
namespace: {{ awx_kubernetes_namespace }}
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: endpoint-reader
namespace: {{ awx_kubernetes_namespace }}
subjects:
- kind: ServiceAccount
name: rabbitmq
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: endpoint-reader
{% endif %}
{% if openshift_host is defined %}
---
kind: Role
apiVersion: v1
metadata:
name: endpoint-reader
namespace: {{ awx_kubernetes_namespace }}
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get"]
---
kind: RoleBinding
apiVersion: v1
metadata:
name: endpoint-reader
namespace: {{ awx_kubernetes_namespace }}
roleRef:
name: endpoint-reader
namespace: {{ awx_kubernetes_namespace }}
subjects:
- kind: ServiceAccount
name: rabbitmq
namespace: {{ awx_kubernetes_namespace }}
userNames:
- system:serviceaccount:{{ awx_kubernetes_namespace }}:rabbitmq
{% endif %}
---
apiVersion: extensions/v1beta1
kind: Deployment
@ -11,7 +123,9 @@ spec:
labels:
name: awx-web-deploy
service: django
app: rabbitmq
spec:
serviceAccountName: rabbitmq
containers:
- name: awx-web
image: {{ awx_web_kubernetes_image }}
@ -57,40 +171,39 @@ spec:
- name: awx-rabbit
image: ansible/awx_rabbitmq:{{ rabbitmq_version }}
imagePullPolicy: Always
ports:
- name: http
protocol: TCP
containerPort: 15672
- name: amqp
protocol: TCP
containerPort: 5672
livenessProbe:
exec:
command: ["rabbitmqctl", "status"]
initialDelaySeconds: 30
timeoutSeconds: 10
readinessProbe:
exec:
command: ["rabbitmqctl", "status"]
initialDelaySeconds: 10
timeoutSeconds: 10
env:
# For consupmption by rabbitmq-env.conf
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: RABBITMQ_USE_LONGNAME
value: "true"
- name: ERLANG_COOKIE
value: "test"
- name: RABBITMQ_ERLANG_COOKIE
value: "cookiemonster"
- name: RABBITMQ_NODENAME
value: "rabbit@$(MY_POD_IP)"
- name: AUTOCLUSTER_TYPE
value: "etcd"
- name: AUTOCLUSTER_DELAY
value: "60"
- name: ETCD_HOST
value: "etcd"
- name: AUTOCLUSTER_CLEANUP
value: "true"
- name: CLEANUP_WARN_ONLY
value: "false"
- name: CLEANUP_INTERVAL
value: "30"
- name: RABBITMQ_DEFAULT_USER
value: "awx"
- name: RABBITMQ_DEFAULT_PASS
value: "abcdefg"
- name: RABBITMQ_DEFAULT_VHOST
value: "awx"
- name: RABBITMQ_CONFIG_FILE
value: "/etc/rabbitmq/rabbitmq"
- name: K8S_SERVICE_NAME
value: "rabbitmq"
- name: RABBITMQ_ERLANG_COOKIE
value: "cookiemonster"
volumeMounts:
- name: rabbitmq-config
mountPath: /etc/rabbitmq
resources:
requests:
memory: "{{ awx_rabbitmq_mem_request }}Gi"
@ -110,6 +223,14 @@ spec:
path: settings.py
- key: secret_key
path: SECRET_KEY
- name: rabbitmq-config
configMap:
name: rabbitmq-config
items:
- key: rabbitmq.conf
path: rabbitmq.conf
- key: enabled_plugins
path: enabled_plugins
---
apiVersion: v1
kind: Service

View File

@ -1,44 +0,0 @@
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: etcd
namespace: {{ awx_kubernetes_namespace }}
spec:
replicas: 1
template:
metadata:
labels:
name: awx-etcd2
service: etcd
spec:
containers:
- name: etcd
image: elcolio/etcd:latest
ports:
- containerPort: 4001
volumeMounts:
- mountPath: /data
name: datadir
volumes:
- name: datadir
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
annotations:
labels:
name: awx-etcd
name: etcd
namespace: {{ awx_kubernetes_namespace }}
spec:
ports:
- name: etcd
port: 4001
protocol: TCP
targetPort: 4001
selector:
name: awx-etcd2
sessionAffinity: None
type: ClusterIP

View File

@ -0,0 +1 @@
rabbitmq_image: "ansible/awx_rabbitmq:{{rabbitmq_version}}"

View File

@ -20,9 +20,10 @@
name: rabbitmq
state: started
restart_policy: unless-stopped
image: rabbitmq:3
image: "{{ rabbitmq_image }}"
env:
RABBITMQ_DEFAULT_VHOST: "awx"
RABBITMQ_ERLANG_COOKIE: "cookiemonster"
register: rabbitmq_container_activate
- name: Activate memcached container

View File

@ -122,10 +122,11 @@ services:
AWX_ADMIN_PASSWORD: {{ default_admin_password|default('password') }}
rabbitmq:
image: rabbitmq:3
image: {{ rabbitmq_image }}
restart: unless-stopped
environment:
RABBITMQ_DEFAULT_VHOST: awx
RABBITMQ_ERLANG_COOKIE: cookiemonster
memcached:
image: memcached:alpine