Skip to content

Commit

Permalink
Add ICL_INGRESS_HOST_PORTS
Browse files Browse the repository at this point in the history
Set to true by default. When set to false, kind will not map host ports
to the cluster, access to the cluster endpoints will be possible from
ccn only.
  • Loading branch information
pbchekin committed May 18, 2024
1 parent 0641a16 commit 4c0e1b3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions scripts/deploy/kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ else
fi
fi

# Creates kube config in the workspace
function create_kube_config() {
local workspace="workspace/kind/$CLUSTER_NAME"
local kube_config="$PROJECT_ROOT/$workspace/config"
if [[ $ICL_INGRESS_HOST_PORTS == "true" ]]; then
kind get kubeconfig --name "$CLUSTER_NAME" > "$kube_config"
else
kind get kubeconfig --name "$CLUSTER_NAME" --internal > "$kube_config"
fi
}

function ccn_tag() {
cd "$PROJECT_ROOT"
git rev-parse --short HEAD
Expand All @@ -91,7 +102,7 @@ function create_ccn() {
local dockerfile="/tmp/icl-dockerfile-$tag"
local workspace="workspace/kind/$CLUSTER_NAME"
mkdir -p "$PROJECT_ROOT/$workspace"
cp "$KUBECONFIG" "$PROJECT_ROOT/$workspace/config"
create_kube_config
cat << DOCKERFILE > "$dockerfile"
FROM $CONTROL_NODE_IMAGE
COPY --chown=$(id -u):$(id -g) . /work/x1
Expand All @@ -115,7 +126,7 @@ function ensure_ccn() {
# TODO: make ports 80 and 443 configurable on host
function create_kind_cluster() {
local workspace="workspace/kind/$CLUSTER_NAME"
local kind_config="$workspace/kind.yaml"
local kind_config="$PROJECT_ROOT/$workspace/kind.yaml"
mkdir -p "$PROJECT_ROOT/$workspace"

cat << EOF > "$kind_config"
Expand All @@ -126,7 +137,6 @@ nodes:
image: kindest/node:v1.28.0
EOF


if [[ $ICL_INGRESS_HOST_PORTS == "true" ]]; then
cat << EOF >> "$kind_config"
# This works only for one node, see https://kind.sigs.k8s.io/docs/user/ingress/#ingress-nginx
Expand Down

0 comments on commit 4c0e1b3

Please sign in to comment.