commit 3e4803366b680aea9b533d0c4684a2559d1a77e5 Author: Ari Sosnovsky Date: Sat Feb 18 21:41:57 2023 +0000 initial setup diff --git a/.devcontainer/bash.cmd b/.devcontainer/bash.cmd new file mode 100644 index 0000000..652e16a --- /dev/null +++ b/.devcontainer/bash.cmd @@ -0,0 +1,6 @@ +@echo off + +REM On Linux/macOS the passed in script will run inside of bash, but on +REM Windows, this will run a batch file with the same script name instead. + +%1.cmd \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..0ac6712 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,70 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/kubernetes-helm +{ + "name": "HomeLab", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:bullseye", + "runArgs": ["--network=host"], + "features": { + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { + "moby": true, + "version": "latest", + "dockerDashComposeVersion": "v2" + }, + "ghcr.io/devcontainers/features/kubectl-helm-minikube:1": { + "version": "latest", + "helm": "latest", + "minikube": "none" + }, + "./local-features/tweaks": {}, + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "configureZshAsDefaultShell": true, + "installOhMyZsh": true, + "upgradePackages": true, + "username": "vscode", + "userUid": "automatic", + "userGid": "automatic" + }, + "ghcr.io/mpriscella/features/helm-chart-testing:1": { + "version": "latest" + }, + "ghcr.io/devcontainers-contrib/features/argo-cd:1": { + "version": "latest" + }, + "ghcr.io/eitsupi/devcontainer-features/jq-likes:1": { + "jqVersion": "os-provided", + "yqVersion": "latest", + "gojqVersion": "latest" + }, + "ghcr.io/dhoeric/features/act:1": {}, + "ghcr.io/rio/features/k3d:1": {} + }, + + // "remoteEnv": { + // "SYNC_LOCALHOST_KUBECONFIG": "true" + // }, + + // "initializeCommand": "cd .devcontainer && bash ensure-mount-sources", + "mounts": [ + { + "source": "${env:HOME}${env:USERPROFILE}/.kube", + "target": "/home/vscode/kube-localhost", + "type": "bind" + }, + { + "source": "${env:HOME}${env:USERPROFILE}/.gitconfig", + "target": "/home/vscode/.gitconfig", + "type": "bind" + } + ], + "customizations": { + "vscode": { + "extensions": [ + "inercia.vscode-k3d", + "tumido.crd-snippets", + "hilleer.yaml-plus-json" + ] + } + } +} diff --git a/.devcontainer/local-features/tweaks/devcontainer-feature.json b/.devcontainer/local-features/tweaks/devcontainer-feature.json new file mode 100644 index 0000000..308db87 --- /dev/null +++ b/.devcontainer/local-features/tweaks/devcontainer-feature.json @@ -0,0 +1,11 @@ +{ + "id": "tweaks", + "name": "Additional tweaks to the devcontainer", + "options": { + "username": { + "type": "string", + "default": "", + "description": "Enter name of non-root user to configure or blank to use remoteUser" + } + } +} diff --git a/.devcontainer/local-features/tweaks/install.sh b/.devcontainer/local-features/tweaks/install.sh new file mode 100644 index 0000000..4f9536f --- /dev/null +++ b/.devcontainer/local-features/tweaks/install.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e + + +USERNAME="${USERNAME:-"${_REMOTE_USER}"}" + +cat >> /home/${USERNAME}/.zshrc <<- EOM +source <(kubectl completion zsh) +alias k=kubectl +complete -o default -F __start_kubectl k +source <(k3d completion zsh) +source <(helm completion zsh) +EOM + diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..fd6b6a5 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,31 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Dev Server - Start", + "type": "shell", + "command": "k3d cluster create -c k3d-default.yaml && docker logs -f k3d-k3s-default-server-0", + "icon": { + "id": "play-circle" + } + }, + { + "label": "Dev Server - Logs", + "type": "shell", + "command": "docker logs -f k3d-k3s-default-server-0", + "icon": { + "id": "tree-filter-on-type-off" + } + } + { + "label": "Stop Dev Server", + "type": "shell", + "command": "k3d cluster delete -c k3d-default.yaml", + "icon": { + "id": "stop-circle" + } + } + ] +} \ No newline at end of file diff --git a/k3d-default.yaml b/k3d-default.yaml new file mode 100644 index 0000000..d72b41c --- /dev/null +++ b/k3d-default.yaml @@ -0,0 +1,21 @@ +--- +apiVersion: k3d.io/v1alpha4 +kind: Simple +metadata: + name: k3s-default +servers: 1 +agents: 0 +image: docker.io/rancher/k3s:v1.25.6-k3s1 +kubeAPI: + hostPort: "6443" +ports: + - port: 80:80 + nodeFilters: + - loadbalancer + - port: 443:443 + nodeFilters: + - loadbalancer +options: + kubeconfig: + updateDefaultKubeconfig: true + switchCurrentContext: true \ No newline at end of file