Skip to content

Commit 4dae1ba

Browse files
authored
Merge pull request #743 from kitsudaiki/fix/fix-kubernetes-setup
related issue: #731
2 parents c9b7346 + 2cc690c commit 4dae1ba

37 files changed

Lines changed: 549 additions & 143 deletions

.github/workflows/build_test.yml

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ jobs:
680680

681681
docker_build:
682682
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' || github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
683-
name: "Build Docker-images"
683+
name: "Build"
684684
needs: [ sdk_api_tests, cli_api_tests ]
685685
runs-on: ubuntu-24.04
686686
strategy:
@@ -966,37 +966,12 @@ jobs:
966966
kubectl create namespace cert-manager
967967
helm install cert-manager jetstack/cert-manager --namespace cert-manager --set installCRDs=true
968968
-
969-
name: Install rancher-longhorn
969+
name: Create wireguard-configs
970970
run: |
971-
sudo apt-get update
972-
sudo apt-get install -y open-iscsi nfs-common
973-
sudo systemctl enable --now iscsid
974-
helm repo add longhorn https://charts.longhorn.io
975-
helm repo update
976-
kubectl create namespace longhorn-system
977-
helm install longhorn longhorn/longhorn --namespace longhorn-system --set defaultSettings.defaultDataPath="/mnt/longhorn"
978-
sleep 60
979-
cat <<EOF > longhorn-storageclass.yaml
980-
---
981-
982-
apiVersion: storage.k8s.io/v1
983-
kind: StorageClass
984-
metadata:
985-
name: longhorn
986-
provisioner: driver.longhorn.io
987-
parameters:
988-
numberOfReplicas: "1"
989-
staleReplicaTimeout: "30"
990-
volumeBindingMode: Immediate
991-
reclaimPolicy: Delete
992-
allowVolumeExpansion: true
993-
mountOptions: []
994-
parameters: {}
995-
996-
EOF
997-
cat longhorn-storageclass.yaml
998-
kubectl apply -f longhorn-storageclass.yaml
999-
sleep 15
971+
sudo apt-get install -y wireguard-tools
972+
pip3 install jinja2
973+
cd ${GITHUB_REPOSITORY#*/}/deploy/k8s
974+
python3 wg_gen.py
1000975
-
1001976
name: Label nodes
1002977
run: |
@@ -1006,6 +981,7 @@ jobs:
1006981
kubectl label nodes --all sakura-node=true
1007982
kubectl label nodes --all torii-node=true
1008983
kubectl label nodes --all omamori-node=true
984+
kubectl label nodes --all onsen-node=true
1009985
-
1010986
name: Install hanami
1011987
run: |

.secrets.baseline

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,15 @@
193193
"line_number": 72
194194
}
195195
],
196+
"deploy/k8s/ainari/templates/onsen/onsen-deployment.yaml": [
197+
{
198+
"type": "Secret Keyword",
199+
"filename": "deploy/k8s/ainari/templates/onsen/onsen-deployment.yaml",
200+
"hashed_secret": "a191d9cb43e3f682b350dcdc74b2167ff78ed3b4",
201+
"is_verified": false,
202+
"line_number": 70
203+
}
204+
],
196205
"deploy/k8s/ainari/templates/ryokan/ryokan-certificate.yaml": [
197206
{
198207
"type": "Secret Keyword",
@@ -208,7 +217,14 @@
208217
"filename": "deploy/k8s/ainari/templates/ryokan/ryokan-deployment.yaml",
209218
"hashed_secret": "04f5ffaec2d0437e26b1e224de6915e15247989f",
210219
"is_verified": false,
211-
"line_number": 74
220+
"line_number": 84
221+
},
222+
{
223+
"type": "Secret Keyword",
224+
"filename": "deploy/k8s/ainari/templates/ryokan/ryokan-deployment.yaml",
225+
"hashed_secret": "8ecbfb09891f75ade7c286346fe355113e680af7",
226+
"is_verified": false,
227+
"line_number": 90
212228
}
213229
],
214230
"deploy/k8s/ainari/templates/sakura/sakura-certificate.yaml": [
@@ -226,7 +242,14 @@
226242
"filename": "deploy/k8s/ainari/templates/sakura/sakura-deployment.yaml",
227243
"hashed_secret": "1db3a3e51c405b71091fd7885f714805187b5785",
228244
"is_verified": false,
229-
"line_number": 74
245+
"line_number": 80
246+
},
247+
{
248+
"type": "Secret Keyword",
249+
"filename": "deploy/k8s/ainari/templates/sakura/sakura-deployment.yaml",
250+
"hashed_secret": "845e1c68668309b563d8a17950b9529de8b3616e",
251+
"is_verified": false,
252+
"line_number": 86
230253
}
231254
],
232255
"deploy/k8s/ainari/templates/torii/torii-certificate.yaml": [
@@ -253,7 +276,30 @@
253276
"filename": "deploy/k8s/ainari/values.yaml",
254277
"hashed_secret": "9139236dfe89960fee34d53b6089795fe376682e",
255278
"is_verified": false,
256-
"line_number": 24
279+
"line_number": 25
280+
}
281+
],
282+
"deploy/k8s/wg_gen.py": [
283+
{
284+
"type": "Secret Keyword",
285+
"filename": "deploy/k8s/wg_gen.py",
286+
"hashed_secret": "a191d9cb43e3f682b350dcdc74b2167ff78ed3b4",
287+
"is_verified": false,
288+
"line_number": 36
289+
},
290+
{
291+
"type": "Secret Keyword",
292+
"filename": "deploy/k8s/wg_gen.py",
293+
"hashed_secret": "8ecbfb09891f75ade7c286346fe355113e680af7",
294+
"is_verified": false,
295+
"line_number": 41
296+
},
297+
{
298+
"type": "Secret Keyword",
299+
"filename": "deploy/k8s/wg_gen.py",
300+
"hashed_secret": "845e1c68668309b563d8a17950b9529de8b3616e",
301+
"is_verified": false,
302+
"line_number": 42
257303
}
258304
],
259305
"example_configs/ainari/hanami.toml": [
@@ -305,7 +351,7 @@
305351
"filename": "example_configs/ainari/ryokan.toml",
306352
"hashed_secret": "3da541559918a808c2402bba5012f6c60b27661c",
307353
"is_verified": false,
308-
"line_number": 19
354+
"line_number": 18
309355
}
310356
],
311357
"example_configs/ainari/sakura.toml": [
@@ -352,5 +398,5 @@
352398
}
353399
]
354400
},
355-
"generated_at": "2025-11-17T21:27:15Z"
401+
"generated_at": "2025-11-19T11:52:41Z"
356402
}

deploy/k8s/ainari/templates/hanami/hanami-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ data:
1818
file_path = "/etc/ainari/hanami/hanami_db"
1919
2020
[miko]
21-
address = "https://miko-tls-service.default.svc.cluster.local"
22-
port = 8443
21+
address = "https://miko-tls-service.default.svc.cluster.local:8443"
2322
2423
[sakura]
2524
registation_key = "{{ .Values.hanami.registation_key }}"

deploy/k8s/ainari/templates/hanami/hanami-pvc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
spec:
66
accessModes:
77
- ReadWriteOnce
8-
storageClassName: hanami-sc
8+
storageClassName: {{ .Values.storage.storage_class }}
99
resources:
1010
requests:
1111
storage: 100Mi

deploy/k8s/ainari/templates/miko/miko-config.yaml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,19 @@ data:
2121
file_path = "/etc/ainari/miko/miko_db"
2222
2323
[endpoints.hanami]
24-
public_address = "https://local-hanami"
25-
public_port = 443
26-
internal_address = "https://hanami-tls-service.default.svc.cluster.local"
27-
internal_port = 8443
24+
public_address = "https://local-hanami:443"
25+
internal_address = "https://hanami-tls-service.default.svc.cluster.local:8443"
2826
2927
[endpoints.ryokan]
30-
public_address = "https://local-ryokan"
31-
public_port = 443
32-
internal_address = "https://ryokan-tls-service.default.svc.cluster.local"
33-
internal_port = 8443
28+
public_address = "https://local-ryokan:443"
29+
internal_address = "https://ryokan-tls-service.default.svc.cluster.local:8443"
3430
3531
[endpoints.torii]
36-
public_address = "https://local-torii"
37-
public_port = 443
38-
internal_address = "https://torii-tls-service.default.svc.cluster.local"
39-
internal_port = 8443
32+
public_address = "https://local-torii:443"
33+
internal_address = "https://torii-tls-service.default.svc.cluster.local:8443"
4034
4135
[endpoints.omamori]
42-
public_address = "https://local-omamori"
43-
public_port = 443
44-
internal_address = "https://omamori-tls-service.default.svc.cluster.local"
45-
internal_port = 8443
36+
public_address = "https://local-omamori:443"
37+
internal_address = "https://omamori-tls-service.default.svc.cluster.local:8443"
4638
4739
kind: ConfigMap

deploy/k8s/ainari/templates/miko/miko-pvc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
spec:
66
accessModes:
77
- ReadWriteOnce
8-
storageClassName: miko-sc
8+
storageClassName: {{ .Values.storage.storage_class }}
99
resources:
1010
requests:
1111
storage: 100Mi

deploy/k8s/ainari/templates/omamori/omamori-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ data:
1818
file_path = "/etc/ainari/omamori/omamori_db"
1919
2020
[miko]
21-
address = "https://miko-tls-service.default.svc.cluster.local"
22-
port = 8443
21+
address = "https://miko-tls-service.default.svc.cluster.local:8443"
2322
2423
[simple_crypto]
2524
key_b64 = "q9vN4CjOQm5wKzyzjZtS7t4oQp8oQK1JvU5xgq8vFzE="

deploy/k8s/ainari/templates/omamori/omamori-pvc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
spec:
66
accessModes:
77
- ReadWriteOnce
8-
storageClassName: omamori-sc
8+
storageClassName: {{ .Values.storage.storage_class }}
99
resources:
1010
requests:
1111
storage: 100Mi
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: v1
2+
metadata:
3+
name: onsen-config
4+
data:
5+
onsen.toml: |+
6+
debug = true
7+
log_path = ""
8+
insecure_clients = true
9+
address = "http://10.10.0.1:50051"
10+
11+
[storage]
12+
dataset_location = "/etc/ainari/onsen_data/datasets"
13+
checkpoint_location = "/etc/ainari/onsen_data/checkpoints"
14+
tempfile_location = "/etc/ainari/onsen_data/tempfiles"
15+
16+
[api]
17+
public_ip = "127.0.0.1"
18+
public_port = 11416
19+
internal_ip = "127.0.0.1"
20+
internal_port = 10416
21+
internal_api_key = "{{ .Values.api.internal_api_key }}"
22+
23+
[miko]
24+
address = "https://miko-tls-service.default.svc.cluster.local:8443"
25+
26+
[ryokan]
27+
registation_key = "test-registration-key"
28+
29+
kind: ConfigMap
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: onsen
5+
labels:
6+
app: onsen
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: onsen
12+
template:
13+
metadata:
14+
labels:
15+
app: onsen
16+
spec:
17+
affinity:
18+
nodeAffinity:
19+
requiredDuringSchedulingIgnoredDuringExecution:
20+
nodeSelectorTerms:
21+
- matchExpressions:
22+
- key: onsen-node
23+
operator: In
24+
values:
25+
- "true"
26+
podAntiAffinity:
27+
requiredDuringSchedulingIgnoredDuringExecution:
28+
- labelSelector:
29+
matchExpressions:
30+
- key: app
31+
operator: In
32+
values:
33+
- onsen
34+
topologyKey: kubernetes.io/hostname
35+
containers:
36+
- name: onsen
37+
image: {{ .Values.docker.registry }}/onsen:{{ .Values.docker.tag }}
38+
imagePullPolicy: Always
39+
env:
40+
- name: RUST_LOG
41+
value: "debug,h2=info"
42+
ports:
43+
- containerPort: 50051
44+
name: grpc
45+
volumeMounts:
46+
- name: data-volume
47+
mountPath: /etc/ainari/onsen/
48+
- name: onsen-config
49+
mountPath: /etc/ainari/onsen.toml
50+
subPath: onsen.toml
51+
readOnly: true
52+
- name: wg-secret
53+
mountPath: /etc/wireguard
54+
readOnly: true
55+
securityContext:
56+
capabilities:
57+
add:
58+
- NET_ADMIN
59+
- SYS_MODULE
60+
61+
volumes:
62+
- name: onsen-config
63+
configMap:
64+
name: onsen-config
65+
- name: data-volume
66+
persistentVolumeClaim:
67+
claimName: onsen-pvc
68+
- name: wg-secret
69+
secret:
70+
secretName: wg-onsen-secret

0 commit comments

Comments
 (0)