项目重构

This commit is contained in:
zeaslity
2024-11-28 16:42:36 +08:00
parent a31ae1055a
commit c9f69d595e
822 changed files with 4 additions and 3091 deletions

View File

@@ -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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@@ -0,0 +1,8 @@
apiVersion: v2
appVersion: 3.11.4
description: A Helm chart for a RabbitMQ cluster on Kubernetes
maintainers:
- name: groundhog2k
name: rabbitmq
type: application
version: 0.6.4

View File

@@ -0,0 +1,233 @@
# RabbitMQ
![Version: 0.6.4](https://img.shields.io/badge/Version-0.6.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.11.4](https://img.shields.io/badge/AppVersion-3.11.4-informational?style=flat-square)
## Changelog
see [RELEASENOTES.md](RELEASENOTES.md)
A Helm chart for a RabbitMQ HA-cluster on Kubernetes
## TL;DR
```bash
helm repo add groundhog2k https://groundhog2k.github.io/helm-charts/
helm install my-release groundhog2k/rabbitmq
```
## Introduction
This chart uses the original [RabbitMQ image from Docker Hub](https://hub.docker.com/_/rabbitmq) to deploy a stateful RabbitMQ cluster in Kubernetes.
It fully supports deployment of the multi-architecture docker image.
## Prerequisites
- Kubernetes 1.12+
- Helm 3.x
- PV provisioner support in the underlying infrastructure
## Installing the Chart
To install the chart with the release name `my-release`:
```bash
helm install my-release groundhog2k/rabbitmq
```
## Uninstalling the Chart
To uninstall/delete the `my-release` deployment:
```bash
helm uninstall my-release
```
## Common parameters
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| fullnameOverride | string | `""` | Fully override the deployment name |
| nameOverride | string | `""` | Partially override the deployment name |
## Deployment parameters
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
| image.registry | string | `"docker.io"` | Image registry |
| image.repository | string | `"rabbitmq"` | Image name |
| image.tag | string | `""` | Image tag |
| initImage.pullPolicy | string | `"IfNotPresent"` | Init image pull policy |
| initImage.registry | string | `"docker.io"` | Image registry |
| initImage.repository | string | `"busybox"` | Init image name |
| initImage.tag | string | `"latest"` | Init image tag |
| imagePullSecrets | list | `[]` | Image pull secrets |
| extraInitContainers | list | `[]` | Extra init containers |
| extaContainers | list | `[]` | Extra containers for usage as sidecars |
| startupProbe | object | `see values.yaml` | Startup probe configuration |
| livenessProbe | object | `see values.yaml` | Liveness probe configuration |
| readinessProbe | object | `see values.yaml` | Readiness probe configuration |
| customStartupProbe | object | `{}` | Custom startup probe (overwrites default startup probe configuration) |
| customLivenessProbe | object | `{}` | Custom liveness probe (overwrites default liveness probe configuration) |
| customReadinessProbe | object | `{}` | Custom readiness probe (overwrites default readiness probe configuration) |
| resources | object | `{}` | Resource limits and requests |
| nodeSelector | object | `{}` | Deployment node selector |
| podAnnotations | object | `{}` | Additional pod annotations |
| podSecurityContext | object | `see values.yaml` | Pod security context |
| securityContext | object | `see values.yaml` | Container security context |
| env | list | `[]` | Additional container environmment variables |
| args | list | `[]` | Additional container command arguments |
| terminationGracePeriodSeconds | int | `60` | Container termination grace period in seconds |
| rbac.create | bool | `true` | Enable creation of RBAC |
| serviceAccount.annotations | object | `{}` | Additional service account annotations |
| serviceAccount.create | bool | `true` | Enable service account creation |
| serviceAccount.name | string | `""` | Optional name of the service account |
| affinity | object | `{}` | Affinity for pod assignment |
| tolerations | list | `[]` | Tolerations for pod assignment |
| podManagementPolicy | string | `"OrderedReady"` | Pod management policy |
| updateStrategyType | string | `"RollingUpdate"` | Pod update strategy |
| replicaCount | int | `1` | Number of replicas |
| revisionHistoryLimit | int | `nil` | Maximum number of revisions maintained in revision history
| podDisruptionBudget | object | `{}` | Pod disruption budget |
| podDisruptionBudget.minAvailable | int | `nil` | Minimum number of pods that must be available after eviction |
| podDisruptionBudget.maxUnavailable | int | `nil` | Maximum number of pods that can be unavailable after eviction |
## Service parameters
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| service.type | string | `"ClusterIP"` | Service type |
| service.clusterIP | string | `nil` | The cluster ip address (only relevant for type LoadBalancer or NodePort) |
| service.loadBalancerIP | string | `nil` | The load balancer ip address (only relevant for type LoadBalancer) |
| service.amqp.port | int | `5672` | AMQP service port |
| service.amqp.nodePort | int | `nil` | Service node port (only relevant for type LoadBalancer or NodePort)|
| service.amqps.port | int | `5671` | Secure AMQP service port |
| service.amqps.nodePort | int | `nil` | Service node port (only relevant for type LoadBalancer or NodePort)|
| service.mgmt.port | int | `15672` | Management UI service port |
| service.mgmt.nodePort | int | `nil` | Service node port (only relevant for type LoadBalancer or NodePort) |
| service.prometheus.port | int | `15692` | Prometheus service port |
| service.prometheus.nodePort | int | `nil` | Service node port (only relevant for type LoadBalancer or NodePort) |
| service.annotations | object | `{}` | Additional service annotations |
## Extra services parameters
Section to define custom services
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| extraServices[].name | string | `nil` | Unique name of the input service |
| extraServices[].type | string | `nil` | Service type (ClusterIP / NodePort / LoadBalancer) |
| extraServices[].protocol | string | `nil` | Protocol type (TCP / UDP) |
| extraServices[].containerPort | int | `nil` | Container port |
| extraServices[].port | int | `nil` | Service port |
| extraServices[].nodePort | int | `nil` | The node port (only relevant for type LoadBalancer or NodePort) |
| extraServices[].clusterIP | string | `nil` | The cluster ip address (only relevant for type LoadBalancer or NodePort) |
| extraServices[].loadBalancerIP | string | `nil` | The load balancer ip address (only relevant for type LoadBalancer) |
| extraServices[].annotations | object | `{}` | Additional service annotations |
## Service monitor parameters
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| serviceMonitor.enabled | bool | `false` | Enable service monitor |
| serviceMonitor.additionalLabels | object | `{}` | Additional labels for the service monitor object |
| serviceMonitor.annotations | object | `{}` | Annotations for the service monitor object |
| serviceMonitor.interval | Duration | `nil` | Scrape interval for prometheus |
| serviceMonitor.scrapeTimeout | Duration | `nil` | Scrape timeout value |
| serviceMonitor.extraEndpointParameters | object | `nil` | Extra parameters rendered to the [service monitor endpoint](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint) |
| serviceMonitor.extraParameters | object | `nil` | Extra parameters rendered to the [service monitor object](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitorspec) |
## Storage parameters
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| storage.accessModes[0] | string | `"ReadWriteOnce"` | Storage access mode |
| storage.persistentVolumeClaimName | string | `nil` | PVC name when existing storage volume should be used |
| storage.requestedSize | string | `nil` | Size for new PVC, when no existing PVC is used |
| storage.className | string | `nil` | Storage class name |
## Ingress parameters
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| ingress.enabled | bool | `false` | Enable ingress for the Management UI service |
| ingress.annotations | string | `nil` | Additional annotations for ingress |
| ingress.hosts[0].host: | string | `""` | Hostname for the ingress endpoint |
| ingress.hosts[0].host.paths[0] | string | `"/"` | Path for the RabbitMQ Management UI |
| ingress.tls | list | `[]` | Ingress TLS parameters |
## RabbitMQ base parameters
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| clusterDomain | string | `"cluster.local"` | Kubernetes cluster domain (DNS) suffix |
| plugins | list | `[]` | List of additional RabbitMQ plugins that should be activated (see: [RabbitMQ plugins](https://www.rabbitmq.com/plugins.html)) |
| authentication.user | string | `"guest"` | Initial user name |
| authentication.password | string | `"guest"` | Initial password |
| authentication.erlangCookie | string | `nil` | Erlang cookie (MANDATORY) (Alternative: Set the environment variable ERLANG_COOKIE) |
| clustering.rebalance | bool | `false` | Enable rebalance queues with master when new replica is created |
| clustering.forceBoot | bool | `false` | Force boot in case cluster peers are not available |
| clustering.useLongName | bool | `true` | Use FQDN for RabbitMQ node names |
## RabbitMQ memory parameters
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| options.memoryHighWatermark.enabled | bool | `false` | Enables high memory watermark configuration |
| options.memoryHighWatermark.type | string | `"relative"` | Type of watermark value (relative or absolute) |
| options.memoryHighWatermark.value | float | `0.4` | Watermark value (default: 40%) |
| options.memoryHighWatermark.pagingRatio | float | `nil` | Paging threshold when RabbitMQ starts paging queue content before high memory watermark is reached |
| options.memory.totalAvailableOverrideValue | int | `nil` | Overwrites the value that is automatically calculated from resource.limits.memory |
| options.memory.calculationStrategy | string | `nil` | Strategy for memory usage report (rss or allocated) |
## RabbitMQ communication parameters
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| options.tcp.port | int | `5672` | AMQP tcp port |
| options.ssl.enabled | bool | `false` | Enable secure AMQP (amqps) |
| options.ssl.port | int | `5671` | AMQPS tcp port |
| options.ssl.verify | bool | `false` | Enables or disables peer verification |
| options.ssl.failIfNoPeerCert | bool | `false` | Reject TLS connection when client fails to provide a certificate |
| options.ssl.depth | int | `nil` | Client certificate verification depth |
## RabbitMQ certificate parameters
Section for certificate support
(cacert,cert,key,password will be used for AMQP-over-SSL (AMPQS) - see: options.ssl)
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| certificates.enabled | bool | `false` | Enable mounting following certificates into folder /ssl |
| certificates.cacert | string | `nil` | CA certificate(s) in base64 format |
| certificates.cert | string | `nil` | Server certificate in base64 format |
| certificates.key | string | `nil` | Private key in base64 format |
| certificates.password | string | `nil` | Optional private key passwort |
| certificates.extraCerts | list | `[]` | List of extra certificates that will be mounted to the container into /ssl and can be used for custom/advanced configuration (see: customConfig) |
| certificates.extraCerts[].name | string | `nil` | Name of the certificate (will be the filename of the mounted certificate - i.e.: /ssl/{name}) |
| certificates.extraCerts[].cert | string | `nil` | The certificate content in base64 format |
| extraSecrets | list | `[]` | A list of additional existing secrets that will be mounted into the container |
| extraSecrets[].name | string | `nil` | Name of the existing K8s secret |
| extraSecrets[].mountPath | string | `nil` | Mount path where the secret should be mounted into the container (f.e. /mysecretfolder) |
## RabbitMQ plugin base parameters
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| managementPlugin.enabled | bool | `true` | Enable management UI plugin with default configuration |
| managementPlugin.tcp.port | int | `15672` | Management UI port |
| prometheusPlugin.enabled | bool | `true` | Enable prometheus monitoring plugin with default configuration |
| prometheusPlugin.tcp.port | int | `15692` | Prometheus plugin TCP port |
| k8sPeerDiscoveryPlugin.enabled | bool | `true` | Enable K8s peer discovery plugin for a RabbitMQ HA-cluster with default configuration |
| k8sPeerDiscoveryPlugin.addressType | string | `"hostname"` | K8s peer discovery plugin address type (hostname or ip) |
## RabbitMQ custom configuration parameters
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| customConfig | string | `nil` | Custom configuration entries for rabbitmq.conf (see [RabbitMQ config](https://www.rabbitmq.com/configure.html#config-file)) |
| extraSecretConfigs | string | `nil` | An existing secret with files that will be added to the `rabbitmq.conf` |
| customAdvancedConfig | string | `nil` | Custom advanced configuration entries for advanced.config (see [RabbitMQ advanced config](https://www.rabbitmq.com/configure.html#advanced-config-file)) |
| extraSecretAdvancedConfigs | string | `nil` | An existing secret with files that will be added to the `advanced.conf` |
| extraEnvSecrets | list | `[]` | A list of existing secrets that will be mounted into the container as environment variables |

View File

@@ -0,0 +1,54 @@
# Changelog
| Chart version | App version | Change description |
| :------------ | :---------- | :----------------- |
| 0.3.13 | 3.8.27 | Fixed ingress API detection and implemented startupProbe support |
| 0.3.14 | 3.8.27 | Fixed startupProbe |
| 0.3.15 | 3.8.28 | Upgraded to RabbitMQ 3.8.28, Added graceful shutdown hook, Fixed headless service and enabled publishNotReadyAddresses |
| 0.3.16 | 3.8.29 | Upgraded to RabbitMQ 3.8.29 |
| 0.3.17 | 3.8.30 | Upgraded to RabbitMQ 3.8.30 |
| 0.3.18 | 3.8.31 | Upgraded to RabbitMQ 3.8.31 |
| 0.3.19 | 3.8.32 | Upgraded to RabbitMQ 3.8.32 |
| 0.3.20 | 3.8.33 | Upgraded to RabbitMQ 3.8.33 |
| 0.3.21 | 3.8.34 | Upgraded to RabbitMQ 3.8.34 |
| 0.4.8 | 3.9.13 | Upgraded to RabbitMQ 3.9.13, fixed ingress API detection, implemented startupProbe support |
| 0.4.9 | 3.9.13 | Fixed startupProbe |
| 0.4.10 | 3.9.13 | Implemented support for extra secrets and advanced configuration capabilites |
| 0.4.11 | 3.9.13 | Corrected chart documentation |
| 0.4.12 | 3.9.13 | Fixed headless service and enabled publishNotReadyAddresses |
| 0.4.13 | 3.9.13 | Added graceful shutdown hook |
| 0.4.14 | 3.9.14 | Upgraded to RabbitMQ 3.9.14 |
| 0.4.15 | 3.9.15 | Upgraded to RabbitMQ 3.9.15 |
| 0.4.16 | 3.9.16 | Upgraded to RabbitMQ 3.9.16 |
| 0.4.17 | 3.9.17 | Upgraded to RabbitMQ 3.9.17 |
| 0.4.18 | 3.9.18 | Upgraded to RabbitMQ 3.9.18 |
| 0.4.19 | 3.9.19 | Upgraded to RabbitMQ 3.9.19 |
| 0.4.20 | 3.9.20 | Upgraded to RabbitMQ 3.9.20 |
| 0.4.21 | 3.9.21 | Upgraded to RabbitMQ 3.9.21 |
| 0.4.22 | 3.9.22 | Upgraded to RabbitMQ 3.9.22 |
| 0.4.23 | 3.9.23 | Upgraded to RabbitMQ 3.9.23 |
| 0.4.24 | 3.9.24 | Upgraded to RabbitMQ 3.9.24 |
| 0.4.25 | 3.9.25 | Upgraded to RabbitMQ 3.9.25 |
| 0.4.26 | 3.9.26 | Upgraded to RabbitMQ 3.9.26 |
| 0.5.0 | 3.10.0 | Upgraded to RabbitMQ 3.10.0 |
| 0.5.1 | 3.10.1 | Upgraded to RabbitMQ 3.10.1 |
| 0.5.2 | 3.10.2 | Upgraded to RabbitMQ 3.10.2 |
| 0.5.3 | 3.10.4 | Upgraded to RabbitMQ 3.10.4 |
| 0.5.4 | 3.10.5 | Upgraded to RabbitMQ 3.10.5 |
| 0.5.5 | 3.10.5 | Added force_boot option during cluster redeployment |
| 0.5.6 | 3.10.5 | Added service monitor support |
| 0.5.7 | 3.10.6 | Added service monitor support |
| 0.5.8 | 3.10.7 | Upgraded to RabbitMQ 3.10.7 |
| 0.5.9 | 3.10.7 | Implemented support for image.registry option |
| 0.5.10 | 3.10.8 | Upgraded to RabbitMQ 3.10.8 |
| 0.5.11 | 3.10.9 | Upgraded to RabbitMQ 3.10.9 |
| 0.5.12 | 3.10.10 | Upgraded to RabbitMQ 3.10.10 |
| 0.5.13 | 3.10.11 | Upgraded to RabbitMQ 3.10.11 |
| 0.5.14 | 3.10.12 | Upgraded to RabbitMQ 3.10.12 |
| 0.6.0 | 3.11.0 | Upgraded to RabbitMQ 3.11.0 |
| 0.6.1 | 3.11.1 | Upgraded to RabbitMQ 3.11.1 |
| 0.6.2 | 3.11.2 | Upgraded to RabbitMQ 3.11.2 |
| 0.6.2 | 3.11.2 | Upgraded to RabbitMQ 3.11.2 |
| 0.6.3 | 3.11.3 | Upgraded to RabbitMQ 3.11.3 |
| 0.6.4 | 3.11.4 | Upgraded to RabbitMQ 3.11.4 |
| | | |

View File

@@ -0,0 +1,197 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "rabbitmq.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "rabbitmq.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
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 }}
{{/*
Common labels
*/}}
{{- define "rabbitmq.labels" -}}
helm.sh/chart: {{ include "rabbitmq.chart" . }}
{{ include "rabbitmq.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "rabbitmq.selectorLabels" -}}
app.kubernetes.io/name: {{ include "rabbitmq.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "rabbitmq.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "rabbitmq.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{/*
Return the number of bytes given a value
following a base 2 o base 10 number system.
Usage:
{{ include "rabbitmq.toBytes" .Values.path.to.the.Value }}
*/}}
{{- define "rabbitmq.toBytes" -}}
{{- $value := int (regexReplaceAll "([0-9]+).*" . "${1}") }}
{{- $unit := regexReplaceAll "[0-9]+(.*)" . "${1}" }}
{{- if eq $unit "Ki" }}
{{- mul $value 1024 }}
{{- else if eq $unit "Mi" }}
{{- mul $value 1024 1024 }}
{{- else if eq $unit "Gi" }}
{{- mul $value 1024 1024 1024 }}
{{- else if eq $unit "Ti" }}
{{- mul $value 1024 1024 1024 1024 }}
{{- else if eq $unit "Pi" }}
{{- mul $value 1024 1024 1024 1024 1024 }}
{{- else if eq $unit "Ei" }}
{{- mul $value 1024 1024 1024 1024 1024 1024 }}
{{- else if eq $unit "K" }}
{{- mul $value 1000 }}
{{- else if eq $unit "M" }}
{{- mul $value 1000 1000 }}
{{- else if eq $unit "G" }}
{{- mul $value 1000 1000 1000 }}
{{- else if eq $unit "T" }}
{{- mul $value 1000 1000 1000 1000 }}
{{- else if eq $unit "P" }}
{{- mul $value 1000 1000 1000 1000 1000 }}
{{- else if eq $unit "E" }}
{{- mul $value 1000 1000 1000 1000 1000 1000 }}
{{- end }}
{{- end -}}
{{/*
Management UI plugin options (when plugin is enabled)
*/}}
{{- define "rabbitmq.managementPluginOptions" -}}
{{- if .Values.managementPlugin.enabled }}
## Management UI plugin options
management.tcp.port = {{ .Values.managementPlugin.tcp.port }}
{{- end }}
{{- end -}}
{{/*
K8 peer discovery cluster plugin options (when plugin is enabled)
*/}}
{{- define "rabbitmq.k8sPeerDiscoveryPluginOptions" -}}
{{- if .Values.k8sPeerDiscoveryPlugin.enabled }}
## Clustering with K8s peer discovery plugin
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_k8s
cluster_formation.k8s.host = kubernetes.default.svc.{{ .Values.clusterDomain }}
cluster_formation.k8s.address_type = {{ .Values.k8sPeerDiscoveryPlugin.addressType }}
cluster_formation.k8s.service_name = {{ template "rabbitmq.fullname" . }}-internal
cluster_formation.k8s.hostname_suffix = .{{ template "rabbitmq.fullname" . }}-internal.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
{{- end }}
{{- end -}}
{{/*
Prometheus plugin options (when plugin is enabled)
*/}}
{{- define "rabbitmq.prometheusPluginOptions" -}}
{{- if .Values.prometheusPlugin.enabled }}
## Prometheus plugin options
prometheus.tcp.port = {{ .Values.prometheusPlugin.tcp.port }}
{{- end }}
{{- end -}}
{{/*
Main RabbitMQ options
*/}}
{{- define "rabbitmq.options" -}}
## Initial login user
default_user = {{ (.Values.authentication).user | default "guest" }}
default_pass = {{ (.Values.authentication).password | default "guest" }}
loopback_users.guest = false
## RabbitMQ options
listeners.tcp.default = {{ .Values.options.tcp.port }}
{{- with .Values.options.ssl }}
{{- if .enabled }}
## SSL options
listeners.ssl.default = {{ .port }}
{{- if .verify }}
ssl_options.verify = verify_peer
{{- else }}
ssl_options.verify = verify_none
{{- end }}
ssl_options.fail_if_no_peer_cert = {{ .failIfNoPeerCert }}
{{- if .depth }}
ssl_options.depth = {{ .depth }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.certificates }}
{{- if .enabled }}
{{- if .cacert }}
ssl_options.cacertfile = /ssl/cacert
{{- end }}
{{- if .cert }}
ssl_options.certfile = /ssl/cert
{{- end }}
{{- if .key }}
ssl_options.keyfile = /ssl/key
{{- end }}
{{- if .password }}
ssl_options.password = {{ .password }}
{{- end }}
{{- end }}
{{- end }}
## Memory options
{{- if ((.Values.options).memory).calculationStrategy }}
vm_memory_calculation_strategy = {{ .Values.options.memory.calculationStrategy }}
{{- end}}
{{- if ((.Values.options).memory).totalAvailableOverrideValue }}
total_memory_available_override_value = {{ .Values.options.memory.totalAvailableOverrideValue }}
{{- else }}
{{- $memLimit := ((.Values.resources).limits).memory -}}
{{- if $memLimit }}
total_memory_available_override_value = {{ include "rabbitmq.toBytes" $memLimit }}
{{- end }}
{{- end }}
{{- with .Values.options.memoryHighWatermark }}
{{- if .enabled }}
## Memory Threshold
vm_memory_high_watermark.{{ .type }} = {{ .value }}
{{- if .pagingRatio }}
vm_memory_high_watermark_paging_ratio = {{ .pagingRatio }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,28 @@
{{- if .Values.certificates.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "rabbitmq.fullname" . }}-certs
labels:
{{- include "rabbitmq.labels" . | nindent 4 }}
type: Opaque
data:
{{- with .Values.certificates -}}
{{- if .cacert }}
cacert: |
{{ .cacert | b64enc }}
{{- end }}
{{- if .cert }}
cert: |
{{ .cert | b64enc }}
{{- end }}
{{- if .key }}
key: |
{{ .key | b64enc }}
{{- end }}
{{- range $cert := .extraCerts }}
{{ $cert.name }}: |
{{ $cert.cert | b64enc }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,34 @@
{{- $fullname := include "rabbitmq.fullname" . }}
{{- $labels := include "rabbitmq.labels" . }}
{{- $selectorLabels := include "rabbitmq.selectorLabels" . }}
{{- range $service := .Values.extraServices }}
apiVersion: v1
kind: Service
metadata:
name: {{ $fullname }}-{{ $service.name }}
labels:
{{- $labels | nindent 4 }}
{{- with $service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ $service.type }}
ports:
- port: {{ $service.port }}
targetPort: {{ $service.name }}
protocol: {{ $service.protocol }}
name: {{ $service.name }}
{{- if and ( or (eq $service.type "LoadBalancer") (eq $service.type "NodePort") ) ($service.nodePort) }}
nodePort: {{ $service.nodePort }}
{{- end }}
{{- if and (eq $service.type "LoadBalancer") ($service.loadBalancerIP) }}
loadBalancerIP: {{ $service.loadBalancerIP }}
{{- end }}
{{- if $service.clusterIP }}
clusterIP: {{ $service.clusterIP }}
{{- end }}
selector:
{{- $selectorLabels | nindent 4 }}
---
{{- end }}

View File

@@ -0,0 +1,55 @@
{{- if .Values.ingress.enabled }}
{{- $fullName := include "rabbitmq.fullname" . -}}
{{- $svcPort := .Values.service.mgmt.port -}}
{{- $apiVersion := .Capabilities.APIVersions -}}
{{- if $apiVersion.Has "networking.k8s.io/v1" }}
apiVersion: networking.k8s.io/v1
{{- else }}
{{- if $apiVersion.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "rabbitmq.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
{{- if $apiVersion.Has "networking.k8s.io/v1" }}
pathType: ImplementationSpecific
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,22 @@
{{- if and (.Values.podDisruptionBudget) (or .Values.podDisruptionBudget.minAvailable .Values.podDisruptionBudget.maxUnavailable) }}
{{- if semverCompare ">=1.21" .Capabilities.KubeVersion.Version }}
apiVersion: policy/v1
{{- else }}
apiVersion: policy/v1beta1
{{- end }}
kind: PodDisruptionBudget
metadata:
name: {{ include "rabbitmq.fullname" . }}
labels:
{{- include "rabbitmq.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "rabbitmq.selectorLabels" . | nindent 6 }}
{{- end }}

View File

@@ -0,0 +1,22 @@
{{ $plugins := compact (list "") }}
{{- if .Values.k8sPeerDiscoveryPlugin.enabled }}
{{ $plugins = append $plugins "rabbitmq_peer_discovery_k8s" }}
{{- end }}
{{- if .Values.managementPlugin.enabled }}
{{ $plugins = append $plugins "rabbitmq_management" }}
{{- end }}
{{- if .Values.prometheusPlugin.enabled }}
{{ $plugins = append $plugins "rabbitmq_prometheus"}}
{{- end }}
{{- if .Values.plugins }}
{{ $plugins = concat $plugins .Values.plugins }}
{{- end }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "rabbitmq.fullname" . }}-plugins
labels:
{{- include "rabbitmq.labels" . | nindent 4 }}
data:
enabled_plugins: |
[{{- join "," $plugins }}].

View File

@@ -0,0 +1,20 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "rabbitmq.fullname" . }}-config
labels:
{{- include "rabbitmq.labels" . | nindent 4 }}
data:
rabbitmq.conf: |+
{{- include "rabbitmq.options" . | nindent 4 }}
{{- include "rabbitmq.managementPluginOptions" . | nindent 4 }}
{{- include "rabbitmq.k8sPeerDiscoveryPluginOptions" . | nindent 4 }}
{{- include "rabbitmq.prometheusPluginOptions" . | nindent 4 }}
{{- if .Values.customConfig }}
## Custom configuration
{{ .Values.customConfig | nindent 4 }}
{{- end }}
{{- if .Values.customAdvancedConfig }}
advanced.config: |+
{{ .Values.customAdvancedConfig | nindent 4 }}
{{- end }}

View File

@@ -0,0 +1,14 @@
{{- if .Values.rbac.create }}
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "rabbitmq.fullname" . }}-endpoint-reader
labels: {{- include "rabbitmq.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get"]
# - apiGroups: [""]
# resources: ["events"]
# verbs: ["create"]
{{- end }}

View File

@@ -0,0 +1,14 @@
{{- if and .Values.serviceAccount.create .Values.rbac.create }}
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "rabbitmq.fullname" . }}-endpoint-reader
labels: {{- include "rabbitmq.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ template "rabbitmq.serviceAccountName" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "rabbitmq.fullname" . }}-endpoint-reader
{{- end }}

View File

@@ -0,0 +1,80 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "rabbitmq.fullname" . }}-scripts
labels:
{{- include "rabbitmq.labels" . | nindent 4 }}
data:
init.sh: |
#!/bin/sh
echo "Initializing RabbitMQ instance..."
echo "Copy configuration"
cp /temp/rabbitmq/* /etc/rabbitmq
if [ -d /extraconfigs ]; then
echo "Add extra configs to rabbitmq config"
cat /extraconfigs/* >>/etc/rabbitmq/rabbitmq.conf
fi
if [ -d /extraadvancedconfigs ]; then
echo "Add extra advanced configs to rabbitmq advanced config"
cat /extraadvancedconfigs/* >>/etc/rabbitmq/advanced.conf
fi
if [ -d /temp/plugins ]; then
echo "Copy plugin configuration"
cp /temp/plugins/* /etc/rabbitmq
else
echo "No plugins configured."
fi
mkdir -p /etc/rabbitmq/conf.d
if [ ! -f /var/lib/rabbitmq/.erlang.cookie ]; then
echo "Copy erlang cookie"
echo $ERLANG_COOKIE >/var/lib/rabbitmq/.erlang.cookie
else
echo "Erlang cookie already exists."
fi
chmod 600 /var/lib/rabbitmq/.erlang.cookie
echo "Finished."
startup.sh: |
{{- if .Values.clustering.forceBoot }}
echo "Forcing boot of cluster instance" >/proc/1/fd/1
rabbitmqctl force_boot
{{- end }}
{{- if .Values.clustering.rebalance }}
until rabbitmqctl cluster_status >/dev/null; do
echo "PostStart: Waiting for cluster readiness..." >/proc/1/fd/1
sleep 5
done
echo "PostStart: Rebalancing all queues.." >/proc/1/fd/1
rabbitmq-queues rebalance "all" >/proc/1/fd/1
{{- end }}
shutdown.sh: |
{{- if and (.Values.terminationGracePeriodSeconds) (gt (int .Values.terminationGracePeriodSeconds) 10) }}
if rabbitmqctl cluster_status; then
echo "PreStop: Will wait up to {{ sub .Values.terminationGracePeriodSeconds 10 }} seconds for node to make sure cluster is healthy after node shutdown" >/proc/1/fd/1
timeout {{ sub .Values.terminationGracePeriodSeconds 10 }} /scripts/safeshutdown.sh
fi
{{- end }}
echo "PreStop: Stopping RabbitMQ" >/proc/1/fd/1
rabbitmqctl stop_app
echo "PreStop: RabbitMQ stopped" >/proc/1/fd/1
sleep 5
safeshutdown.sh: |
while true; do
waiting="false"
if ! rabbitmq-diagnostics -q check_if_node_is_mirror_sync_critical >/proc/1/fd/1; then
echo "PreStop: check_if_node_is_mirror_sync_critical returns error. Continuing to wait" >/proc/1/fd/1
waiting="true"
else
echo "PreStop: check_if_node_is_mirror_sync_critical returns o.k." >/proc/1/fd/1
fi
if ! rabbitmq-diagnostics -q check_if_node_is_quorum_critical >/proc/1/fd/1; then
echo "PreStop: check_if_node_is_quorum_critical returns error. Continuing to wait" >/proc/1/fd/1
waiting="true"
else
echo "PreStop: check_if_node_is_quorum_critical returns o.k." >/proc/1/fd/1
fi
if [ $waiting = "true" ]; then
sleep 1
else
break
fi
done

View File

@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "rabbitmq.fullname" . }}-internal
labels:
{{- include "rabbitmq.labels" . | nindent 4 }}
spec:
clusterIP: None
publishNotReadyAddresses: true
ports:
- port: {{ .Values.service.amqp.port }}
targetPort: amqp
name: amqp
- port: {{ .Values.service.mgmt.port }}
targetPort: mgmt
name: mgmt
- port: 4369
targetPort: epmd
name: epmd
- port: 25672
targetPort: dist
name: dist
selector:
{{- include "rabbitmq.selectorLabels" . | nindent 4 }}

View File

@@ -0,0 +1,51 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "rabbitmq.fullname" . }}
labels:
{{- include "rabbitmq.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ports:
- port: {{ .Values.service.amqp.port }}
targetPort: amqp
name: amqp
{{- if and ( or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") ) (.Values.service.amqp.nodePort) }}
nodePort: {{ .Values.service.amqp.nodePort }}
{{- end }}
{{- if .Values.options.ssl.enabled }}
- port: {{ .Values.service.amqps.port }}
targetPort: amqps
name: amqps
{{- if and ( or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") ) (.Values.service.amqps.nodePort) }}
nodePort: {{ .Values.service.amqps.nodePort }}
{{- end }}
{{- end }}
{{- if .Values.managementPlugin.enabled }}
- port: {{ .Values.service.mgmt.port }}
targetPort: mgmt
name: mgmt
{{- if and ( or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") ) (.Values.service.mgmt.nodePort) }}
nodePort: {{ .Values.service.mgmt.nodePort }}
{{- end }}
{{- end }}
{{- if .Values.prometheusPlugin.enabled }}
- port: {{ .Values.service.prometheus.port }}
targetPort: prometheus
name: prometheus
{{- if and ( or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") ) (.Values.service.prometheus.nodePort) }}
nodePort: {{ .Values.service.prometheus.nodePort }}
{{- end }}
{{- end }}
{{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.loadBalancerIP) }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
{{- if .Values.service.clusterIP }}
clusterIP: {{ .Values.service.clusterIP }}
{{- end }}
selector:
{{- include "rabbitmq.selectorLabels" . | nindent 4 }}
type: {{ .Values.service.type }}

View File

@@ -0,0 +1,14 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "rabbitmq.serviceAccountName" . }}
labels:
{{- include "rabbitmq.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
secrets:
- name: {{ include "rabbitmq.fullname" . }}
{{- end }}

View File

@@ -0,0 +1,34 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "rabbitmq.fullname" . }}
labels:
{{- include "rabbitmq.labels" . | nindent 4 }}
{{- with .Values.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.serviceMonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: "prometheus"
path: "/metrics"
{{- if .Values.serviceMonitor.interval }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
{{- if .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- with .Values.serviceMonitor.extraEndpointParameters }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.serviceMonitor.extraParameters }}
{{- toYaml . | nindent 2 }}
{{- end }}
selector:
matchLabels:
{{- include "rabbitmq.selectorLabels" . | nindent 6 }}
{{- end }}

View File

@@ -0,0 +1,316 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "rabbitmq.fullname" . }}
labels:
{{- include "rabbitmq.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "rabbitmq.selectorLabels" . | nindent 6 }}
serviceName: {{ include "rabbitmq.fullname" . }}-internal
podManagementPolicy: {{ .Values.podManagementPolicy }}
replicas: {{ .Values.replicaCount }}
{{- if .Values.revisionHistoryLimit }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
{{- end }}
updateStrategy:
type: {{ .Values.updateStrategyType }}
template:
metadata:
annotations:
checksum/rabbit-config: {{ include (print $.Template.BasePath "/rabbit-config.yaml") . | sha256sum }}
checksum/plugins-config: {{ include (print $.Template.BasePath "/plugins-config.yaml") . | sha256sum }}
checksum/scripts: {{ include (print $.Template.BasePath "/scripts.yaml") . | sha256sum }}
checksum/certs: {{ include (print $.Template.BasePath "/certs.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "rabbitmq.selectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "rabbitmq.serviceAccountName" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
initContainers:
- name: {{ .Chart.Name }}-init
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.initImage.registry }}/{{ .Values.initImage.repository }}:{{ .Values.initImage.tag }}"
imagePullPolicy: {{ .Values.initImage.pullPolicy }}
env:
{{- if .Values.authentication.erlangCookie }}
- name: ERLANG_COOKIE
value: {{ .Values.authentication.erlangCookie }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/rabbitmq
{{- if .Values.extraSecretConfigs }}
- mountPath: /extraconfigs
name: extraconfigs-volume
{{- end }}
{{- if .Values.extraSecretAdvancedConfigs }}
- mountPath: /extraadvancedconfigs
name: extraadvancedconfigs-volume
{{- end }}
- name: rabbitconfig
mountPath: /temp/rabbitmq
- name: rabbitmq-volume
mountPath: /var/lib/rabbitmq
- name: scripts
mountPath: /scripts
- name: plugins
mountPath: /temp/plugins
command: [ "/scripts/init.sh" ]
{{- with .Values.extraInitContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: amqp
containerPort: {{ .Values.options.tcp.port }}
{{- if .Values.options.ssl.enabled }}
- name: amqps
containerPort: {{ .Values.options.ssl.port }}
{{- end }}
{{- if .Values.managementPlugin.enabled }}
- name: mgmt
containerPort: {{ .Values.managementPlugin.tcp.port }}
{{- end }}
{{- if .Values.prometheusPlugin.enabled }}
- name: prometheus
containerPort: {{ .Values.prometheusPlugin.tcp.port }}
{{- end }}
- name: epmd
containerPort: 4369
- name: dist
containerPort: 25672
{{- range $service := .Values.extraServices }}
- name: {{ $service.name }}
containerPort: {{ $service.containerPort}}
protocol: {{ $service.protocol }}
{{- end }}
{{- if .Values.customStartupProbe }}
startupProbe:
{{- toYaml .Values.customStartupProbe | nindent 12 }}
{{- else }}
{{- if .Values.startupProbe.enabled }}
startupProbe:
exec:
command:
- /bin/bash
- -ec
- rabbitmq-diagnostics -q check_running
{{- with .Values.startupProbe }}
initialDelaySeconds: {{ .initialDelaySeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
failureThreshold: {{ .failureThreshold }}
successThreshold: {{ .successThreshold }}
periodSeconds: {{ .periodSeconds }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.customLivenessProbe }}
livenessProbe:
{{- toYaml .Values.customLivenessProbe | nindent 12 }}
{{- else }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
exec:
command:
- /bin/bash
- -ec
- rabbitmq-diagnostics -q check_running
{{- with .Values.livenessProbe }}
initialDelaySeconds: {{ .initialDelaySeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
periodSeconds: {{ .periodSeconds }}
failureThreshold: {{ .failureThreshold }}
successThreshold: {{ .successThreshold }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.customReadinessProbe }}
readinessProbe:
{{- toYaml .Values.customReadinessProbe | nindent 12 }}
{{- else }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
exec:
command:
- /bin/bash
- -ec
- rabbitmq-diagnostics -q check_running
{{- with .Values.readinessProbe }}
initialDelaySeconds: {{ .initialDelaySeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
periodSeconds: {{ .periodSeconds }}
failureThreshold: {{ .failureThreshold }}
successThreshold: {{ .successThreshold }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
lifecycle:
{{- if gt (.Values.replicaCount | int) 1 }}
postStart:
exec:
command:
- /bin/bash
- -ec
- /scripts/startup.sh
{{- end }}
preStop:
exec:
command:
- bash
- -ec
- /scripts/shutdown.sh
env:
- name: RABBITMQ_USE_LONGNAME
value: {{ .Values.clustering.useLongName | quote }}
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
{{- if .Values.clustering.useLongName }}
- name: RABBITMQ_NODENAME
value: rabbit@$(NODE_NAME).{{ include "rabbitmq.fullname" . }}-internal.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
{{- else }}
- name: RABBITMQ_NODENAME
value: rabbit@$(NODE_NAME)
{{- end }}
{{- with .Values.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
envFrom:
{{- range .Values.extraEnvSecrets }}
- secretRef:
name: {{ . }}
{{- end }}
{{- if .Values.args }}
args:
{{- range .Values.args }}
- {{ . }}
{{- end }}
{{- end }}
volumeMounts:
- name: logs
mountPath: /var/log/rabbitmq
- name: tmp
mountPath: /tmp
- name: rabbitmq-volume
mountPath: /var/lib/rabbitmq
- name: config
mountPath: /etc/rabbitmq
- name: scripts
mountPath: /scripts
{{- if .Values.certificates.enabled }}
- name: certs
mountPath: /ssl
{{- end }}
{{- range $secret := .Values.extraSecrets }}
- name: {{ $secret.name }}
mountPath: {{ $secret.mountPath }}
{{- end }}
{{- with .Values.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: tmp
emptyDir: {}
- name: logs
emptyDir: {}
- name: config
emptyDir: {}
- name: rabbitconfig
configMap:
name: {{ include "rabbitmq.fullname" . }}-config
{{- if .Values.extraSecretConfigs }}
- name: extraconfigs-volume
secret:
secretName: {{ .Values.extraSecretConfigs }}
{{- end }}
{{- if .Values.extraSecretAdvancedConfigs }}
- name: extraadvancedconfigs-volume
secret:
secretName: {{ .Values.extraSecretAdvancedConfigs }}
{{- end }}
- name: scripts
configMap:
name: {{ include "rabbitmq.fullname" . }}-scripts
defaultMode: 0555
- name: plugins
configMap:
name: {{ include "rabbitmq.fullname" . }}-plugins
{{- if .Values.certificates.enabled }}
- name: certs
secret:
secretName: {{ include "rabbitmq.fullname" . }}-certs
defaultMode: 0440
{{- end }}
{{- range $secret := .Values.extraSecrets }}
- name: {{ $secret.name }}
secret:
secretName: {{ $secret.name }}
defaultMode: 0440
{{- end }}
{{- if .Values.storage.persistentVolumeClaimName }}
- name: rabbitmq-volume
persistentVolumeClaim:
claimName: {{ .Values.storage.persistentVolumeClaimName }}
{{- else }}
{{- if not .Values.storage.requestedSize }}
- name: rabbitmq-volume
emptyDir: {}
{{- else }}
volumeClaimTemplates:
- metadata:
name: rabbitmq-volume
spec:
{{- with .Values.storage.accessModes }}
accessModes:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- if .Values.storage.className }}
storageClassName: {{ .Values.storage.className }}
{{- end }}
resources:
requests:
storage: {{ .Values.storage.requestedSize }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,379 @@
## Default values for the RabbitMQ deployment
## RabbitMQ docker image
image:
registry: "docker.io"
repository: "rabbitmq"
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
# Default Init container image
initImage:
registry: "docker.io"
repository: "busybox"
pullPolicy: IfNotPresent
tag: "latest"
## Pull secrets and name override options
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
## Number of replicas
replicaCount: 1
## Additional pod annotations
podAnnotations: {}
## Pod security options
podSecurityContext:
fsGroup: 5001
## Pod management policy
podManagementPolicy: OrderedReady
## Pod update strategy
updateStrategyType: RollingUpdate
## Default security options to run RabbitMq as read only container without privilege escalation
securityContext:
allowPrivilegeEscalation: false
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsGroup: 5001
runAsUser: 5001
## Default RabbitMq service ports (default: AMQP port 5672, Secure AMQP port 5671, Management UI port 15672)
service:
type: NodePort
## AMQP service port
amqp:
port: 5672
## The node port (only relevant for type LoadBalancer or NodePort)
nodePort: 20672
## Secure AMQP service port
amqps:
port: 5671
## The node port (only relevant for type LoadBalancer or NodePort)
nodePort:
## Management UI service port
mgmt:
port: 15672
## The node port (only relevant for type LoadBalancer or NodePort)
nodePort:
## Prometheus service port
prometheus:
port: 15692
## The node port (only relevant for type LoadBalancer or NodePort)
nodePort:
## The cluster ip address (only relevant for type LoadBalancer or NodePort)
clusterIP:
## The loadbalancer ip address (only relevant for type LoadBalancer)
loadBalancerIP:
# Annotations to add to the service
annotations: {}
## Custom list of extra services
extraServices: []
# - name: stomp
## Service port type
# type: ClusterIP
## Service protocol
# protocol: TCP
## The container target port
# containerPort: 12345
## The service port
# port: 12345
## The node port (only relevant for type LoadBalancer or NodePort)
# nodePort:
## The cluster ip address (only relevant for type LoadBalancer or NodePort)
# clusterIP:
## The loadbalancer ip address (only relevant for type LoadBalancer)
# loadBalancerIP:
## Annotations to add to the service
# annotations: {}
## Service monitor configuration for Prometheus metrics
## Prometheus plugin must be enabled to use this
serviceMonitor:
## Enable service monitor
enabled: false
## Additional labels for the service monitor object
additionalLabels: {}
## Annotations for the service monitor object
annotations: {}
## The scrape interval for prometheus
# interval:
## The scrape timeout value
# scrapeTimeout:
## Extra parameters rendered to the service monitor endpoint
extraEndpointParameters: {}
## Extra parameters rendered to the service monitor
extraParameters: {}
## Ingress configuration
ingress:
enabled: true
## Additional ingress annotations
annotations:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
cert-manager.io/cluster-issuer: cm-cloudflare-7421
className: "traefik"
## Hosts
hosts:
- host:
paths:
- /
## TLS settings for hosts
tls:
- secretName: rabbitmq-manage.107421.xyz-tls
hosts:
- rabbitmq-manage.107421.xyz
## Resource limits and requests
resources: {}
# limits:
# cpu: 100m
# memory: 512Mi
# requests:
# cpu: 100m
# memory: 128Mi
## Additional node selector
nodeSelector: {}
tolerations: []
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- node-tokyo-0
## Maximum number of revisions maintained in revision history
revisionHistoryLimit:
## Pod disruption budget
podDisruptionBudget: {}
## Minimum number of pods that must be available after eviction
# minAvailable:
## Maximum number of pods that can be unavailable after eviction
# maxUnavailable:
## Custom startup probe (overwrites default startup probe)
customStartupProbe: {}
## Default startup probe
startupProbe:
enabled: true
initialDelaySeconds: 10
timeoutSeconds: 5
failureThreshold: 30
successThreshold: 1
periodSeconds: 10
## Custom liveness probe (overwrites default liveness probe)
customLivenessProbe: {}
## Default liveness probe
livenessProbe:
enabled: true
initialDelaySeconds: 60
timeoutSeconds: 20
periodSeconds: 30
failureThreshold: 5
successThreshold: 1
## Custom readiness probe (overwrites default readiness probe)
customReadinessProbe: {}
## Default readiness probe
readinessProbe:
enabled: true
initialDelaySeconds: 60
timeoutSeconds: 20
periodSeconds: 30
failureThreshold: 5
successThreshold: 1
## Service account (necessary in cluster mode)
serviceAccount:
create: true
# Annotations to add to the service account
annotations: {}
# The name of the ServiceAccount to use. (If not set and create is true, a name is generated using the rabbitmq.fullname template)
name: ""
## Create RBAC (necessary in cluster mode)
rbac:
create: true
## Additional environment variables
env: []
## Arguments for the container entrypoint process
args: []
## Extra init containers
extraInitContainers: []
## Extra containers for usage as sidecars
extraContainers: []
## Default Kubernetes cluster domain
clusterDomain: wdd.io
## Container termination grace period
terminationGracePeriodSeconds: 60
# A list of plugins (without whitespace!) - f.e.: rabbitmq_federation_management,rabbitmq_mqtt,rabbitmq_stomp
plugins: []
# Default user and erlang cookie
# The erlang cookie is important for clustered or container based usage
# Find more information about it at https://hub.docker.com/_/rabbitmq and https://www.rabbitmq.com/clustering.html#erlang-cookie
# The erlang cookie is a MANDATORY VALUE
# Alternative is to set the environment variable ERLANG_COOKIE
authentication:
## Initial username
user: "boge"
## Initial password
password: "boge14@Level5"
## Erlang cookie (MANDATORY)
erlangCookie: dk5vcU1VQUxQRWF2ekRqYlRDVmZpeEFRNHFoS3BUVmE=
# RabbitMQ specific configuration options described at https://www.rabbitmq.com/configure.html#config-items
options:
## High memory watermark option is described at https://www.rabbitmq.com/memory.html
memoryHighWatermark:
## Enables high memory watermark configuration (default: false)
enabled: false
## Type of watermark value (relative or absoulte - default: relative)
type: "relative"
## High memory watermark value (default: 0.4 - 40%)
value: 0.4
## Paging threshold when RabbitMQ starts paging queue content before high memory watermark is reached
pagingRatio:
## Memory options are described at https://www.rabbitmq.com/configure.html
memory:
## Overwrites the value that is automatically calculated from resource.limits.memory
totalAvailableOverrideValue:
## Strategy for memory usage report (rss or allocated)
calculationStrategy:
tcp:
## AMQP tcp port (default: 5672)
port: 5672
## RabbitMQ AMQP-over-SSL options are described at https://www.rabbitmq.com/ssl.html
ssl:
## Enable secure AMQP (amqps)
enabled: false
## AMQPS port (default: 5671)
port: 5671
## Enables or disables peer verification (default: false)
verify: false
## Reject TLS connection when client fails to provide a certificate (default: false)
failIfNoPeerCert: false
## Client certificate verification depth
depth:
## Certificate support for RabbitMQ
certificates:
## Enable mounting following certificates into folder /ssl
enabled: false
## Certificates that will be used for AMQP-over-SSL (AMPQS) - see: options.ssl
## CA certificate(s) in base64 format
cacert:
## Server certificate in base64 format
cert:
## Private key in base64 format
key:
## Optional private key passwort
password:
## A list of extra certificates
## All certificates will be mounted to the container into /ssl and can be used for custom/advanced configuration (see: customConfig)
extraCerts: []
## Name of the certificate (will be the filename of the mounted certificate - i.e.: /ssl/{name})
# - name:
## The certificate content in base64 format
# cert:
## A list of additional existing secrets that will be mounted into the container
## The mounted files of the secrets can be used for custom or advanced configuration option (see: customConfig)
extraSecrets: []
## Name of the existing K8s secret
# - name:
## Mount path where the secret should be mounted into the container (f.e. /mysecretfolder)
# mountPath:
## A list of existing secrets that will be mounted into the container as environment variables
extraEnvSecrets: []
## Management UI plugin options
managementPlugin:
## Enable management UI plugin with default configuration
enabled: true
tcp:
## Management UI port (default: 15672)
port: 15672
## K8s peer discovery plugin options
k8sPeerDiscoveryPlugin:
## Enable K8s peer discovery plugin for a RabbitMQ HA-cluster with default configuration
enabled: false
## K8s peer discovery plugin address type (default: hostname)
addressType: hostname
## Prometheus plugin options
prometheusPlugin:
## Enable prometheus monitoring plugin with default configuration
enabled: false
tcp:
## Prometheus plugin TCP port (default: 15692)
port: 15692
## Custom configuration entries for rabbitmq.conf (see https://www.rabbitmq.com/configure.html#config-file)
customConfig: |
## An existing secret with files that will be added to the rabbitmq.conf
extraSecretConfigs:
## Custom advanced configuration entries for advanced.config (see https://www.rabbitmq.com/configure.html#advanced-config-file)
customAdvancedConfig: |
## An existing secret with files that will be added to the advanced.conf
extraSecretAdvancedConfigs:
## Common (recommended) cluster settings
clustering:
## Rebalance queues with master when new replica is created
rebalance: false
## Force boot in case cluster peers are not available
forceBoot: false
## Use FQDN for RabbitMQ node names
useLongName: true
## Storage parameters
storage:
## Set persistentVolumenClaimName to reference an existing PVC
persistentVolumeClaimName:
## Alternative set requestedSize to define a size for a dynamically created PVC
requestedSize: 10Gi
## the storage class name
className: local-path
## Default access mode (ReadWriteOnce)
accessModes:
- ReadWriteOnce