apiVersion: batch/v1
kind: Job
metadata:
  name: traefik-storeconfig-job
  labels:
    app: traefik
    stack: lb
spec:
  template:
    metadata:
      name: traefik-storeconfig-job
      labels:
        app: traefik
        stack: lb
    spec:
      restartPolicy: OnFailure
      containers:
      - name: traefik-storeconfig-job
        image: traefik:1.7
        args:
        - "storeconfig"
        - "--consul.watch=false"
        - "--consul.prefix=traefik"
        - "--consul.endpoint=$CONSUL_SVC"
        volumeMounts:
        - name: config
          mountPath: /etc/traefik/traefik.toml
          subPath: traefik.toml
      volumes:
      - name: config
        configMap:
          name: traefik
