Skip to content

Commit

Permalink
Switch to Talos
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxpeople committed Jun 5, 2024
1 parent 9c0c8fd commit 6e1f6ce
Show file tree
Hide file tree
Showing 1,475 changed files with 21,639 additions and 177 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
26 changes: 26 additions & 0 deletions .devcontainer/ci/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$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.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"
}
77 changes: 77 additions & 0 deletions .devcontainer/ci/features/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
set -e
set -o noglob

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

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

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

for app in \
"budimanjojo/talhelper!!?as=talhelper&type=script" \
"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" \
"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"
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
15 changes: 10 additions & 5 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#shellcheck disable=SC2148,SC2155
export KUBECONFIG=$(expand_path ./kubeconfig)
export ANSIBLE_CONFIG=$(expand_path ./ansible.cfg)
export ANSIBLE_HOST_KEY_CHECKING="False"
export K8S_AUTH_KUBECONFIG=$(expand_path ./kubeconfig)
export SOPS_AGE_KEY_FILE=$(expand_path ~/.config/sops/age/keys.txt)
export KUBECONFIG="$(expand_path ./kubeconfig)"
export SOPS_AGE_KEY_FILE="$(expand_path ./age.key)"
# Venv
PATH_add "$(expand_path ./.venv/bin)"
export VIRTUAL_ENV="$(expand_path ./.venv)"
export PYTHONDONTWRITEBYTECODE="1"
# Talos
export TALOSCONFIG="$(expand_path ./kubernetes/bootstrap/talos/clusterconfig/talosconfig)"
# Bin
PATH_add "$(expand_path ./.bin)"
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
* text=auto eol=lf
*.yml.j2 linguist-language=YAML
*.yaml.j2 linguist-language=YAML
*.sops.* diff=sopsdiffer
*.sops.toml linguist-language=JSON
16 changes: 7 additions & 9 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
---
area/ansible:
area/bootstrap:
- changed-files:
- any-glob-to-any-file: "ansible/**/*"
- any-glob-to-any-file: bootstrap/**/*
area/github:
- changed-files:
- any-glob-to-any-file: ".github/**/*"
- any-glob-to-any-file: .github/**/*
area/kubernetes:
- changed-files:
- any-glob-to-any-file: "kubernetes/**/*"
area/terraform:
- any-glob-to-any-file: kubernetes/**/*
area/taskfile:
- changed-files:
- any-glob-to-any-file: "terraform/**/*"
area/templates:
- changed-files:
- any-glob-to-any-file: "tmpl/**/*"
- any-glob-to-any-file: .taskfiles/**/*
- any-glob-to-any-file: Taskfile*
69 changes: 15 additions & 54 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
@@ -1,59 +1,20 @@
---
# 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/template
color: "72ccf3"
description: >-
Changes made in the tmpl directory
- name: area/terraform
color: "72ccf3"
description: >-
Changes made in the terraform directory
- { name: "area/bootstrap", color: "0e8a16" }
- { name: "area/github", color: "0e8a16" }
- { name: "area/kubernetes", color: "0e8a16" }
- { name: "area/taskfile", color: "0e8a16" }
# Distro
- { 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/terraform
color: "ffc300"
- { 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 6e1f6ce

Please sign in to comment.