22set -eo pipefail
33SCRIPT_DIR=" $( dirname " $( readlink -f " $0 " ) " ) "
44
5- KIND=${KIND:- bin/ kind}
6- GRPCURL=${GRPCURL:- bin/ grpcurl}
7- IMG=${IMG:- quay.io/ jumpstarter-dev/ jumpstarter-controller: latest}
8- INGRESS_ENABLED=${INGRESS_ENABLED:- false}
5+ # Source common utilities
6+ source " ${SCRIPT_DIR} /utils"
97
10- GREEN= ' \033[0;32m '
11- NC= ' \033[0m ' # No Color
8+ # Source common deployment variables
9+ source " ${SCRIPT_DIR} /deploy_vars "
1210
1311METHOD=install
14- IP=$( " ${SCRIPT_DIR} " /get_ext_ip.sh)
15-
1612
1713kubectl config use-context kind-jumpstarter
1814
19- HELM_SETS= " "
15+ # Install nginx ingress if in ingress mode
2016if [ " ${INGRESS_ENABLED} " == " true" ]; then
21- echo -e " ${GREEN} Deploying nginx ingress in kind ...${NC} "
22-
23- lsmod | grep ip_tables || \
24- (echo " ip_tables module not loaded needed by nginx ingress, please run 'sudo modprobe ip_tables'" && exit 1)
25-
26- # before our helm installs, we make sure that kind has an ingress installed
27- kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
28-
29- echo -e " ${GREEN} Waiting for nginx to be ready ...${NC} "
30-
31- while ! kubectl get pods --namespace ingress-nginx --selector=app.kubernetes.io/component=controller > /dev/null; do
32- sleep 1
33- done
34-
35- kubectl wait --namespace ingress-nginx \
36- --for=condition=ready pod \
37- --selector=app.kubernetes.io/component=controller \
38- --timeout=90s
39-
40- HELM_SETS=" ${HELM_SETS} --set jumpstarter-controller.grpc.ingress.enabled=true"
41- BASEDOMAIN=" jumpstarter.${IP} .nip.io"
42- GRPC_ENDPOINT=" grpc.${BASEDOMAIN} :5080"
43- GRPC_ROUTER_ENDPOINT=" router.${BASEDOMAIN} :5080"
17+ install_nginx_ingress
4418else
4519 echo -e " ${GREEN} Deploying with nodeport ...${NC} "
46- HELM_SETS=" ${HELM_SETS} --set jumpstarter-controller.grpc.nodeport.enabled=true"
47- BASEDOMAIN=" jumpstarter.${IP} .nip.io"
48- GRPC_ENDPOINT=" grpc.${BASEDOMAIN} :8082"
49- GRPC_ROUTER_ENDPOINT=" router.${BASEDOMAIN} :8083"
5020fi
5121
22+ # Build Helm sets based on configuration
23+ HELM_SETS=" "
5224HELM_SETS=" ${HELM_SETS} --set global.baseDomain=${BASEDOMAIN} "
5325HELM_SETS=" ${HELM_SETS} --set jumpstarter-controller.grpc.endpoint=${GRPC_ENDPOINT} "
5426HELM_SETS=" ${HELM_SETS} --set jumpstarter-controller.grpc.routerEndpoint=${GRPC_ROUTER_ENDPOINT} "
55-
56-
57- IMAGE_REPO=$( echo ${IMG} | cut -d: -f1)
58- IMAGE_TAG=$( echo ${IMG} | cut -d: -f2)
5927HELM_SETS=" ${HELM_SETS} --set jumpstarter-controller.image=${IMAGE_REPO} "
6028HELM_SETS=" ${HELM_SETS} --set jumpstarter-controller.tag=${IMAGE_TAG} "
6129
62- # Function to save images to kind, with workaround for github CI and other environment issues
63- # In github CI, kind gets confused and tries to pull the image from docker instead
64- # of podman, so if regular docker-image fails we need to:
65- # * save it to OCI image format
66- # * then load it into kind
67- kind_load_image () {
68- local image=$1
69-
70- # First, try to load the image directly
71- if ${KIND} load docker-image " ${image} " --name jumpstarter; then
72- echo " Image ${image} loaded successfully."
73- return
74- fi
75-
76- # Save to tar file
77- podman save " ${image} " | ${KIND} load image-archive /dev/stdin --name jumpstarter
78- if [ $? -eq 0 ]; then
79- echo " Image loaded successfully."
80- else
81- echo " Error loading image ${image} ."
82- exit 1
83- fi
84- }
30+ # Enable appropriate networking mode
31+ if [ " ${NETWORKING_MODE} " == " ingress" ]; then
32+ HELM_SETS=" ${HELM_SETS} --set jumpstarter-controller.grpc.ingress.enabled=true"
33+ else
34+ HELM_SETS=" ${HELM_SETS} --set jumpstarter-controller.grpc.nodeport.enabled=true"
35+ fi
8536
8637echo -e " ${GREEN} Loading the ${IMG} in kind ...${NC} "
8738# load the docker image into the kind cluster
@@ -105,21 +56,8 @@ helm ${METHOD} --namespace jumpstarter-lab \
10556
10657kubectl config set-context --current --namespace=jumpstarter-lab
10758
108- echo -e " ${GREEN} Waiting for grpc endpoints to be ready:${NC} "
109- for ep in ${GRPC_ENDPOINT} ${GRPC_ROUTER_ENDPOINT} ; do
110- RETRIES=60
111- echo -e " ${GREEN} * Checking ${ep} ... ${NC} "
112- while ! ${GRPCURL} -insecure ${ep} list; do
113- sleep 2
114- RETRIES=$(( RETRIES- 1 ))
115- if [ ${RETRIES} -eq 0 ]; then
116- echo -e " ${GREEN} * ${ep} not ready after 120s, exiting ... ${NC} "
117- exit 1
118- fi
119- done
120- done
121-
59+ # Check gRPC endpoints are ready
60+ check_grpc_endpoints
12261
123- echo -e " ${GREEN} Jumpstarter controller deployed successfully!${NC} "
124- echo -e " gRPC endpoint: ${GRPC_ENDPOINT} "
125- echo -e " gRPC router endpoint: ${GRPC_ROUTER_ENDPOINT} "
62+ # Print success banner
63+ print_deployment_success " Helm"
0 commit comments