Compare commits

..

8 Commits

Author SHA1 Message Date
unkinben b39ab9b4ea chore: enable access to gitea
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/kubeconform Pipeline was successful
- add gitea to gitea-dl remote
2026-06-06 19:44:50 +10:00
unkinben 4437ee9374 chore: add almalinux-vault repos (#186)
- 9.7 is end of life, ensure that we can still query packages

Reviewed-on: #186
2026-06-06 19:44:50 +10:00
unkinben a3a56d0c2b chore: add almalinux-vault repos (#186)
- 9.7 is end of life, ensure that we can still query packages

Reviewed-on: #186
2026-06-02 23:13:45 +10:00
unkinben 4b1fbe1fe1 feat(kanidm): scale down to single replica, remove replication (#185)
Drop from 3 replicas to 1. Remove init container, repl-certs secret,
replication port, podAntiAffinity, server-1/2 configs, and replication
stanza from server-0.toml. Mount configmap directly via subPath.

Reviewed-on: #185
2026-06-02 22:41:28 +10:00
unkinben 666f3d055c feat: add sessionaffinity to kanidm service (#184)
- required as traefik is in passthrough mode

Reviewed-on: #184
2026-06-02 21:17:51 +10:00
unkinben 3dc8801070 fix(kanidm): fix automatic_refresh TOML generation in init container (#182)
## Summary

- The `\n` escape in a shell variable wasn't interpreted as a newline when passed as a `printf %s` argument
- This caused `automatic_refresh = true` to be appended to the `partner_cert` string value on the same line, breaking TOML parsing on kanidm-2
- Fixed by using separate `printf` calls per peer type, with `\n` in the format string (not a variable) where it is correctly interpreted

## Test plan

- [ ] kanidm-2 init container generates valid TOML with `automatic_refresh = true` on its own line under the kanidm-0 peer section
- [ ] kanidm-1 and kanidm-2 start successfully and auto-refresh domain UUID from kanidm-0

Reviewed-on: #182
2026-05-31 00:25:21 +10:00
unkinben 60f1f3130b fix(kanidm): replicate 1/2 from 0 only with automatic_refresh (#181)
kanidm-0 is the authoritative supplier; kanidm-1 and kanidm-2 pull
from kanidm-0 only. automatic_refresh = true on the kanidm-0 peer
entry for kanidm-1/2 so fresh nodes auto-sync domain UUID on restart.

Reviewed-on: #181
2026-05-31 00:20:30 +10:00
unkinben b6f8cb0633 feat: autorestart statefulset (#180)
- ensure kanidm is restarted with vault secrets

Reviewed-on: #180
2026-05-30 23:40:07 +10:00
9 changed files with 31 additions and 100 deletions
@@ -81,6 +81,8 @@ remotes:
description: "Gitea download site" description: "Gitea download site"
immutable_patterns: immutable_patterns:
- "act_runner/.*/act_runner-.*-linux-amd64$" - "act_runner/.*/act_runner-.*-linux-amd64$"
- "gitea/.*/gitea-.*-linux-amd64$"
- "gitea/.*/gitea-.*-linux-amd64.xz$"
- "tea/.*/tea-.*-linux-amd64$" - "tea/.*/tea-.*-linux-amd64$"
cache: cache:
immutable_ttl: 0 immutable_ttl: 0
@@ -17,6 +17,24 @@ remotes:
immutable_ttl: 0 immutable_ttl: 0
mutable_ttl: 7200 mutable_ttl: 7200
almalinux-vault:
base_url: "https://vault.almalinux.org"
package: "rpm"
description: "AlmaLinux Vault RPM package repository"
immutable_patterns:
- ".*/x86_64/.*\\.rpm$"
- ".*/noarch/.*\\.rpm$"
- ".*/repodata/.*\\.sqlite.*$"
- ".*/repodata/.*\\.xml.*$"
- ".*/repodata/.*\\.yaml.*$"
- ".*/install.img"
- ".*/squashfs.img"
- ".*/updates.img"
- ".*/RPM-GPG-KEY-.*$"
cache:
immutable_ttl: 0
mutable_ttl: 7200
ceph-reef: ceph-reef:
base_url: "https://download.ceph.com/rpm-reef/" base_url: "https://download.ceph.com/rpm-reef/"
package: "rpm" package: "rpm"
-2
View File
@@ -25,5 +25,3 @@ configMapGenerator:
app.kubernetes.io/instance: kanidm app.kubernetes.io/instance: kanidm
files: files:
- server-0.toml=resources/server-0.toml - server-0.toml=resources/server-0.toml
- server-1.toml=resources/server-1.toml
- server-2.toml=resources/server-2.toml
-4
View File
@@ -13,7 +13,3 @@ log_level = "info"
path = "/data/backups/" path = "/data/backups/"
schedule = "0 22 * * *" schedule = "0 22 * * *"
versions = 7 versions = 7
[replication]
origin = "repl://kanidm-0.kanidm-headless.kanidm.svc.cluster.local:8444"
bindaddress = "[::]:8444"
-19
View File
@@ -1,19 +0,0 @@
version = "2"
domain = "auth.unkin.net"
origin = "https://auth.unkin.net"
bindaddress = "[::]:8443"
db_path = "/data/kanidm.db"
db_arc_size = 2048
tls_chain = "/data/tls/tls.crt"
tls_key = "/data/tls/tls.key"
log_level = "info"
[online_backup]
path = "/data/backups/"
schedule = "0 22 * * *"
versions = 7
[replication]
origin = "repl://kanidm-1.kanidm-headless.kanidm.svc.cluster.local:8444"
bindaddress = "[::]:8444"
-19
View File
@@ -1,19 +0,0 @@
version = "2"
domain = "auth.unkin.net"
origin = "https://auth.unkin.net"
bindaddress = "[::]:8443"
db_path = "/data/kanidm.db"
db_arc_size = 2048
tls_chain = "/data/tls/tls.crt"
tls_key = "/data/tls/tls.key"
log_level = "info"
[online_backup]
path = "/data/backups/"
schedule = "0 22 * * *"
versions = 7
[replication]
origin = "repl://kanidm-2.kanidm-headless.kanidm.svc.cluster.local:8444"
bindaddress = "[::]:8444"
+4 -4
View File
@@ -9,6 +9,10 @@ metadata:
app.kubernetes.io/instance: kanidm app.kubernetes.io/instance: kanidm
spec: spec:
type: ClusterIP type: ClusterIP
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
ports: ports:
- name: https - name: https
port: 8443 port: 8443
@@ -34,10 +38,6 @@ spec:
port: 8443 port: 8443
targetPort: https targetPort: https
protocol: TCP protocol: TCP
- name: replication
port: 8444
targetPort: replication
protocol: TCP
selector: selector:
app.kubernetes.io/name: kanidm app.kubernetes.io/name: kanidm
app.kubernetes.io/instance: kanidm app.kubernetes.io/instance: kanidm
+4 -52
View File
@@ -11,7 +11,7 @@ metadata:
app.kubernetes.io/instance: kanidm app.kubernetes.io/instance: kanidm
spec: spec:
serviceName: kanidm-headless serviceName: kanidm-headless
replicas: 3 replicas: 1
selector: selector:
matchLabels: matchLabels:
app.kubernetes.io/name: kanidm app.kubernetes.io/name: kanidm
@@ -23,52 +23,11 @@ spec:
app.kubernetes.io/instance: kanidm app.kubernetes.io/instance: kanidm
spec: spec:
serviceAccountName: kanidm serviceAccountName: kanidm
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app.kubernetes.io/name: kanidm
app.kubernetes.io/instance: kanidm
topologyKey: kubernetes.io/hostname
securityContext: securityContext:
runAsUser: 1000 runAsUser: 1000
runAsGroup: 1000 runAsGroup: 1000
runAsNonRoot: true runAsNonRoot: true
fsGroup: 1000 fsGroup: 1000
initContainers:
- name: config-init
image: busybox:1.36
command: ["/bin/sh", "-c"]
args:
- |
set -e
cp "/config-template/server-${POD_NAME##*-}.toml" /config/server.toml
for peer in kanidm-0 kanidm-1 kanidm-2; do
[ "${peer}" = "${POD_NAME}" ] && continue
cert_file="/repl-certs/${peer}"
[ -s "${cert_file}" ] || continue
fqdn="${peer}.kanidm-headless.kanidm.svc.cluster.local"
printf '\n[replication."repl://%s:8444"]\ntype = "mutual-pull"\npartner_cert = "%s"\n' \
"${fqdn}" "$(cat ${cert_file})" >> /config/server.toml
done
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: config-template
mountPath: /config-template
readOnly: true
- name: config
mountPath: /config
- name: repl-certs
mountPath: /repl-certs
readOnly: true
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
containers: containers:
- name: kanidm - name: kanidm
image: kanidm/server:1.10.3 image: kanidm/server:1.10.3
@@ -78,14 +37,12 @@ spec:
- name: https - name: https
containerPort: 8443 containerPort: 8443
protocol: TCP protocol: TCP
- name: replication
containerPort: 8444
protocol: TCP
volumeMounts: volumeMounts:
- name: data - name: data
mountPath: /data mountPath: /data
- name: config - name: config
mountPath: /config mountPath: /config/server.toml
subPath: server-0.toml
readOnly: true readOnly: true
- name: tls - name: tls
mountPath: /data/tls mountPath: /data/tls
@@ -111,14 +68,9 @@ spec:
initialDelaySeconds: 30 initialDelaySeconds: 30
periodSeconds: 30 periodSeconds: 30
volumes: volumes:
- name: config-template - name: config
configMap: configMap:
name: kanidm-config name: kanidm-config
- name: config
emptyDir: {}
- name: repl-certs
secret:
secretName: kanidm-repl-certs
- name: tls - name: tls
secret: secret:
secretName: kanidm-tls secretName: kanidm-tls
+3
View File
@@ -18,3 +18,6 @@ spec:
create: true create: true
overwrite: true overwrite: true
hmacSecretData: true hmacSecretData: true
rolloutRestartTargets:
- kind: StatefulSet
name: kanidm