Skip to content

Commit

Permalink
Optimize deployment add istio (#37)
Browse files Browse the repository at this point in the history
* Add istio

* Move istio config files to separate dir

* Add optional istio and consistent logging.

* changing directory structure of manifests

---------

Co-authored-by: Joe Martin <[email protected]>
  • Loading branch information
davi17g and arrowplum authored Jun 7, 2024
1 parent 4cf3624 commit 898229f
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 27 deletions.
36 changes: 31 additions & 5 deletions kubernetes/full-create-and-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export CLUSTER_NAME="${PROJECT_ID}-cluster"
export NODE_POOL_NAME_AEROSPIKE="aerospike-pool"
export NODE_POOL_NAME_AVS="avs-pool"
export ZONE="us-central1-c"
export HELM_CHART="/home/joem/src/helm-charts/aerospike-vector-search"
export FEATURES_CONF="./features.conf"
export FEATURES_CONF="./features.conf"
export AEROSPIKE_CR="./manifests/ssd_storage_cluster_cr.yaml"

# Print environment variables to ensure they are set correctly
Expand Down Expand Up @@ -131,6 +130,29 @@ echo "Setting secrets for AVS cluster..."
kubectl --namespace avs create secret generic aerospike-secret --from-file=features.conf="$FEATURES_CONF"
kubectl --namespace avs create secret generic auth-secret --from-literal=password='admin123'

###################################################
# Optional add Istio
###################################################
echo "Deploying Istio"
helm repo add istio https://istio-release.storage.googleapis.com/charts
helm repo update

helm install istio-base istio/base --namespace istio-system --set defaultRevision=default --create-namespace --wait
helm install istiod istio/istiod --namespace istio-system --create-namespace --wait
helm install istio-ingress istio/gateway \
--values ./manifests/istio/istio-ingressgateway-values.yaml \
--namespace istio-ingress \
--create-namespace \
--wait

kubectl apply -f manifests/istio/gateway.yaml
kubectl apply -f manifests/istio/avs-virtual-service.yaml

###################################################
# End Istio
###################################################


helm repo add aerospike-helm https://artifact.aerospike.io/artifactory/api/helm/aerospike-helm
helm repo update
helm install avs-gke --values "manifests/avs-gke-values.yaml" --namespace avs aerospike-helm/aerospike-vector-search --wait
Expand All @@ -144,7 +166,11 @@ helm repo update
helm install monitoring-stack prometheus-community/kube-prometheus-stack --namespace monitoring --create-namespace

echo "Applying additional monitoring manifests..."
kubectl apply -f manifests/monitoring
kubectl apply -f manifests/monitoring/aerospike-exporter-service.yaml
kubectl apply -f manifests/monitoring/aerospike-servicemonitor.yaml
kubectl apply -f manifests/monitoring/avs-servicemonitor.yaml



echo "Setup complete."
echo "To include your Grafana dashboards, use 'import-dashboards.sh <your grafana dashboard directory>'"
Expand All @@ -153,5 +179,5 @@ echo "To view Grafana dashboards from your machine use 'kubectl port-forward -n
echo "To expose Grafana ports publicly, use 'kubectl apply -f helpers/EXPOSE-GRAFANA.yaml'"
echo "To find the exposed port, use 'kubectl get svc -n monitoring'"

echo "To run the quote search sample app on your new cluster, use:"
echo "helm install semantic-search-app aerospike/quote-semantic-search --namespace avs --values manifests/semantic-search-values.yaml --wait"
echo "To run the quote search sample app on your new cluster, for istio use:"
echo "helm install semantic-search-app aerospike/quote-semantic-search --namespace avs --values manifests/quote-search/semantic-search-values.yaml --wait"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: avs-vs
namespace: aerospike
namespace: avs
spec:
hosts:
- "*"
Expand All @@ -17,7 +17,7 @@ spec:
- destination:
port:
number: 8080
host: quote-search-quote-semantic-search.aerospike.svc.cluster.local
host: sematic-search-app-quote-semantic-search.avs.svc.cluster.local
- match:
- uri:
prefix: /
Expand All @@ -26,4 +26,7 @@ spec:
- destination:
port:
number: 5000
host: avs-gke-aerospike-vector-search.aerospike.svc.cluster.local
host: avs-gke-aerospike-vector-search.avs.svc.cluster.local

---

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: avs-gw
namespace: aerospike
namespace: avs
spec:
selector:
istio: ingress
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
quoteSearchConfig:
avsHost: "istio-ingress.istio-ingress.svc.cluster.local"
avsIsLoadbalancer: "True"
avsNamespace: "test"
avsIndexName: "istio-witticisms"

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
quoteSearchConfig:
avsHost: "avs-gke-aerospike-vector-search-lb.svc.cluster.local"
avsIsLoadbalancer: "True"
avsNamespace: "avs-meta"
avsNamespace: "test"

14 changes: 0 additions & 14 deletions kubernetes/manifests/servicemonitor.yaml

This file was deleted.

4 changes: 1 addition & 3 deletions quote-semantic-search/quote-search/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@

def get_bool_env(name, default):
env = os.environ.get(name)

if env is None:
return default

env = env.lower()
env = env.lower()

if env in ["true", "1"]:
return True
Expand Down

0 comments on commit 898229f

Please sign in to comment.