Skip to content

Commit

Permalink
chart(rocketmq-cluster): release 12.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
itboon committed Aug 11, 2024
1 parent cff9e5b commit 1e1903b
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 99 deletions.
2 changes: 1 addition & 1 deletion charts/rocketmq-cluster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: rocketmq-cluster
description: RocketMQ Helm chart
type: application

version: 12.0.2
version: 12.1.0
appVersion: '5.3.0'

maintainers:
Expand Down
13 changes: 8 additions & 5 deletions charts/rocketmq-cluster/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,12 @@ env NAMESRV_ADDR
*/}}
{{- define "rocketmq.nameserver.addr" -}}
{{- $nsFullName := include "rocketmq.nameserver.fullname" . -}}
{{- $nsReplica := int .Values.nameserver.replicaCount -}}
{{- range $i := until $nsReplica -}}
{{- if gt $i 0 }}{{ printf ";" }}{{ end -}}
{{- printf "%s-%d.%s:9876" $nsFullName $i $nsFullName -}}
{{- $headlessDomain := printf "%s-headless.%s.svc" $nsFullName .Release.Namespace -}}
{{- $address := list -}}
{{- $replicaCount := int .Values.nameserver.replicaCount -}}
{{- range $i := until $replicaCount -}}
{{- $address = printf "%s-%d.%s:9876" $nsFullName $i $headlessDomain | append $address -}}
{{- end -}}
{{- end }}
{{- join ";" $address -}}
{{- end -}}

18 changes: 15 additions & 3 deletions charts/rocketmq-cluster/templates/broker/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ metadata:
name: {{ $brokerFullName }}
labels:
{{- include "rocketmq.labels" $ | nindent 4 }}
{{- with $.Values.broker.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
minReadySeconds: {{ $.Values.broker.minReadySeconds | default 10 }}
podManagementPolicy: OrderedReady
minReadySeconds: {{ $.Values.broker.minReadySeconds | default 20 }}
replicas: {{ $masterSize }}
podManagementPolicy: {{ $.Values.broker.podManagementPolicy | default "OrderedReady" }}
{{- with $.Values.broker.updateStrategy }}
updateStrategy:
type: RollingUpdate
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{- include "rocketmq.selectorLabels" $ | nindent 6 }}
Expand All @@ -38,6 +44,12 @@ spec:
serviceName: ""
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") $ | sha256sum }}
{{- with $.Values.broker.podAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "rocketmq.selectorLabels" $ | nindent 8 }}
component: {{ $clusterRole }}
Expand Down
12 changes: 6 additions & 6 deletions charts/rocketmq-cluster/templates/dashboard/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{{- if and .Values.dashboard.enabled .Values.dashboard.auth .Values.dashboard.auth.enabled -}}
{{- $authValues := .Values.dashboard.auth -}}
{{- $fullName := include "rocketmq.dashboard.configmap.fullname" . -}}
{{- with .Values.dashboard }}
{{- if and .enabled .auth .auth.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $fullName| quote }}
name: {{ include "rocketmq.dashboard.configmap.fullname" $ | quote }}
data:
{{- if .Values.dashboard.auth.users }}
{{- if .auth.users }}
users.properties: |
{{- range .Values.dashboard.auth.users }}
{{- range .auth.users }}
{{ .name }}={{ .password }}{{ if .isAdmin }},1{{ end }}
{{- end }}
{{- else }}
users.properties: |
admin=admin,1
{{- end }}
{{- end }}
{{- end }}
55 changes: 32 additions & 23 deletions charts/rocketmq-cluster/templates/dashboard/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,67 +1,76 @@
{{- if .Values.dashboard.enabled -}}
{{- $fullName := include "rocketmq.dashboard.fullname" . -}}
{{- $nameserverFullName := include "rocketmq.nameserver.fullname" . -}}
{{- $maxHeapSize := .Values.dashboard.jvm.maxHeapSize }}
{{- $image := printf "%s:%s" .Values.dashboard.image.repository .Values.dashboard.image.tag }}
{{- with .Values.dashboard -}}
{{- if .enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $fullName | quote }}
name: {{ include "rocketmq.dashboard.fullname" $ | quote }}
labels:
{{- include "rocketmq.labels" . | nindent 4 }}
{{- include "rocketmq.labels" $ | nindent 4 }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.dashboard.replicaCount }}
replicas: {{ .replicaCount }}
selector:
matchLabels:
{{- include "rocketmq.selectorLabels" . | nindent 6 }}
{{- include "rocketmq.selectorLabels" $ | nindent 6 }}
component: dashboard
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/dashboard/configmap.yaml") $ | sha256sum }}
{{- with .podAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "rocketmq.selectorLabels" . | nindent 8 }}
{{- include "rocketmq.selectorLabels" $ | nindent 8 }}
component: dashboard
spec:
containers:
- name: dashboard
image: {{ $image | quote }}
imagePullPolicy: {{ .Values.dashboard.image.pullPolicy | default "IfNotPresent" }}
image: {{ printf "%s:%s" .image.repository .image.tag | quote }}
imagePullPolicy: {{ .image.pullPolicy | default "IfNotPresent" }}
env:
- name: JAVA_OPTS
value: {{ printf "-XX:MaxHeapSize=%s -Drocketmq.namesrv.addr=%s:9876" .Values.dashboard.jvm.maxHeapSize $nameserverFullName }}
{{- if .Values.dashboard.auth.enabled }}
{{- $namesrvAddr := printf "%s.%s.svc:9876" (include "rocketmq.nameserver.fullname" $) $.Release.Namespace }}
value: {{ printf "-XX:MaxHeapSize=%s -Drocketmq.namesrv.addr=%s" .jvm.maxHeapSize $namesrvAddr }}
{{- if .auth.enabled }}
- name: rocketmq.config.loginRequired
value: "true"
- name: rocketmq.config.dataPath
value: {{ include "rocketmq.dashboard.dataPath" . }}
value: {{ include "rocketmq.dashboard.dataPath" $ }}
{{- end }}
ports:
- name: http
containerPort: 8080
protocol: TCP
resources:
{{- toYaml .Values.dashboard.resources | nindent 10 }}
{{- with .Values.dashboard.livenessProbe }}
{{- toYaml .resources | nindent 10 }}
{{- with .livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.dashboard.readinessProbe }}
{{- with .readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.dashboard.auth.enabled }}
{{- if .auth.enabled }}
volumeMounts:
- mountPath: "{{ include "rocketmq.dashboard.dataPath" . }}/users.properties"
- mountPath: "{{ include "rocketmq.dashboard.dataPath" $ }}/users.properties"
name: dashboard-cm
subPath: users.properties
{{- end }}
terminationGracePeriodSeconds: {{ .Values.dashboard.terminationGracePeriodSeconds | default 5 }}
{{- if .Values.dashboard.auth.enabled }}
terminationGracePeriodSeconds: {{ .terminationGracePeriodSeconds | default 5 }}
{{- if .auth.enabled }}
volumes:
- configMap:
items:
- key: users.properties
path: users.properties
name: {{ include "rocketmq.dashboard.configmap.fullname" . }}
name: {{ include "rocketmq.dashboard.configmap.fullname" $ }}
name: dashboard-cm
{{- end }}
{{- end }}
{{- end }}
30 changes: 16 additions & 14 deletions charts/rocketmq-cluster/templates/dashboard/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{{- if .Values.dashboard.ingress.enabled -}}
{{- $fullName := include "rocketmq.dashboard.fullname" . -}}
{{- if and .Values.dashboard.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.dashboard.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.dashboard.ingress.annotations "kubernetes.io/ingress.class" .Values.dashboard.ingress.className}}
{{- with .Values.dashboard.ingress -}}
{{- if and .enabled $.Values.dashboard.enabled -}}
{{- $fullName := include "rocketmq.dashboard.fullname" $ -}}
{{- if and .className (not (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .annotations "kubernetes.io/ingress.class" .className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- else if semverCompare ">=1.14-0" $.Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
Expand All @@ -16,18 +17,18 @@ kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "rocketmq.labels" . | nindent 4 }}
{{- with .Values.dashboard.ingress.annotations }}
{{- include "rocketmq.labels" $ | nindent 4 }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.dashboard.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.dashboard.ingress.className }}
{{- if and .className (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .className }}
{{- end }}
{{- if .Values.dashboard.ingress.tls }}
{{- if .tls }}
tls:
{{- range .Values.dashboard.ingress.tls }}
{{- range .tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
Expand All @@ -36,7 +37,7 @@ spec:
{{- end }}
{{- end }}
rules:
{{- range .Values.dashboard.ingress.hosts }}
{{- range .hosts }}
- host: {{ .host | quote }}
http:
paths:
Expand All @@ -54,3 +55,4 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
{{- $fullName := include "rocketmq.nameserver.fullname" . -}}
{{- with .Values.nameserver -}}
{{- $clusterRole := "nameserver" -}}
{{- $configmapName := include "rocketmq.configmap.fullname" . -}}
{{- $image := printf "%s:%s" .Values.image.repository .Values.image.tag }}
{{- $configmapName := include "rocketmq.configmap.fullname" $ -}}
{{- $image := printf "%s:%s" $.Values.image.repository $.Values.image.tag }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ $fullName | quote }}
name: {{ include "rocketmq.nameserver.fullname" $ | quote }}
labels:
{{- include "rocketmq.labels" $ | nindent 4 }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
minReadySeconds: {{ .Values.nameserver.minReadySeconds | default 10 }}
podManagementPolicy: OrderedReady
replicas: {{ .Values.nameserver.replicaCount }}
minReadySeconds: {{ .minReadySeconds | default 20 }}
replicas: {{ .replicaCount }}
podManagementPolicy: {{ .podManagementPolicy | default "OrderedReady" }}
{{- with .updateStrategy }}
updateStrategy:
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{- include "rocketmq.selectorLabels" $ | nindent 6 }}
component: {{ $clusterRole }}
serviceName: {{ $fullName | quote }}
serviceName: "{{ include "rocketmq.nameserver.fullname" $ }}-headless"
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") $ | sha256sum }}
{{- with .podAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "rocketmq.selectorLabels" $ | nindent 8 }}
component: {{ $clusterRole }}
spec:
{{- with $.Values.nameserver.nodeSelector }}
{{- with .nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if not $.Values.nameserver.affinityOverride }}
{{- if not .affinityOverride }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -38,42 +52,42 @@ spec:
{{- include "rocketmq.selectorLabels" $ | nindent 18 }}
component: nameserver
topologyKey: kubernetes.io/hostname
{{- else if $.Values.nameserver.affinityOverride }}
{{- else if .affinityOverride }}
affinity:
{{- toYaml $.Values.nameserver.affinityOverride | nindent 8 }}
{{- toYaml .affinityOverride | nindent 8 }}
{{- end }}
{{- with $.Values.nameserver.tolerations }}
{{- with .tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: nameserver
image: {{ $image | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy | default "IfNotPresent" }}
imagePullPolicy: {{ $.Values.image.pullPolicy | default "IfNotPresent" }}
command:
- sh
- /mq-server-start.sh
env:
- name: ROCKETMQ_PROCESS_ROLE
value: {{ $clusterRole }}
- name: ROCKETMQ_JAVA_OPTIONS_HEAP
{{- $maxHeapSize := .Values.nameserver.jvm.maxHeapSize }}
{{- $maxHeapSize := .jvm.maxHeapSize }}
value: {{ printf "-Xms%s -Xmx%s" $maxHeapSize $maxHeapSize }}
{{- if .Values.proxy.jvm.javaOptsOverride }}
{{- if and .jvm .jvm.javaOptsOverride }}
- name: ROCKETMQ_JAVA_OPTIONS_OVERRIDE
value: {{ .Values.proxy.jvm.javaOptsOverride }}
value: {{ .jvm.javaOptsOverride | quote }}
{{- end }}
ports:
- containerPort: 9876
name: main
protocol: TCP
resources:
{{- toYaml .Values.nameserver.resources | nindent 10 }}
{{- with .Values.nameserver.readinessProbe }}
{{- toYaml .resources | nindent 10 }}
{{- with .readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.nameserver.livenessProbe }}
{{- with .livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 10 }}
{{- end }}
Expand All @@ -89,7 +103,7 @@ spec:
name: nameserver-storage
subPath: logs
dnsPolicy: ClusterFirst
terminationGracePeriodSeconds: {{ $.Values.nameserver.terminationGracePeriodSeconds | default 15 }}
terminationGracePeriodSeconds: {{ .terminationGracePeriodSeconds | default 15 }}
volumes:
- configMap:
items:
Expand All @@ -98,7 +112,7 @@ spec:
name: {{ $configmapName }}
defaultMode: 0755
name: mq-server-start-sh
{{- if not $.Values.nameserver.persistence.enabled }}
{{- if not .persistence.enabled }}
- name: nameserver-storage
emptyDir: {}
{{- else }}
Expand All @@ -108,10 +122,11 @@ spec:
spec:
accessModes:
- ReadWriteOnce
{{- with $.Values.nameserver.persistence.storageClass }}
{{- with .persistence.storageClass }}
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }}
{{- end }}
resources:
requests:
storage: {{ $.Values.nameserver.persistence.size | quote }}
{{- end }}
storage: {{ .persistence.size | quote }}
{{- end }}
{{- end }}
Loading

0 comments on commit 1e1903b

Please sign in to comment.