Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Simple deployment on Kind
Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
  • Loading branch information
dmartinol committed Sep 17, 2024
commit 9468258bd630e684c4f3c6067fbc591b5c18a9e1
961 changes: 961 additions & 0 deletions examples/kind-quickstart/01-Install.ipynb

Large diffs are not rendered by default.

632 changes: 632 additions & 0 deletions examples/kind-quickstart/02-Client.ipynb

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions examples/kind-quickstart/03-Uninstall.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Uninstall deployment\n",
"Use Helm to uninstall all the previous deployments"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"release \"feast-online\" uninstalled\n",
"release \"feast-offline\" uninstalled\n",
"release \"feast-registry\" uninstalled\n",
"NAME\tNAMESPACE\tREVISION\tUPDATED\tSTATUS\tCHART\tAPP VERSION\n"
]
}
],
"source": [
"!helm uninstall feast-online\n",
"!helm uninstall feast-offline\n",
"!helm uninstall feast-registry\n",
"!helm list"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Delete the PostgreSQL deployment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!kubectl delete -f postgres/postgres.yaml"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"No resources found in feast namespace.\n",
"No resources found in feast namespace.\n",
"No resources found in feast namespace.\n"
]
}
],
"source": [
"!kubectl get svc\n",
"!kubectl get deployments\n",
"!kubectl get pods"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "feast3.11",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Empty file.
14 changes: 14 additions & 0 deletions examples/kind-quickstart/client/feature_store.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
project: sample
registry:
path: localhost:8001
registry_type: remote
offline_store:
host: localhost
port: 8002
type: remote
online_store:
path: http://localhost:8003
type: remote
entity_key_serialization_version: 2
auth:
type: no_auth
31 changes: 31 additions & 0 deletions examples/kind-quickstart/init-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: batch/v1
kind: Job
metadata:
name: feast-apply-job
spec:
template:
spec:
containers:
- name: feast-apply
image: feastdev/feature-server:0.40.1
command: ["/bin/sh", "-c"]
args:
- |
echo "Starting feast initialization job...";
mkdir /tmp/sample;
cd /tmp/sample;
cp /sample/* .;
sed -i 's/localhost/postgres/' feature_store.yaml;
feast apply;
CURRENT_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S");
feast materialize-incremental $CURRENT_TIME;
echo "Feast initialization completed successfully.";
volumeMounts:
- name: sample-repo-files
mountPath: /sample
restartPolicy: Never
volumes:
- name: sample-repo-files
configMap:
name: sample-repo
backoffLimit: 1
83 changes: 83 additions & 0 deletions examples/kind-quickstart/postgres/postgres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#https://www.digitalocean.com/community/tutorials/how-to-deploy-postgres-to-kubernetes-cluster
apiVersion: v1
kind: Secret
metadata:
name: postgres-secret
labels:
app: postgres
stringData:
POSTGRES_DB: feast
POSTGRES_USER: feast
POSTGRES_PASSWORD: feast
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgres-volume
labels:
type: local
app: postgres
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /data/postgresql
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-volume-claim
labels:
app: postgres
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: 'postgres:15-alpine'
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5432
envFrom:
- secretRef:
name: postgres-secret
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgresdata
volumes:
- name: postgresdata
persistentVolumeClaim:
claimName: postgres-volume-claim
---
apiVersion: v1
kind: Service
metadata:
name: postgres
labels:
app: postgres
spec:
type: NodePort
ports:
- port: 5432
selector:
app: postgres
Empty file.
12 changes: 12 additions & 0 deletions examples/kind-quickstart/src/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import subprocess

def port_forward(service, external_port, local_port=80) :
"""
Run a background process to forward port 80 of the given `service` service to the given `external_port` port.

Returns: the process instance
"""
command = ["kubectl", "port-forward", f"service/{service}", f"{external_port}:{local_port}"]
process = subprocess.Popen(command)
print(f"Port-forwarding {service} with process ID: {process.pid}")
return process