Skip to content

Commit

Permalink
feat: migrate to talos
Browse files Browse the repository at this point in the history
  • Loading branch information
oscaromeu committed May 19, 2024
1 parent 9225c60 commit 573530f
Show file tree
Hide file tree
Showing 511 changed files with 5,471 additions and 14,869 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ref: https://github.com/devcontainers/ci/issues/191
FROM mcr.microsoft.com/devcontainers/base:alpine
27 changes: 27 additions & 0 deletions .devcontainer/ci/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
"name": "Flux Cluster Template (CI)",
"build": {
"dockerfile": "./Dockerfile",
"context": "."
},
"features": {
"./features": {}
},
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/usr/bin/fish"
}
},
"terminal.integrated.defaultProfile.linux": "fish"
},
"extensions": [
"redhat.ansible",
"redhat.vscode-yaml"
]
}
}
}
6 changes: 6 additions & 0 deletions .devcontainer/ci/features/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Flux Cluster Template (Tools)",
"id": "cluster-template",
"version": "1.0.0",
"description": "Install Tools"
}
79 changes: 79 additions & 0 deletions .devcontainer/ci/features/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env bash
set -e
set -o noglob

apk add --no-cache \
bash bind-tools ca-certificates curl gettext python3 \
py3-pip moreutils jq git iputils openssh-client \
starship fzf fish

apk add --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
age helm kubectl sops

sudo apk add --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing \
lsd

for app in \
"budimanjojo/talhelper!" \
"cilium/cilium-cli!!?as=cilium&type=script" \
"cli/cli!!?as=gh&type=script" \
"cloudflare/cloudflared!!?as=cloudflared&type=script" \
"derailed/k9s!!?as=k9s&type=script" \
"direnv/direnv!!?as=direnv&type=script" \
"fluxcd/flux2!!?as=flux&type=script" \
"go-task/task!!?as=task&type=script" \
"helmfile/helmfile!!?as=helmfile&type=script" \
"kubecolor/kubecolor!!?as=kubecolor&type=script" \
"kubernetes-sigs/krew!!?as=krew&type=script" \
"kubernetes-sigs/kustomize!!?as=kustomize&type=script" \
"stern/stern!!?as=stern&type=script" \
"siderolabs/talos!!?as=talosctl&type=script" \
"yannh/kubeconform!!?as=kubeconform&type=script" \
"mikefarah/yq!!?as=yq&type=script"
do
echo "=== Installing ${app} ==="
curl -fsSL "https://i.jpillora.com/${app}" | bash
done

# Create the fish configuration directory
mkdir -p /home/vscode/.config/fish/{completions,conf.d}

# Setup autocompletions for fish
for tool in cilium flux helm helmfile k9s kubectl kustomize talhelper talosctl; do
$tool completion fish > /home/vscode/.config/fish/completions/$tool.fish
done
gh completion --shell fish > /home/vscode/.config/fish/completions/gh.fish
stern --completion fish > /home/vscode/.config/fish/completions/stern.fish
yq shell-completion fish > /home/vscode/.config/fish/completions/yq.fish

# Add hooks into fish
tee /home/vscode/.config/fish/conf.d/hooks.fish > /dev/null <<EOF
if status is-interactive
direnv hook fish | source
starship init fish | source
end
EOF

# Add aliases into fish
tee /home/vscode/.config/fish/conf.d/aliases.fish > /dev/null <<EOF
alias ls lsd
alias kubectl kubecolor
alias k kubectl
EOF

# Custom fish prompt
tee /home/vscode/.config/fish/conf.d/fish_greeting.fish > /dev/null <<EOF
set fish_greeting
EOF

# Add direnv whitelist for the workspace directory
mkdir -p /home/vscode/.config/direnv
tee /home/vscode/.config/direnv/direnv.toml > /dev/null <<EOF
[whitelist]
prefix = [ "/workspaces" ]
EOF

# Set ownership vscode .config directory to the vscode user
chown -R vscode:vscode /home/vscode/.config
11 changes: 11 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
"name": "Flux Cluster Template",
"image": "ghcr.io/onedr0p/cluster-template/devcontainer:base",
"postCreateCommand": {
"setup": "bash ${containerWorkspaceFolder}/.devcontainer/postCreateCommand.sh"
},
"postStartCommand": {
"git": "git config --global --add safe.directory ${containerWorkspaceFolder}"
}
}
19 changes: 19 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
set -o noglob

# Setup fisher plugin manager for fish and install plugins
/usr/bin/fish -c "
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
fisher install decors/fish-colored-man
fisher install edc/bass
fisher install jorgebucaran/autopair.fish
fisher install nickeb96/puffer-fish
fisher install PatrickF1/fzf.fish
"

# Create/update virtual environment
if ! grep -q "venv /workspaces/" .venv/pyvenv.cfg; then
rm -rf .venv
fi
task workstation:venv
6 changes: 1 addition & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
indent_style = space
indent_size = 4

[*.{bash,sh}]
[*.{bash,py,sh}]
indent_style = space
indent_size = 4
12 changes: 10 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#shellcheck disable=SC2148,SC2155
export KUBECONFIG="$(expand_path ./kubeconfig)"
export SOPS_AGE_KEY_FILE="$(expand_path ./age.key)"
# ansible
# Venv
PATH_add "$(expand_path ./.venv/bin)"
export VIRTUAL_ENV="$(expand_path ./.venv)"
export PYTHONDONTWRITEBYTECODE="1"
# Ann Seabelle
export ANSIBLE_COLLECTIONS_PATH=$(expand_path ./.venv/galaxy)
export ANSIBLE_ROLES_PATH=$(expand_path ./.venv/galaxy/ansible_roles)
export ANSIBLE_VARS_ENABLED="host_group_vars,community.sops.sops"
export ANSIBLE_VARS_ENABLED="host_group_vars"
export ANSIBLE_LOCALHOST_WARNING="False"
export ANSIBLE_INVENTORY_UNPARSED_WARNING="False"
export K8S_AUTH_KUBECONFIG="$(expand_path ./kubeconfig)"
# Talos
export TALOSCONFIG="$(expand_path ./kubernetes/bootstrap/talos/clusterconfig/talosconfig)"
# Bin
PATH_add "$(expand_path ./.bin)"
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
* text=auto eol=lf
*.yaml.j2 linguist-language=YAML
*.sops.* diff=sopsdiffer
*.sops.toml linguist-language=JSON
27 changes: 13 additions & 14 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
---
area/ansible:
- "ansible/**/*"
- "bootstrap/templates/ansible/**/*"
- "bootstrap/tasks/ansible/**/*"
- changed-files:
- any-glob-to-any-file: ansible/**/*
area/bootstrap:
- changed-files:
- any-glob-to-any-file: bootstrap/**/*
area/github:
- ".github/**/*"
- changed-files:
- any-glob-to-any-file: .github/**/*
area/kubernetes:
- "kubernetes/**/*"
- "bootstrap/templates/kubernetes/**/*"
- "bootstrap/tasks/kubernetes/**/*"
area/bootstrap:
- "bootstrap/**/*"
- "bootstrap/configure.yaml"
area/addons:
- "bootstrap/templates/addons/**/*"
- "bootstrap/tasks/addons/**/*"
- "bootstrap/vars/addons.sample.yaml"
- changed-files:
- any-glob-to-any-file: kubernetes/**/*
area/taskfile:
- changed-files:
- any-glob-to-any-file: .taskfiles/**/*
- any-glob-to-any-file: Taskfile*
70 changes: 18 additions & 52 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
@@ -1,57 +1,23 @@
---
# Area
- name: area/ansible
color: "72ccf3"
description: >-
Changes made in the ansible directory
- name: area/github
color: "72ccf3"
description: >-
Changes made in the github directory
- name: area/kubernetes
color: "72ccf3"
description: >-
Changes made in the kubernetes directory
- name: area/addons
color: "72ccf3"
description: >-
Changes made in the addons directory
- name: area/bootstrap
color: "72ccf3"
description: >-
Changes made in the bootstrap directory
- { name: "area/ansible", color: "0e8a16" }
- { name: "area/bootstrap", color: "0e8a16" }
- { name: "area/github", color: "0e8a16" }
- { name: "area/kubernetes", color: "0e8a16" }
- { name: "area/taskfile", color: "0e8a16" }
# Distro
- { name: "distro/k3s", color: "ffc300" }
- { name: "distro/talos", color: "ffc300" }
# Renovate
- name: renovate/ansible
color: "ffc300"
- name: renovate/container
color: "ffc300"
- name: renovate/github-action
color: "ffc300"
- name: renovate/github-release
color: "ffc300"
- name: renovate/helm
color: "ffc300"
- { name: "renovate/ansible", color: "027fa0" }
- { name: "renovate/container", color: "027fa0" }
- { name: "renovate/github-action", color: "027fa0" }
- { name: "renovate/github-release", color: "027fa0" }
- { name: "renovate/helm", color: "027fa0" }
# Semantic Type
- name: type/patch
color: "FFEC19"
- name: type/minor
color: "FF9800"
- name: type/major
color: "F6412D"
- name: type/break
color: "F6412D"
- { name: "type/patch", color: "ffec19" }
- { name: "type/minor", color: "ff9800" }
- { name: "type/major", color: "f6412d" }
- { name: "type/break", color: "f6412d" }
# Uncategorized
- name: bug
color: "ee0701"
- name: do-not-merge
color: "ee0701"
- name: docs
color: "F4D1B7"
- name: enhancement
color: "84b6eb"
- name: broken-links
color: "7B55D7"
- name: question
color: "cc317c"
- name: community
color: "0e8a16"
- { name: "hold/upstream", color: "ee0701" }
4 changes: 4 additions & 0 deletions .github/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changelog:
exclude:
authors:
- renovate
Loading

0 comments on commit 573530f

Please sign in to comment.