-
Notifications
You must be signed in to change notification settings - Fork 3
/
migration-cos-location.sh
executable file
·40 lines (36 loc) · 1.27 KB
/
migration-cos-location.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
. ./setenv.sh
# oc config use-context $(oc config get-contexts -o name | grep violet)
echo k10migration4yong1 > k10_migration_bucketname
export MY_OBJECT_STORAGE_PROFILE=myibmcos1-migration
export AWS_ACCESS_KEY_ID=$(cat ../ocp4yong1-ibm-k10/ibmaccess | head -1 | sed -e 's/\"//g')
export AWS_SECRET_ACCESS_KEY=$(cat ../ocp4yong1-ibm-k10/ibmaccess | tail -1 | sed -e 's/\"//g')
echo '-------Creating a IBM COS profile secret'
kubectl create secret generic k10-ibm-migration-s3-secret \
--namespace kasten-io \
--type secrets.kanister.io/aws \
--from-literal=aws_access_key_id=$AWS_ACCESS_KEY_ID \
--from-literal=aws_secret_access_key=$AWS_SECRET_ACCESS_KEY
echo '-------Creating an IBM COS profile'
cat <<EOF | kubectl apply -f -
apiVersion: config.kio.kasten.io/v1alpha1
kind: Profile
metadata:
name: $MY_OBJECT_STORAGE_PROFILE
namespace: kasten-io
spec:
type: Location
locationSpec:
credential:
secretType: AwsAccessKey
secret:
apiVersion: v1
kind: Secret
name: k10-ibm-migration-s3-secret
namespace: kasten-io
type: ObjectStore
objectStore:
name: $(cat k10_migration_bucketname)
objectStoreType: S3
region: $MY_REGION
endpoint: s3.$MY_REGION.cloud-object-storage.appdomain.cloud
EOF