apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: hsds
  name: hsds
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hsds
  template:
    metadata:
      labels:
        app: hsds
    spec:
      containers:
        -
          name: sn
          image: "hdfgroup/hsds"
          imagePullPolicy: IfNotPresent
          volumeMounts:
          - name: data
            mountPath: "/data"
          - name: accounts
            mountPath: "/config/passwd.txt"
            subPath: passwd.txt
          - name: config
            mountPath: "/config/config.yml"
            subPath: config.yml
          - name: override
            mountPath: "/config/override.yml"
            subPath: override.yml
          ports:
            -
              containerPort: 5101
          env:
          - name: NODE_TYPE
            value: sn
          - name: ROOT_DIR
            value: /data
          - name: BUCKET_NAME
            value: hsds
          - name: LOG_LEVEL
            value: DEBUG
          - name: SERVER_NAME
            value: "Highly Scalable Data Service (HSDS)"
          - name: HSDS_ENDPOINT
            value: "http://hsds.hdf.test" # change to external DNS LB path
          - name: GREETING
            value: "Welcome to HSDS!"
          - name: ABOUT
            value: "HSDS is a webservice for HDF data"
          - name: PASSWORD_FILE
            value: /config/passwd.txt
        -
          name: dn
          image: "hdfgroup/hsds"
          lifecycle:
            preStop:
              exec:
                command: ["/usr/bin/curl", "-X", "DELETE", "http://127.0.0.1:6101/prestop"]
          imagePullPolicy: IfNotPresent
          volumeMounts:
          - name: data
            mountPath: "/data"
          ports:
            -
              containerPort: 6101
          env:
          - name: NODE_TYPE
            value: dn
          - name: ROOT_DIR
            value: /data
          - name: BUCKET_NAME
            value: hsds
          - name: LOG_LEVEL
            value: DEBUG
          - name: HSDS_ENDPOINT
            value: http://hsds.hdf.test
      volumes:
      - name: data
        hostPath:
          # change to directory location for bucket parent directory
          path: /var/mybuckets
          type: Directory
      - name: config
        secret:
          secretName: user-password
      - name: hsds-config
        configMap:
          name: hsds-config
      - name: hsds-override
        configMap:
          name: hsds-override
