apiVersion: apps/v1
kind: Deployment
metadata:
  name: token-refresher
spec:
  selector:
    matchLabels:
      app: token-refresher
  replicas: 1
  template:
    metadata:
      labels:
        app: token-refresher
    spec:
      volumes:
      - name: hub-secret
        secret:
          secretName: hub-secret
      - name: hub-config
        configMap:
          name: hub-config
      containers:
      - name: refresher
        volumeMounts:
          - mountPath: /etc/jupyterhub/config/
            name: hub-config
        image: betatim/openhumans-refresher:v14
        ports:
        - containerPort: 80
        env:
          - name: JUPYTERHUB_API_TOKEN
            valueFrom:
              secretKeyRef:
                name: hub-secret
                key: "services.token.refresher"
          - name: JUPYTERHUB_API_URL
            value: http://$(HUB_SERVICE_HOST):$(HUB_SERVICE_PORT)/hub/api
          - name: JUPYTERHUB_SERVICE_PREFIX
            value: "/services/refresher/"
          - name: JUPYTERHUB_SERVICE_URL
            value: "http://$(REFRESHER_SERVICE_HOST):$(REFRESHER_SERVICE_PORT)/"
