Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .devcontainer/etcdetcetc/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "etcdetcetc",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/rust:1": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"minikube": "none"
},
"ghcr.io/devcontainers/features/sshd:1": {}
},
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/apps/etcdetcetc",
"onCreateCommand": "bash /workspaces/${localWorkspaceFolderBasename}/.devcontainer/etcdetcetc/on-create.sh",
"postStartCommand": "bash /workspaces/${localWorkspaceFolderBasename}/.devcontainer/etcdetcetc/post-start.sh",
"postAttachCommand": {
"tilt": "tilt up"
},
"remoteEnv": {
"KUBECONFIG": "${containerWorkspaceFolder}/.dev/kubeconfig"
},
"forwardPorts": [10350],
"portsAttributes": {
"10350": {
"label": "Tilt UI"
}
},
"hostRequirements": {
"cpus": 4,
"memory": "8gb",
"storage": "32gb"
},
"customizations": {
"vscode": {
"extensions": [
"ms-kubernetes-tools.vscode-kubernetes-tools",
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml",
"tilt-dev.tiltfile"
],
"settings": {
"vs-kubernetes.kubeconfig": "${workspaceFolder}/.dev/kubeconfig"
}
}
}
}
48 changes: 48 additions & 0 deletions .devcontainer/etcdetcetc/on-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
set -euo pipefail

REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"

sudo apt-get update && sudo apt-get install -y protobuf-compiler musl-tools

arch="$(uname -m)"
case "$arch" in
x86_64) kind_arch="amd64"; crane_arch="x86_64" ;;
aarch64) kind_arch="arm64"; crane_arch="arm64" ;;
*)
echo "unsupported architecture: $arch" >&2
exit 1
;;
esac

curl -fsSL "https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-${kind_arch}" -o /tmp/kind
sudo install -m 0755 /tmp/kind /usr/local/bin/kind

curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash

curl -fsSL "https://github.com/google/go-containerregistry/releases/latest/download/go-containerregistry_Linux_${crane_arch}.tar.gz" | sudo tar xz -C /usr/local/bin crane

curl -fsSL "https://github.com/derailed/k9s/releases/download/v0.50.18/k9s_Linux_${crane_arch}.tar.gz" | sudo tar xz -C /usr/local/bin k9s

rustup target add x86_64-unknown-linux-musl

cd "$REPO_ROOT/apps/etcdetcetc"
cargo build -p xtask
cargo build --target x86_64-unknown-linux-musl

# Wait for Docker-in-Docker, then run full dev-up + tilt ci to validate the
# pipeline and warm the Docker image cache (kindest/node, registry:2).
# Cluster state won't survive prebuild, but the image cache does.
timeout_seconds=30
elapsed=0
until docker info >/dev/null 2>&1; do
if [ "$elapsed" -ge "$timeout_seconds" ]; then
echo "docker daemon not ready after ${timeout_seconds}s" >&2
exit 1
fi
sleep 2
elapsed=$((elapsed + 2))
done

cargo xtask dev-up
tilt ci
19 changes: 19 additions & 0 deletions .devcontainer/etcdetcetc/post-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -euo pipefail

REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"

timeout_seconds=30
elapsed=0

until docker info >/dev/null 2>&1; do
if [ "$elapsed" -ge "$timeout_seconds" ]; then
echo "docker daemon was not ready within ${timeout_seconds}s" >&2
exit 1
fi
sleep 2
elapsed=$((elapsed + 2))
done

cd "$REPO_ROOT/apps/etcdetcetc"
cargo xtask dev-up
2 changes: 2 additions & 0 deletions apps/etcdetcetc/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
xtask = "run --package xtask --"
4 changes: 4 additions & 0 deletions apps/etcdetcetc/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
xtask/
.cargo/
.dev/
target/
2 changes: 2 additions & 0 deletions apps/etcdetcetc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
/.dev/
22 changes: 22 additions & 0 deletions apps/etcdetcetc/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Tilt Up",
"type": "shell",
"command": "tilt up",
"isBackground": true,
"problemMatcher": []
},
{
"label": "Dev Up",
"type": "shell",
"command": "cargo xtask dev-up"
},
{
"label": "Dev Down",
"type": "shell",
"command": "cargo xtask dev-down"
}
]
}
Loading
Loading