diff --git a/k8s/ci-deployer.yaml b/k8s/ci-deployer.yaml deleted file mode 100644 index 5a38e4a..0000000 --- a/k8s/ci-deployer.yaml +++ /dev/null @@ -1,49 +0,0 @@ -# Bootstrap once with an administrator identity. CI can update only the -# existing 30-birthday Deployment and cannot access Kubernetes Secrets. -apiVersion: v1 -kind: ServiceAccount -metadata: - name: 30-birthday-deployer - namespace: default -automountServiceAccountToken: false ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: 30-birthday-deployer - namespace: default -rules: - - apiGroups: - - apps - resources: - - deployments - resourceNames: - - 30-birthday - verbs: - - get - - patch - - update - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: 30-birthday-deployer - namespace: default -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: 30-birthday-deployer -subjects: - - kind: ServiceAccount - name: 30-birthday-deployer - namespace: default ---- -apiVersion: v1 -kind: Secret -metadata: - name: 30-birthday-deployer-token - namespace: default - annotations: - kubernetes.io/service-account.name: 30-birthday-deployer -type: kubernetes.io/service-account-token diff --git a/k8s/create-ci-kubeconfig.sh b/k8s/create-ci-kubeconfig.sh deleted file mode 100755 index 3af53d6..0000000 --- a/k8s/create-ci-kubeconfig.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -namespace=default -secret=30-birthday-deployer-token -workdir=$(mktemp --directory) -trap 'rm -rf "${workdir}"' EXIT - -server=$(kubectl config view --minify --output 'jsonpath={.clusters[0].cluster.server}') -kubectl --namespace "${namespace}" get secret "${secret}" --output 'jsonpath={.data.ca\.crt}' \ - | base64 --decode > "${workdir}/ca.crt" -token=$(kubectl --namespace "${namespace}" get secret "${secret}" --output 'jsonpath={.data.token}' \ - | base64 --decode) - -export KUBECONFIG="${workdir}/config" -kubectl config set-cluster cluster --server "${server}" --certificate-authority "${workdir}/ca.crt" --embed-certs=true \ - > /dev/null -kubectl config set-credentials 30-birthday-deployer --token "${token}" > /dev/null -kubectl config set-context 30-birthday --cluster cluster --user 30-birthday-deployer --namespace "${namespace}" \ - > /dev/null -kubectl config use-context 30-birthday > /dev/null - -base64 --wrap=0 "${KUBECONFIG}" -printf '\n' diff --git a/k8s/invitation.yaml b/k8s/invitation.yaml deleted file mode 100644 index 644aa4a..0000000 --- a/k8s/invitation.yaml +++ /dev/null @@ -1,171 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: 30-birthday-data - namespace: default -spec: - accessModes: - - ReadWriteOnce - storageClassName: rook-ceph-block - resources: - requests: - storage: 128Mi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: 30-birthday - namespace: default -spec: - replicas: 1 - strategy: - type: Recreate - selector: - matchLabels: - app: 30-birthday - template: - metadata: - labels: - app: 30-birthday - spec: - automountServiceAccountToken: false - securityContext: - fsGroup: 65532 - fsGroupChangePolicy: OnRootMismatch - containers: - - name: 30-birthday - image: registry.brunner.ninja/feedc0de/30-birthday:latest - imagePullPolicy: Always - env: - - name: ORIGIN - value: https://30.brunner.ninja - - name: DATABASE_FILE - value: /data/invites.db - - name: TRUST_AUTHENTIK - value: "true" - - name: INVITATION_PDF - value: /private/Einladung.pdf - - name: INVITATION_IMAGE - value: /private/einladung.jpg - ports: - - name: http - containerPort: 3000 - volumeMounts: - - name: data - mountPath: /data - - name: invitation - mountPath: /private - readOnly: true - readinessProbe: - httpGet: - path: /health - port: http - initialDelaySeconds: 2 - periodSeconds: 5 - livenessProbe: - httpGet: - path: /health - port: http - initialDelaySeconds: 10 - periodSeconds: 15 - resources: - requests: - cpu: 10m - memory: 32Mi - ephemeral-storage: 32Mi - limits: - cpu: 250m - memory: 192Mi - ephemeral-storage: 128Mi - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - readOnlyRootFilesystem: true - runAsNonRoot: true - runAsUser: 65532 - runAsGroup: 65532 - volumes: - - name: data - persistentVolumeClaim: - claimName: 30-birthday-data - - name: invitation - secret: - secretName: 30-birthday-invitation ---- -apiVersion: v1 -kind: Service -metadata: - name: 30-birthday - namespace: default -spec: - selector: - app: 30-birthday - ports: - - name: http - port: 80 - protocol: TCP - targetPort: http ---- -# Guest pages, invitation assets, and guest RSVP APIs stay public. -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: 30-birthday-public - namespace: default - annotations: - traefik.ingress.kubernetes.io/router.entrypoints: websecure - traefik.ingress.kubernetes.io/router.priority: "10" -spec: - ingressClassName: traefik - tls: - - hosts: - - 30.brunner.ninja - secretName: brunner-ninja-tls - rules: - - host: 30.brunner.ninja - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: 30-birthday - port: - name: http ---- -# Longer admin prefixes win over the public catch-all and require Authentik. -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: 30-birthday-admin - namespace: default - annotations: - traefik.ingress.kubernetes.io/router.entrypoints: websecure - traefik.ingress.kubernetes.io/router.middlewares: default-authentik@kubernetescrd - traefik.ingress.kubernetes.io/router.priority: "100" -spec: - ingressClassName: traefik - tls: - - hosts: - - 30.brunner.ninja - secretName: brunner-ninja-tls - rules: - - host: 30.brunner.ninja - http: - paths: - - path: /admin - pathType: Prefix - backend: - service: - name: 30-birthday - port: - name: http - - path: /api/admin/ - pathType: Prefix - backend: - service: - name: 30-birthday - port: - name: http