Skip to content

Commit

Permalink
feature: add k0s and k0sctl configuration files for Kubernetes cluste…
Browse files Browse the repository at this point in the history
…r setup

Signed-off-by: Schubert Anselme <[email protected]>
  • Loading branch information
sanselme committed Dec 30, 2024
1 parent 2d84024 commit f213699
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 42 deletions.
File renamed without changes.
File renamed without changes.
43 changes: 18 additions & 25 deletions config/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ binary:
archs:
- amd64
- arm64
- name: yq
type: executable
url: https://github.com/mikefarah/yq/releases/download/v${version}/yq_${os}_${arch}
version: 4.44.3
archs:
- amd64
- arm64
package:
add: []
# - name: ""
Expand All @@ -29,24 +22,24 @@ package:
remove: []
# - name: containerd
# type: apt
group:
- name: docker
keyring: https://download.docker.com/${os}/ubuntu/gpg
repo: https://download.docker.com/${os}/ubuntu
type: apt
add:
- containerd.io
- docker-buildx-plugin
- docker-ce-cli
- docker-ce
- docker-compose-plugin
remove:
- containerd
- docker-compose
- docker-doc
- docker.io
- podman-docker
- runc
group: []
# - name: docker
# keyring: https://download.docker.com/${os}/ubuntu/gpg
# repo: https://download.docker.com/${os}/ubuntu
# type: apt
# add:
# - containerd.io
# - docker-buildx-plugin
# - docker-ce-cli
# - docker-ce
# - docker-compose-plugin
# remove:
# - containerd
# - docker-compose
# - docker-doc
# - docker.io
# - podman-docker
# - runc
plugin:
- name: kubectl
installer: krew
Expand Down
6 changes: 6 additions & 0 deletions scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ if [[ -n $(command -v "apt-get") ]]; then
"curl"
"git"
"gnupg2"
"jq"
"yq"
"zsh"
)

Expand Down Expand Up @@ -103,4 +105,8 @@ ln -sf .trunk/configs/.* .
if [[ -n $(command -v "trunk") ]]; then
trunk fmt
trunk check
else
curl https://get.trunk.io -fsSL | bash
trunk fmt
trunk check
fi
10 changes: 8 additions & 2 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ VERSION_CONFIG="config/versions.yaml"
export arch="$(uname -m)"
export os="$(uname | tr '[:upper:]' '[:lower:]')"

if [[ "${arch}" == "aarch64" ]]; then
export arch="arm64"
fi

# todo: packages
# note: package groups
package_groups="$(yq '.package.group[] | .name' "${VERSION_CONFIG}")"
Expand All @@ -30,8 +34,10 @@ done

# note: binaries
binaries="$(yq '.binary[] | .name' "${VERSION_CONFIG}")"

for name in ${binaries[@]}; do
export name="${name}"
yq '.binary[] | select(.name == env(name))' "${VERSION_CONFIG}"
export $(getenv <(yq '.binary[] | select(.name == env(name))' "${VERSION_CONFIG}"))

if [[ -n $(command -v "${name}") ]]; then
Expand All @@ -43,7 +49,7 @@ for name in ${binaries[@]}; do
case "${type}" in
archive)
curl -fsSLo "/tmp/${name}.tgz" "${url}"
tar -xzf "/tmp/${name}.tgz"
tar -xzf "/tmp/${name}.tgz" -C /tmp/
install "/tmp/${os}-${arch}/${name}" "/usr/local/bin/${name}"
"${name}" version
;;
Expand All @@ -69,7 +75,7 @@ for name in ${plugins[@]}; do

if [[ -z $(command -v "${name}") ]]; then
echo "{name} is not installed"
elif "${name}" "${installer}" &>/dev/null; then
elif "${name}" "${installer}" >/dev/null 2>&1; then
echo "================== installing ${name} plugins ================="
list=$(yq '.plugin[] | select(.name == env(name)) | .list[]' "${VERSION_CONFIG}")
"${name}" "${installer}" install ${list[*]} || true
Expand Down
15 changes: 6 additions & 9 deletions scripts/install/go.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0
# source ../alias.sh
source ../environment.sh
# source scripts/alias.sh
source scripts/environment.sh

# install golang
if [[ -z $(command -v go) ]]; then
sudo apt-get update -yq
sudo apt-get install -yq --no-install-recommends golang
fi

# install sbctl
if [[ -z $(command -v sbctl) ]]; then
# version: 0.16
# https://github.com/Foxboron/sbctl/commit/53e074d6934f5ecfffa81a576293219c717f7d19
go install github.com/foxboron/sbctl/cmd/sbctl@53e074d6934f5ecfffa81a576293219c717f7d19
fi
# install packages
command -v sbctl || go install github.com/foxboron/sbctl/cmd/sbctl@53e074d6934f5ecfffa81a576293219c717f7d19 # 0.16 https://github.com/Foxboron/sbctl/commit/53e074d6934f5ecfffa81a576293219c717f7d19
command -v buf || go install github.com/bufbuild/buf/cmd/buf@8482b8f2dc17e93ac8a490cdfd86ff20f0bd1037 # v1.48.0 https://github.com/bufbuild/buf/commit/8482b8f2dc17e93ac8a490cdfd86ff20f0bd1037

go version
sbctl status
sbctl status || true
11 changes: 7 additions & 4 deletions scripts/install/rust.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0
# source ../alias.sh
source ../environment.sh
# source scripts/alias.sh
source scripts/environment.sh

# install rust
if [[ -z $(command -v rustup) ]]; then
Expand All @@ -10,14 +10,17 @@ if [[ -z $(command -v rustup) ]]; then
fi

# set rust toolchain
if [[ -n $(command -v rustc) ]]; then
if [[ -z $(command -v rustc) ]]; then
rustup default stable
rustup component add rust-src
fi

# install bindgen-cli
[[ -n $(command -v bindgen-cli) ]] || cargo install bindgen-cli
command -v bindgen >/dev/null 2>&1 || echo cargo install bindgen-cli
cargo generate --version >/dev/null 2>&1 || echo cargo install cargo-generate
# cargo xtask >/dev/null 2>&1 || cargo install bpf-linker # fixme: bpf-linker

rustc --version
cargo --version
cargo generate --version
bindgen --version
4 changes: 2 additions & 2 deletions scripts/install/swift.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0
# source ../alias.sh
source ../environment.sh
# source scripts/alias.sh
source scripts/environment.sh

ARCH="$(uname -m)"
SWIFT_VERSION="6.0.2"
Expand Down
13 changes: 13 additions & 0 deletions scripts/install/toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,38 @@

apt-get update -yq
apt-get install -yq --no-install-recommends \
avahi-utils \
binutils \
bison \
build-essential \
ccache \
clang \
cmake \
default-jre \
dfu-util \
flex \
g++ \
gcc \
git \
gnupg2 \
gperf \
libavahi-client-dev \
libc6-dev \
libcairo2-dev \
libcurl4 \
libdbus-1-dev \
libedit2 \
libelf-dev \
libffi-dev \
libgcc-9-dev \
libgirepository1.0-dev \
libglib2.0-dev \
libncurses6 \
libreadline-dev \
libsdl2-dev \
libsqlite3-0 \
libssl-dev \
libssl-dev \
libstdc++-9-dev \
libusb-1.0-0 \
libxml2 \
Expand All @@ -35,9 +46,11 @@ apt-get install -yq --no-install-recommends \
ninja-build \
pkg-config \
python3 \
python3-dev \
python3-pip \
python3-venv \
tzdata \
unzip \
uuid-dev \
wget \
zlib1g-dev

0 comments on commit f213699

Please sign in to comment.