diff --git a/script/install-cni.sh b/script/install-cni.sh index 18f7abe4f..439f75b5c 100755 --- a/script/install-cni.sh +++ b/script/install-cni.sh @@ -19,7 +19,7 @@ WHEREABOUTS_RECONCILER_CRON=${WHEREABOUTS_RECONCILER_CRON:-30 4 * * *} mkdir -p $CNI_CONF_DIR/whereabouts.d WHEREABOUTS_KUBECONFIG=$CNI_CONF_DIR/whereabouts.d/whereabouts.kubeconfig -WHEREABOUTS_FLATFILE=$CNI_CONF_DIR/whereabouts.d/whereabouts.conf # Yuki~ Nikhil's note: imo we should remove "flatfile" from whereabouts vocabulary and call this "WHEREABOUTS_CONF_FILE" instead. Flatfile may be the format but it's confusing naming. +WHEREABOUTS_CONF_FILE=$CNI_CONF_DIR/whereabouts.d/whereabouts.conf WHEREABOUTS_KUBECONFIG_LITERAL=$(echo "$WHEREABOUTS_KUBECONFIG" | sed -e s'|/host||') # ------------------------------- Generate a "kube-config" @@ -46,7 +46,8 @@ function warn() } -# Check if we're running as a k8s pod. +function generateKubeConfig { + # Check if we're running as a k8s pod. if [ -f "$SERVICE_ACCOUNT_PATH/token" ]; then # We're running as a k8d pod - expect some variables. if [ -z ${KUBERNETES_SERVICE_HOST} ]; then @@ -96,9 +97,23 @@ contexts: current-context: whereabouts-context EOF - touch $WHEREABOUTS_FLATFILE - chmod ${KUBECONFIG_MODE:-600} $WHEREABOUTS_FLATFILE - cat > $WHEREABOUTS_FLATFILE < $WHEREABOUTS_CONF_FILE <