diff --git a/k8s/spoolman/database.yaml b/k8s/spoolman/database.yaml new file mode 100644 index 0000000..3916236 --- /dev/null +++ b/k8s/spoolman/database.yaml @@ -0,0 +1,20 @@ +apiVersion: "acid.zalan.do/v1" +kind: postgresql +metadata: + name: spoolman-database +spec: + teamId: spoolman + volume: + size: 10Gi + numberOfInstances: 2 + users: + superuser: + - superuser + - createdb + spoolman: [] + databases: + spoolman: spoolman + preparedDatabases: + spoolman: {} + postgresql: + version: "16" diff --git a/k8s/spoolman/deployment.yaml b/k8s/spoolman/deployment.yaml new file mode 100644 index 0000000..ec7e554 --- /dev/null +++ b/k8s/spoolman/deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: spoolman +spec: + selector: + matchLabels: + app: spoolman + template: + metadata: + labels: + app: spoolman + spec: + containers: + - name: spoolman + image: ghcr.io/donkie/spoolman + resources: + limits: + memory: "128Mi" + cpu: "500m" + env: + - name: SPOOLMAN_PORT + value: "8080" + - name: SPOOLMAN_DB_TYPE + value: postgres + - name: SPOOLMAN_DB_HOST + value: spoolman-database + - name: SPOOLMAN_DB_PORT + value: "5432" + - name: SPOOLMAN_DB_NAME + value: spoolman + - name: SPOOLMAN_DB_USERNAME + valueFrom: + secretKeyRef: + name: spoolman.spoolman-database.credentials.postgresql.acid.zalan.do + key: username + - name: SPOOLMAN_DB_PASSWORD + valueFrom: + secretKeyRef: + name: spoolman.spoolman-database.credentials.postgresql.acid.zalan.do + key: password + - name: SPOOLMAN_METRICS_ENABLED + value: "TRUE" + ports: + - containerPort: 8080 + name: http diff --git a/k8s/spoolman/ingress.yaml b/k8s/spoolman/ingress.yaml new file mode 100644 index 0000000..7b9313a --- /dev/null +++ b/k8s/spoolman/ingress.yaml @@ -0,0 +1,32 @@ +apiVersion: v1 +kind: Service +metadata: + name: spoolman +spec: + selector: + app: spoolman + ports: + - port: 8080 + name: http +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: spoolman + labels: + name: spoolman + annotations: + traefik.ingress.kubernetes.io/router.middlewares: kube-system-traefik-forward-auth@kubernetescrd +spec: + rules: + - host: spoolman.k8s.home.finn.io + http: + paths: + - pathType: Prefix + path: "/" + backend: + service: + name: spoolman + port: + number: 8080 + diff --git a/k8s/spoolman/kustomization.yaml b/k8s/spoolman/kustomization.yaml new file mode 100644 index 0000000..47128a6 --- /dev/null +++ b/k8s/spoolman/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: spoolman +resources: + - namespace.yaml + - database.yaml + - deployment.yaml + - ingress.yaml diff --git a/k8s/spoolman/namespace.yaml b/k8s/spoolman/namespace.yaml new file mode 100644 index 0000000..875474e --- /dev/null +++ b/k8s/spoolman/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: spoolman