-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-kaniko-secret.sh
executable file
·57 lines (48 loc) · 1.12 KB
/
create-kaniko-secret.sh
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
#!/usr/bin/env bash
if [ ${#DOCKER_PRIVATE_ENDPOINT} -eq 0 ];
then
read -p "Enter private registry endpoint: " DOCKER_PRIVATE_ENDPOINT
fi
if [ ${#DOCKER_PRIVATE_USERNAME} -eq 0 ];
then
read -p "Enter docker login: " DOCKER_PRIVATE_USERNAME
fi
if [ ${#DOCKER_PRIVATE_PASSWORD} -eq 0 ];
then
read -s -p "Enter docker password: " DOCKER_PRIVATE_PASSWORD
echo ""
fi
if [ ${#DOCKER_DEV_ENDPOINT} -eq 0 ];
then
read -p "Enter private registry endpoint: " DOCKER_DEV_ENDPOINT
fi
if [ ${#DOCKER_DEV_USERNAME} -eq 0 ];
then
read -p "Enter docker login: " DOCKER_DEV_USERNAME
fi
if [ ${#DOCKER_DEV_PASSWORD} -eq 0 ];
then
read -s -p "Enter docker password: " DOCKER_DEV_PASSWORD
echo ""
fi
cat <<EOF | kubectl apply -f -
apiVersion: v1
stringData:
config.json: |
{
"auths": {
"$DOCKER_DEV_ENDPOINT": {
"username": "$DOCKER_DEV_USERNAME",
"password": "$DOCKER_DEV_PASSWORD"
},
"$DOCKER_PRIVATE_ENDPOINT": {
"username": "$DOCKER_PRIVATE_USERNAME",
"password": "$DOCKER_PRIVATE_PASSWORD"
}
}
}
kind: Secret
metadata:
name: kaniko-secret
type: Opaque
EOF