This repository has been archived by the owner on Nov 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
K2-kasten-storage.sh
executable file
·90 lines (82 loc) · 2.09 KB
/
K2-kasten-storage.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env bash
#### LOCALIP #########
ip address show ens160 >/dev/null
retval=$?
if [ ${retval} -eq 0 ]; then
LOCALIPADDR=`ip -f inet -o addr show ens160 |cut -d\ -f 7 | cut -d/ -f 1`
else
ip address show ens192 >/dev/null
retval2=$?
if [ ${retval2} -eq 0 ]; then
LOCALIPADDR=`ip -f inet -o addr show ens192 |cut -d\ -f 7 | cut -d/ -f 1`
else
LOCALIPADDR=`ip -f inet -o addr show eth0 |cut -d\ -f 7 | cut -d/ -f 1`
fi
fi
echo ${LOCALIPADDR}
MINIOIP=${LOCALIPADDR}
BUCKETNAME=`hostname`
mc alias rm local
MINIO_ENDPOINT=https://${MINIOIP}:9000
mc alias set local ${MINIO_ENDPOINT} minioadminuser minioadminuser --api S3v4
# Configure local minio setup
AWS_ACCESS_KEY_ID=` echo -n "minioadminuser" | base64`
AWS_SECRET_ACCESS_KEY_ID=` echo -n "minioadminuser" | base64`
cat << EOF | kubectl -n kasten-io create -f -
apiVersion: v1
data:
aws_access_key_id: ${AWS_ACCESS_KEY_ID}
aws_secret_access_key: ${AWS_SECRET_ACCESS_KEY_ID}
kind: Secret
metadata:
name: k10-s3-secret
namespace: kasten-io
type: secrets.kanister.io/aws
EOF
cat <<EOF | kubectl -n kasten-io create -f -
apiVersion: config.kio.kasten.io/v1alpha1
kind: Profile
metadata:
name: minio-profile
namespace: kasten-io
spec:
type: Location
locationSpec:
credential:
secretType: AwsAccessKey
secret:
apiVersion: v1
kind: Secret
name: k10-s3-secret
namespace: kasten-io
type: ObjectStore
objectStore:
name: ${BUCKETNAME}
objectStoreType: S3
endpoint: 'https://${MINIOIP}:9000'
skipSSLVerify: true
region: us-east-1
EOF
sleep 10
kubectl -n kasten-io get pvc | grep kastennfspvc01
retval1=$?
if [ ${retval1} -eq 0 ]; then
cat <<EOF | kubectl -n kasten-io create -f -
apiVersion: config.kio.kasten.io/v1alpha1
kind: Profile
metadata:
name: nfs-profile
namespace: kasten-io
spec:
type: Location
locationSpec:
type: FileStore
fileStore:
claimName: kastennfspvc01
EOF
fi
kubectl -n kasten-io get profiles.config.kio.kasten.io
echo ""
echo "Kasten backup storage were configured"
echo ""
chmod -x ./K2-kasten-storage.sh