From 4c0e1b3aeb730ba4426e4301f98113a60d263c0f Mon Sep 17 00:00:00 2001 From: Pavel Chekin Date: Fri, 17 May 2024 17:58:17 -0700 Subject: [PATCH] Add ICL_INGRESS_HOST_PORTS 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. --- scripts/deploy/kind.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/deploy/kind.sh b/scripts/deploy/kind.sh index a104d39..27cfc5b 100755 --- a/scripts/deploy/kind.sh +++ b/scripts/deploy/kind.sh @@ -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 @@ -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 @@ -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" @@ -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