caigy commented on a change in pull request #81:
URL: https://github.com/apache/rocketmq-operator/pull/81#discussion_r700169437



##########
File path: images/namesrv/alpine/Dockerfile
##########
@@ -34,7 +34,7 @@ RUN set -eux; \
     apk add --virtual .build-deps curl gnupg unzip; \
     curl 
https://archive.apache.org/dist/rocketmq/${ROCKETMQ_VERSION}/rocketmq-all-${ROCKETMQ_VERSION}-bin-release.zip
 -o rocketmq.zip; \
     curl 
https://archive.apache.org/dist/rocketmq/${ROCKETMQ_VERSION}/rocketmq-all-${ROCKETMQ_VERSION}-bin-release.zip.asc
 -o rocketmq.zip.asc; \
-       curl https://www.apache.org/dist/rocketmq/KEYS -o KEYS; \
+       curl https://downloads.apache.org/rocketmq/KEYS -o KEYS; \

Review comment:
       Could you provide the reason to change it? It seems that this 
modification is not related to the title

##########
File path: pkg/controller/broker/broker_controller.go
##########
@@ -375,14 +375,43 @@ func getBrokerName(broker *rocketmqv1alpha1.Broker, 
brokerGroupIndex int) string
 
 // getBrokerStatefulSet returns a broker StatefulSet object
 func (r *ReconcileBroker) getBrokerStatefulSet(broker 
*rocketmqv1alpha1.Broker, brokerGroupIndex int, replicaIndex int) 
*appsv1.StatefulSet {
-       ls := labelsForBroker(broker.Name)
+       ls := labelsForBrokerWithRole(broker.Name,replicaIndex)
        var a int32 = 1
        var c = &a
        var statefulSetName string
+       var podAntiAffinity *corev1.PodAntiAffinity
        if replicaIndex == 0 {
                statefulSetName = broker.Name + "-" + 
strconv.Itoa(brokerGroupIndex) + "-master"
+               podAntiAffinity = &corev1.PodAntiAffinity{
+                       RequiredDuringSchedulingIgnoredDuringExecution:  
[]corev1.PodAffinityTerm{corev1.PodAffinityTerm{
+                               TopologyKey: "kubernetes.io/hostname",
+                               LabelSelector: &metav1.LabelSelector{
+                                       MatchLabels: ls,
+                                       },
+                               }},
+                       PreferredDuringSchedulingIgnoredDuringExecution: 
[]corev1.WeightedPodAffinityTerm{corev1.WeightedPodAffinityTerm{
+                               Weight: 100,
+                               PodAffinityTerm: corev1.PodAffinityTerm{
+                                       TopologyKey: "kubernetes.io/hostname",
+                                       LabelSelector: &metav1.LabelSelector{
+                                               MatchLabels: 
labelsForBroker(broker.Name),
+                                       },
+                               },
+                       }},
+               }

Review comment:
       Changes should be related to this PR. Also, podAntiAffinity feature is 
discussed in #38 with PR  #75, you can  join it and work together to implement 
this feature.

##########
File path: images/namesrv/alpine/runserver-customize.sh
##########
@@ -54,8 +54,8 @@ calculate_heap_sizes()
 {
     case "`uname`" in
         Linux)
-            system_memory_in_mb=`free -m| sed -n '2p' | awk '{print $2}'`
-            system_cpu_cores=`egrep -c 'processor([[:space:]]+):.*' 
/proc/cpuinfo`
+            system_memory_in_mb=$(($(cat 
/sys/fs/cgroup/memory/memory.limit_in_bytes)/1024/1024))
+            system_cpu_cores=$(($(cat 
/sys/fs/cgroup/cpu/cpu.cfs_quota_us)/100000))

Review comment:
       It would be better to check memory and cpu from cgroup are smaller than 
system memory and cpu, because resource limits may not be set.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to