Compare commits

..

11 Commits

Author SHA1 Message Date
Gitea Actions Bot 149666dde9 Auto-update README with current k8s applications
Keycloak Terraform / Terraform (pull_request) Successful in 17s
Generated by CI/CD workflow on 2026-07-02 13:58:41

This PR updates the README.md file with the current list of applications found in the k8s/ directory structure.
2026-07-02 13:58:41 +00:00
ab 4d98223004 Migrated awg
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 2m30s
Check with kubeconform / lint (push) Successful in 7s
Auto-update README / Generate README and Create MR (push) Successful in 5s
2026-07-02 16:55:48 +03:00
ab fdd79fcff3 Migrated awg
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 6s
Check with kubeconform / lint (push) Successful in 7s
Auto-update README / Generate README and Create MR (push) Successful in 5s
2026-07-02 16:39:08 +03:00
Ultradesu 04044b32e0 AWG: Added migration
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 6s
Check with kubeconform / lint (push) Successful in 6s
Auto-update README / Generate README and Create MR (push) Successful in 6s
2026-07-01 13:43:17 +03:00
Ultradesu aa4c9dce08 Added amnezia-fellow DB user
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 7s
Check with kubeconform / lint (push) Successful in 6s
Auto-update README / Generate README and Create MR (push) Successful in 5s
2026-07-01 13:09:46 +03:00
Ultradesu c31ca20fb0 Fix amnezia exporter's config
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 6s
Check with kubeconform / lint (push) Successful in 7s
Auto-update README / Generate README and Create MR (push) Successful in 4s
2026-06-30 14:00:07 +03:00
Ultradesu b42ba8d68f Added config reload
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 2m33s
Check with kubeconform / lint (push) Successful in 7s
Auto-update README / Generate README and Create MR (push) Successful in 5s
2026-06-29 21:08:54 +03:00
Ultradesu f8c69c2434 Added config reload
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 58s
Check with kubeconform / lint (push) Successful in 7s
Auto-update README / Generate README and Create MR (push) Successful in 5s
2026-06-29 21:00:55 +03:00
Ultradesu 67104123a5 Added amnezia exporter
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 8s
Check with kubeconform / lint (push) Successful in 7s
Auto-update README / Generate README and Create MR (push) Successful in 11s
2026-06-29 20:46:16 +03:00
ab 976ea1fbe1 Update terraform/keycloak/terraform.tfvars
Keycloak Terraform / Terraform (push) Failing after 3m2s
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 6s
2026-06-29 14:07:10 +00:00
ab 7cfcfac94c Update terraform/keycloak/terraform.tfvars
Keycloak Terraform / Terraform (push) Successful in 18s
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 5s
2026-06-29 14:03:55 +00:00
11 changed files with 438 additions and 18 deletions
+159 -7
View File
@@ -126,8 +126,11 @@ data:
set -euo pipefail
SERVER_CONFIG="/etc/amnezia/server/awg0.conf"
CLIENTS_DIR="/etc/amnezia/clients"
CLIENTS_DIR="${AMNEZIAWG_CLIENTS_DIR:-/run/amnezia/clients}"
RUNTIME_CONFIG="/run/amnezia/awg0.conf"
SYNC_CONFIG="/run/amnezia/awg0.sync.conf"
STATUS_FILE="/run/amnezia/reload-status"
RELOAD_INTERVAL="${AMNEZIAWG_RELOAD_INTERVAL:-10}"
cleanup() {
if awg show awg0 >/dev/null 2>&1; then
@@ -137,32 +140,181 @@ data:
render_config() {
mkdir -p "$(dirname "${RUNTIME_CONFIG}")"
cp "${SERVER_CONFIG}" "${RUNTIME_CONFIG}"
chmod 0600 "${RUNTIME_CONFIG}"
local tmp_config="${RUNTIME_CONFIG}.tmp"
cp "${SERVER_CONFIG}" "${tmp_config}"
chmod 0600 "${tmp_config}"
local clients_found=0
for client_config in "${CLIENTS_DIR}"/*; do
[ -f "${client_config}" ] || continue
[ -s "${client_config}" ] || continue
printf '\n' >> "${RUNTIME_CONFIG}"
cat "${client_config}" >> "${RUNTIME_CONFIG}"
printf '\n' >> "${tmp_config}"
cat "${client_config}" >> "${tmp_config}"
clients_found=1
done
if [ "${clients_found}" = "0" ]; then
echo "No client peer configs found in ${CLIENTS_DIR}; starting without peers"
fi
mv "${tmp_config}" "${RUNTIME_CONFIG}"
chmod 0600 "${RUNTIME_CONFIG}"
}
client_config_hash() {
{
for client_config in "${CLIENTS_DIR}"/*; do
[ -f "${client_config}" ] || continue
sha256sum "${client_config}"
done
} | sha256sum | awk '{print $1}'
}
write_reload_status() {
local state="${1}"
local hash="${2:-}"
local applied_at_ms=""
if [ "${state}" = "applied" ]; then
applied_at_ms="$(($(date +%s) * 1000))"
fi
mkdir -p "$(dirname "${STATUS_FILE}")"
{
printf 'state=%s\n' "${state}"
printf 'hash=%s\n' "${hash}"
printf 'applied_at_ms=%s\n' "${applied_at_ms}"
} > "${STATUS_FILE}.tmp"
mv "${STATUS_FILE}.tmp" "${STATUS_FILE}"
}
apply_live_config() {
render_config
awg-quick strip "${RUNTIME_CONFIG}" > "${SYNC_CONFIG}"
chmod 0600 "${SYNC_CONFIG}"
awg syncconf awg0 "${SYNC_CONFIG}"
}
watch_client_config() {
local last_hash="${1}"
while true; do
sleep "${RELOAD_INTERVAL}" &
wait "$!" || return 0
local current_hash
current_hash="$(client_config_hash)"
if [ "${current_hash}" = "${last_hash}" ]; then
continue
fi
echo "Detected AmneziaWG client peer config change; applying with awg syncconf"
if apply_live_config; then
last_hash="${current_hash}"
write_reload_status applied "${current_hash}"
awg show awg0 || true
else
echo "ERROR: failed to hot-reload AmneziaWG client peer config" >&2
write_reload_status error "${current_hash}"
fi
done
}
trap cleanup EXIT
trap 'exit 0' TERM INT
initial_hash="$(client_config_hash)"
render_config
cleanup
awg-quick up "${RUNTIME_CONFIG}"
awg show awg0 || true
write_reload_status applied "${initial_hash}"
watch_client_config "${initial_hash}"
client-secret-sync.sh: |
#!/usr/bin/env bash
set -euo pipefail
CLIENT_SECRET="${AMNEZIAWG_CLIENT_SECRET:-amneziawg-clients}"
CLIENT_SECRET_KEY="${AMNEZIAWG_CLIENT_SECRET_KEY:-peers.conf}"
CLIENTS_DIR="${AMNEZIAWG_CLIENTS_DIR:-/run/amnezia/clients}"
PEERS_FILE="${CLIENTS_DIR}/peers.conf"
SYNC_INTERVAL="${AMNEZIAWG_CLIENT_SECRET_SYNC_INTERVAL:-5}"
NAMESPACE="${POD_NAMESPACE:-$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)}"
write_empty_once() {
mkdir -p "${CLIENTS_DIR}"
if [ ! -f "${PEERS_FILE}" ]; then
: > "${PEERS_FILE}"
chmod 0600 "${PEERS_FILE}"
fi
}
sync_once() {
mkdir -p "${CLIENTS_DIR}"
local tmp_file="${PEERS_FILE}.tmp"
local encoded=""
if ! encoded="$(kubectl get secret "${CLIENT_SECRET}" -n "${NAMESPACE}" -o "go-template={{ index .data \"${CLIENT_SECRET_KEY}\" }}" 2>/dev/null)"; then
echo "WARN: failed to read Secret ${NAMESPACE}/${CLIENT_SECRET}; keeping current peers" >&2
write_empty_once
return 0
fi
if [ -n "${encoded}" ]; then
printf '%s' "${encoded}" | base64 -d > "${tmp_file}"
else
: > "${tmp_file}"
fi
chmod 0600 "${tmp_file}"
if [ -f "${PEERS_FILE}" ] && cmp -s "${tmp_file}" "${PEERS_FILE}"; then
rm -f "${tmp_file}"
return 0
fi
mv "${tmp_file}" "${PEERS_FILE}"
echo "Synced AmneziaWG client peers from Secret ${NAMESPACE}/${CLIENT_SECRET}:${CLIENT_SECRET_KEY}"
}
if [ "${1:-}" = "once" ]; then
sync_once
exit 0
fi
while true; do
sleep 3600 &
wait "$!"
sync_once || true
sleep "${SYNC_INTERVAL}"
done
status-patch.sh: |
#!/usr/bin/env bash
set -euo pipefail
STATUS_FILE="/run/amnezia/reload-status"
PATCH_INTERVAL="${AMNEZIAWG_STATUS_PATCH_INTERVAL:-5}"
NAMESPACE="${POD_NAMESPACE:-$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)}"
: "${POD_NAME:?POD_NAME is required}"
last_file_hash=""
patch_status() {
local state="unknown"
local hash=""
local applied_at_ms=""
# The file is generated by run.sh and contains only shell assignments.
# shellcheck disable=SC1090
source "${STATUS_FILE}"
kubectl patch pod "${POD_NAME}" -n "${NAMESPACE}" --type merge -p "{\"metadata\":{\"annotations\":{\"amnezia-fellow.hexor.cy/client-secret-reload-status\":\"${state}\",\"amnezia-fellow.hexor.cy/client-secret-applied-at-ms\":\"${applied_at_ms}\",\"amnezia-fellow.hexor.cy/client-secret-applied-hash\":\"${hash}\"}}}"
}
while true; do
if [ -f "${STATUS_FILE}" ]; then
file_hash="$(sha256sum "${STATUS_FILE}" | awk '{print $1}')"
if [ "${file_hash}" != "${last_file_hash}" ]; then
patch_status || true
last_file_hash="${file_hash}"
fi
fi
sleep "${PATCH_INTERVAL}"
done
+147 -10
View File
@@ -6,8 +6,9 @@ metadata:
labels:
app: amneziawg
annotations:
reloader.stakater.com/auto: "true"
secret.reloader.stakater.com/reload: "amneziawg-server,amneziawg-clients"
reloader.stakater.com/auto: "false"
secret.reloader.stakater.com/reload: "amneziawg-server"
configmap.reloader.stakater.com/reload: "amneziawg-scripts,amneziawg-exporter-redis"
spec:
selector:
matchLabels:
@@ -27,6 +28,21 @@ spec:
tolerations:
- operator: Exists
initContainers:
- name: install-awg
image: amneziavpn/amneziawg-go:latest
imagePullPolicy: IfNotPresent
command:
- /bin/bash
- -lc
- |
set -euo pipefail
cp /usr/bin/awg /shared-bin/awg
cp /lib/ld-musl-x86_64.so.1 /shared-bin/ld-musl-x86_64.so.1
cp /lib/ld-musl-x86_64.so.1 /shared-bin/libc.musl-x86_64.so.1
chmod 0755 /shared-bin/awg /shared-bin/ld-musl-x86_64.so.1 /shared-bin/libc.musl-x86_64.so.1
volumeMounts:
- name: awg-bin
mountPath: /shared-bin
- name: register-endpoint
image: bitnami/kubectl:latest
imagePullPolicy: IfNotPresent
@@ -65,6 +81,26 @@ spec:
kubectl create secret generic amneziawg-endpoints -n "${NAMESPACE}" \
--from-literal="${NODE_NAME}=${VALUE}"
fi
- name: sync-client-secret
image: bitnami/kubectl:latest
imagePullPolicy: IfNotPresent
command:
- /bin/bash
- /scripts/client-secret-sync.sh
- once
resources:
requests:
memory: "32Mi"
cpu: "10m"
limits:
memory: "128Mi"
cpu: "100m"
volumeMounts:
- name: scripts
mountPath: /scripts
readOnly: true
- name: runtime-config
mountPath: /run/amnezia
containers:
- name: amneziawg
image: amneziavpn/amneziawg-go:latest
@@ -113,9 +149,6 @@ spec:
- name: server-config
mountPath: /etc/amnezia/server
readOnly: true
- name: client-config
mountPath: /etc/amnezia/clients
readOnly: true
- name: scripts
mountPath: /scripts
readOnly: true
@@ -123,6 +156,108 @@ spec:
mountPath: /run/amnezia
- name: dev-net-tun
mountPath: /dev/net/tun
- name: reload-status
image: bitnami/kubectl:latest
imagePullPolicy: IfNotPresent
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
command:
- /bin/bash
- /scripts/status-patch.sh
resources:
requests:
memory: "32Mi"
cpu: "10m"
limits:
memory: "128Mi"
cpu: "100m"
volumeMounts:
- name: scripts
mountPath: /scripts
readOnly: true
- name: runtime-config
mountPath: /run/amnezia
- name: client-secret-sync
image: bitnami/kubectl:latest
imagePullPolicy: IfNotPresent
command:
- /bin/bash
- /scripts/client-secret-sync.sh
resources:
requests:
memory: "32Mi"
cpu: "10m"
limits:
memory: "128Mi"
cpu: "100m"
volumeMounts:
- name: scripts
mountPath: /scripts
readOnly: true
- name: runtime-config
mountPath: /run/amnezia
- name: amneziawg-exporter-redis
image: redis:alpine
imagePullPolicy: IfNotPresent
command:
- redis-server
- /etc/redis/redis.conf
ports:
- name: redis
containerPort: 6379
protocol: TCP
resources:
requests:
memory: "32Mi"
cpu: "10m"
limits:
memory: "128Mi"
cpu: "100m"
volumeMounts:
- name: exporter-redis-config
mountPath: /etc/redis
readOnly: true
- name: exporter-redis-data
mountPath: /data
- name: amneziawg-exporter
image: amneziavpn/amneziawg-exporter:latest
imagePullPolicy: IfNotPresent
securityContext:
capabilities:
add:
- NET_ADMIN
env:
- name: AWG_EXPORTER_REDIS_HOST
value: "127.0.0.1"
- name: AWG_EXPORTER_REDIS_PORT
value: "6379"
ports:
- name: metrics
containerPort: 9351
protocol: TCP
resources:
requests:
memory: "64Mi"
cpu: "25m"
limits:
memory: "256Mi"
cpu: "200m"
volumeMounts:
- name: awg-bin
mountPath: /usr/bin/awg
subPath: awg
readOnly: true
- name: awg-bin
mountPath: /lib/ld-musl-x86_64.so.1
subPath: ld-musl-x86_64.so.1
readOnly: true
- name: awg-bin
mountPath: /lib/libc.musl-x86_64.so.1
subPath: libc.musl-x86_64.so.1
readOnly: true
volumes:
- name: server-config
secret:
@@ -131,17 +266,19 @@ spec:
items:
- key: awg0.conf
path: awg0.conf
- name: client-config
secret:
secretName: amneziawg-clients
optional: true
defaultMode: 0600
- name: scripts
configMap:
name: amneziawg-scripts
defaultMode: 0755
- name: runtime-config
emptyDir: {}
- name: awg-bin
emptyDir: {}
- name: exporter-redis-config
configMap:
name: amneziawg-exporter-redis
- name: exporter-redis-data
emptyDir: {}
- name: dev-net-tun
hostPath:
path: /dev/net/tun
@@ -0,0 +1,32 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: amneziawg-exporter-redis
labels:
app: amneziawg
component: exporter
data:
redis.conf: |
bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
pidfile /run/redis.pid
loglevel warning
logfile ""
databases 16
always-show-logo no
set-proc-title no
save ""
appendonly no
stop-writes-on-bgsave-error no
rdbcompression yes
rdbchecksum yes
dir /data
rename-command CONFIG ""
rename-command SAVE ""
rename-command BGSAVE ""
+17
View File
@@ -0,0 +1,17 @@
---
apiVersion: v1
kind: Service
metadata:
name: amneziawg-exporter
labels:
app: amneziawg
component: exporter
spec:
type: ClusterIP
selector:
app: amneziawg
ports:
- name: metrics
protocol: TCP
port: 9351
targetPort: 9351
+28
View File
@@ -48,3 +48,31 @@ spec:
remoteRef:
key: 3092dc7c-41dd-461a-9f7a-377727f47e93
property: fields[1].value
---
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: amnezia-fellow
spec:
target:
name: amnezia-fellow
deletionPolicy: Delete
template:
type: Opaque
data:
database-url: |-
postgresql://amnezia_fellow:{{ .amnezia_fellow }}@psql.psql.svc:5432/amnezia_fellow
postgres-password: |-
{{ .amnezia_fellow }}
data:
- secretKey: amnezia_fellow
sourceRef:
storeRef:
name: vaultwarden-login
kind: ClusterSecretStore
remoteRef:
conversionStrategy: Default
decodingStrategy: None
metadataPolicy: None
key: 2a9deb39-ef22-433e-a1be-df1555625e22
property: fields[19].value
+8 -1
View File
@@ -5,6 +5,8 @@ metadata:
name: amnezia-fellow
labels:
app: amnezia-fellow
annotations:
secret.reloader.stakater.com/reload: "amnezia-fellow"
spec:
replicas: 1
strategy:
@@ -31,7 +33,12 @@ spec:
protocol: TCP
env:
- name: AMNEZIA_FELLOW_DATABASE_URL
value: "sqlite:///data/amnezia-fellow.sqlite3?mode=rwc"
valueFrom:
secretKeyRef:
name: amnezia-fellow
key: database-url
- name: AMNEZIA_FELLOW_MIGRATE_SQLITE
value: "sqlite:///data/amnezia-fellow.sqlite3?mode=ro"
- name: AMNEZIA_FELLOW_K8S_NAMESPACE
value: "amnezia"
- name: AMNEZIA_FELLOW_K8S_CLIENTS_SECRET
+3
View File
@@ -12,4 +12,7 @@ resources:
- fellow-service.yaml
- fellow-ingress.yaml
- fellow-deployment.yaml
- exporter-redis-configmap.yaml
- exporter-service.yaml
- servicemonitor.yaml
- daemonset.yaml
+3
View File
@@ -42,6 +42,9 @@ rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "create", "patch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
+23
View File
@@ -0,0 +1,23 @@
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: amneziawg-exporter
labels:
app: amneziawg
component: exporter
release: prometheus
spec:
selector:
matchLabels:
app: amneziawg
component: exporter
endpoints:
- port: metrics
path: /metrics
interval: 30s
scrapeTimeout: 10s
honorLabels: true
namespaceSelector:
matchNames:
- amnezia
+13
View File
@@ -140,6 +140,8 @@ spec:
{{ .furumi_dev }}
USER_keycloak: |-
{{ .keycloak }}
USER_amnezia_fellow: |-
{{ .amnezia_fellow }}
data:
- secretKey: authentik
sourceRef:
@@ -339,3 +341,14 @@ spec:
metadataPolicy: None
key: 2a9deb39-ef22-433e-a1be-df1555625e22
property: fields[18].value
- secretKey: amnezia_fellow
sourceRef:
storeRef:
name: vaultwarden-login
kind: ClusterSecretStore
remoteRef:
conversionStrategy: Default
decodingStrategy: None
metadataPolicy: None
key: 2a9deb39-ef22-433e-a1be-df1555625e22
property: fields[19].value
+5
View File
@@ -95,4 +95,9 @@ oauth2_applications = {
web_origins = ["https://auth.matrix.hexor.cy"]
post_logout_redirect_uris = ["https://auth.matrix.hexor.cy/*"]
}
Amnezia-Fellow = {
redirect_uris = ["https://awg.hexor.cy/auth/oidc/callback"]
web_origins = ["https://awg.hexor.cy"]
post_logout_redirect_uris = ["https://awg.hexor.cy/*"]
}
}