-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgcs-location.sh
executable file
·36 lines (34 loc) · 1 KB
/
gcs-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
. ./setenv.sh
TEMP_PREFIX=$(echo $(whoami) | sed -e 's/\_//g' | sed -e 's/\.//g' | awk '{print tolower($0)}')
FIRST2=$(echo -n $TEMP_PREFIX | head -c2)
LAST2=$(echo -n $TEMP_PREFIX | tail -c2)
MY_PREFIX=$(echo $FIRST2$LAST2)
echo '-------Creating a GCS profile secret'
myproject=$(gcloud config get-value core/project)
kubectl create secret generic k10-gcs-secret \
--namespace kasten-io \
--from-literal=project-id=$myproject \
--from-file=service-account.json=k10-sa-key.json
echo '-------Creating a GCS 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: GcpServiceAccountKey
secret:
apiVersion: v1
kind: Secret
name: k10-gcs-secret
namespace: kasten-io
type: ObjectStore
objectStore:
name: $MY_PREFIX-$MY_BUCKET
objectStoreType: GCS
region: $MY_REGION
EOF