apiVersion: apps/v1
kind: Deployment
metadata:
  name: akashd
spec:
  selector:
    matchLabels:
      app: akashd
  template:
    metadata:
      labels:
        app: akashd
    spec:
      containers:
        - name: akashd
          image: ovrclk/akashd:latest
          imagePullPolicy: IfNotPresent
          command: [ "/bin/sh" , "/boot/run.sh" ]
          env:

            ##
            # boot config
            ##

            - name: AKASHD_BOOT_DATA
              value: /boot-data

            - name: AKASHD_BOOT_KEYS
              value: /boot-keys

            ##
            # cosmos-sdk app config (app.toml)
            ##

            - name: AKASHD_MINIMUM_GAS_PRICES
              valueFrom:
                configMapKeyRef:
                  name: akashd-app-config
                  key: minimum-gas-prices

            - name: AKASHD_HALT_HEIGHT
              valueFrom:
                configMapKeyRef:
                  name: akashd-app-config
                  key: halt-height

            - name: AKASHD_HALT_TIME
              valueFrom:
                configMapKeyRef:
                  name: akashd-app-config
                  key: halt-time

            - name: AKASHD_INTER_BLOCK_CACHE
              valueFrom:
                configMapKeyRef:
                  name: akashd-app-config
                  key: inter-block-cache

            - name: AKASHD_PRUNING
              valueFrom:
                configMapKeyRef:
                  name: akashd-app-config
                  key: pruning

            ##
            # tendermint node config (config.toml)
            ##

            - name: AKASHD_HOME
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: home

            - name: AKASHD_MONIKER
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: moniker

            - name: AKASHD_FAST_SYNC
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: fast_sync

            - name: AKASHD_DB_BACKEND
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: db_backend

            - name: AKASHD_DB_DIR
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: db_dir

            - name: AKASHD_LOG_LEVEL
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: log_level

            - name: AKASHD_LOG_FORMAT
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: log_format

            - name: AKASHD_GENESIS_FILE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: genesis_file

            - name: AKASHD_PRIV_VALIDATOR_KEY_FILE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: priv_validator_key_file

            - name: AKASHD_PRIV_VALIDATOR_STATE_FILE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: priv_validator_state_file

            - name: AKASHD_PRIV_VALIDATOR_LADDR
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: priv_validator_laddr

            - name: AKASHD_NODE_KEY_FILE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: node_key_file

            - name: AKASHD_ABCI
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: abci

            - name: AKASHD_PROF_LADDR
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: prof_laddr

            - name: AKASHD_FILTER_PEERS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: filter_peers

            - name: AKASHD_RPC_LADDR
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: rpc.laddr

            - name: AKASHD_RPC_GRPC_LADDR
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: rpc.grpc_laddr

            - name: AKASHD_RPC_GRPC_MAX_OPEN_CONNECTIONS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: rpc.grpc_max_open_connections

            - name: AKASHD_RPC_UNSAFE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: rpc.unsafe

            - name: AKASHD_RPC_MAX_OPEN_CONNECTIONS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: rpc.max_open_connections

            - name: AKASHD_RPC_MAX_SUBSCRIPTION_CLIENTS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: rpc.max_subscription_clients

            - name: AKASHD_RPC_MAX_SUBSCRIPTIONS_PER_CLIENT
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: rpc.max_subscriptions_per_client

            - name: AKASHD_RPC_TIMEOUT_BROADCAST_TX_COMMIT
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: rpc.timeout_broadcast_tx_commit

            - name: AKASHD_RPC_MAX_BODY_BYTES
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: rpc.max_body_bytes

            - name: AKASHD_RPC_MAX_HEADER_BYTES
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: rpc.max_header_bytes

            - name: AKASHD_RPC_TLS_CERT_FILE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: rpc.tls_cert_file

            - name: AKASHD_RPC_TLS_KEY_FILE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: rpc.tls_key_file

            - name: AKASHD_P2P_LADDR
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.laddr

            - name: AKASHD_P2P_EXTERNAL_ADDRESS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.external_address

            - name: AKASHD_P2P_SEEDS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.seeds

            - name: AKASHD_P2P_PERSISTENT_PEERS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.persistent_peers

            - name: AKASHD_P2P_UPNP
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.upnp

            - name: AKASHD_P2P_ADDR_BOOK_FILE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.addr_book_file

            - name: AKASHD_P2P_ADDR_BOOK_STRICT
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.addr_book_strict

            - name: AKASHD_P2P_MAX_NUM_INBOUND_PEERS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.max_num_inbound_peers

            - name: AKASHD_P2P_MAX_NUM_OUTBOUND_PEERS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.max_num_outbound_peers

            - name: AKASHD_P2P_UNCONDITIONAL_PEER_IDS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.unconditional_peer_ids

            - name: AKASHD_P2P_PERSISTENT_PEERS_MAX_DIAL_PERIOD
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.persistent_peers_max_dial_period

            - name: AKASHD_P2P_FLUSH_THROTTLE_TIMEOUT
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.flush_throttle_timeout

            - name: AKASHD_P2P_MAX_PACKET_MSG_PAYLOAD_SIZE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.max_packet_msg_payload_size

            - name: AKASHD_P2P_SEND_RATE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.send_rate

            - name: AKASHD_P2P_RECV_RATE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.recv_rate

            - name: AKASHD_P2P_PEX
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.pex

            - name: AKASHD_P2P_SEED_MODE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.seed_mode

            - name: AKASHD_P2P_PRIVATE_PEER_IDS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.private_peer_ids

            - name: AKASHD_P2P_ALLOW_DUPLICATE_IP
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.allow_duplicate_ip

            - name: AKASHD_P2P_HANDSHAKE_TIMEOUT
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.handshake_timeout

            - name: AKASHD_P2P_DIAL_TIMEOUT
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: p2p.dial_timeout

            - name: AKASHD_MEMPOOL_RECHECK
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: mempool.recheck

            - name: AKASHD_MEMPOOL_BROADCAST
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: mempool.broadcast

            - name: AKASHD_MEMPOOL_WAL_DIR
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: mempool.wal_dir

            - name: AKASHD_MEMPOOL_SIZE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: mempool.size

            - name: AKASHD_MEMPOOL_MAX_TXS_BYTES
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: mempool.max_txs_bytes

            - name: AKASHD_MEMPOOL_CACHE_SIZE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: mempool.cache_size

            - name: AKASHD_MEMPOOL_MAX_TX_BYTES
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: mempool.max_tx_bytes

            - name: AKASHD_FASTSYNC_VERSION
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: fastsync.version

            - name: AKASHD_CONSENSUS_WAL_FILE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.wal_file

            - name: AKASHD_CONSENSUS_TIMEOUT_PROPOSE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.timeout_propose

            - name: AKASHD_CONSENSUS_TIMEOUT_PROPOSE_DELTA
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.timeout_propose_delta

            - name: AKASHD_CONSENSUS_TIMEOUT_PREVOTE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.timeout_prevote

            - name: AKASHD_CONSENSUS_TIMEOUT_PREVOTE_DELTA
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.timeout_prevote_delta

            - name: AKASHD_CONSENSUS_TIMEOUT_PRECOMMIT
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.timeout_precommit

            - name: AKASHD_CONSENSUS_TIMEOUT_PRECOMMIT_DELTA
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.timeout_precommit_delta

            - name: AKASHD_CONSENSUS_TIMEOUT_COMMIT
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.timeout_commit

            - name: AKASHD_CONSENSUS_SKIP_TIMEOUT_COMMIT
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.skip_timeout_commit

            - name: AKASHD_CONSENSUS_CREATE_EMPTY_BLOCKS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.create_empty_blocks

            - name: AKASHD_CONSENSUS_CREATE_EMPTY_BLOCKS_INTERVAL
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.create_empty_blocks_interval

            - name: AKASHD_CONSENSUS_PEER_GOSSIP_SLEEP_DURATION
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.peer_gossip_sleep_duration

            - name: AKASHD_CONSENSUS_PEER_QUERY_MAJ23_SLEEP_DURATION
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: consensus.peer_query_maj23_sleep_duration

            - name: AKASHD_TX_INDEX_INDEXER
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: tx_index.indexer

            - name: AKASHD_TX_INDEX_INDEX_KEYS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: tx_index.index_keys

            - name: AKASHD_TX_INDEX_INDEX_ALL_KEYS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: tx_index.index_all_keys

            - name: AKASHD_INSTRUMENTATION_PROMETHEUS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: instrumentation.prometheus

            - name: AKASHD_INSTRUMENTATION_PROMETHEUS_LISTEN_ADDR
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: instrumentation.prometheus_listen_addr

            - name: AKASHD_INSTRUMENTATION_MAX_OPEN_CONNECTIONS
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: instrumentation.max_open_connections

            - name: AKASHD_INSTRUMENTATION_NAMESPACE
              valueFrom:
                configMapKeyRef:
                  name: akashd-config
                  key: instrumentation.namespace

          ports:
            - name: akashd-rpc
              containerPort: 26657
            - name: akashd-p2p
              containerPort: 26656
          volumeMounts:
            - name: boot
              mountPath: /boot
              readOnly: true
            - name: data
              mountPath: /boot-data
              readOnly: true
            - name: keys
              mountPath: /boot-keys
              readOnly: true
      volumes:
        - name: boot
          configMap:
            name: akashd-boot
        - name: data
          configMap:
            name: akashd-data
        - name: keys
          secret:
            secretName: akashd-keys
