github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/pulsar/config/broker-env.tpl (about)

     1  PULSAR_EXTRA_OPTS: -Dpulsar.allocator.exit_on_oom=true -Dio.netty.recycler.maxCapacity.default=1000 -Dio.netty.recycler.linkCapacity=1024 -Dnetworkaddress.cache.ttl=60 -XX:ActiveProcessorCount=1 -XshowSettings:vm -Ddepth=64
     2  PULSAR_GC: -XX:+UseG1GC -XX:MaxGCPauseMillis=10 -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:+DoEscapeAnalysis -XX:G1NewSizePercent=50 -XX:+DisableExplicitGC -XX:-ResizePLAB
     3  {{- $MaxDirectMemorySize := "" }}
     4  {{- $phy_memory := getContainerMemory ( index $.podSpec.containers 0 ) }}
     5  {{- if gt $phy_memory 0 }}
     6    {{- $MaxDirectMemorySize = printf "-XX:MaxDirectMemorySize=%dm" (mul (div $phy_memory ( mul 1024 1024 10)) 6) }}
     7  {{- end }}
     8  PULSAR_MEM: -XX:MinRAMPercentage=30 -XX:MaxRAMPercentage=30 {{ $MaxDirectMemorySize }}
     9  
    10  {{- $clusterName := $.cluster.metadata.name }}
    11  {{- $namespace := $.cluster.metadata.namespace }}
    12  {{- $pulsar_zk_from_service_ref := fromJson "{}" }}
    13  {{- $pulsar_zk_from_component := fromJson "{}" }}
    14  
    15  {{- if index $.component "serviceReferences" }}
    16    {{- range $i, $e := $.component.serviceReferences }}
    17      {{- if eq $i "pulsarZookeeper" }}
    18        {{- $pulsar_zk_from_service_ref = $e }}
    19        {{- break }}
    20      {{- end }}
    21    {{- end }}
    22  {{- end }}
    23  {{- range $i, $e := $.cluster.spec.componentSpecs }}
    24    {{- if eq $e.componentDefRef "zookeeper" }}
    25      {{- $pulsar_zk_from_component = $e }}
    26    {{- end }}
    27  {{- end }}
    28  
    29  # Try to get zookeeper from service reference first, if zookeeper service reference is empty, get default zookeeper componentDef in ClusterDefinition
    30  {{- $zk_server := "" }}
    31  {{- if $pulsar_zk_from_service_ref }}
    32    {{- if and (index $pulsar_zk_from_service_ref.spec "endpoint") (index $pulsar_zk_from_service_ref.spec "port") }}
    33       {{- $zk_server = printf "%s:%s" $pulsar_zk_from_service_ref.spec.endpoint.value $pulsar_zk_from_service_ref.spec.port.value }}
    34    {{- else }}
    35       {{- $zk_server = printf "%s-%s.%s.svc:2181" $clusterName $pulsar_zk_from_component.name $namespace }}
    36    {{- end }}
    37  {{- else }}
    38    {{- $zk_server = printf "%s-%s.%s.svc:2181" $clusterName $pulsar_zk_from_component.name $namespace }}
    39  {{- end }}
    40  zookeeperServers: {{ $zk_server }}
    41  configurationStoreServers: {{ $zk_server }}