apiVersion: v1
kind: Secret
metadata:
  name: docker-config
  namespace: mastodon-to-airtable
  annotations:
    kube-1password: i6ngbk5zf4k52xgwdwnfup5bby
    kube-1password/vault: Kubernetes
    kube-1password/secret-text-key: .dockerconfigjson
type: kubernetes.io/dockerconfigjson
data:
  .dockerconfigjson: e30=
---
apiVersion: v1
kind: Secret
metadata:
  name: mastodon-to-airtable-auth
  namespace: mastodon-to-airtable
  annotations:
    kube-1password: mr6spkkx7n3memkbute6ojaarm
    kube-1password/vault: Kubernetes
type: Opaque
---
apiVersion: v1
kind: Secret
metadata:
  name: mastodon-to-airtable
  namespace: mastodon-to-airtable
  annotations:
    kube-1password: kizmkmbndgu3ryrox3csev4mim
    kube-1password/vault: Kubernetes
    kube-1password/secret-text-parse: "true"
type: Opaque
---
apiVersion: v1
kind: Service
metadata:
  name: mastodon-to-airtable
  namespace: mastodon-to-airtable
spec:
  type: ClusterIP
  ports:
  - port: 80
    targetPort: auth
    name: web
  selector:
    app: mastodon-to-airtable
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mastodon-to-airtable
  namespace: mastodon-to-airtable
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mastodon-to-airtable
  template:
    metadata:
      labels:
        app: mastodon-to-airtable
    spec:
      imagePullSecrets:
        - name: docker-config
      containers:
      - args:
        - --cookie-secure=false
        - --provider=oidc
        - --provider-display-name=Auth0
        - --upstream=http://localhost:8080
        - --http-address=$(HOST_IP):8000
        - --redirect-url=https://mastodon-to-airtable.cluster.fun/oauth2/callback
        - --email-domain=marcusnoble.co.uk
        - --pass-basic-auth=false
        - --pass-access-token=false
        - --oidc-issuer-url=https://marcusnoble.eu.auth0.com/
        - --cookie-secret=KDGD6rrK6cBmryyZ4wcJ9xAUNW9AQNFT
        env:
        - name: HOST_IP
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: status.podIP
        - name: OAUTH2_PROXY_CLIENT_ID
          valueFrom:
            secretKeyRef:
              key: username
              name: mastodon-to-airtable-auth
        - name: OAUTH2_PROXY_CLIENT_SECRET
          valueFrom:
            secretKeyRef:
              key: password
              name: mastodon-to-airtable-auth
        image: quay.io/oauth2-proxy/oauth2-proxy:v7.7.1
        name: oauth-proxy
        ports:
        - containerPort: 8000
          protocol: TCP
          name: auth
        resources:
          limits:
            memory: 50Mi
          requests:
            memory: 50Mi
      - name: web
        image: rg.fr-par.scw.cloud/averagemarcus-private/mastodon-to-airtable:latest
        imagePullPolicy: Always
        env:
        - name: PORT
          value: "8080"
        envFrom:
        - secretRef:
            name: "mastodon-to-airtable"
        ports:
        - containerPort: 8080
          name: web
        resources:
          limits:
            memory: 50Mi
          requests:
            memory: 50Mi

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: mastodon-to-airtable
  namespace: mastodon-to-airtable
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt
    kubernetes.io/ingress.class: traefik
    traefik.ingress.kubernetes.io/router.tls: "true"
    ingress.kubernetes.io/ssl-redirect: "true"
    traefik.ingress.kubernetes.io/router.entrypoints: websecure
spec:
  tls:
  - hosts:
    - mastodon-to-airtable.cluster.fun
    secretName: mastodon-to-airtable-ingress
  rules:
  - host: mastodon-to-airtable.cluster.fun
    http:
      paths:
      - path: /
        pathType: ImplementationSpecific
        backend:
          service:
            name: mastodon-to-airtable
            port:
              number: 80