{% extends "administration/base.html" %} {% load i18n %} {% load humanize %} {% load passbook_utils %} {% block content %}

{% trans 'Outpost Setup' %}

{% trans "Outposts are deployments of passbook components to support different environments and protocols, like reverse proxies." %}

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: "passbook-{{ outpost.type }}"
    app.kubernetes.io/instance: "{{ outpost.name }}"
    passbook.beryju.org/outpost: "{{ outpost.pk.hex }}"
  name: "passbook-{{ outpost.type }}-{{ outpost.name }}"
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: "passbook-{{ outpost.type }}"
      app.kubernetes.io/instance: "{{ outpost.name }}"
      passbook.beryju.org/outpost: "{{ outpost.pk.hex }}"
  template:
    metadata:
      labels:
        app.kubernetes.io/name: "passbook-{{ outpost.type }}"
        app.kubernetes.io/instance: "{{ outpost.name }}"
        passbook.beryju.org/outpost: "{{ outpost.pk.hex }}"
    spec:
      containers:
      - env:
        - name: PASSBOOK_HOST
          value: "{{ host }}"
        - name: PASSBOOK_TOKEN
          value: "{{ outpost.token.pk.hex }}"
        image: beryju/passbook-{{ outpost.type }}:{{ version }}
        name: "passbook-{{ outpost.type }}"
        ports:
        - containerPort: 4180
          protocol: TCP
          name: http
        - containerPort: 4443
          protocol: TCP
          name: https
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/name: "passbook-{{ outpost.type }}"
    app.kubernetes.io/instance: "{{ outpost.name }}"
    passbook.beryju.org/outpost: "{{ outpost.pk.hex }}"
  name: "passbook-{{ outpost.type }}-{{ outpost.name }}"
spec:
  ports:
  - name: http
    port: 4180
    protocol: TCP
    targetPort: 4180
  - name: https
    port: 4443
    protocol: TCP
    targetPort: 4443
  selector:
    app.kubernetes.io/name: "passbook-{{ outpost.type }}"
    app.kubernetes.io/instance: "{{ outpost.name }}"
    passbook.beryju.org/outpost: "{{ outpost.pk.hex }}"
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "passbook-{{ outpost.type }}-{{ outpost.name }}"
spec:
  rules:
  - host: "{{ provider.external_host }}"
    http:
      paths:
      - backend:
          serviceName: "passbook-{{ outpost.type }}-{{ outpost.name }}"
          servicePort: 4180
        path: "/pbprox"
{% endblock %}