You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by vo...@apache.org on 2019/09/04 07:31:43 UTC
[rocketmq-operator] 11/28: add ReplicationMode Spec
This is an automated email from the ASF dual-hosted git repository.
vongosling pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-operator.git
commit 4b495efbb6e2126eb09bfb8ae37e271cfe2bae1c
Author: liuruiyiyang <24...@qq.com>
AuthorDate: Mon Sep 2 13:10:37 2019 +0800
add ReplicationMode Spec
---
deploy/crds/cache_v1alpha1_broker_cr.yaml | 2 +-
deploy/crds/cache_v1alpha1_broker_crd.yaml | 3 +++
images/broker/brokerGenConfig.sh | 2 +-
images/broker/brokerStart.sh | 2 +-
deploy-operator.sh => install-operator.sh | 2 +-
pkg/apis/cache/v1alpha1/broker_types.go | 2 ++
pkg/apis/cache/v1alpha1/zz_generated.openapi.go | 7 +++++++
pkg/controller/broker/broker_controller.go | 2 +-
8 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/deploy/crds/cache_v1alpha1_broker_cr.yaml b/deploy/crds/cache_v1alpha1_broker_cr.yaml
index 79923f0..48acbae 100644
--- a/deploy/crds/cache_v1alpha1_broker_cr.yaml
+++ b/deploy/crds/cache_v1alpha1_broker_cr.yaml
@@ -6,4 +6,4 @@ spec:
# Add fields here
size: 1
nameServers: "192.168.130.33:9876;192.168.130.34:9876"
-
+ replicationMode: "ASYNC"
diff --git a/deploy/crds/cache_v1alpha1_broker_crd.yaml b/deploy/crds/cache_v1alpha1_broker_crd.yaml
index d787c05..0171207 100644
--- a/deploy/crds/cache_v1alpha1_broker_crd.yaml
+++ b/deploy/crds/cache_v1alpha1_broker_crd.yaml
@@ -30,6 +30,9 @@ spec:
nameServers:
description: NameServers defines the name service list e.g. 192.168.1.1:9876;192.168.1.2:9876
type: string
+ replicationMode:
+ description: ReplicationMode is SYNC or ASYNC
+ type: string
size:
format: int32
type: integer
diff --git a/images/broker/brokerGenConfig.sh b/images/broker/brokerGenConfig.sh
index cc7a02a..b5714bc 100755
--- a/images/broker/brokerGenConfig.sh
+++ b/images/broker/brokerGenConfig.sh
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-BROKER_CONFIG_FILE="/opt/rocketmq-$ROCKETMQ_VERSION/conf/broker.conf"
+BROKER_CONFIG_FILE="$ROCKETMQ_HOME/conf/broker.conf"
echo $BROKER_CONFIG_FILE
BROKER_ID=0
diff --git a/images/broker/brokerStart.sh b/images/broker/brokerStart.sh
index 090b337..b1d3c81 100755
--- a/images/broker/brokerStart.sh
+++ b/images/broker/brokerStart.sh
@@ -16,4 +16,4 @@
# limitations under the License.
./brokerGenConfig.sh
-./mqbroker -n $NAMESRV_ADDRESS
\ No newline at end of file
+./mqbroker -n $NAMESRV_ADDRESS -c $ROCKETMQ_HOME/conf/broker.conf
\ No newline at end of file
diff --git a/deploy-operator.sh b/install-operator.sh
similarity index 99%
rename from deploy-operator.sh
rename to install-operator.sh
index 8811c69..b497142 100755
--- a/deploy-operator.sh
+++ b/install-operator.sh
@@ -22,5 +22,5 @@ kubectl create -f deploy/role_binding.yaml
kubectl create -f deploy/operator.yaml
echo "Wait for operator being ready..."
-sleep 5
+sleep 2
kubectl create -f deploy/crds/cache_v1alpha1_broker_cr.yaml
diff --git a/pkg/apis/cache/v1alpha1/broker_types.go b/pkg/apis/cache/v1alpha1/broker_types.go
index cb1f4bc..a3c9de0 100644
--- a/pkg/apis/cache/v1alpha1/broker_types.go
+++ b/pkg/apis/cache/v1alpha1/broker_types.go
@@ -13,6 +13,8 @@ type BrokerSpec struct {
Size int32 `json:"size"`
// NameServers defines the name service list e.g. 192.168.1.1:9876;192.168.1.2:9876
NameServers string `json:"nameServers,omitempty"`
+ // ReplicationMode is SYNC or ASYNC
+ ReplicationMode string `json:"replicationMode,omitempty"`
}
// BrokerStatus defines the observed state of Broker
diff --git a/pkg/apis/cache/v1alpha1/zz_generated.openapi.go b/pkg/apis/cache/v1alpha1/zz_generated.openapi.go
index 7ae4070..764b988 100644
--- a/pkg/apis/cache/v1alpha1/zz_generated.openapi.go
+++ b/pkg/apis/cache/v1alpha1/zz_generated.openapi.go
@@ -79,6 +79,13 @@ func schema_pkg_apis_cache_v1alpha1_BrokerSpec(ref common.ReferenceCallback) com
Format: "",
},
},
+ "replicationMode": {
+ SchemaProps: spec.SchemaProps{
+ Description: "ReplicationMode is SYNC or ASYNC",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
},
Required: []string{"size"},
},
diff --git a/pkg/controller/broker/broker_controller.go b/pkg/controller/broker/broker_controller.go
index b949064..7fe1c05 100644
--- a/pkg/controller/broker/broker_controller.go
+++ b/pkg/controller/broker/broker_controller.go
@@ -190,7 +190,7 @@ func (r *ReconcileBroker) deploymentForBroker(m *cachev1alpha1.Broker) *appsv1.D
Value: m.Spec.NameServers,
},{
Name: "REPLICATION_MODE",
- Value: "ASYNC",
+ Value: m.Spec.ReplicationMode,
}},
//Command: []string{"memcached", "-m=64", "-o", "modern", "-v"},
Ports: []corev1.ContainerPort{{