-
Notifications
You must be signed in to change notification settings - Fork 35
/
build-secrets
executable file
·81 lines (73 loc) · 1.63 KB
/
build-secrets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
# Run this in a home directory with all credentials; write OpenShift secret
# volumes YAML definitions to stdout
# https://docs.openshift.com/container-platform/3.9/dev_guide/secrets.html
set -eu
BASE=${1:-/var/lib/cockpit-secrets}
# tasks secrets
cat <<EOF
---
apiVersion: v1
kind: Secret
metadata:
name: cockpit-tasks-secrets
data:
EOF
cd "$BASE/tasks"
# This intentionally does not capture subdirs. As OpenShift secret volumes don't have subdirectories,
# these need to be created as a separate volume if and when we ever need that.
for f in $(find -maxdepth 1 -type f -o -type l); do
printf ' %s: %s\n' "${f#./}" "$(base64 --wrap=0 $f)"
done
# S3 keys secrets
cat <<EOF
---
apiVersion: v1
kind: Secret
metadata:
name: cockpit-s3-secrets
data:
EOF
cd "$BASE/s3-keys"
for f in $(find -maxdepth 1 -type f -o -type l); do
printf ' %s: %s\n' "${f#./}" "$(base64 --wrap=0 $f)"
done
# local S3 image cache server secrets
cat <<EOF
---
apiVersion: v1
kind: Secret
metadata:
name: cockpit-s3-server-secrets
data:
EOF
cd "$BASE/s3-server"
for f in $(find -maxdepth 1 -type f -o -type l); do
printf ' %s: %s\n' "${f#./}" "$(base64 --wrap=0 $f)"
done
# webhook secrets
cat <<EOF
---
apiVersion: v1
kind: Secret
metadata:
name: webhook-secrets
data:
EOF
cd "$BASE/webhook"
for f in $(find -maxdepth 1 -type f -o -type l); do
printf ' %s: %s\n' "${f#./}" "$(base64 --wrap=0 $f)"
done
# metrics secrets
cat <<EOF
---
apiVersion: v1
kind: Secret
metadata:
name: metrics-secrets
data:
EOF
cd "$BASE/metrics"
for f in $(find -maxdepth 1 -type f -o -type l); do
printf ' %s: %s\n' "${f#./}" "$(tr -d '\n' < $f | base64 --wrap=0)"
done