# _helpers.tpl
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "hlf-peer.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "hlf-peer.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "hlf-peer.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- /*
Credit: @technosophos
https://github.com/technosophos/common-chart/
labels.standard prints the standard Helm labels.
The standard labels are frequently used in metadata.
*/ -}}
{{- define "labels.standard" -}}
app: {{ include "hlf-peer.name" . }}
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
chart: {{ include "hlf-peer.chart" . }}
{{- end -}}
 # configmap--peer.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "hlf-peer.fullname" . }}--peer
  labels:
{{ include "labels.standard" . | indent 4 }}
data:
  CORE_PEER_ADDRESSAUTODETECT: "true"
  CORE_PEER_ID: {{ .Release.Name }}
  CORE_PEER_NETWORKID: nid1
  # If we have an ingress, we set hostname to it
  {{- if .Values.ingress.enabled }}
  CORE_PEER_ADDRESS: {{ index .Values.ingress.hosts 0 }}:443
  {{- else }}
  # Otherwise we use CORE_PEER_ADDRESSAUTODETECT to auto-detect its address
  {{- end }}
  CORE_PEER_LISTENADDRESS: 0.0.0.0:7051
  CORE_PEER_EVENTS_ADDRESS: 0.0.0.0:7053
  CORE_PEER_COMMITTER_ENABLED: "true"
  CORE_PEER_PROFILE_ENABLED: "true"
  CORE_PEER_DISCOVERY_PERIOD: 60s
  CORE_PEER_DISCOVERY_TOUCHPERIOD: 60s
  CORE_PEER_LOCALMSPID: {{ .Values.peer.mspID | quote }}
  CORE_PEER_MSPCONFIGPATH: /var/hyperledger/msp
  ###########
  # Logging #
  ###########
  CORE_LOGGING_LEVEL: {{ .Values.logging.level | quote }}
  CORE_LOGGING_PEER: {{ .Values.logging.peer | quote }}
  CORE_LOGGING_CAUTHDSL: {{ .Values.logging.cauthdsl | quote }}
  CORE_LOGGING_GOSSIP: {{ .Values.logging.gossip | quote }}
  CORE_LOGGING_LEDGER: {{ .Values.logging.ledger | quote }}
  CORE_LOGGING_MSP: {{ .Values.logging.msp | quote }}
  CORE_LOGGING_POLICIES: {{ .Values.logging.policies | quote }}
  CORE_LOGGING_GRPC: {{ .Values.logging.grpc | quote }}
  ##########
  # Gossip #
  ##########
  CORE_PEER_GOSSIP_BOOTSTRAP: {{ .Values.peer.gossip.bootstrap | quote }}
  CORE_PEER_GOSSIP_ENDPOINT: {{ .Values.peer.gossip.endpoint | quote }}
  CORE_PEER_GOSSIP_EXTERNALENDPOINT: {{ .Values.peer.gossip.externalEndpoint | quote }}
  CORE_PEER_GOSSIP_ORGLEADER: {{ .Values.peer.gossip.orgLeader | quote }}
  CORE_PEER_GOSSIP_USELEADERELECTION: {{ .Values.peer.gossip.useLeaderElection | quote }}
  #############
  # CHAINCODE #
  #############
  {{- if .Values.peer.chaincode.builder }}
  CORE_CHAINCODE_BUILDER: {{ .Values.peer.chaincode.builder | quote }}
  {{- end}}
  {{- if .Values.peer.chaincode.runtime.golang }}
  CORE_CHAINCODE_GOLANG_RUNTIME: {{ .Values.peer.chaincode.runtime.golang | quote }}
  {{- end}}
  {{- if .Values.peer.chaincode.runtime.java }}
  CORE_CHAINCODE_JAVA_RUNTIME: {{ .Values.peer.chaincode.runtime.java | quote }}
  {{- end}}
  {{- if .Values.peer.chaincode.runtime.node }}
  CORE_CHAINCODE_NODE_RUNTIME: {{ .Values.peer.chaincode.runtime.node | quote }}
  {{- end}}
  ##########
  # TLS    #
  ##########
  CORE_PEER_TLS_ENABLED: {{ .Values.peer.tls.server.enabled | quote }}
  CORE_PEER_TLS_CERT_FILE: "/var/hyperledger/tls/server/pair/tls.crt"
  CORE_PEER_TLS_KEY_FILE: "/var/hyperledger/tls/server/pair/tls.key"
  CORE_PEER_TLS_ROOTCERT_FILE: "/var/hyperledger/tls/server/cert/cacert.pem"
  CORE_PEER_TLS_CLIENTAUTHREQUIRED: {{ .Values.peer.tls.client.enabled | quote }}
  # This is fixed prior to starting the peer
  CORE_PEER_TLS_CLIENTROOTCAS_FILES: "/var/hyperledger/tls/client/cert/*"
  CORE_PEER_TLS_CLIENTCERT_FILE: "/var/hyperledger/tls/client/pair/tls.crt"
  CORE_PEER_TLS_CLIENTKEY_FILE: "/var/hyperledger/tls/client/pair/tls.key"
  CORE_VM_ENDPOINT: unix:///host/var/run/docker.sock
  CORE_LEDGER_STATE_STATEDATABASE: {{ .Values.peer.databaseType | quote }}
  # Containers in the same pod share the host
  {{- if eq .Values.peer.databaseType "CouchDB" }}
  CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS: {{ .Values.peer.couchdbInstance }}-hlf-couchdb:5984
  {{- end }}
  PEER_CFG_PATH: /var/hyperledger/config
  FABRIC_CFG_PATH: /var/hyperledger/fabric_cfg
  GODEBUG: "netdns=go"
  ADMIN_MSP_PATH: /var/hyperledger/admin_msp
  ORD_TLS_PATH: /var/hyperledger/tls/ord/cert
##############
# Operations #
##############
  {{- if eq .Values.peer.metrics.provider "prometheus" }}
  CORE_OPERATIONS_LISTENADDRESS: 0.0.0.0:9443
  {{- end }}
  {{- if eq .Values.peer.metrics.provider "statsd" }}
  CORE_OPERATIONS_LISTENADDRESS: 127.0.0.1:8125
  {{- end }}
###########
# Metrics #
###########
  CORE_METRICS_PROVIDER: {{ .Values.peer.metrics.provider | quote }}
  {{- if eq .Values.peer.metrics.provider "statsd" }}
  CORE_METRICS_STATSD_NETWORK: {{ .Values.peer.metrics.statsd.network | quote }}
  CORE_METRICS_STATSD_ADDRESS: {{ .Values.peer.metrics.statsd.address | quote }}
  CORE_METRICS_STATSD_WRITEINTERVAL: {{ .Values.peer.metrics.statsd.writeInterval | quote }}
  CORE_METRICS_STATSD_PREFIX: {{ .Values.peer.metrics.statsd.prefix | quote }}
  {{- end }}
 # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "hlf-peer.fullname" . }}
  labels:
{{ include "labels.standard" . | indent 4 }}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: {{ include "hlf-peer.name" . }}
      release: {{ .Release.Name }}
  # Ensure we allow our pod to be unavailable, so we can upgrade
  strategy:
    rollingUpdate:
      maxUnavailable: 1
  template:
    metadata:
      labels:
{{ include "labels.standard" . | indent 8 }}
    spec:
      volumes:
        - name: data
        {{- if .Values.persistence.enabled }}
          persistentVolumeClaim:
            claimName: {{ .Values.persistence.existingClaim | default (include "hlf-peer.fullname" .) }}
        {{- else }}
          emptyDir: {}
        {{- end }}
        - name: dockersocket
          hostPath:
            path: {{ .Values.dockerSocketPath }}
        {{- if .Values.dockerConfig }}
        - name: docker-config
          secret:
            secretName: {{ include "hlf-peer.fullname" . }}-dockerconfigjson
            items:
              - key: .dockerconfigjson
                path: config.json
        {{- end }}
        {{- if .Values.secrets.peer.cert }}
        - name: id-cert
          secret:
            secretName: {{ .Values.secrets.peer.cert }}
        {{- end }}
        {{- if .Values.secrets.peer.key }}
        - name: id-key
          secret:
            secretName: {{ .Values.secrets.peer.key }}
        {{- end }}
        {{- if .Values.secrets.peer.caCert }}
        - name: cacert
          secret:
            secretName: {{ .Values.secrets.peer.caCert }}
        {{- end }}
        {{- if .Values.secrets.peer.intCaCert }}
        - name: intcacert
          secret:
            secretName: {{ .Values.secrets.peer.intCaCert }}
        {{- end }}
        {{- if .Values.secrets.peer.tls }}
        - name: tls
          secret:
            secretName: {{ .Values.secrets.peer.tls }}
        {{- end }}
        {{- if .Values.secrets.peer.tlsRootCert }}
        - name: tls-rootcert
          secret:
            secretName: {{ .Values.secrets.peer.tlsRootCert }}
        {{- end }}
        {{- if .Values.secrets.peer.tlsClient }}
        - name: tls-client
          secret:
            secretName: {{ .Values.secrets.peer.tlsClient }}
        {{- end }}
        {{- if .Values.secrets.peer.tlsClientRootCert }}
        - name: tls-clientrootcert
          secret:
            secretName: {{ .Values.secrets.peer.tlsClientRootCert }}
        {{- end }}
        {{- if .Values.secrets.channels }}
          {{- range .Values.secrets.channels }}
        - name: {{ . }}
          secret:
            secretName: {{ . }}
          {{- end }}
        {{- end }}
        {{- if .Values.secrets.adminCert }}
        - name: admin-cert
          secret:
            secretName: {{ .Values.secrets.adminCert }}
        {{- end }}
        {{- if .Values.secrets.adminKey }}
        - name: admin-key
          secret:
            secretName: {{ .Values.secrets.adminKey }}
        {{- end }}
        {{- if .Values.secrets.ordTlsRootCert }}
        - name: ord-tls-rootcert
          secret:
            secretName: {{ .Values.secrets.ordTlsRootCert }}
        {{- end }}
      containers:
        - name: peer
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: request
              containerPort: 7051
              protocol: TCP
            - name: event
              containerPort: 7053
              protocol: TCP
            {{- if eq .Values.peer.metrics.provider "prometheus" }}
            - name: metrics
              containerPort: 9443
              protocol: TCP
            {{- end }}
          livenessProbe:
            exec:
              command:
              - ls
              - /var/hyperledger
            initialDelaySeconds: 5
            periodSeconds: 5
          # TODO: Improve readiness probe (ideally `ps aux | awk '$11=="orderer"'`)
          readinessProbe:
            exec:
              command:
              - ls
              - /var/hyperledger
            initialDelaySeconds: 15
          command:
            - bash
            - -c
            - |
              # To avoid having separate secrets for CouchDB and HLF
              export CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=$COUCHDB_USER
              export CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=$COUCHDB_PASSWORD

              while [ ! -d /var/hyperledger/admin_msp/admincerts ] || [ -z "$(ls -A /var/hyperledger/admin_msp/admincerts)" ];
              do
                echo "\033[0;31m /var/hyperledger/admin_msp/admincerts must contain Peer admin certificates files \033[0m"
                sleep 60
              done

              while [ ! -d ${CORE_PEER_MSPCONFIGPATH}/signcerts ];
              do
                echo "\033[0;31m ${CORE_PEER_MSPCONFIGPATH}/signcerts directory must exist \033[0m"
                sleep 60
              done

              if [ ! -d ${FABRIC_CFG_PATH} ]
              then
                mkdir -p ${FABRIC_CFG_PATH}
                cp -r /etc/hyperledger/fabric/core.yaml ${FABRIC_CFG_PATH}
                ls ${FABRIC_CFG_PATH}
              fi

              if [ $CORE_PEER_TLS_CLIENTAUTHREQUIRED ]
              then
                export CORE_PEER_TLS_CLIENTROOTCAS_FILES=$(ls -d $CORE_PEER_TLS_CLIENTROOTCAS_FILES)
              fi

              echo ">\033[0;35m peer node start \033[0m"
              peer node start
          envFrom:
            {{- if eq .Values.peer.databaseType "CouchDB" }}
            - secretRef:
                name: {{ .Values.peer.couchdbInstance }}-hlf-couchdb
            {{- end }}
            - configMapRef:
                name: {{ include "hlf-peer.fullname" . }}--peer
          volumeMounts:
            - mountPath: /var/hyperledger
              name: data
            - mountPath: /host/var/run/docker.sock
              name: dockersocket
            {{- if .Values.dockerConfig }}
            - name: docker-config
              mountPath: {{ .Values.dockerConfigMountPath }}
            {{ end }}
            {{- if .Values.secrets.peer.cert }}
            - mountPath: /var/hyperledger/msp/signcerts
              name: id-cert
            {{- end }}
            {{- if .Values.secrets.peer.key }}
            - mountPath: /var/hyperledger/msp/keystore
              name: id-key
            {{- end }}
            {{- if .Values.secrets.peer.caCert }}
            - mountPath: /var/hyperledger/msp/cacerts
              name: cacert
            - mountPath: /var/hyperledger/admin_msp/cacerts
              name: cacert
            {{- end }}
            {{- if .Values.secrets.peer.intCaCert }}
            - mountPath: /var/hyperledger/msp/intermediatecerts
              name: intcacert
            - mountPath: /var/hyperledger/admin_msp/intermediatecerts
              name: intcacert
            {{- end }}
            {{- if .Values.secrets.peer.tls }}
            - mountPath: /var/hyperledger/tls/server/pair
              name: tls
            {{- end }}
            {{- if .Values.secrets.peer.tlsRootCert }}
            - mountPath: /var/hyperledger/tls/server/cert
              name: tls-rootcert
            {{- end }}
            {{- if .Values.secrets.peer.tlsClient }}
            - mountPath: /var/hyperledger/tls/client/pair
              name: tls-client
            {{- end }}
            {{- if .Values.secrets.peer.tlsClientRootCert }}
            - mountPath: /var/hyperledger/tls/client/cert
              name: tls-clientrootcert
            {{- end }}
            {{- if .Values.secrets.ordTlsRootCert }}
            - mountPath: /var/hyperledger/tls/ord/cert
              name: ord-tls-rootcert
            {{- end }}
            {{- if .Values.secrets.channels }}
              {{- range .Values.secrets.channels }}
            - mountPath: /hl_config/channel/{{ . }}
              name: {{ . }}
              {{- end }}
            {{- end }}
            {{- if .Values.secrets.adminCert }}
            - mountPath: /var/hyperledger/admin_msp/admincerts
              name: admin-cert
            - mountPath: /var/hyperledger/admin_msp/signcerts
              name: admin-cert
            - mountPath: /var/hyperledger/msp/admincerts
              name: admin-cert
            {{- end }}
            {{- if .Values.secrets.adminKey }}
            - mountPath: /var/hyperledger/admin_msp/keystore
              name: admin-key
            {{- end }}
          resources:
{{ toYaml .Values.resources | indent 12 }}
    {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.affinity }}
      affinity:
        ## This affinity is required to ensure reasonable ledger access speeds
        {{- if eq $.Values.peer.databaseType "CouchDB" }}
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: release
                operator: In
                values:
                - {{ $.Values.peer.couchdbInstance }}
            topologyKey: "kubernetes.io/hostname"
        {{- end }}
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
{{ toYaml . | indent 8 }}
    {{- end }}
 # ingress.yaml
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "hlf-peer.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
{{ include "labels.standard" . | indent 4 }}
{{- with .Values.ingress.annotations }}
  annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
  tls:
  {{- range .Values.ingress.tls }}
    - hosts:
      {{- range .hosts }}
        - {{ . }}
      {{- end }}
      secretName: {{ .secretName }}
  {{- end }}
{{- end }}
  rules:
  {{- range .Values.ingress.hosts }}
    - host: {{ . }}
      http:
        paths:
          - path: {{ $ingressPath }}
            backend:
              serviceName: {{ $fullName }}
              servicePort: request
  {{- end }}
{{- end }}
 # pvc.yaml
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: {{ include "hlf-peer.fullname" . }}
  labels:
{{ include "labels.standard" . | indent 4 }}
{{- if .Values.persistence.annotations }}
  annotations:
{{ toYaml .Values.persistence.annotations | indent 4 }}
{{- end }}
spec:
  accessModes:
    - {{ .Values.persistence.accessMode | quote }}
  resources:
    requests:
      storage: {{ .Values.persistence.size | quote }}
  {{- if .Values.persistence.storageClass }}
  {{- if (eq "-" .Values.persistence.storageClass) }}
  storageClassName: ""
  {{- else }}
  storageClassName: "{{ .Values.persistence.storageClass }}"
  {{- end }}
  {{- end }}
{{- end }}
 # secret.yaml
{{- if .Values.dockerConfig }}
apiVersion: v1
kind: Secret
type: kubernetes.io/dockerconfigjson
metadata:
  name: {{ include "hlf-peer.fullname" . }}-dockerconfigjson
data:
  .dockerconfigjson: {{ .Values.dockerConfig }}
{{ end }}
 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "hlf-peer.fullname" . }}
  labels:
{{ include "labels.standard" . | indent 4 }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.portRequest }}
      targetPort: 7051
      protocol: TCP
      name: request
    - port: {{ .Values.service.portEvent }}
      targetPort: 7053
      protocol: TCP
      name: event
    {{- if eq .Values.peer.metrics.provider "prometheus" }}
    - port: {{ .Values.service.portMetrics }}
      targetPort: 9443
      protocol: TCP
      name: metrics
    {{- end }}
  selector:
    app: {{ include "hlf-peer.name" . }}
    release: {{ .Release.Name }}

# Default values for  hlf-peer.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

image:
  repository: hyperledger/fabric-peer
  tag: 1.4.3
  pullPolicy: IfNotPresent

service:
  # Cluster IP or LoadBalancer
  type: ClusterIP
  portRequest: 7051
  portEvent: 7053
  portMetrics: 9443

# Path of the docker socket on the host
dockerSocketPath: /var/run/docker.sock
# Docker config to be used to pull the images (base64'd)
dockerConfig: null
# Docker config mount path
dockerConfigMountPath: /root/.docker

ingress:
  enabled: false
  annotations: {}
    # kubernetes.io/ingress.class: nginx
    # nginx.ingress.kubernetes.io/ssl-redirect: "true"
    # nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
    # certmanager.k8s.io/cluster-issuer: "letsencrypt-staging"
  path: /
  hosts:
    - hlf-peer.local
  tls: []
  #  - secretName: hlf-peer-tls
  #    hosts:
  #      - hlf-peer.local

persistence:
  enabled: true
  annotations: {}
  ## If defined, storageClassName: <storageClass>
  ## If set to "-", storageClassName: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClassName spec is
  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
  ##   GKE, AWS & OpenStack)
  ##
  storageClass: ""
  accessMode: ReadWriteOnce
  size: 1Gi
  # existingClaim: ""

logging:
  level: info
  peer: info
  cauthdsl: warning
  gossip: info
  grpc: error
  ledger: info
  msp: warning
  policies: warning


##################################
## Peer configuration options    #
##################################
peer:
  # Type of database ("goleveldb" or "CouchDB"):
  databaseType: goleveldb
  # If CouchDB is used, which chart holds it
  couchdbInstance: cdb-peer1
  ## MSP ID of the Peer
  mspID: Org1MSP
  gossip:
    bootstrap: ""
    endpoint: ""
    externalEndpoint: ""
    orgLeader: "false"
    useLeaderElection: "true"

  tls:
    server:
      enabled: "false"
    client:
      enabled: "false"
  chaincode:
    # define the ccenv image used by the peer
    builder: ""
    runtime:
      golang: ""
      java: ""
      node: ""
  metrics:
    provider: "disabled"
    statsd:
      network: "udp"
      address: "127.0.0.1:8125"
      writeInterval: "10s"
      prefix: ""
# Secrets references, empty by default, fill in with your secrets (particularly adminCert) or add Peer Admin certificate manually after launching chart.
secrets:
  ## These secrets should contain the Orderer crypto materials and credentials
  peer: {}
    ## Credentials, saved under keys 'CA_USERNAME' and 'CA_PASSWORD'
    # cred: hlf--peer1-cred
    ## Certificate, saved under key 'cert.pem'
    # cert: hlf--peer1-idcert
    ## Key, saved under 'key.pem'
    # key: hlf--peer1-idkey
    ## CA Cert, saved under 'cacert.pem'
    # caCert: hlf--peer1-cacert
    ## Intermediate CA Cert (optional), saved under 'intermediatecacert.pem'
    # intCaCert: hlf--peer1-caintcert
    ## TLS secret, saved under keys 'tls.crt' and 'tls.key' (to conform with K8S nomenclature)
    # tls: hlf--peer1-tls
    ## TLS root CA certificate saved under key 'cert.pem'
    # tlsRootCert: hlf--peer-tlsrootcert
    ## TLS client root CA certificates saved under any names (as there may be multiple)
    # tlsClient: hlf--peer1-tls
    ## TLS client root CA certificates saved under any names (as there may be multiple)
    # tlsClientRootCerts: hlf--ord-tlsrootcert
  ## This should contain "channel" transaction derived from a configtx.yaml
  ## configtxgen -profile ComposerChannel -channelID composerchannel -outputCreateChannelTx composerchannel.tx
  # channels:
  # - foochannel
  # - barchannel
  ## This should contain the Certificate of the Peer Organisation admin
  ## This is necessary to successfully run the peer
  # adminCert: hlf--peer-admincert
  ## This should contain the Private Key of the Peer Organisation admin
  ## This is necessary to successfully join a channel
  # adminKey: hlf--peer-adminkey
  ## This should include the Orderer TLS 'cacert.pem'
  # ordTlsRootCert: hlf--ord-tlsrootcert

resources: {}
  ## We usually recommend not to specify default resources and to leave this as a conscious
  ## choice for the user. This also increases chances charts run on environments with little
  ## resources, such as Minikube. If you do want to specify resources, uncomment the following
  ## lines, adjust them as necessary, and remove the curly braces after 'resources:'.
  # limits:
  #   cpu: 100m
  #   memory: 128Mi
  # requests:
  #   cpu: 100m
  #   memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}
  ## Suggested antiAffinity, as each Peer should be on a separate Node for resilience
  # podAntiAffinity:
  #   requiredDuringSchedulingIgnoredDuringExecution:
  #     - topologyKey: "kubernetes.io/hostname"
  #       labelSelector:
  #         matchLabels:
  #           app: hlf-peer
