apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "rmq.fullname" . }}
labels:
app: {{ template "rmq.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "rmq.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "rmq.labels" . | nindent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.dockerRegistry }}{{ .Values.image.repository }}{{ .Values.image.imageName }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
{{- range .Values.service.ports }}
- name: {{ .name }}
protocol: {{ .protocol }}
containerPort: {{ .targetPort }}
{{- end }}
env:
- name: "RABBITMQ_DEFAULT_USER"
valueFrom:
secretKeyRef:
name: {{ .Values.secretName | quote }}
key: "RABBITMQ_DEFAULT_USER"
- name: "RABBITMQ_DEFAULT_PASS"
valueFrom:
secretKeyRef:
name: {{ .Values.secretName | quote }}
key: "RABBITMQ_DEFAULT_PASS"
- name: "CERT"
valueFrom:
secretKeyRef:
name: {{ .Values.secretName | quote }}
key: "CERT"
- name: "CERT_KEY"
valueFrom:
secretKeyRef:
name: {{ .Values.secretName | quote }}
key: "CERT_KEY"
# ports:
# containerPort: {{ .Values.service.containerPort }}
livenessProbe:
httpGet:
scheme: {{ .Values.livenessProbe.httpGet.scheme | default "HTTP" }}
path: {{ .Values.livenessProbe.httpGet.path }}
port: {{ .Values.livenessProbe.httpGet.port }}
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
readinessProbe:
httpGet:
scheme: {{ .Values.livenessProbe.httpGet.scheme | default "HTTP" }}
path: {{ .Values.readinessProbe.httpGet.path }}
port: {{ .Values.readinessProbe.httpGet.port }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- 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 }}
dnsPolicy: Default
below is the values.yaml file
# Default values for rmq.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
namespace:
create: true
name: ns-rabbitmq-dev
image:
containerName: rabbitmq-3
dockerRegistry: docker-bda.com.stihl-dns.net:443
imageName: rabbitmq-3
pullPolicy: IfNotPresent
repository: /stihl/
# Overrides the image tag whose default is the chart appVersion.
tag: "u20.04_002_r3_001"
#image: 'docker-bda.com.stihl-dns.net:443/stihl/rabbitmq-3:u20.04_002_r3_001'
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Automatically mount a ServiceAccount's API credentials?
automount: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podLabels: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
# service:
# name: rabbitmq-trial1
# type: ClusterIP
# portName: rmq
# protocol: TCP
# containerPort: 5672
# port: 5672
service:
name: rabbitmq-trial1
type: ClusterIP
ports:
- name: rmq
protocol: TCP
port: 5672
targetPort: 5672
- name: management
protocol: TCP
port: 15672
targetPort: 15672
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
livenessProbe:
httpGet:
scheme: HTTPS
path: /
port: 5672
initialDelaySeconds: 3
periodSeconds: 3
readinessProbe:
httpGet:
scheme: HTTPS
path: /
port: 5672
initialDelaySeconds: 3
periodSeconds: 3
# livenessProbe:
# httpGet:
# path: /
# port: http
# readinessProbe:
# httpGet:
# path: /
# port: http
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
volumes:
- name: data
hostPath: "./data"
mountPath: "/var/lib/rabbitmq"
- name: log
hostPath: "./log"
mountPath: "/var/log/rabbitmq"
- name: config
hostPath: "./config"
mountPath: "/etc/rabbitmq"
# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false
# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true
nodeSelector: {}
tolerations: []
affinity: {}
secretName: certificate-secrets
env:
RABBITMQ_DEFAULT_USER: 'admin'
RABBITMQ_DEFAULT_PASS: 'admin2024'
CERT: |-
-----BEGIN CERTIFICATE-----
blablabla
-----END CERTIFICATE-----
CERT_KEY: |-
-----BEGIN RSA PRIVATE KEY-----
bla bla bla
-----END RSA PRIVATE KEY-----
#Azure AD
# APPLICATION_ID:
# TENANT_ID:
# CLIENT_SECRET:
# AZURE_AD_JWKS_URI:
and this is service.yaml file
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.service.name }}
labels:
{{- include "rmq.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
{{- range .Values.service.ports }}
- name: {{ .name }}
protocol: {{ .protocol }}
port: {{ .port }}
targetPort: {{ .targetPort }}
{{- end }}
# - port: {{ .Values.service.port }}
# targetPort: {{ .Values.service.containerPort}}
# protocol: {{ .Values.service.protocol}}
# name: {{ .Values.service.portName}}
selector:
{{- include "rmq.selectorLabels" . | nindent 4 }}
and this is secret.yaml file
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.secretName }}
labels:
{{- include "rmq.labels" . | nindent 4 }}
stringData:
RABBITMQ_DEFAULT_USER: {{ .Values.env.RABBITMQ_DEFAULT_USER | quote }}
RABBITMQ_DEFAULT_PASS: {{ .Values.env.RABBITMQ_DEFAULT_PASS | quote }}
CERT: {{ .Values.env.CERT | quote }}
CERT_KEY: {{ .Values.env.CERT_KEY | quote }}
i am trying to create helm chart for rabbitmq at my work. and i am confused how to link volumes and multiple ports in it . i have share all relevant files . kindly tell me if i am making any mistaked as I am not able to deploy my helm chart on rancher.