Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jfroy authored Feb 29, 2024
0 parents commit 02a4a4b
Show file tree
Hide file tree
Showing 185 changed files with 6,114 additions and 0 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 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
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{bash,py,sh}]
indent_style = space
indent_size = 4
18 changes: 18 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#shellcheck disable=SC2148,SC2155
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"
# 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"
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)"
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf
*.yaml.j2 linguist-language=YAML
*.sops.* diff=sopsdiffer
17 changes: 17 additions & 0 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
area/ansible:
- changed-files:
- any-glob-to-any-file: ansible/**/*
area/bootstrap:
- changed-files:
- any-glob-to-any-file: bootstrap/**/*
area/github:
- changed-files:
- any-glob-to-any-file: .github/**/*
area/kubernetes:
- changed-files:
- any-glob-to-any-file: kubernetes/**/*
area/taskfile:
- changed-files:
- any-glob-to-any-file: .taskfiles/**/*
- any-glob-to-any-file: Taskfile*
23 changes: 23 additions & 0 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
# Area
- { 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: "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" }
# Uncategorized
- { 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 02a4a4b

Please sign in to comment.