Skip to content

Commit e1932ec

Browse files
committed
work on cache CI
1 parent 92cb732 commit e1932ec

2 files changed

Lines changed: 39 additions & 20 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,28 +99,43 @@ jobs:
9999
echo "=== Node pod logs ==="
100100
kubectl logs -l app.kubernetes.io/name=csi -n nix-csi --tail -1
101101
102-
- name: Debug on failure
102+
- name: Cluster state all
103103
if: failure()
104104
run: |
105-
echo "=== Cluster state ==="
106-
kubectl get all -A
105+
echo "=== Cluster state all ==="
106+
kubectl get all -A || true
107107
108-
echo "=== Cache pod logs ==="
109-
kubectl logs -l app.kubernetes.io/name=cache -n nix-csi --tail -1 || true
108+
- name: Cluster state configmaps
109+
if: failure()
110+
run: |
111+
echo "=== Cluster configmaps ==="
112+
kubectl get configmaps -A || true
113+
114+
- name: Cluster state secrets
115+
if: failure()
116+
run: |
117+
kubectl get secrets -A || true
110118
111-
echo "=== Cache pod describe ==="
119+
- name: Cache
120+
if: failure()
121+
run: |
122+
kubectl logs -l app.kubernetes.io/name=cache -n nix-csi --tail -1 || true
112123
kubectl describe pod -l app.kubernetes.io/name=cache-n nix-csi || true
113124
114-
echo "=== Node pod logs ==="
125+
- name: Node
126+
if: failure()
127+
run: |
115128
kubectl logs -l app.kubernetes.io/name=csi -n nix-csi --tail -1 || true
116-
117-
echo "=== Node pod describe ==="
118129
kubectl describe pod -l app.kubernetes.io/name=csi -n nix-csi || true
119130
120-
echo "=== Init pod logs ==="
131+
- name: Init
132+
if: failure()
133+
run: |
121134
kubectl logs -l app.kubernetes.io/name=init -n nix-csi --tail -1 || true
122135
123-
echo "=== Events ==="
136+
- name: Events
137+
if: failure()
138+
run: |
124139
kubectl get events -n nix-csi --sort-by='.lastTimestamp'
125140
126141
test-kind-nocache:

kubenix/secret.nix

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,34 @@ in
6161
};
6262
};
6363
ConfigMap.init-scripts = {
64-
data.init-secrets = # bash
64+
data.init-secrets = let
65+
kc = "kubectl -n ${cfg.namespace}";
66+
in
67+
# bash
6568
''
69+
set -x
6670
mkdir -p /tmp/{ssh-key,nix-key,ssh-auth}
67-
if ! kubectl get secret ssh-key &>/dev/null || ! kubectl get configmap ssh-dynauth &>/dev/null; then
71+
if ! ${kc} get secret ssh-key &>/dev/null || ! ${kc} get configmap ssh-dynauth &>/dev/null; then
6872
# Create ssh secret
6973
ssh-keygen -t ed25519 -C "" -N "" -f /tmp/ssh-key/id_ed25519
70-
kubectl delete --ignore-not-found secret ssh-key
71-
kubectl create secret generic ssh-key --from-file=/tmp/ssh-key
74+
${kc} delete --ignore-not-found secret ssh-key
75+
${kc} create secret generic ssh-key --from-file=/tmp/ssh-key
7276
7377
# Create pubkey configmap
7478
cp /tmp/ssh-key/id_ed25519.pub /tmp/ssh-auth/authorized_keys
7579
echo "* $(cat /tmp/ssh-key/id_ed25519.pub)" > /tmp/ssh-auth/ssh_known_hosts
76-
kubectl delete --ignore-not-found configmap ssh-dynauth
77-
kubectl create configmap ssh-dynauth --from-file=/tmp/ssh-auth
80+
${kc} delete --ignore-not-found configmap ssh-dynauth
81+
${kc} create configmap ssh-dynauth --from-file=/tmp/ssh-auth
7882
fi
7983
80-
if ! kubectl get secret nix-key &>/dev/null; then
84+
if ! ${kc} get secret nix-key &>/dev/null; then
8185
# create nix binary cache key
8286
nix-store --generate-binary-cache-key \
8387
nix-cache-1 \
8488
/tmp/nix-key/nix_ed25519 \
8589
/tmp/nix-key/nix_ed25519.pub
86-
kubectl delete --ignore-not-found secret nix-key
87-
kubectl create secret generic nix-key --from-file=/tmp/nix-key
90+
${kc} delete --ignore-not-found secret nix-key
91+
${kc} create secret generic nix-key --from-file=/tmp/nix-key
8892
fi
8993
'';
9094
};

0 commit comments

Comments
 (0)