-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathinstall_feast.sh
More file actions
executable file
·109 lines (84 loc) · 3.9 KB
/
install_feast.sh
File metadata and controls
executable file
·109 lines (84 loc) · 3.9 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# Specify the RBAC type (folder)
read -p "Enter RBAC type (e.g., k8s or oidc): " FOLDER
echo "You have selected the RBAC type: $FOLDER"
# feature_store files name for the servers
OFFLINE_YAML="feature_store_offline.yaml"
ONLINE_YAML="feature_store_online.yaml"
REGISTRY_YAML="feature_store_registry.yaml"
# Helm chart path and service account
HELM_CHART_PATH="../../infra/charts/feast-feature-server"
SERVICE_ACCOUNT_NAME="feast-sa"
CLIENT_REPO_DIR="client/$FOLDER/feature_repo"
# Function to check if a file exists and encode it to base64
encode_to_base64() {
local file_path=$1
if [ ! -f "$file_path" ]; then
echo "Error: File not found at $file_path"
exit 1
fi
base64 < "$file_path"
}
FEATURE_STORE_OFFLINE_YAML_PATH="server/$FOLDER/$OFFLINE_YAML"
FEATURE_STORE_ONLINE_YAML_PATH="server/$FOLDER/$ONLINE_YAML"
FEATURE_STORE_REGISTRY_YAML_PATH="server/$FOLDER/$REGISTRY_YAML"
# Encode the YAML files to base64
FEATURE_STORE_OFFLINE_YAML_BASE64=$(encode_to_base64 "$FEATURE_STORE_OFFLINE_YAML_PATH")
FEATURE_STORE_ONLINE_YAML_BASE64=$(encode_to_base64 "$FEATURE_STORE_ONLINE_YAML_PATH")
FEATURE_STORE_REGISTRY_YAML_BASE64=$(encode_to_base64 "$FEATURE_STORE_REGISTRY_YAML_PATH")
# Check if base64 encoding was successful
if [ -z "$FEATURE_STORE_OFFLINE_YAML_BASE64" ] || [ -z "$FEATURE_STORE_ONLINE_YAML_BASE64" ] || [ -z "$FEATURE_STORE_REGISTRY_YAML_BASE64" ]; then
echo "Error: Failed to base64 encode one or more feature_store.yaml files in folder $FOLDER."
exit 1
fi
# Upgrade or install Feast components for the specified folder
read -p "Deploy Feast server components for $FOLDER? (y/n) " confirm_server
if [[ $confirm_server == [yY] ]]; then
# Apply the server service accounts and role bindings
kubectl apply -f "server/k8s/server_resources.yaml"
# Upgrade or install Feast components
echo "Upgrading or installing Feast server components for $FOLDER"
helm upgrade --install feast-registry-server $HELM_CHART_PATH \
--set feast_mode=registry \
--set feature_store_yaml_base64=$FEATURE_STORE_REGISTRY_YAML_BASE64 \
--set serviceAccount.name=$SERVICE_ACCOUNT_NAME
helm upgrade --install feast-feature-server $HELM_CHART_PATH \
--set feature_store_yaml_base64=$FEATURE_STORE_ONLINE_YAML_BASE64 \
--set serviceAccount.name=$SERVICE_ACCOUNT_NAME
helm upgrade --install feast-offline-server $HELM_CHART_PATH \
--set feast_mode=offline \
--set feature_store_yaml_base64=$FEATURE_STORE_OFFLINE_YAML_BASE64 \
--set serviceAccount.name=$SERVICE_ACCOUNT_NAME
echo "Server components deployed for $FOLDER."
else
echo "Server components not deployed for $FOLDER."
fi
read -p "Apply client creation examples ? (y/n) " confirm_clients
if [[ $confirm_clients == [yY] ]]; then
kubectl delete configmap client-feature-repo-config --ignore-not-found
kubectl create configmap client-feature-repo-config --from-file=$CLIENT_REPO_DIR
kubectl apply -f "client/$FOLDER/admin_user_resources.yaml"
kubectl apply -f "client/$FOLDER/readonly_user_resources.yaml"
kubectl apply -f "client/$FOLDER/unauthorized_user_resources.yaml"
echo "Client resources applied."
else
echo "Client resources not applied."
fi
read -p "Apply 'feast apply' in the remote registry? (y/n) " confirm_apply
if [[ $confirm_apply == [yY] ]]; then
POD_NAME=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep '^feast-registry-server-feast-feature-server')
if [ -z "$POD_NAME" ]; then
echo "No pod found with the prefix feast-registry-server-feast-feature-server"
exit 1
fi
LOCAL_DIR="./server/feature_repo/"
REMOTE_DIR="/app/"
echo "Copying files from $LOCAL_DIR to $POD_NAME:$REMOTE_DIR"
kubectl cp $LOCAL_DIR $POD_NAME:$REMOTE_DIR
echo "Files copied successfully!"
kubectl exec $POD_NAME -- feast -c feature_repo apply
echo "'feast apply' command executed successfully in the for remote registry."
else
echo "'feast apply' not performed ."
fi
echo "Setup completed."