Skip to content

Commit 97df3e8

Browse files
committed
Remove fernet key removal
Removing of extra fernet keys will be implemented on keystone-operator startup, in Go. Keys are mounted by paths, so there is always a set amount of keys.
1 parent 113ff84 commit 97df3e8

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

pkg/keystone/fernet.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ const (
5353
5454
cd /var/lib/fernet-keys
5555
mkdir /tmp/keys
56-
for file in FernetKeys[0-9]*;
56+
for file in [0-9]*;
5757
do
58-
cat "$file" > /tmp/keys/"${file#FernetKeys}"
58+
cat "$file" > /tmp/keys/"${file}"
5959
done
6060
6161
cd /tmp/keys
@@ -91,24 +91,6 @@ const (
9191
kubectl patch secret -n $NAMESPACE $SECRET_NAME \
9292
--patch-file=/tmp/patch_file.json
9393
echo $(date -u) $((i+1)) keys rotated.
94-
95-
cd /var/lib/fernet-keys
96-
if [ -f "FernetKeys$MAX_ACTIVE_KEYS" ]; then
97-
echo '[' > /tmp/patch_file.json
98-
i=$((MAX_ACTIVE_KEYS-1))
99-
while [ -f "FernetKeys$((i+1))" ]; do
100-
echo '{"op": "remove", "path": "/data/FernetKeys'$i'"},' \
101-
>> /tmp/patch_file.json
102-
i=$((i+1))
103-
done
104-
echo '{"op": "remove", "path": "/data/FernetKeys'$i'"}' \
105-
>> /tmp/patch_file.json
106-
echo ']' >> /tmp/patch_file.json
107-
108-
kubectl patch secret -n $NAMESPACE $SECRET_NAME \
109-
--type=json --patch-file=/tmp/patch_file.json
110-
echo $(date -u) $MAX_ACTIVE_KEYS through $i keys deleted.
111-
fi
11294
`
11395
)
11496

0 commit comments

Comments
 (0)