Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .tmuxinator/tmuxinator-k8.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: k8_dev
on_project_first_start: ./dev k8-init
# on_project_first_start: ./dev k8-init
on_project_exit: minikube delete
windows:
- editor:
Expand Down
9 changes: 4 additions & 5 deletions deploy_k8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# Exit on any error
set -e

# eval $(minikube docker-env)

STATEFULSET_NAME="store"
NAMESPACE="default"

eval $(minikube docker-env)
TAG=$(date +%s)
NEW_IMAGE=docker.io/andrew-delph/main:$TAG
NEW_IMAGE=ghcr.io/andrew-delph/main:$TAG

bazel run --execution_log_json_file=events.json //main:store_image
docker tag docker.io/andrew-delph/main:store_image $NEW_IMAGE
bazel run --execution_log_json_file=events.json //main:image_push -- -dst=$NEW_IMAGE


ROLL_OUT_FLAG=0
Expand All @@ -35,7 +35,6 @@ SECONDS=0 # Reset the SECONDS variable
if [ $ROLL_OUT_FLAG -eq 0 ]; then
echo "The 'rollout' flag is not set. Setting up."
(cd operator && kustomize build config/crd | kubectl apply -f - || true)
bazel run //main:image_push
kubectl apply -f ./operator/config/samples/ || true
else
echo "The 'rollout' flag is set."
Expand Down
7 changes: 3 additions & 4 deletions deploy_operator.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/bin/bash

# eval $(minikube docker-env)


eval $(minikube docker-env)
TAG=$(date +%s)
IMG=docker.io/andrew-delph/operator:$TAG
bazel run //operator:operator_image
docker tag docker.io/andrew-delph/operator:operator_image $IMG
IMG=ghcr.io/andrew-delph/operator:$TAG
bazel run //operator:image_push -- -dst=$IMG
(cd operator && make deploy IMG=$IMG)
(cd operator && kustomize build config/rbac | kubectl apply -f - || true)

Expand Down
6 changes: 2 additions & 4 deletions dev
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ case $1 in
;;
k8-r)
kubectl delete -f ./operator/config/samples/ || true
./deploy_k8.sh
./deploy_operator.sh
kubectl apply -f ./resources/prom.yaml
kubectl create configmap prometheus-config --from-file=prometheus.yml || true
./deploy_k8.sh
;;
k8-operator)
./deploy_operator.sh
Expand All @@ -38,7 +36,7 @@ case $1 in
tmux kill-session -t k8_dev
;;
k8-e2e)
k6 run -e ADDRESS="192.168.49.2:30000" e2e/test.js
./e2e_k8.sh
;;
dc-e2e)
k6 run e2e/test.js
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ services:

store:
# hostname: store
image: docker.io/andrew-delph/main:store_image
image: ghcr.io/andrew-delph/main:store_image
scale: 5
depends_on:
# - zookeeper
Expand All @@ -57,7 +57,7 @@ services:
# store-profile:
# # hostname: store
# # scale: 1
# image: docker.io/andrew-delph/main:store_image
# image: ghcr.io/andrew-delph/main:store_image
# environment:
# - PROFILE_SERVER=true
# - BOOTSTRAP_TIMEOUT=1
Expand Down
27 changes: 15 additions & 12 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ build:
init:
@echo "init"
curl https://raw.githubusercontent.com/grafana/k6-operator/main/bundle.yaml | kubectl apply -f -
make monitoring

setup:
kubectl --context minikube create namespace k6 || echo "namespace already exists"
kubectl --context minikube delete configmap test-scripts --ignore-not-found -n k6
kubectl --context minikube delete configmap prometheus-config --ignore-not-found -n k6
kubectl --context minikube create configmap test-scripts \
kubectl create namespace k6 || echo "namespace already exists"
kubectl delete configmap test-scripts --ignore-not-found -n k6
kubectl delete configmap prometheus-config --ignore-not-found -n k6
kubectl create configmap test-scripts \
--from-file=./test.js -n k6

run:
Expand All @@ -21,14 +22,16 @@ run:
logs:
stern -n k6 .*

prod:
make setup
./run-kube.sh resources/k6-output-grafana-cloud.yaml --external

watch:
watch -n 15 kubectl get pods -n k6
watch kubectl get pods -n k6

delete:
kubectl --context minikube delete -f resources/k6-output-grafana-cloud.yaml -n k6
# cd dependencies/k6-operator && make delete

kubectl delete -f resources/k6-output-grafana-cloud.yaml -n k6 || true
helm uninstall loki --namespace=monitoring --wait || true

monitoring:
helm repo add grafana https://grafana.github.io/helm-charts
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml --wait
kubectl create namespace monitoring --dry-run=client -o yaml | kubectl apply -f -
helm upgrade --install loki --namespace=monitoring grafana/loki-stack -f loki-stack.values.yaml
bash ./create_dashboards.sh
21 changes: 21 additions & 0 deletions e2e/create_dashboards.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# default dashboards: https://github.com/prometheus-community/helm-charts/tree/8f91606e01b85b9aa013ed472c5acb836c4e7ac8/charts/kube-prometheus-stack/templates/grafana/dashboards-1.14

# delete existing dashboards
kubectl delete configmap --selector custom_dashboard='1' -n monitoring

# Set the directory path
dir_path="./dashboards"

# Loop through all files in the directory
for file_path in $dir_path/*; do
file_name=$(basename "${file_path%.*}")

# # Create the ConfigMap using the file contents and name as the ConfigMap name
kubectl create configmap "$file_name" --from-file="$file_path" -n monitoring

# # Add labels to the ConfigMap
kubectl label configmap "$file_name" grafana_dashboard='1' custom_dashboard='1' -n monitoring

done
Loading