Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

use default k8s cluster plugin from rabbitmq #4591

Merged
merged 8 commits into from
Apr 3, 2018

Conversation

vtuson
Copy link
Contributor

@vtuson vtuson commented Apr 2, 2018

What this PR does / why we need it:
This PR modifies the existing chart to be able to be horizontally scaled by adding additional replicas of rabbitmq. It uses the default http://www.rabbitmq.com/cluster-formation.html#peer-discovery-k8s which is prepackage in 3.7+ versions of rabbitmq.

In order to achieve this I have moved from a deployment to a statefulselt for a stable network configuration.

This PR also provides rbac Service account, role and role-binding since the rabbitmq plugin configures the cluster by monitoring endpoint on a given service.

Additionally this PR provides an ingress resource (optional) for the management interface of rabbitmq.

I have also provided an additional values yaml file for high availability configuration.

This PR adds additional configurability for the chart, including the option of using a private registry, control over probe settings and a few other things.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #
It is an improvement pr - addresses some of the concern in this issue #3075

Special notes for your reviewer:

@tompizmor @sameersbn @prydonius followed the discuss approach to provide both default setup and also production set up.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 2, 2018
@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 2, 2018
@vtuson
Copy link
Contributor Author

vtuson commented Apr 2, 2018

/assign @tompizmor

same than before but with a matching email

pullPolicy: IfNotPresent

## set to true if you would like to see extra information on logs
## it turns BASH and NAMI debuggin in minideb
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: debuggin -> debugging

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, will fix

tag: 3.7.4-r1

## set to true if you would like to see extra information on logs
## it turns BASH and NAMI debuggin in minideb
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ta!

cpu: 100m
resources: {}

## Replica count, set to 3 to provide a default available cluster
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment and below value mismatch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, copy paste :)

[rabbitmq_management,rabbitmq_peer_discovery_k8s].

rabbitmq.conf: |
## Clustering
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this configuration should come from the values.yaml.
Example: https://github.com/kubernetes/charts/blob/master/stable/mariadb/templates/configmap.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I have moved the main body of both config files, but left the user and password configuration as that is configure via other variables. you cant reference other variables via values.yaml

- path: {{ default "/" .path }}
backend:
serviceName: {{ template "rabbitmq.fullname" . }}
servicePort: {{ default "15672" .Values.rabbitmq.managerPort }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use "default" in the template is not recommended. We should rely on the default value set in the values.yaml file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to know , thanks

- secretName: {{ .Values.ingress.tlsSecret }}
{{- end }}
{{- end }}
---
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say you don't need this dashes. I have seen it in some other charts but they were creating several ingress resources. For example https://github.com/kubernetes/charts/blob/master/stable/wordpress/templates/ingress.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok removed

{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{.}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{{.}} -> {{ . }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@coreypobrien
Copy link
Contributor

A lot of this looks like the beginning of merging this into the rabbitmq-ha chart maybe? The rabbitmq-ha chart already is using a statefulset. What would this PR accomplish that isn't already handled by the rabbitmq-ha chart?

@vtuson
Copy link
Contributor Author

vtuson commented Apr 3, 2018

@coreypobrien I am not sure why rabbitmq-ha was created to start with, seems like it should have been itself a PR to this chart. My prefer option would be to merge this PR once the comments are addressed and see how we want to proceed.

@@ -0,0 +1,14 @@
apiVersion: v1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are missing labels in this file:

labels:
    app: {{ template "rabbitmq.name" . }}
    chart: {{ template "rabbitmq.chart". }}
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that PVC has this also missing so I fixed both

metadata:
name: "{{ template "rabbitmq.fullname" . }}"
labels:
app: {{ template "rabbitmq.fullname" . }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated in the best-practices the app labels should use the {{ template "rabbitmq.name" . }} and not {{ template "rabbitmq.fullname" . }}

This change in the labels applies to all files

name: "{{ template "rabbitmq.fullname" . }}"
labels:
app: {{ template "rabbitmq.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using "{{ .Chart.Name }}-{{ .Chart.Version }}" you should create the following template and use it here:

chart: {{ template "rabbitmq.chart" . }}

Template:

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "rabbitmq.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

This change in the labels applies to all files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm,seems over kill - is there a guideline about when to do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

- name: epmd
containerPort: 4369
- name: amqp
containerPort: {{ default "5672" .Values.rabbitmq.nodePort }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are several default values in this file. can you remove all of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -14,13 +14,13 @@ spec:
port: 4369
targetPort: epmd
- name: amqp
port: {{ default "5672" .Values.rabbitmqNodePort }}
port: {{ default "5672" .Values.rabbitmq.nodePort }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more defaults

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in my defence, they were there before :) - changed

image:
registry: docker.io
repository: bitnami/rabbitmq
tag: 3.7.4-r1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you update this tag to 3.7.4? The tag already exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I didnt know if that was the case. will do.

@tompizmor
Copy link
Collaborator

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 3, 2018
@tompizmor
Copy link
Collaborator

/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 3, 2018
@k8s-ci-robot k8s-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Apr 3, 2018
@tompizmor
Copy link
Collaborator

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 3, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tompizmor, vtuson

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit d13f1f1 into helm:master Apr 3, 2018
@macropin
Copy link

macropin commented Apr 4, 2018

Why is this madness being merged into stable?

@redbaron
Copy link
Contributor

redbaron commented Apr 4, 2018

Seems that new rabbitmq.diskFreeLimit is not used anywhere and totally ignored

rolanddb pushed a commit to Eneco/charts that referenced this pull request Apr 9, 2018
* use default k8s cluster plugin from rabbitmq

* changes to reflect pr review comments

* remove trailing spaces

* futher changes from PR review

* doing sed in the copy as it fails in gce due to filesystem permisions when starting the pod
@prydonius
Copy link
Member

@vtuson @tompizmor for future reference, this should have been a major version bump.

@@ -0,0 +1,150 @@
apiVersion: apps/v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works only with Kubernetes 1.9+, before this was a beta API 😭

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #4908

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#4909 should fix it

ichtar pushed a commit to Bestmile/charts that referenced this pull request May 15, 2018
* use default k8s cluster plugin from rabbitmq

* changes to reflect pr review comments

* remove trailing spaces

* futher changes from PR review

* doing sed in the copy as it fails in gce due to filesystem permisions when starting the pod
voron pushed a commit to dysnix/helm-charts that referenced this pull request Sep 5, 2018
* use default k8s cluster plugin from rabbitmq

* changes to reflect pr review comments

* remove trailing spaces

* futher changes from PR review

* doing sed in the copy as it fails in gce due to filesystem permisions when starting the pod

Signed-off-by: voron <[email protected]>
intelfx pushed a commit to intelfx/charts that referenced this pull request Oct 19, 2018
* use default k8s cluster plugin from rabbitmq

* changes to reflect pr review comments

* remove trailing spaces

* futher changes from PR review

* doing sed in the copy as it fails in gce due to filesystem permisions when starting the pod
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants