-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnamespace-loop.txt
executable file
·42 lines (38 loc) · 1020 Bytes
/
namespace-loop.txt
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
#!/bin/bash
secret_name="my-secret"
p12Encode=$(echo -n admin|base64)
pwdEncode=$(echo -n password|base64)
echo "p12Encode is $p12Encode"
echo "pwdEncode is $pwdEncode"
echo "Now will checking namespace"
awk 'BEGIN{while (a++<50) s=s "-"; print s,"splite line",s}'
kubectl get ns|grep -E "lextest|alex"|awk '{print$1}'| while IFS='' read -r line
do
echo "starting=======›create secret in namespace: ""$line"" "
kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
name: $secret_name
namespace: ${line}
type: Opaque
data:
test-pw.p12: $p12Encode
test-pw.p12.pwd: $pwdEncode
EOF
kubectl apply -f - <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
namespace: ${line}
name: test-common-sb-conf
data:
server-conf.properties:
server.port=443
server.ssl.enabled=true
server.ssl.key-store=/opt/keystore/test-pw.p12
server.ssl.key-store-type=PKCS12
server.ssl.key-store-password=\${KEY_STORE_PWD}
server.servlet.context-path=/\$(apiName}/v\${minorVersion}
EOF
done