From 5b8b476efbe3a5296db8320d12524e13072ff9f0 Mon Sep 17 00:00:00 2001 From: DTadrzak Date: Fri, 18 Nov 2016 16:54:35 +0100 Subject: [PATCH] Basic version of rabbitmq. Signed-off-by: DTadrzak --- rabbitmq/.helmignore | 23 +++++++++++++++ rabbitmq/Chart.yaml | 4 +++ rabbitmq/templates/deployment.yaml | 39 ++++++++++++++++++++++++++ rabbitmq/templates/service.yaml | 9 ++++++ rabbitmq/templates/start_rabbitmq.yaml | 31 ++++++++++++++++++++ rabbitmq/values.yaml | 17 +++++++++++ 6 files changed, 123 insertions(+) create mode 100644 rabbitmq/.helmignore create mode 100755 rabbitmq/Chart.yaml create mode 100644 rabbitmq/templates/deployment.yaml create mode 100644 rabbitmq/templates/service.yaml create mode 100644 rabbitmq/templates/start_rabbitmq.yaml create mode 100644 rabbitmq/values.yaml diff --git a/rabbitmq/.helmignore b/rabbitmq/.helmignore new file mode 100644 index 0000000000..3ca0aad82e --- /dev/null +++ b/rabbitmq/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj + + diff --git a/rabbitmq/Chart.yaml b/rabbitmq/Chart.yaml new file mode 100755 index 0000000000..ce116f3620 --- /dev/null +++ b/rabbitmq/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: A Helm chart for Kubernetes +name: rabbitmq +version: 0.1.0 diff --git a/rabbitmq/templates/deployment.yaml b/rabbitmq/templates/deployment.yaml new file mode 100644 index 0000000000..62ba30546b --- /dev/null +++ b/rabbitmq/templates/deployment.yaml @@ -0,0 +1,39 @@ +kind: Deployment +apiVersion: extensions/v1beta1 +metadata: + name: rabbitmq +spec: + replicas: 1 + template: + metadata: + labels: + name: rabbitmq + spec: + nodeSelector: + {{.Values.global.label.control_node}}: enabled + volumes: + - name: rabbitmq-emptydir + emptyDir: {} + - name: start-rabbitmq + configMap: + name: start-rabbitmq + containers: + - name: rabbitmq + image: rabbitmq:3-management + command: + - bash + - /tmp/start_rabbitmq.sh + livenessProbe: + tcpSocket: + port: {{.Values.global.rabbitmq_port_public}} + initialDelaySeconds: 60 + timeoutSeconds: 5 + ports: + - name: rabbitmq + containerPort: {{.Values.global.rabbitmq_port_public}} + volumeMounts: + - name: rabbitmq-emptydir + mountPath: /var/lib/rabbitmq + - mountPath: /tmp/start_rabbitmq.sh + name: start-rabbitmq + subPath: start_rabbitmq.sh diff --git a/rabbitmq/templates/service.yaml b/rabbitmq/templates/service.yaml new file mode 100644 index 0000000000..673b3ef863 --- /dev/null +++ b/rabbitmq/templates/service.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Service +metadata: + name: rabbitmq +spec: + ports: + - port: {{.Values.global.rabbitmq_port_public}} + selector: + app: rabbitmq \ No newline at end of file diff --git a/rabbitmq/templates/start_rabbitmq.yaml b/rabbitmq/templates/start_rabbitmq.yaml new file mode 100644 index 0000000000..205a817d61 --- /dev/null +++ b/rabbitmq/templates/start_rabbitmq.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: start-rabbitmq + labels: + system: openstack + type: configuration + component: messaging + +data: + start_rabbitmq.sh: | + + chown -R rabbitmq:rabbitmq /var/lib/rabbitmq + + /etc/init.d/rabbitmq-server start + + rabbitmq-plugins enable rabbitmq_tracing + rabbitmqctl trace_on + + rabbitmqctl add_user {{ .Values.global.rabbitmq_default_user }} {{ .Values.global.rabbitmq_default_pass }} || true + rabbitmqctl set_permissions {{ .Values.global.rabbitmq_default_user }} ".*" ".*" ".*" || true + + rabbitmqctl add_user {{ .Values.global.rabbitmq_admin_user }} {{ .Values.global.rabbitmq_admin_pass }}|| true + rabbitmqctl set_permissions {{ .Values.global.rabbitmq_admin_user }} ".*" ".*" ".*" || true + rabbitmqctl set_user_tags {{ .Values.global.rabbitmq_admin_user }} administrator || true + + rabbitmqctl change_password guest {{ .Values.global.rabbitmq_default_pass }} || true + rabbitmqctl set_user_tags guest monitoring || true + /etc/init.d/rabbitmq-server stop + exec rabbitmq-server + diff --git a/rabbitmq/values.yaml b/rabbitmq/values.yaml new file mode 100644 index 0000000000..af38e809cb --- /dev/null +++ b/rabbitmq/values.yaml @@ -0,0 +1,17 @@ +# Default values for rabbitmq. +# This is a YAML-formatted file. +# Declare name/value pairs to be passed into your templates. +# name: value +global: + rabbitmq_default_user: openstack + rabbitmq_admin_user: rabbitmq + rabbitmq_port_public: '5672' + rabbitmq_port_management: '15672' + + rabbitmq_default_pass: password + rabbitmq_admin_pass: password + label: + control_node: "openstack-control-plane" +# TODO(DTadrzak): delete me +local: + image: "quay.io/stackanetes/stackanetes-rabbitmq:newton"