@@ -484,19 +484,7 @@ func (r *ReconcileBroker) getBrokerStatefulSet(broker *rocketmqv1alpha1.Broker,
484484 ContainerPort : cons .BrokerHighAvailabilityContainerPort ,
485485 Name : cons .BrokerHighAvailabilityContainerPortName ,
486486 }},
487- VolumeMounts : []corev1.VolumeMount {{
488- MountPath : cons .LogMountPath ,
489- Name : broker .Spec .VolumeClaimTemplates [0 ].Name ,
490- SubPath : cons .LogSubPathName + getPathSuffix (broker , brokerGroupIndex , replicaIndex ),
491- }, {
492- MountPath : cons .StoreMountPath ,
493- Name : broker .Spec .VolumeClaimTemplates [0 ].Name ,
494- SubPath : cons .StoreSubPathName + getPathSuffix (broker , brokerGroupIndex , replicaIndex ),
495- }, {
496- MountPath : cons .BrokerConfigPath + "/" + cons .BrokerConfigName ,
497- Name : broker .Spec .Volumes [0 ].Name ,
498- SubPath : cons .BrokerConfigName ,
499- }},
487+ VolumeMounts : getVolumeMounts (broker , brokerGroupIndex , replicaIndex ),
500488 }},
501489 Volumes : getVolumes (broker ),
502490 SecurityContext : getPodSecurityContext (broker ),
@@ -512,6 +500,39 @@ func (r *ReconcileBroker) getBrokerStatefulSet(broker *rocketmqv1alpha1.Broker,
512500
513501}
514502
503+ func getVolumeMounts (broker * rocketmqv1alpha1.Broker , brokerGroupIndex int , replicaIndex int ) []corev1.VolumeMount {
504+ mounts := make ([]corev1.VolumeMount , 0 )
505+
506+ if len (broker .Spec .VolumeClaimTemplates ) >= 1 {
507+ mounts = append (mounts , corev1.VolumeMount {
508+ MountPath : cons .LogMountPath ,
509+ Name : broker .Spec .VolumeClaimTemplates [0 ].Name ,
510+ SubPath : cons .LogSubPathName + getPathSuffix (broker , brokerGroupIndex , replicaIndex ),
511+ })
512+ mounts = append (mounts , corev1.VolumeMount {
513+ MountPath : cons .StoreMountPath ,
514+ Name : broker .Spec .VolumeClaimTemplates [0 ].Name ,
515+ SubPath : cons .StoreSubPathName + getPathSuffix (broker , brokerGroupIndex , replicaIndex ),
516+ })
517+ }
518+ if len (broker .Spec .Volumes ) >= 1 {
519+ mounts = append (mounts , corev1.VolumeMount {
520+ MountPath : cons .BrokerConfigPath + "/" + cons .BrokerConfigName ,
521+ Name : broker .Spec .Volumes [0 ].Name ,
522+ SubPath : cons .BrokerConfigName ,
523+ })
524+ }
525+
526+ if len (broker .Spec .Volumes ) > 1 {
527+ mounts = append (mounts , corev1.VolumeMount {
528+ MountPath : cons .BrokerConfigPath + "/" + cons .BrokerPlainAclConfigName ,
529+ Name : broker .Spec .Volumes [1 ].Name ,
530+ SubPath : cons .BrokerPlainAclConfigName ,
531+ })
532+ }
533+ return mounts
534+ }
535+
515536func getENV (broker * rocketmqv1alpha1.Broker , replicaIndex int , brokerGroupIndex int ) []corev1.EnvVar {
516537 envs := []corev1.EnvVar {{
517538 Name : cons .EnvNameServiceAddress ,
0 commit comments