Skip to content
Snippets Groups Projects
Commit 3ef6b0e4 authored by Andri Joos's avatar Andri Joos :blush:
Browse files

fixup! add distribution.create_cluster

parent eb243ec0
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
source "${SCRIPT_DIR}/helpers/helm_helpers.sh"
k3d cluster create distribution \
--agents 2 \
--servers 1 \
......@@ -15,21 +18,32 @@ k3d cluster create distribution \
--kubeconfig-update-default=true \
--kubeconfig-switch-context=true
# install calico
calico_dir="/tmp/calico"
git clone https://git.420joos.dev/kubernetes-cluster/networking/calico.git "${calico_dir}"
calico_repo_name="projectcalico"
helm repo add ${calico_repo_name} https://docs.tigera.io/calico/charts
helm upgrade calico ${calico_repo_name}/tigera-operator \
--install \
--version "${CALICO_VERSION:-v3.29.2}" \
--namespace tigera-operator \
--create-namespace \
--values "${calico_dir}/values.yaml" \
--wait \
--set "installation.calicoNetwork.ipPools[0].cidr=${CLUSTER_CIDR}"
add_helm_repo ${calico_repo_name} https://docs.tigera.io/calico/charts
install_helm_chart calico \
${calico_repo_name} \
tigera-operator \
"${CALICO_VERSION:-v3.29.2}" \
tigera-operator \
300 \
"${calico_dir}/values.yaml" \
"--set installation.calicoNetwork.ipPools[0].cidr=${CLUSTER_CIDR}"
# helm repo add ${calico_repo_name} https://docs.tigera.io/calico/charts
# helm repo update
# helm upgrade calico ${calico_repo_name}/tigera-operator \
# --install \
# --version "${CALICO_VERSION:-v3.29.2}" \
# --namespace tigera-operator \
# --create-namespace \
# --values "${calico_dir}/values.yaml" \
# --wait \
# --set "installation.calicoNetwork.ipPools[0].cidr=${CLUSTER_CIDR}"
helm repo remove ${calico_repo_name}
rm -rf "${calico_dir}"
# TODO: setup cluster for usage (agent & maybe calico)
# install gitlab agent
add_helm_repo() {
repo_name=$1
repo_url=$2
helm repo add ${repo_name} ${repo_url}
helm repo update
}
remove_helm_repo() {
repo_name=$1
helm repo remove ${repo_name}
}
install_helm_chart() {
deployment_name=$1
repo_name=$2
chart_name=$3
chart_version=$4
namespace=$5
timeout=$6
values_files=$7
upgrade_args=$8
values_arg=""
for values_file in $values_files; do
values_arg="${values_arg} --values ${values_file}"
done
helm upgrade ${deployment_name} ${repo_name}/${chart_name} \
--install \
--version ${chart_version} \
--namespace ${namespace} \
--create-namespace \
--timeout ${timeout} \
--wait \
${values_arg} \
${upgrade_args}
}
install_gitlab_agent() {
repo_name="gitlab"
chart_version=$1
git_repo_url=$2
values_filenames=$3
image_tag=$4
token=$5
git_repo_dir="/tmp/gitlab-agent"
values_files=""
for filename in $values_filenames; do
values_files="${values_files} ${git_repo_dir}/${filename}"
done
upgrade_args="--set image.tag=${image_tag} --set config.token=${token}"
git clone "${git_repo_url}" "${git_repo_dir}"
add_helm_repo ${repo_name} https://charts.gitlab.io
install_helm_chart distribution-agent ${repo_name} ${chart_name} ${chart_version} gitlab-agents 300 "${values_files}" "${upgrade_args}"
remove_helm_repo ${repo_name}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment