Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cluster setup
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kubernetes Cluster
cluster setup
Commits
3ef6b0e4
Commit
3ef6b0e4
authored
1 month ago
by
Andri Joos
Browse files
Options
Downloads
Patches
Plain Diff
fixup! add distribution.create_cluster
parent
eb243ec0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
distribution.create_cluster.sh
+24
-10
24 additions, 10 deletions
distribution.create_cluster.sh
helpers/helm_helpers.sh
+61
-0
61 additions, 0 deletions
helpers/helm_helpers.sh
with
85 additions
and
10 deletions
distribution.create_cluster.sh
+
24
−
10
View file @
3ef6b0e4
#!/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
This diff is collapsed.
Click to expand it.
helpers/helm_helpers.sh
0 → 100644
+
61
−
0
View file @
3ef6b0e4
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
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment