Skip to content

Commit

Permalink
feat: support deploy in kubeblock
Browse files Browse the repository at this point in the history
Signed-off-by: wangxye <[email protected]>
  • Loading branch information
wangxye authored and wangxye committed Oct 23, 2023
1 parent 909c76f commit 3c0544c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 24 deletions.
2 changes: 1 addition & 1 deletion rocketmq-k8s-helm/templates/broker/_brokerconfig.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ limitations under the License.
{{- $replicaCount := .Values.broker.replicaCount | int }}
{{- range $index := until $replicaCount }}
{{ $clusterName }}-{{ $name }}-{{ $index }}: |
name: {{ $clusterName }}-{{ $brokerNamePrefix }}-{{ $index }}
name: {{ $clusterName }}-{{ $name }}-{{ $index }}
instanceId: {{ $brokerNamePrefix }}-{{ $index }}
bindAddress: "0.0.0.0:{{ $bindAddress.port }}"
innerAccessKey: {{ $innerKey.accessKey }}
Expand Down
45 changes: 30 additions & 15 deletions rocketmq-k8s-helm/templates/broker/clusterdefinition.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps.kubeblocks.io/v1alpha1
kind: ClusterDefinition
metadata:
Expand All @@ -7,34 +22,29 @@ metadata:
spec:
type: rocketmq-on-s3
componentDefs:
- name: rocketmq-on-s3
- name: rocketmq-on-s3-broker
description: |-
Rocketmq broker that act as both brokers and controllers are referred to as "combined" servers.
workloadType: Stateful # Consensus
workloadType: Stateful
characterType: rocketmq-broker
probes:
monitor:
configSpecs:
{{/* - name: broker-config*/}}
{{/* configMap:*/}}
{{/* name: broker-conf*/}}
{{/* - name: broker-storage*/}}
{{/* hostPath:*/}}
{{/* path: /root/logs/rocketmqlogs*/}}
{{/* type: DirectoryOrCreate*/}}
- name: broker-conf
templateRef: broker-conf
volumeName: broker-conf
namespace: {{ .Release.Namespace }}
scriptSpecs:
service:
ports:
- name: rocketmq-broker
targetPort: rocketmq-broker
port: 8081
podSpec:
securityContext:
fsGroup: 1001
containers:
- name: rocketmq
- name: broker
command: [ "/bin/sh" ]
args: [ "-c", "./run-server.sh com.automq.rocketmq.broker.BrokerStartup -c /home/rocketmq/rocketmq-on-s3-5.1.3/conf/broker/$(CLUSTER_NAME)-$(POD_NAME)" ]
args: [ "-c", "./run-server.sh com.automq.rocketmq.broker.BrokerStartup -c /home/rocketmq/rocketmq-on-s3-5.1.3/conf/broker/$(POD_NAME)" ]
env:
- name: POD_NAME
valueFrom:
Expand Down Expand Up @@ -84,6 +94,11 @@ spec:
port: rocketmq-broker
volumeMounts:
- mountPath: /home/rocketmq/rocketmq-on-s3-5.1.3/conf/broker
name: broker-config
name: broker-conf
- mountPath: /root/logs/rocketmqlogs
name: broker-storage
name: broker-storage
volumes:
- name: broker-storage
hostPath:
path: /root/logs/rocketmqlogs
type: DirectoryOrCreate
27 changes: 19 additions & 8 deletions rocketmq-k8s-helm/templates/broker/clusterversion.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps.kubeblocks.io/v1alpha1
kind: ClusterVersion
metadata:
name: {{ include "rocketmq-broker.fullname" . }}-{{ default .Chart.AppVersion .Values.clusterVersionOverride }}
name: {{ .Release.Name }}-{{ default .Chart.AppVersion .Values.broker.image.tag }}
labels:
{{- include "rocketmq-broker.selectorLabels" . | nindent 8 }}
spec:
clusterDefinitionRef: {{ .Release.Name }}
componentVersions:
- componentDefRef: rocketmq-on-s3
- componentDefRef: rocketmq-on-s3-broker
versionsContext:
containers:
- name: rocketmq-on-s3
- name: broker
image: {{ .Values.broker.image.repository }}:{{ .Values.broker.image.tag | default .Chart.AppVersion }}
imagePullPolicy: {{ default "IfNotPresent" .Values.broker.image.pullPolicy }}
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1001
imagePullPolicy: {{ default "IfNotPresent" .Values.broker.image.pullPolicy }}

0 comments on commit 3c0544c

Please sign in to comment.