问:
How does the master bootstrap process work and how can I debug it?
I am working to stand up 3 instances of the yugabyte master and tserver in separate k8s clusters connected over LoadBalancer services on bare metal. However, on all three master instances it looks like the bootstrap process is failing:

```<code>I0531 19:50:28.081645     1 master_main.cc:94] NumCPUs determined to be: 2
I0531 19:50:28.082594     1 server_base_options.cc:124] Updating master addrs to {yb-master-black.example.com:7100},{yb-master-blue.example.com:7100},{yb-master-white.example.com:7100},{:7100}
I0531 19:50:28.082682     1 server_base_options.cc:124] Updating master addrs to {yb-master-black.example.com:7100},{yb-master-blue.example.com:7100},{yb-master-white.example.com:7100},{:7100}
I0531 19:50:28.082937     1 mem_tracker.cc:249] MemTracker: hard memory limit is 1.699219 GB
I0531 19:50:28.082963     1 mem_tracker.cc:251] MemTracker: soft memory limit is 1.444336 GB
I0531 19:50:28.083189     1 server_base_options.cc:124] Updating master addrs to {yb-master-black.example.com:7100},{yb-master-blue.example.com:7100},{yb-master-white.example.com:7100},{:7100}
I0531 19:50:28.090148     1 server_base_options.cc:124] Updating master addrs to {yb-master-black.example.com:7100},{yb-master-blue.example.com:7100},{yb-master-white.example.com:7100},{:7100}
I0531 19:50:28.090863     1 rpc_server.cc:86] yb::server::RpcServer created at 0x1a7e210
I0531 19:50:28.090924     1 master.cc:146] yb::master::Master created at 0x7ffe2d4bd140
I0531 19:50:28.090958     1 master.cc:147] yb::master::TSManager created at 0x1a90850
I0531 19:50:28.090975     1 master.cc:148] yb::master::CatalogManager created at 0x1dea000
I0531 19:50:28.091152     1 master_main.cc:115] Initializing master server...
I0531 19:50:28.093097     1 server_base.cc:462] Could not load existing FS layout: Not found (yb/util/env_posix.cc:1482): /mnt/disk0/yb-data/master/instance: No such file or directory (system error 2)
I0531 19:50:28.093150     1 server_base.cc:463] Creating new FS layout
I0531 19:50:28.193439     1 fs_manager.cc:463] Generated new instance metadata in path /mnt/disk0/yb-data/master/instance:
uuid: "5f2f6ad78d27450b8cde9c8bcf40fefa"
format_stamp: "Formatted at 2020-05-31 19:50:28 on yb-master-0"
I0531 19:50:28.238484     1 fs_manager.cc:463] Generated new instance metadata in path /mnt/disk1/yb-data/master/instance:
uuid: "5f2f6ad78d27450b8cde9c8bcf40fefa"
format_stamp: "Formatted at 2020-05-31 19:50:28 on yb-master-0"
I0531 19:50:28.377483     1 fs_manager.cc:251] Opened local filesystem: /mnt/disk0,/mnt/disk1
uuid: "5f2f6ad78d27450b8cde9c8bcf40fefa"
format_stamp: "Formatted at 2020-05-31 19:50:28 on yb-master-0"
I0531 19:50:28.378015     1 server_base.cc:245] Auto setting FLAGS_num_reactor_threads to 2
I0531 19:50:28.380707     1 thread_pool.cc:166] Starting thread pool { name: Master queue_limit: 10000 max_workers: 1024 }
I0531 19:50:28.382266     1 master_main.cc:118] Starting Master server...
I0531 19:50:28.382313    24 async_initializer.cc:74] Starting to init ybclient
I0531 19:50:28.382365     1 master_main.cc:119] ulimit cur(max)...
ulimit: core file size unlimited(unlimited) blks
ulimit: data seg size unlimited(unlimited) kb
ulimit: open files 1048576(1048576)
ulimit: file size unlimited(unlimited) blks
ulimit: pending signals 22470(22470)
ulimit: file locks unlimited(unlimited)
ulimit: max locked memory 64(64) kb
ulimit: max memory size unlimited(unlimited) kb
ulimit: stack size 8192(unlimited) kb
ulimit: cpu time unlimited(unlimited) secs
ulimit: max user processes unlimited(unlimited)
W0531 19:50:28.383322    24 master.cc:186] Failed to get current config: Illegal state (yb/master/catalog_manager.cc:6854): Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
I0531 19:50:28.383525    24 client-internal.cc:1847] New master addresses: [yb-master-black.example.com:7100,yb-master-blue.example.com:7100,yb-master-white.example.com:7100,:7100]
I0531 19:50:28.383685     1 service_pool.cc:148] yb.master.MasterBackupService: yb::rpc::ServicePoolImpl created at 0x1a82b40
I0531 19:50:28.384888     1 service_pool.cc:148] yb.master.MasterService: yb::rpc::ServicePoolImpl created at 0x1a83680
I0531 19:50:28.385342     1 service_pool.cc:148] yb.tserver.TabletServerService: yb::rpc::ServicePoolImpl created at 0x1a838c0
I0531 19:50:28.388526     1 thread_pool.cc:166] Starting thread pool { name: Master-high-pri queue_limit: 10000 max_workers: 1024 }
I0531 19:50:28.388588     1 service_pool.cc:148] yb.consensus.ConsensusService: yb::rpc::ServicePoolImpl created at 0x201eb40
I0531 19:50:28.393231     1 service_pool.cc:148] yb.tserver.RemoteBootstrapService: yb::rpc::ServicePoolImpl created at 0x201ed80
I0531 19:50:28.393501     1 webserver.cc:148] Starting webserver on 0.0.0.0:7000
I0531 19:50:28.393544     1 webserver.cc:153] Document root: /home/yugabyte/www
I0531 19:50:28.394471     1 webserver.cc:240] Webserver started. Bound to: http://0.0.0.0:7000/
I0531 19:50:28.394668     1 service_pool.cc:148] yb.server.GenericService: yb::rpc::ServicePoolImpl created at 0x201efc0
I0531 19:50:28.395015     1 rpc_server.cc:169] RPC server started. Bound to: 0.0.0.0:7100
I0531 19:50:28.420223    23 tcp_stream.cc:308] { local: 10.233.80.35:55710 remote: 172.16.0.34:7100 }:  Recv failed: Network error (yb/util/net/socket.cc:537): recvmsg error: Connection refused (system error 111)
E0531 19:51:28.523921    24 async_initializer.cc:84] Failed to initialize client: Timed out (yb/rpc/rpc.cc:213): Could not locate the leader master: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 293) passed its deadline 2074493.105s (passed: 60.140s): Not found (yb/master/master_rpc.cc:284): no leader found: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 1)
W0531 19:51:29.524827    24 master.cc:186] Failed to get current config: Illegal state (yb/master/catalog_manager.cc:6854): Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
I0531 19:51:29.524914    24 client-internal.cc:1847] New master addresses: [yb-master-black.example.com:7100,yb-master-blue.example.com:7100,yb-master-white.example.com:7100,:7100]
E0531 19:52:29.524785    24 async_initializer.cc:84] Failed to initialize client: Timed out (yb/rpc/outbound_call.cc:512): Could not locate the leader master: GetMasterRegistration RPC (request call id 2359) to 172.29.1.1:7100 timed out after 0.033s
W0531 19:52:30.525079    24 master.cc:186] Failed to get current config: Illegal state (yb/master/catalog_manager.cc:6854): Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
I0531 19:52:30.525205    24 client-internal.cc:1847] New master addresses: [yb-master-black.example.com:7100,yb-master-blue.example.com:7100,yb-master-white.example.com:7100,:7100]
W0531 19:53:28.114395    36 master-path-handlers.cc:150] Illegal state (yb/master/catalog_manager.cc:6854): Unable to list Masters: Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
W0531 19:53:29.133951    36 master-path-handlers.cc:1002] Illegal state (yb/master/catalog_manager.cc:6854): Unable to list Masters: Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
E0531 19:53:30.625366    24 async_initializer.cc:84] Failed to initialize client: Timed out (yb/rpc/rpc.cc:213): Could not locate the leader master: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 299) passed its deadline 2074615.247s (passed: 60.099s): Not found (yb/master/master_rpc.cc:284): no leader found: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 1)
W0531 19:53:31.625660    24 master.cc:186] Failed to get current config: Illegal state (yb/master/catalog_manager.cc:6854): Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
I0531 19:53:31.625742    24 client-internal.cc:1847] New master addresses: [yb-master-black.example.com:7100,yb-master-blue.example.com:7100,yb-master-white.example.com:7100,:7100]
W0531 19:53:34.024369    37 master-path-handlers.cc:150] Illegal state (yb/master/catalog_manager.cc:6854): Unable to list Masters: Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
E0531 19:54:31.870801    24 async_initializer.cc:84] Failed to initialize client: Timed out (yb/rpc/rpc.cc:213): Could not locate the leader master: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 300) passed its deadline 2074676.348s (passed: 60.244s): Not found (yb/master/master_rpc.cc:284): no leader found: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 1)
W0531 19:54:32.871065    24 master.cc:186] Failed to get current config: Illegal state (yb/master/catalog_manager.cc:6854): Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
I0531 19:54:32.871222    24 client-internal.cc:1847] New master addresses: [yb-master-black.example.com:7100,yb-master-blue.example.com:7100,yb-master-white.example.com:7100,:7100]
W0531 19:55:28.190217    41 master-path-handlers.cc:1002] Illegal state (yb/master/catalog_manager.cc:6854): Unable to list Masters: Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
W0531 19:55:31.745038    42 master-path-handlers.cc:1002] Illegal state (yb/master/catalog_manager.cc:6854): Unable to list Masters: Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
E0531 19:55:33.164300    24 async_initializer.cc:84] Failed to initialize client: Timed out (yb/rpc/rpc.cc:213): Could not locate the leader master: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 299) passed its deadline 2074737.593s (passed: 60.292s): Not found (yb/master/master_rpc.cc:284): no leader found: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 1)
W0531 19:55:34.164574    24 master.cc:186] Failed to get current config: Illegal state (yb/master/catalog_manager.cc:6854): Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
I0531 19:55:34.164667    24 client-internal.cc:1847] New master addresses: [yb-master-black.example.com:7100,yb-master-blue.example.com:7100,yb-master-white.example.com:7100,:7100]
E0531 19:56:34.315380    24 async_initializer.cc:84] Failed to initialize client: Timed out (yb/rpc/rpc.cc:213): Could not locate the leader master: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 299) passed its deadline 2074798.886s (passed: 60.150s): Not found (yb/master/master_rpc.cc:284): no leader found: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 1)

</code>```

As far as connectivity goes, I am able to verify the LoadBalancer endpoints are responding across the different network boundaries by curling the same service endpoint but on the UI port:

```<code>[root@yb-master-0 yugabyte]# curl -I http://yb-master-blue.example.com:7000
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1975
Access-Control-Allow-Origin: *

[root@yb-master-0 yugabyte]# curl -I http://yb-master-white.example.com:7000
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1975
Access-Control-Allow-Origin: *

[root@yb-master-0 yugabyte]# curl -I http://yb-master-black.example.com:7000
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1975
Access-Control-Allow-Origin: *

</code>```

What strategies are there to debug the bootstrap process?

EDIT:
Here are the startup flags for the master:

```<code>/home/yugabyte/bin/yb-master --fs_data_dirs=/mnt/disk0,/mnt/disk1 --server_broadcast_addresses=yb-master-white.example.com:7100 --master_addresses=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, --replication_factor=3 --enable_ysql=true --rpc_bind_addresses=0.0.0.0:7100 --metric_node_name=yb-master-0 --memory_limit_hard_bytes=1824522240 --stderrthreshold=0 --num_cpus=2 --undefok=num_cpus,enable_ysql --default_memory_limit_to_ram_ratio=0.85 --leader_failure_max_missed_heartbeat_periods=10 --placement_cloud=AAAA --placement_region=XXXX --placement_zone=XXXX

/home/yugabyte/bin/yb-master --fs_data_dirs=/mnt/disk0,/mnt/disk1 --server_broadcast_addresses=yb-master-blue.example.com:7100 --master_addresses=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, --replication_factor=3 --enable_ysql=true --rpc_bind_addresses=0.0.0.0:7100 --metric_node_name=yb-master-0 --memory_limit_hard_bytes=1824522240 --stderrthreshold=0 --num_cpus=2 --undefok=num_cpus,enable_ysql --default_memory_limit_to_ram_ratio=0.85 --leader_failure_max_missed_heartbeat_periods=10 --placement_cloud=AAAA --placement_region=YYYY --placement_zone=YYYY

/home/yugabyte/bin/yb-master --fs_data_dirs=/mnt/disk0,/mnt/disk1 --server_broadcast_addresses=yb-master-black.example.com:7100 --master_addresses=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100,  --replication_factor=3 --enable_ysql=true --rpc_bind_addresses=0.0.0.0:7100 --metric_node_name=yb-master-0 --memory_limit_hard_bytes=1824522240 --stderrthreshold=0 --num_cpus=2 --undefok=num_cpus,enable_ysql --default_memory_limit_to_ram_ratio=0.85 --leader_failure_max_missed_heartbeat_periods=10 --placement_cloud=AAAA --placement_region=ZZZZ --placement_zone=ZZZZ
</code>```

For the sake of completeness here is one of the k8s manifest that I've modified from one of the helm examples. It is modified to utilize LoadBalancer for the master service:

```<code>---
# Source: yugabyte/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: "yb-masters"
  labels:
    app: "yb-master"
    heritage: "Helm"
    release: "blue"
    chart: "yugabyte"
    component: "yugabytedb"
spec:
  type: LoadBalancer
  loadBalancerIP: 172.16.0.34
  ports:
    - name: "rpc-port"
      port: 7100
    - name: "ui"
      port: 7000
  selector:
    app: "yb-master"
---
# Source: yugabyte/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: "yb-tservers"
  labels:
    app: "yb-tserver"
    heritage: "Helm"
    release: "blue"
    chart: "yugabyte"
    component: "yugabytedb"
spec:
  clusterIP: None
  ports:
    - name: "rpc-port"
      port: 7100
    - name: "ui"
      port: 9000
    - name: "yedis-port"
      port: 6379
    - name: "yql-port"
      port: 9042
    - name: "ysql-port"
      port: 5433
  selector:
    app: "yb-tserver"
---
# Source: yugabyte/templates/service.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: "yb-master"
  namespace: "yugabytedb"
  labels:
    app: "yb-master"
    heritage: "Helm"
    release: "blue"
    chart: "yugabyte"
    component: "yugabytedb"
spec:
  serviceName: "yb-masters"
  podManagementPolicy: Parallel

  replicas: 1

  volumeClaimTemplates:
    - metadata:
        name: datadir0
        annotations:
          volume.beta.kubernetes.io/storage-class: rook-ceph-block
        labels:
          heritage: "Helm"
          release: "blue"
          chart: "yugabyte"
          component: "yugabytedb"
      spec:
        accessModes:
          - "ReadWriteOnce"
        storageClassName: rook-ceph-block
        resources:
          requests:
            storage: 10Gi
    - metadata:
        name: datadir1
        annotations:
          volume.beta.kubernetes.io/storage-class: rook-ceph-block
        labels:
          heritage: "Helm"
          release: "blue"
          chart: "yugabyte"
          component: "yugabytedb"
      spec:
        accessModes:
          - "ReadWriteOnce"
        storageClassName: rook-ceph-block
        resources:
          requests:
            storage: 10Gi
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:

      partition: 0

  selector:
    matchLabels:
      app: "yb-master"
  template:
    metadata:

      labels:
        app: "yb-master"
        heritage: "Helm"
        release: "blue"
        chart: "yugabyte"
        component: "yugabytedb"
    spec:
      affinity:
        # Set the anti-affinity selector scope to YB masters.

        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - "yb-master"
              topologyKey: kubernetes.io/hostname
      containers:
      - name: "yb-master"
        image: "yugabytedb/yugabyte:2.1.6.0-b17"
        imagePullPolicy: IfNotPresent
        lifecycle:
          postStart:
            exec:
              command:
                - "sh"
                - "-c"
                - >
                  mkdir -p /mnt/disk0/cores;
                  mkdir -p /mnt/disk0/yb-data/scripts;
                  if [ ! -f /mnt/disk0/yb-data/scripts/log_cleanup.sh ]; then
                    if [ -f /home/yugabyte/bin/log_cleanup.sh ]; then
                      cp /home/yugabyte/bin/log_cleanup.sh /mnt/disk0/yb-data/scripts;
                    fi;
                  fi
        env:
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: HOSTNAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        resources:

          limits:
            cpu: 2
            memory: 2Gi
          requests:
            cpu: 500m
            memory: 1Gi

        command:

          - "/home/yugabyte/bin/yb-master"

          - "--fs_data_dirs=/mnt/disk0,/mnt/disk1"

          - "--server_broadcast_addresses=yb-master-blue.example.com:7100"

          - "--master_addresses=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, "
          - "--replication_factor=3"

          - "--enable_ysql=true"
          - "--rpc_bind_addresses=0.0.0.0:7100"
          - "--metric_node_name=$(HOSTNAME)"
          - "--memory_limit_hard_bytes=1824522240"
          - "--stderrthreshold=0"
          - "--num_cpus=2"
          - "--undefok=num_cpus,enable_ysql"
          - "--default_memory_limit_to_ram_ratio=0.85"
          - "--leader_failure_max_missed_heartbeat_periods=10"
          - "--placement_cloud=AAAA"
          - "--placement_region=YYYY"
          - "--placement_zone=YYYY"

        ports:
          - containerPort: 7100
            name: "rpc-port"
          - containerPort: 7000
            name: "ui"
        volumeMounts:

          - name: datadir0
            mountPath: /mnt/disk0
          - name: datadir1
            mountPath: /mnt/disk1

      - name: yb-cleanup
        image: busybox:1.31
        env:
        - name: USER
          value: "yugabyte"
        command:
          - "/bin/sh"
          - "-c"
          - >
            mkdir /var/spool/cron;
            mkdir /var/spool/cron/crontabs;
            echo "0 * * * * /home/yugabyte/scripts/log_cleanup.sh" | tee -a /var/spool/cron/crontabs/root;
            crond;
            while true; do
              sleep 86400;
            done
        volumeMounts:
          - name: datadir0
            mountPath: /home/yugabyte/
            subPath: yb-data

      volumes:

        - name: datadir0
          hostPath:
            path: /mnt/disks/ssd0
        - name: datadir1
          hostPath:
            path: /mnt/disks/ssd1
---
# Source: yugabyte/templates/service.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: "yb-tserver"
  namespace: "yugabytedb"
  labels:
    app: "yb-tserver"
    heritage: "Helm"
    release: "blue"
    chart: "yugabyte"
    component: "yugabytedb"
spec:
  serviceName: "yb-tservers"
  podManagementPolicy: Parallel

  replicas: 1

  volumeClaimTemplates:
    - metadata:
        name: datadir0
        annotations:
          volume.beta.kubernetes.io/storage-class: rook-ceph-block
        labels:
          heritage: "Helm"
          release: "blue"
          chart: "yugabyte"
          component: "yugabytedb"
      spec:
        accessModes:
          - "ReadWriteOnce"
        storageClassName: rook-ceph-block
        resources:
          requests:
            storage: 10Gi
    - metadata:
        name: datadir1
        annotations:
          volume.beta.kubernetes.io/storage-class: rook-ceph-block
        labels:
          heritage: "Helm"
          release: "blue"
          chart: "yugabyte"
          component: "yugabytedb"
      spec:
        accessModes:
          - "ReadWriteOnce"
        storageClassName: rook-ceph-block
        resources:
          requests:
            storage: 10Gi
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:

      partition: 0

  selector:
    matchLabels:
      app: "yb-tserver"
  template:
    metadata:

      labels:
        app: "yb-tserver"
        heritage: "Helm"
        release: "blue"
        chart: "yugabyte"
        component: "yugabytedb"
    spec:
      affinity:
        # Set the anti-affinity selector scope to YB masters.

        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - "yb-tserver"
              topologyKey: kubernetes.io/hostname
      containers:
      - name: "yb-tserver"
        image: "yugabytedb/yugabyte:2.1.6.0-b17"
        imagePullPolicy: IfNotPresent
        lifecycle:
          postStart:
            exec:
              command:
                - "sh"
                - "-c"
                - >
                  mkdir -p /mnt/disk0/cores;
                  mkdir -p /mnt/disk0/yb-data/scripts;
                  if [ ! -f /mnt/disk0/yb-data/scripts/log_cleanup.sh ]; then
                    if [ -f /home/yugabyte/bin/log_cleanup.sh ]; then
                      cp /home/yugabyte/bin/log_cleanup.sh /mnt/disk0/yb-data/scripts;
                    fi;
                  fi
        env:
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: HOSTNAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        resources:

          limits:
            cpu: 2
            memory: 4Gi
          requests:
            cpu: 500m
            memory: 2Gi

        command:

          - "/home/yugabyte/bin/yb-tserver"
          - "--fs_data_dirs=/mnt/disk0,/mnt/disk1"
          - "--server_broadcast_addresses=$(HOSTNAME).yb-tservers.$(NAMESPACE).svc.cluster.local:9100"
          - "--rpc_bind_addresses=$(HOSTNAME).yb-tservers.$(NAMESPACE).svc.cluster.local"
          - "--cql_proxy_bind_address=$(HOSTNAME).yb-tservers.$(NAMESPACE).svc.cluster.local"

          - "--enable_ysql=true"
          - "--pgsql_proxy_bind_address=$(POD_IP):5433"

          - "--tserver_master_addrs=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, "

          - "--metric_node_name=$(HOSTNAME)"
          - "--memory_limit_hard_bytes=3649044480"
          - "--stderrthreshold=0"
          - "--num_cpus=2"
          - "--undefok=num_cpus,enable_ysql"
          - "--leader_failure_max_missed_heartbeat_periods=10"
          - "--placement_cloud=AAAA"
          - "--placement_region=YYYY"
          - "--placement_zone=YYYY"
          - "--use_cassandra_authentication=false"

        ports:
          - containerPort: 7100
            name: "rpc-port"
          - containerPort: 9000
            name: "ui"
          - containerPort: 6379
            name: "yedis-port"
          - containerPort: 9042
            name: "yql-port"
          - containerPort: 5433
            name: "ysql-port"
        volumeMounts:

          - name: datadir0
            mountPath: /mnt/disk0
          - name: datadir1
            mountPath: /mnt/disk1

      - name: yb-cleanup
        image: busybox:1.31
        env:
        - name: USER
          value: "yugabyte"
        command:
          - "/bin/sh"
          - "-c"
          - >
            mkdir /var/spool/cron;
            mkdir /var/spool/cron/crontabs;
            echo "0 * * * * /home/yugabyte/scripts/log_cleanup.sh" | tee -a /var/spool/cron/crontabs/root;
            crond;
            while true; do
              sleep 86400;
            done
        volumeMounts:
          - name: datadir0
            mountPath: /home/yugabyte/
            subPath: yb-data

      volumes:

        - name: datadir0
          hostPath:
            path: /mnt/disks/ssd0
        - name: datadir1
          hostPath:
            path: /mnt/disks/ssd1
</code>```

答:
This was mostly resolved (looks like I've now run into an unrelated issue), by dropping the extraneous comma on the master addresses list:

```<code>--master_addresses=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100,
</code>```

vs

```<code>--master_addresses=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100
</code>```

Body:
I am working to stand up 3 instances of the yugabyte master and tserver in separate k8s clusters connected over LoadBalancer services on bare metal. However, on all three master instances it looks like the bootstrap process is failing:

I0531 19:50:28.081645     1 master_main.cc:94] NumCPUs determined to be: 2
I0531 19:50:28.082594     1 server_base_options.cc:124] Updating master addrs to {yb-master-black.example.com:7100},{yb-master-blue.example.com:7100},{yb-master-white.example.com:7100},{:7100}
I0531 19:50:28.082682     1 server_base_options.cc:124] Updating master addrs to {yb-master-black.example.com:7100},{yb-master-blue.example.com:7100},{yb-master-white.example.com:7100},{:7100}
I0531 19:50:28.082937     1 mem_tracker.cc:249] MemTracker: hard memory limit is 1.699219 GB
I0531 19:50:28.082963     1 mem_tracker.cc:251] MemTracker: soft memory limit is 1.444336 GB
I0531 19:50:28.083189     1 server_base_options.cc:124] Updating master addrs to {yb-master-black.example.com:7100},{yb-master-blue.example.com:7100},{yb-master-white.example.com:7100},{:7100}
I0531 19:50:28.090148     1 server_base_options.cc:124] Updating master addrs to {yb-master-black.example.com:7100},{yb-master-blue.example.com:7100},{yb-master-white.example.com:7100},{:7100}
I0531 19:50:28.090863     1 rpc_server.cc:86] yb::server::RpcServer created at 0x1a7e210
I0531 19:50:28.090924     1 master.cc:146] yb::master::Master created at 0x7ffe2d4bd140
I0531 19:50:28.090958     1 master.cc:147] yb::master::TSManager created at 0x1a90850
I0531 19:50:28.090975     1 master.cc:148] yb::master::CatalogManager created at 0x1dea000
I0531 19:50:28.091152     1 master_main.cc:115] Initializing master server...
I0531 19:50:28.093097     1 server_base.cc:462] Could not load existing FS layout: Not found (yb/util/env_posix.cc:1482): /mnt/disk0/yb-data/master/instance: No such file or directory (system error 2)
I0531 19:50:28.093150     1 server_base.cc:463] Creating new FS layout
I0531 19:50:28.193439     1 fs_manager.cc:463] Generated new instance metadata in path /mnt/disk0/yb-data/master/instance:
uuid: "5f2f6ad78d27450b8cde9c8bcf40fefa"
format_stamp: "Formatted at 2020-05-31 19:50:28 on yb-master-0"
I0531 19:50:28.238484     1 fs_manager.cc:463] Generated new instance metadata in path /mnt/disk1/yb-data/master/instance:
uuid: "5f2f6ad78d27450b8cde9c8bcf40fefa"
format_stamp: "Formatted at 2020-05-31 19:50:28 on yb-master-0"
I0531 19:50:28.377483     1 fs_manager.cc:251] Opened local filesystem: /mnt/disk0,/mnt/disk1
uuid: "5f2f6ad78d27450b8cde9c8bcf40fefa"
format_stamp: "Formatted at 2020-05-31 19:50:28 on yb-master-0"
I0531 19:50:28.378015     1 server_base.cc:245] Auto setting FLAGS_num_reactor_threads to 2
I0531 19:50:28.380707     1 thread_pool.cc:166] Starting thread pool { name: Master queue_limit: 10000 max_workers: 1024 }
I0531 19:50:28.382266     1 master_main.cc:118] Starting Master server...
I0531 19:50:28.382313    24 async_initializer.cc:74] Starting to init ybclient
I0531 19:50:28.382365     1 master_main.cc:119] ulimit cur(max)...
ulimit: core file size unlimited(unlimited) blks
ulimit: data seg size unlimited(unlimited) kb
ulimit: open files 1048576(1048576)
ulimit: file size unlimited(unlimited) blks
ulimit: pending signals 22470(22470)
ulimit: file locks unlimited(unlimited)
ulimit: max locked memory 64(64) kb
ulimit: max memory size unlimited(unlimited) kb
ulimit: stack size 8192(unlimited) kb
ulimit: cpu time unlimited(unlimited) secs
ulimit: max user processes unlimited(unlimited)
W0531 19:50:28.383322    24 master.cc:186] Failed to get current config: Illegal state (yb/master/catalog_manager.cc:6854): Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
I0531 19:50:28.383525    24 client-internal.cc:1847] New master addresses: [yb-master-black.example.com:7100,yb-master-blue.example.com:7100,yb-master-white.example.com:7100,:7100]
I0531 19:50:28.383685     1 service_pool.cc:148] yb.master.MasterBackupService: yb::rpc::ServicePoolImpl created at 0x1a82b40
I0531 19:50:28.384888     1 service_pool.cc:148] yb.master.MasterService: yb::rpc::ServicePoolImpl created at 0x1a83680
I0531 19:50:28.385342     1 service_pool.cc:148] yb.tserver.TabletServerService: yb::rpc::ServicePoolImpl created at 0x1a838c0
I0531 19:50:28.388526     1 thread_pool.cc:166] Starting thread pool { name: Master-high-pri queue_limit: 10000 max_workers: 1024 }
I0531 19:50:28.388588     1 service_pool.cc:148] yb.consensus.ConsensusService: yb::rpc::ServicePoolImpl created at 0x201eb40
I0531 19:50:28.393231     1 service_pool.cc:148] yb.tserver.RemoteBootstrapService: yb::rpc::ServicePoolImpl created at 0x201ed80
I0531 19:50:28.393501     1 webserver.cc:148] Starting webserver on 0.0.0.0:7000
I0531 19:50:28.393544     1 webserver.cc:153] Document root: /home/yugabyte/www
I0531 19:50:28.394471     1 webserver.cc:240] Webserver started. Bound to: http://0.0.0.0:7000/
I0531 19:50:28.394668     1 service_pool.cc:148] yb.server.GenericService: yb::rpc::ServicePoolImpl created at 0x201efc0
I0531 19:50:28.395015     1 rpc_server.cc:169] RPC server started. Bound to: 0.0.0.0:7100
I0531 19:50:28.420223    23 tcp_stream.cc:308] { local: 10.233.80.35:55710 remote: 172.16.0.34:7100 }:  Recv failed: Network error (yb/util/net/socket.cc:537): recvmsg error: Connection refused (system error 111)
E0531 19:51:28.523921    24 async_initializer.cc:84] Failed to initialize client: Timed out (yb/rpc/rpc.cc:213): Could not locate the leader master: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 293) passed its deadline 2074493.105s (passed: 60.140s): Not found (yb/master/master_rpc.cc:284): no leader found: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 1)
W0531 19:51:29.524827    24 master.cc:186] Failed to get current config: Illegal state (yb/master/catalog_manager.cc:6854): Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
I0531 19:51:29.524914    24 client-internal.cc:1847] New master addresses: [yb-master-black.example.com:7100,yb-master-blue.example.com:7100,yb-master-white.example.com:7100,:7100]
E0531 19:52:29.524785    24 async_initializer.cc:84] Failed to initialize client: Timed out (yb/rpc/outbound_call.cc:512): Could not locate the leader master: GetMasterRegistration RPC (request call id 2359) to 172.29.1.1:7100 timed out after 0.033s
W0531 19:52:30.525079    24 master.cc:186] Failed to get current config: Illegal state (yb/master/catalog_manager.cc:6854): Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
I0531 19:52:30.525205    24 client-internal.cc:1847] New master addresses: [yb-master-black.example.com:7100,yb-master-blue.example.com:7100,yb-master-white.example.com:7100,:7100]
W0531 19:53:28.114395    36 master-path-handlers.cc:150] Illegal state (yb/master/catalog_manager.cc:6854): Unable to list Masters: Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
W0531 19:53:29.133951    36 master-path-handlers.cc:1002] Illegal state (yb/master/catalog_manager.cc:6854): Unable to list Masters: Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
E0531 19:53:30.625366    24 async_initializer.cc:84] Failed to initialize client: Timed out (yb/rpc/rpc.cc:213): Could not locate the leader master: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 299) passed its deadline 2074615.247s (passed: 60.099s): Not found (yb/master/master_rpc.cc:284): no leader found: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 1)
W0531 19:53:31.625660    24 master.cc:186] Failed to get current config: Illegal state (yb/master/catalog_manager.cc:6854): Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
I0531 19:53:31.625742    24 client-internal.cc:1847] New master addresses: [yb-master-black.example.com:7100,yb-master-blue.example.com:7100,yb-master-white.example.com:7100,:7100]
W0531 19:53:34.024369    37 master-path-handlers.cc:150] Illegal state (yb/master/catalog_manager.cc:6854): Unable to list Masters: Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
E0531 19:54:31.870801    24 async_initializer.cc:84] Failed to initialize client: Timed out (yb/rpc/rpc.cc:213): Could not locate the leader master: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 300) passed its deadline 2074676.348s (passed: 60.244s): Not found (yb/master/master_rpc.cc:284): no leader found: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 1)
W0531 19:54:32.871065    24 master.cc:186] Failed to get current config: Illegal state (yb/master/catalog_manager.cc:6854): Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
I0531 19:54:32.871222    24 client-internal.cc:1847] New master addresses: [yb-master-black.example.com:7100,yb-master-blue.example.com:7100,yb-master-white.example.com:7100,:7100]
W0531 19:55:28.190217    41 master-path-handlers.cc:1002] Illegal state (yb/master/catalog_manager.cc:6854): Unable to list Masters: Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
W0531 19:55:31.745038    42 master-path-handlers.cc:1002] Illegal state (yb/master/catalog_manager.cc:6854): Unable to list Masters: Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
E0531 19:55:33.164300    24 async_initializer.cc:84] Failed to initialize client: Timed out (yb/rpc/rpc.cc:213): Could not locate the leader master: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 299) passed its deadline 2074737.593s (passed: 60.292s): Not found (yb/master/master_rpc.cc:284): no leader found: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 1)
W0531 19:55:34.164574    24 master.cc:186] Failed to get current config: Illegal state (yb/master/catalog_manager.cc:6854): Node 5f2f6ad78d27450b8cde9c8bcf40fefa peer not initialized.
I0531 19:55:34.164667    24 client-internal.cc:1847] New master addresses: [yb-master-black.example.com:7100,yb-master-blue.example.com:7100,yb-master-white.example.com:7100,:7100]
E0531 19:56:34.315380    24 async_initializer.cc:84] Failed to initialize client: Timed out (yb/rpc/rpc.cc:213): Could not locate the leader master: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 299) passed its deadline 2074798.886s (passed: 60.150s): Not found (yb/master/master_rpc.cc:284): no leader found: GetLeaderMasterRpc(addrs: [yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, :7100], num_attempts: 1)

As far as connectivity goes, I am able to verify the LoadBalancer endpoints are responding across the different network boundaries by curling the same service endpoint but on the UI port:

[root@yb-master-0 yugabyte]# curl -I http://yb-master-blue.example.com:7000
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1975
Access-Control-Allow-Origin: *

[root@yb-master-0 yugabyte]# curl -I http://yb-master-white.example.com:7000
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1975
Access-Control-Allow-Origin: *

[root@yb-master-0 yugabyte]# curl -I http://yb-master-black.example.com:7000
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1975
Access-Control-Allow-Origin: *

What strategies are there to debug the bootstrap process?

EDIT:
Here are the startup flags for the master:

/home/yugabyte/bin/yb-master --fs_data_dirs=/mnt/disk0,/mnt/disk1 --server_broadcast_addresses=yb-master-white.example.com:7100 --master_addresses=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, --replication_factor=3 --enable_ysql=true --rpc_bind_addresses=0.0.0.0:7100 --metric_node_name=yb-master-0 --memory_limit_hard_bytes=1824522240 --stderrthreshold=0 --num_cpus=2 --undefok=num_cpus,enable_ysql --default_memory_limit_to_ram_ratio=0.85 --leader_failure_max_missed_heartbeat_periods=10 --placement_cloud=AAAA --placement_region=XXXX --placement_zone=XXXX

/home/yugabyte/bin/yb-master --fs_data_dirs=/mnt/disk0,/mnt/disk1 --server_broadcast_addresses=yb-master-blue.example.com:7100 --master_addresses=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, --replication_factor=3 --enable_ysql=true --rpc_bind_addresses=0.0.0.0:7100 --metric_node_name=yb-master-0 --memory_limit_hard_bytes=1824522240 --stderrthreshold=0 --num_cpus=2 --undefok=num_cpus,enable_ysql --default_memory_limit_to_ram_ratio=0.85 --leader_failure_max_missed_heartbeat_periods=10 --placement_cloud=AAAA --placement_region=YYYY --placement_zone=YYYY

/home/yugabyte/bin/yb-master --fs_data_dirs=/mnt/disk0,/mnt/disk1 --server_broadcast_addresses=yb-master-black.example.com:7100 --master_addresses=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100,  --replication_factor=3 --enable_ysql=true --rpc_bind_addresses=0.0.0.0:7100 --metric_node_name=yb-master-0 --memory_limit_hard_bytes=1824522240 --stderrthreshold=0 --num_cpus=2 --undefok=num_cpus,enable_ysql --default_memory_limit_to_ram_ratio=0.85 --leader_failure_max_missed_heartbeat_periods=10 --placement_cloud=AAAA --placement_region=ZZZZ --placement_zone=ZZZZ

For the sake of completeness here is one of the k8s manifest that I've modified from one of the helm examples. It is modified to utilize LoadBalancer for the master service:

---
# Source: yugabyte/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: "yb-masters"
  labels:
    app: "yb-master"
    heritage: "Helm"
    release: "blue"
    chart: "yugabyte"
    component: "yugabytedb"
spec:
  type: LoadBalancer
  loadBalancerIP: 172.16.0.34
  ports:
    - name: "rpc-port"
      port: 7100
    - name: "ui"
      port: 7000
  selector:
    app: "yb-master"
---
# Source: yugabyte/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: "yb-tservers"
  labels:
    app: "yb-tserver"
    heritage: "Helm"
    release: "blue"
    chart: "yugabyte"
    component: "yugabytedb"
spec:
  clusterIP: None
  ports:
    - name: "rpc-port"
      port: 7100
    - name: "ui"
      port: 9000
    - name: "yedis-port"
      port: 6379
    - name: "yql-port"
      port: 9042
    - name: "ysql-port"
      port: 5433
  selector:
    app: "yb-tserver"
---
# Source: yugabyte/templates/service.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: "yb-master"
  namespace: "yugabytedb"
  labels:
    app: "yb-master"
    heritage: "Helm"
    release: "blue"
    chart: "yugabyte"
    component: "yugabytedb"
spec:
  serviceName: "yb-masters"
  podManagementPolicy: Parallel

  replicas: 1

  volumeClaimTemplates:
    - metadata:
        name: datadir0
        annotations:
          volume.beta.kubernetes.io/storage-class: rook-ceph-block
        labels:
          heritage: "Helm"
          release: "blue"
          chart: "yugabyte"
          component: "yugabytedb"
      spec:
        accessModes:
          - "ReadWriteOnce"
        storageClassName: rook-ceph-block
        resources:
          requests:
            storage: 10Gi
    - metadata:
        name: datadir1
        annotations:
          volume.beta.kubernetes.io/storage-class: rook-ceph-block
        labels:
          heritage: "Helm"
          release: "blue"
          chart: "yugabyte"
          component: "yugabytedb"
      spec:
        accessModes:
          - "ReadWriteOnce"
        storageClassName: rook-ceph-block
        resources:
          requests:
            storage: 10Gi
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:

      partition: 0

  selector:
    matchLabels:
      app: "yb-master"
  template:
    metadata:

      labels:
        app: "yb-master"
        heritage: "Helm"
        release: "blue"
        chart: "yugabyte"
        component: "yugabytedb"
    spec:
      affinity:
        # Set the anti-affinity selector scope to YB masters.

        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - "yb-master"
              topologyKey: kubernetes.io/hostname
      containers:
      - name: "yb-master"
        image: "yugabytedb/yugabyte:2.1.6.0-b17"
        imagePullPolicy: IfNotPresent
        lifecycle:
          postStart:
            exec:
              command:
                - "sh"
                - "-c"
                - >
                  mkdir -p /mnt/disk0/cores;
                  mkdir -p /mnt/disk0/yb-data/scripts;
                  if [ ! -f /mnt/disk0/yb-data/scripts/log_cleanup.sh ]; then
                    if [ -f /home/yugabyte/bin/log_cleanup.sh ]; then
                      cp /home/yugabyte/bin/log_cleanup.sh /mnt/disk0/yb-data/scripts;
                    fi;
                  fi
        env:
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: HOSTNAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        resources:

          limits:
            cpu: 2
            memory: 2Gi
          requests:
            cpu: 500m
            memory: 1Gi

        command:

          - "/home/yugabyte/bin/yb-master"

          - "--fs_data_dirs=/mnt/disk0,/mnt/disk1"

          - "--server_broadcast_addresses=yb-master-blue.example.com:7100"

          - "--master_addresses=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, "
          - "--replication_factor=3"

          - "--enable_ysql=true"
          - "--rpc_bind_addresses=0.0.0.0:7100"
          - "--metric_node_name=$(HOSTNAME)"
          - "--memory_limit_hard_bytes=1824522240"
          - "--stderrthreshold=0"
          - "--num_cpus=2"
          - "--undefok=num_cpus,enable_ysql"
          - "--default_memory_limit_to_ram_ratio=0.85"
          - "--leader_failure_max_missed_heartbeat_periods=10"
          - "--placement_cloud=AAAA"
          - "--placement_region=YYYY"
          - "--placement_zone=YYYY"

        ports:
          - containerPort: 7100
            name: "rpc-port"
          - containerPort: 7000
            name: "ui"
        volumeMounts:

          - name: datadir0
            mountPath: /mnt/disk0
          - name: datadir1
            mountPath: /mnt/disk1

      - name: yb-cleanup
        image: busybox:1.31
        env:
        - name: USER
          value: "yugabyte"
        command:
          - "/bin/sh"
          - "-c"
          - >
            mkdir /var/spool/cron;
            mkdir /var/spool/cron/crontabs;
            echo "0 * * * * /home/yugabyte/scripts/log_cleanup.sh" | tee -a /var/spool/cron/crontabs/root;
            crond;
            while true; do
              sleep 86400;
            done
        volumeMounts:
          - name: datadir0
            mountPath: /home/yugabyte/
            subPath: yb-data

      volumes:

        - name: datadir0
          hostPath:
            path: /mnt/disks/ssd0
        - name: datadir1
          hostPath:
            path: /mnt/disks/ssd1
---
# Source: yugabyte/templates/service.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: "yb-tserver"
  namespace: "yugabytedb"
  labels:
    app: "yb-tserver"
    heritage: "Helm"
    release: "blue"
    chart: "yugabyte"
    component: "yugabytedb"
spec:
  serviceName: "yb-tservers"
  podManagementPolicy: Parallel

  replicas: 1

  volumeClaimTemplates:
    - metadata:
        name: datadir0
        annotations:
          volume.beta.kubernetes.io/storage-class: rook-ceph-block
        labels:
          heritage: "Helm"
          release: "blue"
          chart: "yugabyte"
          component: "yugabytedb"
      spec:
        accessModes:
          - "ReadWriteOnce"
        storageClassName: rook-ceph-block
        resources:
          requests:
            storage: 10Gi
    - metadata:
        name: datadir1
        annotations:
          volume.beta.kubernetes.io/storage-class: rook-ceph-block
        labels:
          heritage: "Helm"
          release: "blue"
          chart: "yugabyte"
          component: "yugabytedb"
      spec:
        accessModes:
          - "ReadWriteOnce"
        storageClassName: rook-ceph-block
        resources:
          requests:
            storage: 10Gi
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:

      partition: 0

  selector:
    matchLabels:
      app: "yb-tserver"
  template:
    metadata:

      labels:
        app: "yb-tserver"
        heritage: "Helm"
        release: "blue"
        chart: "yugabyte"
        component: "yugabytedb"
    spec:
      affinity:
        # Set the anti-affinity selector scope to YB masters.

        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - "yb-tserver"
              topologyKey: kubernetes.io/hostname
      containers:
      - name: "yb-tserver"
        image: "yugabytedb/yugabyte:2.1.6.0-b17"
        imagePullPolicy: IfNotPresent
        lifecycle:
          postStart:
            exec:
              command:
                - "sh"
                - "-c"
                - >
                  mkdir -p /mnt/disk0/cores;
                  mkdir -p /mnt/disk0/yb-data/scripts;
                  if [ ! -f /mnt/disk0/yb-data/scripts/log_cleanup.sh ]; then
                    if [ -f /home/yugabyte/bin/log_cleanup.sh ]; then
                      cp /home/yugabyte/bin/log_cleanup.sh /mnt/disk0/yb-data/scripts;
                    fi;
                  fi
        env:
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: HOSTNAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        resources:

          limits:
            cpu: 2
            memory: 4Gi
          requests:
            cpu: 500m
            memory: 2Gi

        command:

          - "/home/yugabyte/bin/yb-tserver"
          - "--fs_data_dirs=/mnt/disk0,/mnt/disk1"
          - "--server_broadcast_addresses=$(HOSTNAME).yb-tservers.$(NAMESPACE).svc.cluster.local:9100"
          - "--rpc_bind_addresses=$(HOSTNAME).yb-tservers.$(NAMESPACE).svc.cluster.local"
          - "--cql_proxy_bind_address=$(HOSTNAME).yb-tservers.$(NAMESPACE).svc.cluster.local"

          - "--enable_ysql=true"
          - "--pgsql_proxy_bind_address=$(POD_IP):5433"

          - "--tserver_master_addrs=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100, "

          - "--metric_node_name=$(HOSTNAME)"
          - "--memory_limit_hard_bytes=3649044480"
          - "--stderrthreshold=0"
          - "--num_cpus=2"
          - "--undefok=num_cpus,enable_ysql"
          - "--leader_failure_max_missed_heartbeat_periods=10"
          - "--placement_cloud=AAAA"
          - "--placement_region=YYYY"
          - "--placement_zone=YYYY"
          - "--use_cassandra_authentication=false"

        ports:
          - containerPort: 7100
            name: "rpc-port"
          - containerPort: 9000
            name: "ui"
          - containerPort: 6379
            name: "yedis-port"
          - containerPort: 9042
            name: "yql-port"
          - containerPort: 5433
            name: "ysql-port"
        volumeMounts:

          - name: datadir0
            mountPath: /mnt/disk0
          - name: datadir1
            mountPath: /mnt/disk1

      - name: yb-cleanup
        image: busybox:1.31
        env:
        - name: USER
          value: "yugabyte"
        command:
          - "/bin/sh"
          - "-c"
          - >
            mkdir /var/spool/cron;
            mkdir /var/spool/cron/crontabs;
            echo "0 * * * * /home/yugabyte/scripts/log_cleanup.sh" | tee -a /var/spool/cron/crontabs/root;
            crond;
            while true; do
              sleep 86400;
            done
        volumeMounts:
          - name: datadir0
            mountPath: /home/yugabyte/
            subPath: yb-data

      volumes:

        - name: datadir0
          hostPath:
            path: /mnt/disks/ssd0
        - name: datadir1
          hostPath:
            path: /mnt/disks/ssd1

Body:
This was mostly resolved (looks like I've now run into an unrelated issue), by dropping the extraneous comma on the master addresses list:

--master_addresses=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100,

vs

--master_addresses=yb-master-black.example.com:7100, yb-master-blue.example.com:7100, yb-master-white.example.com:7100


来源: stackexchange

问:
How to store drawable in an array
I want to download a bunch of images and would like to store it as drawable in an array. So I tried declaring a drawable array.But it returns me nullPointer exception when I access that array.

My question is, how to declare an array type as drawable ?

答:
you can use an hashMap , and put the keys as urls for example , and to value is the drawable that you download :</p>

```<code>HashMap<String,Drawable> myDrawables = new HashMap<String,Drawable>();
//before you download the images, you can test if your drawable is already downloaded,
// with looking for his url in the Hashmap ,
.....
myDrawables.put(urlOfYourDrawable, yourDrawable);
</code>```

ContentLicense: CC BY-SA 3.0

Title: How to store drawable in an array

Body:
you can use an hashMap , and put the keys as urls for example , and to value is the drawable that you download :

HashMap<String,Drawable> myDrawables = new HashMap<String,Drawable>();
//before you download the images, you can test if your drawable is already downloaded,
// with looking for his url in the Hashmap ,
.....
myDrawables.put(urlOfYourDrawable, yourDrawable);


问:
Django-tinymce not showing in admin
I installed django-tinymce, put it in the installed apps, added the url. Then I created a model as below:

```<code>from tinymce import models as tinymce_models

class Post(models.Model):
    parent = models.ForeignKey('self', blank=True, null=True, on_delete=models.CASCADE)
    unit = models.DecimalField(max_digits=20, decimal_places=2)
    title = models.CharField(max_length=200)
    content = tinymce_models.HTMLField()
</code>```

I have also registered this model into the admin. When trying to add a Post instance through the admin, all the fields are showing, except for the content field. That is the field using Tinymce. The field is just white space with no option to input anything. Anybody know a fix?

答:
Give this a shot:</p>

```<code>from tinymce import HTMLField

class Post(models.Model):
    parent = models.ForeignKey('self', blank=True, null=True, on_delete=models.CASCADE)
    unit = models.DecimalField(max_digits=20, decimal_places=2)
    title = models.CharField(max_length=200)
    content = HTMLField()
</code>```

ContentLicense: CC BY-SA 4.0

Title: Django-tinymce not showing in admin

Body:
I installed django-tinymce, put it in the installed apps, added the url. Then I created a model as below:

from tinymce import models as tinymce_models

class Post(models.Model):
    parent = models.ForeignKey('self', blank=True, null=True, on_delete=models.CASCADE)
    unit = models.DecimalField(max_digits=20, decimal_places=2)
    title = models.CharField(max_length=200)
    content = tinymce_models.HTMLField()

I have also registered this model into the admin. When trying to add a Post instance through the admin, all the fields are showing, except for the content field. That is the field using Tinymce. The field is just white space with no option to input anything. Anybody know a fix?

Body:
Give this a shot:

from tinymce import HTMLField

class Post(models.Model):
    parent = models.ForeignKey('self', blank=True, null=True, on_delete=models.CASCADE)
    unit = models.DecimalField(max_digits=20, decimal_places=2)
    title = models.CharField(max_length=200)
    content = HTMLField()


问:
why local variable 'x' referenced before assignment though i am using it after assignment
In the below code, I wrote this code to find the set of prime numbers in a specific range.

I am getting output as:

```<code>local variable 'x' referenced before assignment
</code>```

(note: I am using Jupiter notebook). I am getting the same error lot of times.

```<code>def prime_list(*args):
    limit=args[0]
    primelist=[]
    for y in range (0,limit):
        factor=0
        for x in range(1,y+1):
            if(y%x)==0:
                #print("entered in to modulo loop")
                factor=factor+1
        if(factor<=2):
            #print("{} is prime number".format(y))
            primelist.append(x)
    return primelist
prime_list(10)
</code>```

答:
You should insert y in the primelist:

```<code>def prime_list(*args):
    limit=args[0]
    primelist=[]
    for y in range (0,limit):
        factor=0
        for x in range(1,y+1):
            if(y%x)==0:
                #print("entered in to modulo loop")
                factor=factor+1
        if(factor<=2):
            #print("{} is prime number".format(y))
            primelist.append(y)
    return primelist

prime_list(10)
</code>```

Output:

```<code>[0, 1, 2, 3, 5, 7]
</code>```

Body:
In the below code, I wrote this code to find the set of prime numbers in a specific range.

I am getting output as:

local variable 'x' referenced before assignment

(note: I am using Jupiter notebook). I am getting the same error lot of times.

def prime_list(*args):
    limit=args[0]
    primelist=[]
    for y in range (0,limit):
        factor=0
        for x in range(1,y+1):
            if(y%x)==0:
                #print("entered in to modulo loop")
                factor=factor+1
        if(factor<=2):
            #print("{} is prime number".format(y))
            primelist.append(x)
    return primelist
prime_list(10)

Body:
You should insert y in the primelist:

def prime_list(*args):
    limit=args[0]
    primelist=[]
    for y in range (0,limit):
        factor=0
        for x in range(1,y+1):
            if(y%x)==0:
                #print("entered in to modulo loop")
                factor=factor+1
        if(factor<=2):
            #print("{} is prime number".format(y))
            primelist.append(y)
    return primelist

prime_list(10)

Output:

[0, 1, 2, 3, 5, 7]


问:
Laravel hasMany returns an empty array or error
I have seen a plethora of related questions but can't seem to figure out what is going on.
I am using Laravel 7.x, I have a Categories and a Products table.

Categories:

```<code>CREATE TABLE categories (
    id int(11) unsigned NOT NULL AUTO_INCREMENT,
    name varchar(255) DEFAULT '',
    PRIMARY KEY (`id`)
)
</code>```

Products:

```<code>CREATE TABLE products (
    id int(11) unsigned NOT NULL AUTO_INCREMENT,
    name varchar(255) DEFAULT '',
    category_id int(11) unsigned DEFAULT NULL,
    PRIMARY KEY (id),
    KEY category_id (category_id),
    CONSTRAINT products_ibfk_1 FOREIGN KEY (category_id) REFERENCES categories (id) ON DELETE CASCADE ON UPDATE CASCADE
)
</code>```

In Laravel I can do Product::first()->catgory and then get the relevant category, with the hasMany relationship things seem to go pear shaped.

Defining Category as such:

```<code>public function products()
{
    return $this->hasMany(Product::class);
}
</code>```

Gives the error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'categories.category_id' in 'where clause' (SQL: select * from categories where categories.category_id = 1 and categories.category_id is not null)

Adding the foreign key and local key simply returns an empty array:

```<code>Category::find(1)->products;

...

public function products()
{
    return $this->hasMany(Product::class, 'id', 'category_id');
}

...

Illuminate\Database\Eloquent\Collection {#306 ▼
   #items: []
}
</code>```

What is it that I am missing here?

*EDIT:
Adding the FK as mentioned still results in the above mentioned SQL error

```<code>class Category extends Model
{
    public function products()
    {
        return $this->hasMany(Product::class, 'category_id');
    }
}
</code>```

alt tried...

```<code>class Category extends Model
{
    public function products()
    {
        return $this->hasMany(Product::class, 'category_id', 'id');
    }
}
</code>```

答:
try this</p>

```<code>   public function products()
    {
        return $this->hasMany(Product::class, 'category_id','id');
    }
</code>```

Body:
I have seen a plethora of related questions but can't seem to figure out what is going on.
I am using Laravel 7.x, I have a Categories and a Products table.

Categories:

CREATE TABLE categories (
    id int(11) unsigned NOT NULL AUTO_INCREMENT,
    name varchar(255) DEFAULT '',
    PRIMARY KEY (`id`)
)

Products:

CREATE TABLE products (
    id int(11) unsigned NOT NULL AUTO_INCREMENT,
    name varchar(255) DEFAULT '',
    category_id int(11) unsigned DEFAULT NULL,
    PRIMARY KEY (id),
    KEY category_id (category_id),
    CONSTRAINT products_ibfk_1 FOREIGN KEY (category_id) REFERENCES categories (id) ON DELETE CASCADE ON UPDATE CASCADE
)

In Laravel I can do Product::first()->catgory and then get the relevant category, with the hasMany relationship things seem to go pear shaped.

Defining Category as such:

public function products()
{
    return $this->hasMany(Product::class);
}

Gives the error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'categories.category_id' in 'where clause' (SQL: select * from categories where categories.category_id = 1 and categories.category_id is not null)

Adding the foreign key and local key simply returns an empty array:

Category::find(1)->products;

...

public function products()
{
    return $this->hasMany(Product::class, 'id', 'category_id');
}

...

Illuminate\Database\Eloquent\Collection {#306 ▼
   #items: []
}

What is it that I am missing here?

*EDIT:
Adding the FK as mentioned still results in the above mentioned SQL error

class Category extends Model
{
    public function products()
    {
        return $this->hasMany(Product::class, 'category_id');
    }
}

alt tried...

class Category extends Model
{
    public function products()
    {
        return $this->hasMany(Product::class, 'category_id', 'id');
    }
}

Body:
try this

   public function products()
    {
        return $this->hasMany(Product::class, 'category_id','id');
    }


问:
How to get custom subdomain working on Wordpress with AWS Bitnami
I installed a Bitnami / Wordpress instance on AWS, it all works great via the public IP but when I try and setup a subdomain I run into some issues, i'm following the instructions here:

https://docs.bitnami.com/bch/apps/wordpress/administration/configure-domain/

I update the wp-config.php file to https://blog.domain.com/ (domain.com is replaced with my actual domain) like the instructions say. Looks like this:

```<code>define('WP_SITEURL', 'https://blog.domain.com/');
define('WP_HOME', 'https://blog.domain.com/');
</code>```

Then in my DNS provider (CloudFlare) I set the A Record for blog to the public IP

However when I go to the url I see this:

And when I go to the https://blog.domain.com/wp-admin I see this:

Note that i'm not attempting to setup a Multisite environment I just want one Wordpress instance setup on the sub-domain https://blog.domain.dom

答:
This is not really a WordPress question. The problem you are facing is the routing of the domain in apache - in general apache says where the website is eg. app/wordpress/htdocs/{website} (the website is in htdocs directory). What you need to do is change the httpd.conf to recognise the subdomain and also you need to add a subfolder where your subdomain will be pointing.

!IMPORTANT! In bitnami stack the location of .conf file is different: /opt/bitnami/apache2/conf/bitnami/bitnami.conf

I am not sure how your folder structure looks like but it will be probably something like this: app/wordpress/htdocs/{main_website} and for subdomain app/wordpress/htdocs/blog/{blog_website}

So in your httpd.conf:

```<code><VirtualHost *:80>
    DocumentRoot "/opt/bitnami/apache2/htdocs/abc"

    ServerAdmin mail@example.com

    ServerName abc.your_domain.com

    ServerAlias www.abc.your_domain.com

    ErrorLog "logs/abc-error_log"

    CustomLog "logs/abc-access_log" common
</VirtualHost>
</code>```

Source: https://community.bitnami.com/t/sub-domain-pointing-to-a-sub-folder/11796

I hope this helps.

Body:
I installed a Bitnami / Wordpress instance on AWS, it all works great via the public IP but when I try and setup a subdomain I run into some issues, i'm following the instructions here:

https://docs.bitnami.com/bch/apps/wordpress/administration/configure-domain/

I update the wp-config.php file to https://blog.domain.com/ (domain.com is replaced with my actual domain) like the instructions say. Looks like this:

define('WP_SITEURL', 'https://blog.domain.com/');
define('WP_HOME', 'https://blog.domain.com/');

Then in my DNS provider (CloudFlare) I set the A Record for blog to the public IP

However when I go to the url I see this:

And when I go to the https://blog.domain.com/wp-admin I see this:

Note that i'm not attempting to setup a Multisite environment I just want one Wordpress instance setup on the sub-domain https://blog.domain.dom

Body:
This is not really a WordPress question. The problem you are facing is the routing of the domain in apache - in general apache says where the website is eg. app/wordpress/htdocs/{website} (the website is in htdocs directory). What you need to do is change the httpd.conf to recognise the subdomain and also you need to add a subfolder where your subdomain will be pointing.

!IMPORTANT! In bitnami stack the location of .conf file is different: /opt/bitnami/apache2/conf/bitnami/bitnami.conf

I am not sure how your folder structure looks like but it will be probably something like this: app/wordpress/htdocs/{main_website} and for subdomain app/wordpress/htdocs/blog/{blog_website}

So in your httpd.conf:

<VirtualHost *:80>
    DocumentRoot "/opt/bitnami/apache2/htdocs/abc"

    ServerAdmin mail@example.com

    ServerName abc.your_domain.com

    ServerAlias www.abc.your_domain.com

    ErrorLog "logs/abc-error_log"

    CustomLog "logs/abc-access_log" common
</VirtualHost>

Source: https://community.bitnami.com/t/sub-domain-pointing-to-a-sub-folder/11796

I hope this helps.


问:
Question regarding multi-threaded environment of servlet
If there is a servlet, inside a servlet container such as Websphere. The servlet are executed by some threads. I would like to ask, what does the threads share? How variables are shared between them?

Do they have a local copy of the following variables?

1) private/protected/public final Semaphore permits = new Semaphore(50);

2) private/protected/public final static Semaphore permits = new Semaphore(50);

3) private/protected/public Semaphore permits = new Semaphore(50);

4) private/protected/public static Semaphore permits = new Semaphore(50);

How should I declare the semaphore so that I can use semaphore to control them? I don't want them to have each of them a copy of the semaphore. Thanks.

答: You should not count on two instances of a servlet even being in the same JVM. Containers can be replicated and your Servlets need to be stateless. Besides the Java EE spec does not allow you to do any threading manipulation within. The containers may allow it, but the behaviour then becomes implementation specific. By putting semaphores in there you are interfering with the pooling and can cause issues. Use Sessions if you need to differentiate between different users.</p>


问:
Use .join() with callback condition
Here is the situation, I'd like to join each elements of an array depending on a condition. I imagine something like a combinaison of join and reduce functions, e.g. :

const SEPARATOR =  ' ';
const array = ['I', 'am', 'coding'];

// my imaginary function (this does not work voluntarily, only for the example)
const output = array.join((previous, current) => {
    // when the function return true, it joins previous with current on the same index, else not
    return (previous + current).length < 6);
}, SEPARATOR);

console.log(output); // expected output : ['I am', 'coding']
```

To be clear, what I'm asking here is is there a way to achieve that with existing logic (for example, using a function similar to join) without recreating a whole logic.

FYI I found a similar question here but does not answer mine, since the goal was only to remove undefined values.

答:
Here is one approach with forEach and join methods.

const merge = (arr, sep, max_length = 6) => {
  const output = [];
  let prev = [];
  arr.forEach((curr) => {
    const word = prev.join(sep);
    if (word.length + curr.length >= max_length) {
      output.push(word);
      prev = [];
    }
    prev.push(curr);
  });
  if (prev.length > 0) {
    output.push(prev.join(sep));
  }
  return output;
};

const SEPARATOR = " ";
const array = ["I", "am", "coding"];

console.log(merge(array, SEPARATOR));```

Title: Use .join() with callback condition

Body:
Here is the situation, I'd like to join each elements of an array depending on a condition. I imagine something like a combinaison of join and reduce functions, e.g. :

const SEPARATOR =  ' ';
const array = ['I', 'am', 'coding'];

// my imaginary function (this does not work voluntarily, only for the example)
const output = array.join((previous, current) => {
    // when the function return true, it joins previous with current on the same index, else not
    return (previous + current).length < 6);
}, SEPARATOR);

console.log(output); // expected output : ['I am', 'coding']

To be clear, what I'm asking here is is there a way to achieve that with existing logic (for example, using a function similar to join) without recreating a whole logic.

FYI I found a similar question here but does not answer mine, since the goal was only to remove undefined values.


问:
No option for "Add Client Side Library" on Visual Studio Mac 2019
Can't see any option to add client side library on Visual Studio for Mac 2019 (Version 8.3.3).

Seems to be supported as I seen a few tutorials on a Mac for it but can't seem to find the option myself.

答: Go to Menu Visual Studio, Extensions, Gallery, add library manager, restart Visual studio, and in the Add client-said Library solution, that's it</p>


问:
Concatenate two (or n) streams

2 streams:

Given readable streams stream1 and stream2, what's an idiomatic (concise) way to get a stream containing stream1 and stream2 concatenated?

I cannot do stream1.pipe(outStream); stream2.pipe(outStream), because then the stream contents are jumbled together.

n streams:

Given an EventEmitter that emits an indeterminate number of streams, e.g.

```<code>eventEmitter.emit('stream', stream1)
eventEmitter.emit('stream', stream2)
eventEmitter.emit('stream', stream3)
...
eventEmitter.emit('end')
</code>```

what's an idiomatic (concise) way to get a stream with all streams concatenated together?

答:
This can now be easily done using async iterators

async function* concatStreams(readables) {
  for (const readable of readables) {
    for await (const chunk of readable) { yield chunk }
  }
}
```

<p>And you can use it like this</p>

<pre class="lang-js prettyprint-override"><code>const fs = require('fs')
const stream = require('stream')

const files = ['file1.txt', 'file2.txt', 'file3.txt']
const iterable = await concatStreams(files.map(f => fs.createReadStream(f)))

// convert the async iterable to a readable stream
const mergedStream = stream.Readable.from(iterable)
</code>```

More info regarding async iterators: https://2ality.com/2019/11/nodejs-streams-async-iteration.html

Title: Concatenate two (or n) streams

Body:
2 streams:

Given readable streams stream1 and stream2, what's an idiomatic (concise) way to get a stream containing stream1 and stream2 concatenated?

I cannot do stream1.pipe(outStream); stream2.pipe(outStream), because then the stream contents are jumbled together.

n streams:

Given an EventEmitter that emits an indeterminate number of streams, e.g.

eventEmitter.emit('stream', stream1)
eventEmitter.emit('stream', stream2)
eventEmitter.emit('stream', stream3)
...
eventEmitter.emit('end')

what's an idiomatic (concise) way to get a stream with all streams concatenated together?

Body:
This can now be easily done using async iterators

async function* concatStreams(readables) {
  for (const readable of readables) {
    for await (const chunk of readable) { yield chunk }
  }
}

And you can use it like this

const fs = require('fs')
const stream = require('stream')

const files = ['file1.txt', 'file2.txt', 'file3.txt']
const iterable = await concatStreams(files.map(f => fs.createReadStream(f)))

// convert the async iterable to a readable stream
const mergedStream = stream.Readable.from(iterable)

More info regarding async iterators: https://2ality.com/2019/11/nodejs-streams-async-iteration.html


问:
How to add headers to OkHttp request interceptor?
I have this interceptor that i add to my OkHttp client:

```<code>public class RequestTokenInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
  Request request = chain.request();
  // Here where we'll try to refresh token.
  // with an retrofit call
  // After we succeed we'll proceed our request
  Response response = chain.proceed(request);
  return response;
}
}
</code>```

How can i add headers to request in my interceptor?

I tried this but i am making mistake and i lose my request when creating new request:

```<code>    public class RequestTokenInterceptor implements Interceptor {
    @Override
    public Response intercept(Interceptor.Chain chain) throws IOException {
        Request request = chain.request();
        Request newRequest;

        try {
            Log.d("addHeader", "Before");
            String token = TokenProvider.getInstance(mContext).getToken();
            newRequest = request.newBuilder()
                    .addHeader(HeadersContract.HEADER_AUTHONRIZATION, O_AUTH_AUTHENTICATION + token)
                    .addHeader(HeadersContract.HEADER_CLIENT_ID, CLIENT_ID)
                    .build();
        } catch (Exception e) {
            Log.d("addHeader", "Error");
            e.printStackTrace();
            return chain.proceed(request);
        }

        Log.d("addHeader", "after");
        return chain.proceed(newRequest);
    }
}
</code>```

Note that, i know i can add header when creating request like this:

```<code>Request request = new Request.Builder()
    .url("https://api.github.com/repos/square/okhttp/issues")
    .header("User-Agent", "OkHttp Headers.java")
    .addHeader("Accept", "application/json; q=0.5")
    .addHeader("Accept", "application/vnd.github.v3+json")
    .build();
</code>```

But it doesn't fit my needs. I need it in interceptor.

答:
```<code>client = new OkHttpClient();

        Request request = new Request.Builder().header("authorization", token).url(url).build();
        MyWebSocketListener wsListener = new MyWebSocketListener(LudoRoomActivity.this);
        client.newWebSocket(request, wsListener);
        client.dispatcher().executorService().shutdown();
</code>```

Body:
I have this interceptor that i add to my OkHttp client:

public class RequestTokenInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
  Request request = chain.request();
  // Here where we'll try to refresh token.
  // with an retrofit call
  // After we succeed we'll proceed our request
  Response response = chain.proceed(request);
  return response;
}
}

How can i add headers to request in my interceptor?

I tried this but i am making mistake and i lose my request when creating new request:

    public class RequestTokenInterceptor implements Interceptor {
    @Override
    public Response intercept(Interceptor.Chain chain) throws IOException {
        Request request = chain.request();
        Request newRequest;

        try {
            Log.d("addHeader", "Before");
            String token = TokenProvider.getInstance(mContext).getToken();
            newRequest = request.newBuilder()
                    .addHeader(HeadersContract.HEADER_AUTHONRIZATION, O_AUTH_AUTHENTICATION + token)
                    .addHeader(HeadersContract.HEADER_CLIENT_ID, CLIENT_ID)
                    .build();
        } catch (Exception e) {
            Log.d("addHeader", "Error");
            e.printStackTrace();
            return chain.proceed(request);
        }

        Log.d("addHeader", "after");
        return chain.proceed(newRequest);
    }
}

Note that, i know i can add header when creating request like this:

Request request = new Request.Builder()
    .url("https://api.github.com/repos/square/okhttp/issues")
    .header("User-Agent", "OkHttp Headers.java")
    .addHeader("Accept", "application/json; q=0.5")
    .addHeader("Accept", "application/vnd.github.v3+json")
    .build();

But it doesn't fit my needs. I need it in interceptor.


问:
How to place greek alphabet in the naming of facet_grid in ggplot
Let say I have below histogram-

```<code>set.seed(1)
df <- data.frame(Type=c(rep("A",1000),rep("B",4000)),
                 Value=c(rnorm(1000,mean=25,sd=10),rchisq(4000,15)))
# you start here...
library(ggplot2)
ggplot(df, aes(x=Value))+
  geom_histogram(aes(y=..density..,fill=Type),color="grey80")+
  facet_grid(Type~.)
</code>```

Now, I want to rename the facet_grid i.e. instead of A and B, I want to place \sigma_1 and \sigma_2 in actual greek alphabet (1 & 2 being suffix)

Is there any way to achieve this?

Any pointer will be highly helpful

答:
You can use plotmath expressions in combination with label_parsed() as the facet's labeller argument.

set.seed(1)
df <- data.frame(Type=c(rep("A",1000),rep("B",4000)),
                 Value=c(rnorm(1000,mean=25,sd=10),rchisq(4000,15)))
library(ggplot2)

df$label <- ifelse(df$Type == "A", "sigma~1", "sigma~2")

ggplot(df, aes(x=Value))+
  geom_histogram(aes(y=..density..,fill=Type),color="grey80")+
  facet_grid(label~., labeller = label_parsed)
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
```

Body:
Let say I have below histogram-

set.seed(1)
df <- data.frame(Type=c(rep("A",1000),rep("B",4000)),
                 Value=c(rnorm(1000,mean=25,sd=10),rchisq(4000,15)))
# you start here...
library(ggplot2)
ggplot(df, aes(x=Value))+
  geom_histogram(aes(y=..density..,fill=Type),color="grey80")+
  facet_grid(Type~.)

Now, I want to rename the facet_grid i.e. instead of A and B, I want to place \sigma_1 and \sigma_2 in actual greek alphabet (1 & 2 being suffix)

Is there any way to achieve this?

Any pointer will be highly helpful


问:
C++ Localization best practices?
We are localizing a cross-platform C++-based client-side application. The first localization pass was done in a big rush for a big partner on a short deadline, and now it's time to refactor it.

We currently have an XML strings file per locale, with a common key and a localized value for each resource. However, sending our not-necessarily-technical localizers an xml file isn't ideal -- they don't know about encoding special characters, etc etc.  I'd like to use an easy, well-known format like Excel/csv with the localizers (also nice because we have server-side localization as well, which could be in a different tab of the same file), and then code-gen the strings files from there.  It seems that Excel doesn't like to output UTF-8 CSV files, which is annoying, and is preventing me from throwing together a few quick scripts to automate the Excel --> strings file conversion.

This problem has been solved hundreds of times.  What workflows have people found best, especially for cases where the localizers will be external to the company? I'm looking for something easy for non-technical users and also easy for the development team to then use to generate the strings file in some simple format like XML.

答:
Qt has a great facility for localization. The first step is to use their string class QString.

Next, you simply wrap any string literals in the tr() macro. The great thing about this method is that you don't have to waste time maintaining constants or defines. Just type the string you want, where you want it.

Later, you use a Qt utility to search all of your code units for translatable strings and creates a .ts file. This file is xml so you don't have to worry about your data being trapped in some proprietary format.

Now that you have a .ts file, Qt provides a translation editor called linguist. This is a very nice program that presents the strings to a translator (person) and provides some simple tools for managing the whole process. The program looks for common mistakes (differing punctuation), tracks the state of each string such as whether it has been tranlated or not, and whether the source string has changed or has been deleted. The program will also show context information for each string which the developer can include in the tr() macro.

When the translation is finished, the .ts file is compiled into smaller binary that is distributed with the application and loaded at runtime. Translations can be switched on the fly.

There is more to it than I can explain fully here. It is really a great system that is worth investigating.

OwnerDisplayName: Kevin Weil

Title: C++ Localization best practices?

ContentLicense: CC BY-SA 2.5


问:
Can I concatenate each values of arrays without VBA?
just a simple question. I have two arrays {"A";"B";"C";"D";"E"} and {1;2;3;4;5} and want to concatenate each of them like {"A1";"B2";"C3";"D4";"E5"}. Is this kind of manipulation possible without VBA but maybe with CSE formula?

答:
Seems I was stucked, I found answer just after tea break... sorry for bothering!

As CSE Formula: =CONCAT({"A";"B";"C";"D";"E"} & {1;2;3;4;5})


问:
Python plot with unique colors for more than 10 lines
I am trying to plot the line graph with around 15 to 50 items, colors are repeating that makes the graph not usable.

I have tried the answers from several method in the answers of a similar question like numpy, random.

However, i am unable to find a easy way to do this .

```<code>import matplotlib.pyplot as plt
import os
import pandas as pd
import random
from datetime import datetime, timedelta
import matplotlib.dates as dates
import matplotlib.colors as colors
import numpy as np

df2=pd.read_csv("Portperfdetails.csv")
df3 = df2.drop(df2.index[0])
df3['DATETIME'] = pd.to_datetime(df3['DATETIME'])
portname=list(dict.fromkeys(df3['PORT_NAME']))
for i in range(len(portname)):
    X = []
    Y = []
    X = list(df3.loc[df3['PORT_NAME'] == '%s' % portname[i]]['DATETIME'])
    Y = list(df3.loc[df3['PORT_NAME'] == '%s' % portname[i]]['TOTAL_MBYTES'])
    ax = plt.axes()
    ax.xaxis.set_minor_locator(dates.HourLocator(interval=4))  # every 4 hours
    ax.xaxis.set_minor_formatter(dates.DateFormatter('%H:%M'))  # hours and minutes
    ax.xaxis.set_major_locator(dates.DayLocator(interval=1))  # every day
    ax.xaxis.set_major_formatter(dates.DateFormatter('\n%d-%m-%Y'))
    for i in range(len(Y)):
        Y[i] = int(Y[i])
    num_plots = 20
    plt.plot(X, Y)
    plt.ylabel('Port throughput')
    plt.xlabel('Time')
    plt.savefig('example.png')
</code>```

Graph

答:
I'll use a toy example since I do not have access to your data (df3).

I adapted this directly from the List of named colors example in the Matplotlib Gallery. The idea is to iterate over color names along with each line that is being plotted and use the color name to specify the color for each line.

```<code>from matplotlib import pyplot as plt
import matplotlib.colors as colors
fig, ax = plt.subplots()
lotsa_colors = colors.get_named_colors_mapping()
for cname,i in zip(lotsa_colors,range(50)):
    y = [n for n in range(i,i+10)]
    #print(cname,lotsa_colors[name])
    ax.plot(y,color=lotsa_colors[cname])

plt.show()
#plt.close()
</code>```

Looks like there are 1163 color names and 1105 unique colors

```<code>len(set(lotsa_colors.values()))
</code>```

If you wanted to you could randomize the color names.

```<code>import random
lotsa_colors = colors.get_named_colors_mapping()
lotsa_colors = list(lotsa_colors.keys())
random.shuffle(lotsa_colors)
</code>```

Body:
I am trying to plot the line graph with around 15 to 50 items, colors are repeating that makes the graph not usable.

I have tried the answers from several method in the answers of a similar question like numpy, random.

However, i am unable to find a easy way to do this .

import matplotlib.pyplot as plt
import os
import pandas as pd
import random
from datetime import datetime, timedelta
import matplotlib.dates as dates
import matplotlib.colors as colors
import numpy as np

df2=pd.read_csv("Portperfdetails.csv")
df3 = df2.drop(df2.index[0])
df3['DATETIME'] = pd.to_datetime(df3['DATETIME'])
portname=list(dict.fromkeys(df3['PORT_NAME']))
for i in range(len(portname)):
    X = []
    Y = []
    X = list(df3.loc[df3['PORT_NAME'] == '%s' % portname[i]]['DATETIME'])
    Y = list(df3.loc[df3['PORT_NAME'] == '%s' % portname[i]]['TOTAL_MBYTES'])
    ax = plt.axes()
    ax.xaxis.set_minor_locator(dates.HourLocator(interval=4))  # every 4 hours
    ax.xaxis.set_minor_formatter(dates.DateFormatter('%H:%M'))  # hours and minutes
    ax.xaxis.set_major_locator(dates.DayLocator(interval=1))  # every day
    ax.xaxis.set_major_formatter(dates.DateFormatter('\n%d-%m-%Y'))
    for i in range(len(Y)):
        Y[i] = int(Y[i])
    num_plots = 20
    plt.plot(X, Y)
    plt.ylabel('Port throughput')
    plt.xlabel('Time')
    plt.savefig('example.png')

Graph

Body:
I'll use a toy example since I do not have access to your data (df3).

I adapted this directly from the List of named colors example in the Matplotlib Gallery. The idea is to iterate over color names along with each line that is being plotted and use the color name to specify the color for each line.

from matplotlib import pyplot as plt
import matplotlib.colors as colors
fig, ax = plt.subplots()
lotsa_colors = colors.get_named_colors_mapping()
for cname,i in zip(lotsa_colors,range(50)):
    y = [n for n in range(i,i+10)]
    #print(cname,lotsa_colors[name])
    ax.plot(y,color=lotsa_colors[cname])

plt.show()
#plt.close()

Looks like there are 1163 color names and 1105 unique colors

len(set(lotsa_colors.values()))

If you wanted to you could randomize the color names.

import random
lotsa_colors = colors.get_named_colors_mapping()
lotsa_colors = list(lotsa_colors.keys())
random.shuffle(lotsa_colors)


问:
What if I use Flutter master channel for production app?
Right now I am using Flutter stable channel for my Android and iOS production app. At this time Flutter web is not available on the stable channel and I also want my existing app for the web.

So, will there be any type of issue with my existing app if I use the Flutter master channel?

(Here's I know that Flutter web is also available in the beta channel but I want to switch to master channel)

答:
You are recommended to stick with the stable channel for production applications, although the beta channel is the next best option if you are looking to make a web application with Flutter. Switching to master has some inherent risks that you should consider before switching. See https://github.com/flutter/flutter/wiki/Flutter-build-release-channels.

Why exactly would you like to be on the master channel? It is not very safe, especially when you can wait a little while for the changes to trickle down to dev and beta.


问:
How to display bootstrap carousel with multiple items in each slide?
Bootstrap Ver: 3.3.7

I want to display multiple images in one slide in bootstrap carousel.

Searched a lot and came across this site https://www.geeksforgeeks.org/how-to-display-bootstrap-carousel-with-three-post-in-each-slide/

In Example 2 problem is being resolved partially, i.e I can display multiple images in one slide, but the javascript code written in this website is cloning all the images and appending one image at a time in the end which is not the desired effect.

```<code>$(window).load(function() {
  $(".carousel .item").each(function() {
    var i = $(this).next();
    i.length || (i = $(this).siblings(":first")),
      i.children(":first-child").clone().appendTo($(this));

    for (var n = 0; n < 4; n++)(i = i.next()).length ||
      (i = $(this).siblings(":first")),
      i.children(":first-child").clone().appendTo($(this))
  })
});
</code>```

My HTML code

```<code><div id="carousel-commodities" class="carousel slide col-md-12"
  style="padding-left: 0; padding-right: 0;" data-ride="carousel">
  <!-- Wrapper for slides -->
  <div class="carousel-inner" role="listbox">
    <div class="item active">
      <div class="col-sm-4">
        <a href="sourcing-solutions.html">
          <img src="assets/img/projects/corporate-gift.jpg"
            alt="Corporate Gifts">
          <div class="carousel-caption">
            <h3>Corporate Gifts</h3>
          </div>
        </a>
      </div>
    </div>
    <div class="item">
      <div class="col-sm-4">
        <a href="sourcing-solutions.html">
          <img src="assets/img/projects/stationary-items.jpg"
            alt="Stationary Items">
          <div class="carousel-caption">
            <h3>Stationary Items</h3>
          </div>
        </a>
      </div>
    </div>
    <div class="item">
      <div class="col-sm-4">
        <a href="sourcing-solutions.html">
          <img src="assets/img/projects/solar-panel.jpg"
            alt="Solar Panel">
          <div class="carousel-caption">
            <h3>Solar Panel</h3>
          </div>
        </a>
      </div>
    </div>
    <div class="item">
      <div class="col-sm-4">
        <a href="sourcing-solutions.html">
          <img src="assets/img/projects/construction-machinary.jpg"
            alt="Construction Machinary">
          <div class="carousel-caption">
            <h3>Construction Machinary</h3>
          </div>
        </a>
      </div>
    </div>
    <div class="item">
      <div class="col-sm-4">
        <a href="sourcing-solutions.html">
          <img src="assets/img/projects/power-tools.jpeg"
            alt="Power Tools">
          <div class="carousel-caption">
            <h3>Power Tools</h3>
          </div>
        </a>
      </div>
    </div>
    <div class="item">
      <div class="col-sm-4">
        <a href="sourcing-solutions.html">
          <img src="assets/img/projects/paint-accessories.png"
            alt="Paint Accessories">
          <div class="carousel-caption">
            <h3>Paint Accessories</h3>
          </div>
        </a>
      </div>
    </div>
    <div class="item">
      <div class="col-sm-4">
        <a href="sourcing-solutions.html">
          <img src="assets/img/projects/hardware-tools.jpg"
            alt="Hardware Tools">
          <div class="carousel-caption">
            <h3>Hardware Tools</h3>
          </div>
        </a>
      </div>
    </div>
    <div class="item">
      <div class="col-sm-4">
        <a href="sourcing-solutions.html">
          <img src="assets/img/projects/fasteners-hardware.jpg"
            alt="Fasteners">
          <div class="carousel-caption">
            <h3>Fasteners</h3>
          </div>
        </a>
      </div>
    </div>
    <div class="item">
      <div class="col-sm-4">
        <a href="sourcing-solutions.html">
          <img src="assets/img/projects/fabrics.jpg" alt="Fabrics">
          <div class="carousel-caption">
            <h3>Fabrics</h3>
          </div>
        </a>
      </div>
    </div>
  </div>
  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-commodities" role="button"
    data-slide="prev">
  <span class="glyphicon glyphicon-chevron-left"
    aria-hidden="true"></span>
  <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#carousel-commodities" role="button"
    data-slide="next">
  <span class="glyphicon glyphicon-chevron-right"
    aria-hidden="true"></span>
  <span class="sr-only">Next</span>
  </a>
</div>
</code>```

Currently how it shows:

Desired result should be all images which are shown on screen at once should be in scrolled and new images should be shown in place.
In normal situation scroller would scroll out all images its currently showing and then show next set of images. What is happening currently is only one image is getting appended at the end when entire scroller scrolls the images.

答:
A nice workaround would be to add a transparent image for the slide, and then in the caption section, you may add a div that has multiple images inside.

```<code><div class="item active">
  <div class="col-sm-4">
    <a href="sourcing-solutions.html">
      <img src="transparent.png"
        alt="Nothing here">
      <div class="carousel-caption">
        <div class="groupImgs">
          <img src="image1" />
          <img src="image2" />
          <img src="image2" />
        </div>
        <h3>Corporate Gifts</h3>
      </div>
    </a>
  </div>
</div>
</code>```

You may then style groupImgs the way you want to arrange the images internally.

Body:
Bootstrap Ver: 3.3.7

I want to display multiple images in one slide in bootstrap carousel.

Searched a lot and came across this site https://www.geeksforgeeks.org/how-to-display-bootstrap-carousel-with-three-post-in-each-slide/

In Example 2 problem is being resolved partially, i.e I can display multiple images in one slide, but the javascript code written in this website is cloning all the images and appending one image at a time in the end which is not the desired effect.

$(window).load(function() {
  $(".carousel .item").each(function() {
    var i = $(this).next();
    i.length || (i = $(this).siblings(":first")),
      i.children(":first-child").clone().appendTo($(this));

    for (var n = 0; n < 4; n++)(i = i.next()).length ||
      (i = $(this).siblings(":first")),
      i.children(":first-child").clone().appendTo($(this))
  })
});

My HTML code

Corporate Gifts

Stationary Items

Solar Panel

Construction Machinary

Power Tools

Paint Accessories

Hardware Tools

Fasteners

Fabrics

  Previous

  Next

Currently how it shows:

Desired result should be all images which are shown on screen at once should be in scrolled and new images should be shown in place.
In normal situation scroller would scroll out all images its currently showing and then show next set of images. What is happening currently is only one image is getting appended at the end when entire scroller scrolls the images.

Body:
A nice workaround would be to add a transparent image for the slide, and then in the caption section, you may add a div that has multiple images inside.

<div class="item active">
  <div class="col-sm-4">
    <a href="sourcing-solutions.html">
      <img src="transparent.png"
        alt="Nothing here">
      <div class="carousel-caption">
        <div class="groupImgs">
          <img src="image1" />
          <img src="image2" />
          <img src="image2" />
        </div>
        <h3>Corporate Gifts</h3>
      </div>
    </a>
  </div>
</div>

You may then style groupImgs the way you want to arrange the images internally.


问:
Pandas count occurence of value in dictionary
Given a DF:

```<code>pd.DataFrame({"A":[1,2,3],
              "B": [{"Mon":"Closed", "Tue":"Open", "Wed":"Closed"},
                    {"Mon":"Open", "Tue":"Open", "Wed":"Closed"},
                    {"Mon":"Open", "Tue":"Open", "Wed":"Open"}]
              })
</code>```

How do i get a count of number of times "Closed" appears in the dict?

```<code>A  B    count
1 {..}  2
2 {..}  1
3 {..}  0
</code>```

I really don't know how to start on this to try

答:
You can use a Counter in a simple list comprehension.</p>

```<code>from collections import Counter

df['count'] = [Counter(x.values())['Closed'] for x in df.B]

#   A                                                  B  Count
#0  1  {'Mon': 'Closed', 'Tue': 'Open', 'Wed': 'Closed'}      2
#1  2    {'Mon': 'Open', 'Tue': 'Open', 'Wed': 'Closed'}      1
#2  3      {'Mon': 'Open', 'Tue': 'Open', 'Wed': 'Open'}      0
</code>```

Body:
Given a DF:

pd.DataFrame({"A":[1,2,3],
              "B": [{"Mon":"Closed", "Tue":"Open", "Wed":"Closed"},
                    {"Mon":"Open", "Tue":"Open", "Wed":"Closed"},
                    {"Mon":"Open", "Tue":"Open", "Wed":"Open"}]
              })

How do i get a count of number of times "Closed" appears in the dict?

A  B    count
1 {..}  2
2 {..}  1
3 {..}  0

I really don't know how to start on this to try

Body:
You can use a Counter in a simple list comprehension.

from collections import Counter

df['count'] = [Counter(x.values())['Closed'] for x in df.B]

#   A                                                  B  Count
#0  1  {'Mon': 'Closed', 'Tue': 'Open', 'Wed': 'Closed'}      2
#1  2    {'Mon': 'Open', 'Tue': 'Open', 'Wed': 'Closed'}      1
#2  3      {'Mon': 'Open', 'Tue': 'Open', 'Wed': 'Open'}      0